]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.18.103/netlink-avoid-a-double-skb-free-in-genlmsg_mcast.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 3.18.103 / netlink-avoid-a-double-skb-free-in-genlmsg_mcast.patch
1 From foo@baz Thu Mar 29 08:53:48 CEST 2018
2 From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
3 Date: Wed, 14 Mar 2018 21:10:23 +0100
4 Subject: netlink: avoid a double skb free in genlmsg_mcast()
5
6 From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
7
8
9 [ Upstream commit 02a2385f37a7c6594c9d89b64c4a1451276f08eb ]
10
11 nlmsg_multicast() consumes always the skb, thus the original skb must be
12 freed only when this function is called with a clone.
13
14 Fixes: cb9f7a9a5c96 ("netlink: ensure to loop over all netns in genlmsg_multicast_allns()")
15 Reported-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
16 Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 ---
20 net/netlink/genetlink.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23 --- a/net/netlink/genetlink.c
24 +++ b/net/netlink/genetlink.c
25 @@ -1083,7 +1083,7 @@ static int genlmsg_mcast(struct sk_buff
26 if (!err)
27 delivered = true;
28 else if (err != -ESRCH)
29 - goto error;
30 + return err;
31 return delivered ? 0 : -ESRCH;
32 error:
33 kfree_skb(skb);