All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] netlink: reset extack earlier in netlink_rcv_skb
@ 2018-01-18  6:48 Xin Long
  2018-01-18 17:10 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Xin Long @ 2018-01-18  6:48 UTC (permalink / raw)
  To: network dev; +Cc: davem, David Ahern

Move up the extack reset/initialization in netlink_rcv_skb, so that
those 'goto ack' will not skip it. Otherwise, later on netlink_ack
may use the uninitialized extack and cause kernel crash.

Fixes: cbbdf8433a5f ("netlink: extack needs to be reset each time through loop")
Reported-by: syzbot+03bee3680a37466775e7@syzkaller.appspotmail.com
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 47ef2d8..84a4e4c 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2391,6 +2391,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
 	while (skb->len >= nlmsg_total_size(0)) {
 		int msglen;
 
+		memset(&extack, 0, sizeof(extack));
 		nlh = nlmsg_hdr(skb);
 		err = 0;
 
@@ -2405,7 +2406,6 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
 		if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
 			goto ack;
 
-		memset(&extack, 0, sizeof(extack));
 		err = cb(skb, nlh, &extack);
 		if (err == -EINTR)
 			goto skip;
-- 
2.1.0

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

* Re: [PATCH net] netlink: reset extack earlier in netlink_rcv_skb
  2018-01-18  6:48 [PATCH net] netlink: reset extack earlier in netlink_rcv_skb Xin Long
@ 2018-01-18 17:10 ` David Ahern
  2018-01-18 20:15   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2018-01-18 17:10 UTC (permalink / raw)
  To: Xin Long, network dev; +Cc: davem

On 1/17/18 10:48 PM, Xin Long wrote:
> Move up the extack reset/initialization in netlink_rcv_skb, so that
> those 'goto ack' will not skip it. Otherwise, later on netlink_ack
> may use the uninitialized extack and cause kernel crash.
> 
> Fixes: cbbdf8433a5f ("netlink: extack needs to be reset each time through loop")
> Reported-by: syzbot+03bee3680a37466775e7@syzkaller.appspotmail.com
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/netlink/af_netlink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Acked-by: David Ahern <dsahern@gmail.com>

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

* Re: [PATCH net] netlink: reset extack earlier in netlink_rcv_skb
  2018-01-18 17:10 ` David Ahern
@ 2018-01-18 20:15   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2018-01-18 20:15 UTC (permalink / raw)
  To: dsahern; +Cc: lucien.xin, netdev

From: David Ahern <dsahern@gmail.com>
Date: Thu, 18 Jan 2018 09:10:51 -0800

> On 1/17/18 10:48 PM, Xin Long wrote:
>> Move up the extack reset/initialization in netlink_rcv_skb, so that
>> those 'goto ack' will not skip it. Otherwise, later on netlink_ack
>> may use the uninitialized extack and cause kernel crash.
>> 
>> Fixes: cbbdf8433a5f ("netlink: extack needs to be reset each time through loop")
>> Reported-by: syzbot+03bee3680a37466775e7@syzkaller.appspotmail.com
>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
>> ---
>>  net/netlink/af_netlink.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
> 
> Acked-by: David Ahern <dsahern@gmail.com>

Applied and queued up for -stable, thank you.

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

end of thread, other threads:[~2018-01-18 20:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-18  6:48 [PATCH net] netlink: reset extack earlier in netlink_rcv_skb Xin Long
2018-01-18 17:10 ` David Ahern
2018-01-18 20:15   ` 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.