diff mbox series

[net] tipc: fix a double kfree_skb()

Message ID 20181210204545.11448-1-xiyou.wangcong@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net] tipc: fix a double kfree_skb() | expand

Commit Message

Cong Wang Dec. 10, 2018, 8:45 p.m. UTC
tipc_udp_xmit() drops the packet on error, there is no
need to drop it again.

Fixes: ef20cd4dd163 ("tipc: introduce UDP replicast")
Reported-and-tested-by: syzbot+eae585ba2cc2752d3704@syzkaller.appspotmail.com
Cc: Ying Xue <ying.xue@windriver.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 net/tipc/udp_media.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jon Maloy Dec. 10, 2018, 9:16 p.m. UTC | #1
Acked. 
Thank you for both your quick fixes, Cong.

///jon


> -----Original Message-----
> From: Cong Wang <xiyou.wangcong@gmail.com>
> Sent: 10-Dec-18 15:46
> To: netdev@vger.kernel.org
> Cc: Cong Wang <xiyou.wangcong@gmail.com>; Ying Xue
> <ying.xue@windriver.com>; Jon Maloy <jon.maloy@ericsson.com>
> Subject: [Patch net] tipc: fix a double kfree_skb()
> 
> tipc_udp_xmit() drops the packet on error, there is no need to drop it again.
> 
> Fixes: ef20cd4dd163 ("tipc: introduce UDP replicast")
> Reported-and-tested-by:
> syzbot+eae585ba2cc2752d3704@syzkaller.appspotmail.com
> Cc: Ying Xue <ying.xue@windriver.com>
> Cc: Jon Maloy <jon.maloy@ericsson.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
>  net/tipc/udp_media.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index
> 10dc59ce9c82..1b1ba1310ea7 100644
> --- a/net/tipc/udp_media.c
> +++ b/net/tipc/udp_media.c
> @@ -245,10 +245,8 @@ static int tipc_udp_send_msg(struct net *net, struct
> sk_buff *skb,
>  		}
> 
>  		err = tipc_udp_xmit(net, _skb, ub, src, &rcast->addr);
> -		if (err) {
> -			kfree_skb(_skb);
> +		if (err)
>  			goto out;
> -		}
>  	}
>  	err = 0;
>  out:
> --
> 2.19.2
David Miller Dec. 14, 2018, 9:24 p.m. UTC | #2
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Mon, 10 Dec 2018 12:45:45 -0800

> tipc_udp_xmit() drops the packet on error, there is no
> need to drop it again.
> 
> Fixes: ef20cd4dd163 ("tipc: introduce UDP replicast")
> Reported-and-tested-by: syzbot+eae585ba2cc2752d3704@syzkaller.appspotmail.com
> Cc: Ying Xue <ying.xue@windriver.com>
> Cc: Jon Maloy <jon.maloy@ericsson.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied and queued up for -stable, thanks Cong.
diff mbox series

Patch

diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 10dc59ce9c82..1b1ba1310ea7 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -245,10 +245,8 @@  static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb,
 		}
 
 		err = tipc_udp_xmit(net, _skb, ub, src, &rcast->addr);
-		if (err) {
-			kfree_skb(_skb);
+		if (err)
 			goto out;
-		}
 	}
 	err = 0;
 out: