From patchwork Wed Dec 18 02:25:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 13912936 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF9117C6E6 for ; Wed, 18 Dec 2024 02:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734488717; cv=none; b=vCtFKX0TU5/ItzUNWuEj+FYrnDfQgUJMRiZk/wYVkv//LEWHXqMWOipjArfNMuTqECuvlBGj0kRyL6csGTDm8ZA2/iCIip3Csq4JPdHj55op7A0Yw5RNNDo8Dt7n99yNeMkBYKZgYsZCgE9iY7ysgik20l9UvP+2CNFhB4JsXl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734488717; c=relaxed/simple; bh=qtbM+6F2WP6jE5aDSwvN90eG9nTdL1OXMn2dS9lpoPM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oGCpmZZY4nMau+aTtP+zCdodr2TqT/hXXxkjwzQb5E2VbC/s4yb/H+ykcIYWaA0IvgaAD2B81ZQD+LVe3W4/VlTyjQuSxtwxCPXV1bTTUjZqJU9UwXXAhQdGhpreKhgpm3Qgt8xV/qqcP4X+dhwvkGxfVOfzDQvtbdbcdAKQ27Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m9ZCbw2s; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m9ZCbw2s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2A2CC4CED6; Wed, 18 Dec 2024 02:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734488715; bh=qtbM+6F2WP6jE5aDSwvN90eG9nTdL1OXMn2dS9lpoPM=; h=From:To:Cc:Subject:Date:From; b=m9ZCbw2sYFU1IwVn53JITMWUsaCfl0RNPFGsXViAIKN6mRoUSydRfpzucnes6CZn4 Nr98RdpNDKH4EY6yot1is0ko/OxZJ7DyvHNWIQgBmxPs0PVre+wduoCKt6tJs+PxhA 0KNCqXGCasMKXg86RQWnswlrh+mQAY5khDe9WAxCb0fJclAwlrXCyA+1iAnoXNs/gj 7prCt2ssh3XF1gcBvnZr89+oQNB61kbEt8Cr+Jp2RhwphdB/lCiblrzl/BKt5gbz6+ 8Tl/Aj4X8fswnF9EUxfVkiOCakxDlHFJRtk6b5bBzck3O9+vpubmvafj9irCxoSsd2 87dZYXycea3JQ== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, Jakub Kicinski , syzbot+0a884bc2d304ce4af70f@syzkaller.appspotmail.com, jdamato@fastly.com, almasrymina@google.com, sridhar.samudrala@intel.com, amritha.nambiar@intel.com Subject: [PATCH net] netdev-genl: avoid empty messages in queue dump Date: Tue, 17 Dec 2024 18:25:08 -0800 Message-ID: <20241218022508.815344-1-kuba@kernel.org> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Empty netlink responses from do() are not correct (as opposed to dump() where not dumping anything is perfectly fine). We should return an error if the target object does not exist, in this case if the netdev is down it has no queues. Fixes: 6b6171db7fc8 ("netdev-genl: Add netlink framework functions for queue") Reported-by: syzbot+0a884bc2d304ce4af70f@syzkaller.appspotmail.com Signed-off-by: Jakub Kicinski Reviewed-by: Eric Dumazet --- CC: jdamato@fastly.com CC: almasrymina@google.com CC: sridhar.samudrala@intel.com CC: amritha.nambiar@intel.com --- net/core/netdev-genl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c index 9527dd46e4dc..b4becd4065d9 100644 --- a/net/core/netdev-genl.c +++ b/net/core/netdev-genl.c @@ -430,10 +430,10 @@ static int netdev_nl_queue_fill(struct sk_buff *rsp, struct net_device *netdev, u32 q_idx, u32 q_type, const struct genl_info *info) { - int err = 0; + int err; if (!(netdev->flags & IFF_UP)) - return err; + return -ENOENT; err = netdev_nl_queue_validate(netdev, q_idx, q_type); if (err)