From nobody Tue Jan 09 21:05:49 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T8k3y0WLRz56NqP; Tue, 9 Jan 2024 21:05:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T8k3x6c4Gz3yvH; Tue, 9 Jan 2024 21:05:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704834349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iTsm+A1RVymSwJketEP/JZRayJtbhxO6M05KKy0/BNU=; b=OibkSeoXcBWp6XN7y8x9L/pc8ja1Mola0LWORQny2CjwyNUun74CPpdMIIaT6xEL4Mp9e7 HhrWk+Iuohl8EE0U5eXTFobqdbkOxoS7UYDCGxFnRZXhg8ULjutjsSpbh/BdjGJtO/0p8b oRIO6LDWmal+Psx4HfLaVfpGsD0ETMged7kA/rSiUULN2sxLM4m9mQxdzXYeEOVgq+aT6q K4WX5dp706wAB+kvbDLJ3rc1c4641tgrIkjCD1q9X9tuUjJK3rBiYOiXqgoS6V8ftFlN9s SEe8UX2gXpYpsa4c1bfad6oqjOCtpyawLlSapS8KzlJm910kghAQC+yufbotrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704834349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iTsm+A1RVymSwJketEP/JZRayJtbhxO6M05KKy0/BNU=; b=VeYD7E0s2it9CsMt2YTmqx+cCVM52gtfe9oCkOwE5qK7bmsp71RJnUAazomzBap9L/8Q5w MiVV6sV1STTkBfQVLlsiDIaDufgNykBfVR1VrqxQPVdXUQKyorsdEU5mNtS4tzsWySqG1o eCiypcSsB2kAO3ckYKm2XcbtRXlUIjQYh5eP2N+Rgyin16FfIm3nP0DEau/0dWA/9GOq3z uRcYmFTsqCliE0TeaVgwKBcV9dX49caIN7GQrH2NNym7LZVcL2NyhyCuuSpogNfJ0wNL9S OemXreNZ4ZY/0mXoDE4VN+Wjpn3c8syWvHTgNp4N47ptWSjeyKF0O+emXxKkGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704834349; a=rsa-sha256; cv=none; b=TyUsvbar+/LGSVbvRgdt+iubiV4toKDsFanAi//H6xZlBUTqjt12rwwMVworuREMGxf1HF 1OW8vsh9XNobFbAadcEdJ5W3XohLK+66+XmfiU3x/LqZIHKoK8UzVB+GmG+3sPK7NFBu2O sbo2IxgxDGfYx80ZcRlfAa+TAYsOGhFtuEyDPhSNkbUU7YAvPyGNMRZU20qNzRxVRCcOoN IhBMmXESvM2QHqFlsxxKSSJs2Es1ivKnl29IUFuVNjKhnf5+qRYtWJugudVlG7XuyMjp4N 8AyB/jiJeVepYVxS5quPqwJfeAWWGppVvg/k4P8ucJ1NAgufqPE1oio1RU6Otw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T8k3x5g2xz15qd; Tue, 9 Jan 2024 21:05:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 409L5nSb000773; Tue, 9 Jan 2024 21:05:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 409L5nUl000770; Tue, 9 Jan 2024 21:05:49 GMT (envelope-from git) Date: Tue, 9 Jan 2024 21:05:49 GMT Message-Id: <202401092105.409L5nUl000770@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 09fa78d438a7 - main - netlink: fix regression with group writers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 09fa78d438a7729f3fbe055d65f0fca4d05c0971 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=09fa78d438a7729f3fbe055d65f0fca4d05c0971 commit 09fa78d438a7729f3fbe055d65f0fca4d05c0971 Author: Gleb Smirnoff AuthorDate: 2024-01-09 21:01:28 +0000 Commit: Gleb Smirnoff CommitDate: 2024-01-09 21:01:28 +0000 netlink: fix regression with group writers Refactoring of argument list to nl_send_one() led to derefercing wrong union member. Rename nl_send_one() to a more generic name, isolate anew nl_send_one() as the callback only for the normal writer and provide correct argument to nl_send() from nl_send_group(). Fixes: ff5ad900d2a0793659241eee96be53e6053b5081 --- sys/netlink/netlink_domain.c | 4 ++-- sys/netlink/netlink_io.c | 3 +-- sys/netlink/netlink_message_writer.c | 7 +++++++ sys/netlink/netlink_var.h | 4 +--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sys/netlink/netlink_domain.c b/sys/netlink/netlink_domain.c index 7660dcada103..4790845d1d31 100644 --- a/sys/netlink/netlink_domain.c +++ b/sys/netlink/netlink_domain.c @@ -233,7 +233,7 @@ nl_send_group(struct nl_writer *nw) copy = nl_buf_copy(nb); if (copy != NULL) { nw->buf = copy; - (void)nl_send_one(nw); + (void)nl_send(nw, nlp_last); } else { NLP_LOCK(nlp_last); if (nlp_last->nl_socket != NULL) @@ -246,7 +246,7 @@ nl_send_group(struct nl_writer *nw) } if (nlp_last != NULL) { nw->buf = nb; - (void)nl_send_one(nw); + (void)nl_send(nw, nlp_last); } else nl_buf_free(nb); diff --git a/sys/netlink/netlink_io.c b/sys/netlink/netlink_io.c index fb8e0a46e8dd..5f50c40f71d8 100644 --- a/sys/netlink/netlink_io.c +++ b/sys/netlink/netlink_io.c @@ -194,9 +194,8 @@ nl_taskqueue_handler(void *_arg, int pending) * If no queue overrunes happened, wakes up socket owner. */ bool -nl_send_one(struct nl_writer *nw) +nl_send(struct nl_writer *nw, struct nlpcb *nlp) { - struct nlpcb *nlp = nw->nlp; struct socket *so = nlp->nl_socket; struct sockbuf *sb = &so->so_rcv; struct nl_buf *nb; diff --git a/sys/netlink/netlink_message_writer.c b/sys/netlink/netlink_message_writer.c index 0b85378b41b6..50305e3d9d80 100644 --- a/sys/netlink/netlink_message_writer.c +++ b/sys/netlink/netlink_message_writer.c @@ -65,6 +65,13 @@ nlmsg_get_buf(struct nl_writer *nw, u_int len, bool waitok) return (true); } +static bool +nl_send_one(struct nl_writer *nw) +{ + + return (nl_send(nw, nw->nlp)); +} + bool _nlmsg_get_unicast_writer(struct nl_writer *nw, int size, struct nlpcb *nlp) { diff --git a/sys/netlink/netlink_var.h b/sys/netlink/netlink_var.h index c8f0d02a0dab..ddf30b373446 100644 --- a/sys/netlink/netlink_var.h +++ b/sys/netlink/netlink_var.h @@ -130,9 +130,7 @@ void nl_osd_unregister(void); void nl_set_thread_nlp(struct thread *td, struct nlpcb *nlp); /* netlink_io.c */ -#define NL_IOF_UNTRANSLATED 0x01 -#define NL_IOF_IGNORE_LIMIT 0x02 -bool nl_send_one(struct nl_writer *); +bool nl_send(struct nl_writer *, struct nlpcb *); void nlmsg_ack(struct nlpcb *nlp, int error, struct nlmsghdr *nlmsg, struct nl_pstate *npt); void nl_on_transmit(struct nlpcb *nlp);