Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1444669 > unrolled thread

[PATCH net] net: nb8800: Fix SKB leak in nb8800_receive()

Started byFlorian Fainelli <f.fainelli@gmail.com>
First post2016-07-16 01:50 +0200
Last post2016-07-17 07:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive() Florian Fainelli <f.fainelli@gmail.com> - 2016-07-16 01:50 +0200
    Re: [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive() Måns Rullgård <mans@mansr.com> - 2016-07-16 13:10 +0200
    Re: [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive() David Miller <davem@davemloft.net> - 2016-07-17 07:10 +0200

#1444669 — [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive()

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2016-07-16 01:50 +0200
Subject[PATCH net] net: nb8800: Fix SKB leak in nb8800_receive()
Message-ID<rVl1L-4Mo-3@gated-at.bofh.it>
In case nb8800_receive() fails to allocate a fragment, we would leak the
SKB freshly allocated and just return, instead, free it.

Reported-by: coverity (CID 1341750)
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/aurora/nb8800.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index 08a23e6b60e9..1a3555d03a96 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -259,6 +259,7 @@ static void nb8800_receive(struct net_device *dev, unsigned int i,
 		if (err) {
 			netdev_err(dev, "rx buffer allocation failed\n");
 			dev->stats.rx_dropped++;
+			dev_kfree_skb(skb);
 			return;
 		}
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1444815

FromMåns Rullgård <mans@mansr.com>
Date2016-07-16 13:10 +0200
Message-ID<rVvDQ-35v-9@gated-at.bofh.it>
In reply to#1444669
Florian Fainelli <f.fainelli@gmail.com> writes:

> In case nb8800_receive() fails to allocate a fragment, we would leak the
> SKB freshly allocated and just return, instead, free it.
>
> Reported-by: coverity (CID 1341750)
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Mans Rullgard <mans@mansr.com>

> ---
>  drivers/net/ethernet/aurora/nb8800.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
> index 08a23e6b60e9..1a3555d03a96 100644
> --- a/drivers/net/ethernet/aurora/nb8800.c
> +++ b/drivers/net/ethernet/aurora/nb8800.c
> @@ -259,6 +259,7 @@ static void nb8800_receive(struct net_device *dev, unsigned int i,
>  		if (err) {
>  			netdev_err(dev, "rx buffer allocation failed\n");
>  			dev->stats.rx_dropped++;
> +			dev_kfree_skb(skb);
>  			return;
>  		}
>
> -- 
> 2.7.4
>

-- 
Måns Rullgård

[toc] | [prev] | [next] | [standalone]


#1445015

FromDavid Miller <davem@davemloft.net>
Date2016-07-17 07:10 +0200
Message-ID<rVMuZ-538-9@gated-at.bofh.it>
In reply to#1444669
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 15 Jul 2016 16:41:16 -0700

> In case nb8800_receive() fails to allocate a fragment, we would leak the
> SKB freshly allocated and just return, instead, free it.
> 
> Reported-by: coverity (CID 1341750)
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web