linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive()
@ 2016-07-15 23:41 Florian Fainelli
  2016-07-16 11:01 ` Måns Rullgård
  2016-07-17  5:06 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2016-07-15 23:41 UTC (permalink / raw)
  To: netdev
  Cc: davem, Florian Fainelli, Måns Rullgård,
	Sebastian Frias, Arnd Bergmann, open list

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

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

* Re: [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive()
  2016-07-15 23:41 [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive() Florian Fainelli
@ 2016-07-16 11:01 ` Måns Rullgård
  2016-07-17  5:06 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Måns Rullgård @ 2016-07-16 11:01 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev, davem, Sebastian Frias, Arnd Bergmann, open list

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

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

* Re: [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive()
  2016-07-15 23:41 [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive() Florian Fainelli
  2016-07-16 11:01 ` Måns Rullgård
@ 2016-07-17  5:06 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-07-17  5:06 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, mans, sf84, arnd, linux-kernel

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.

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

end of thread, other threads:[~2016-07-17  5:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 23:41 [PATCH net] net: nb8800: Fix SKB leak in nb8800_receive() Florian Fainelli
2016-07-16 11:01 ` Måns Rullgård
2016-07-17  5:06 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).