lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230320231834.66273-1-donald.hunter@gmail.com>
Date:   Mon, 20 Mar 2023 23:18:34 +0000
From:   Donald Hunter <donald.hunter@...il.com>
To:     netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>
Cc:     donald.hunter@...hat.com, Donald Hunter <donald.hunter@...il.com>
Subject: [PATCH net-next v1] rtnetlink: Return error when message too short

rtnetlink_rcv_msg currently returns 0 when the message length is too
short. This leads to either no response at all, or an ack response
if NLM_F_ACK was set in the request.

Change rtnetlink_rcv_msg to return -EINVAL which tells af_netlink to
generate a proper error response.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Donald Hunter <donald.hunter@...il.com>
---
 net/core/rtnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5d8eb57867a9..04b7f184f32e 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -6086,7 +6086,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	/* All the messages must have at least 1 byte length */
 	if (nlmsg_len(nlh) < sizeof(struct rtgenmsg))
-		return 0;
+		return -EINVAL;
 
 	family = ((struct rtgenmsg *)nlmsg_data(nlh))->rtgen_family;
 	kind = rtnl_msgtype_kind(type);
-- 
2.39.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ