All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/9] net: netlink: Check address length before reading groups field
@ 2019-04-12 10:53 Tetsuo Handa
  2019-04-12 17:25 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2019-04-12 10:53 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Tetsuo Handa

KMSAN will complain if valid address length passed to bind() is shorter
than sizeof(struct sockaddr_nl) bytes.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 net/netlink/af_netlink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index f28e937320a3..216ab915dd54 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -988,7 +988,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
 	struct netlink_sock *nlk = nlk_sk(sk);
 	struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
 	int err = 0;
-	unsigned long groups = nladdr->nl_groups;
+	unsigned long groups;
 	bool bound;
 
 	if (addr_len < sizeof(struct sockaddr_nl))
@@ -996,6 +996,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
 
 	if (nladdr->nl_family != AF_NETLINK)
 		return -EINVAL;
+	groups = nladdr->nl_groups;
 
 	/* Only superuser is allowed to listen multicasts */
 	if (groups) {
-- 
2.16.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/9] net: netlink: Check address length before reading groups field
  2019-04-12 10:53 [PATCH 4/9] net: netlink: Check address length before reading groups field Tetsuo Handa
@ 2019-04-12 17:25 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-04-12 17:25 UTC (permalink / raw)
  To: penguin-kernel; +Cc: netdev

From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date: Fri, 12 Apr 2019 19:53:38 +0900

> KMSAN will complain if valid address length passed to bind() is shorter
> than sizeof(struct sockaddr_nl) bytes.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-12 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12 10:53 [PATCH 4/9] net: netlink: Check address length before reading groups field Tetsuo Handa
2019-04-12 17:25 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.