* [PATCH] Net, libertas: Resolve memory leak in if_spi_host_to_card()
@ 2011-11-13 21:14 Jesper Juhl
2011-11-14 22:43 ` Dan Williams
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2011-11-13 21:14 UTC (permalink / raw)
To: libertas-dev, linux-wireless, netdev, linux-kernel
Cc: Andrey Yurovsky, Colin McCabe, Dan Williams, John W. Linville,
David S. Miller
If we hit the default case in the switch in if_spi_host_to_card() we'll leak
the memory we allocated for 'packet'. This patch resolves the leak by freeing
the allocated memory in that case.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/net/wireless/libertas/if_spi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Compile tested only due to lack of hardware.
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 11b69b3..728baa4 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
spin_unlock_irqrestore(&card->buffer_lock, flags);
break;
default:
+ kfree(packet);
netdev_err(priv->dev, "can't transfer buffer of type %d\n",
type);
err = -EINVAL;
--
1.7.7.3
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Net, libertas: Resolve memory leak in if_spi_host_to_card()
2011-11-13 21:14 [PATCH] Net, libertas: Resolve memory leak in if_spi_host_to_card() Jesper Juhl
@ 2011-11-14 22:43 ` Dan Williams
0 siblings, 0 replies; 2+ messages in thread
From: Dan Williams @ 2011-11-14 22:43 UTC (permalink / raw)
To: Jesper Juhl
Cc: libertas-dev, linux-wireless, netdev, linux-kernel,
David S. Miller, Andrey Yurovsky, Colin McCabe, John W. Linville
On Sun, 2011-11-13 at 22:14 +0100, Jesper Juhl wrote:
> If we hit the default case in the switch in if_spi_host_to_card() we'll leak
> the memory we allocated for 'packet'. This patch resolves the leak by freeing
> the allocated memory in that case.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Acked-by: Dan Williams <dcbw@redhat.com>
> ---
> drivers/net/wireless/libertas/if_spi.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> Compile tested only due to lack of hardware.
>
> diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
> index 11b69b3..728baa4 100644
> --- a/drivers/net/wireless/libertas/if_spi.c
> +++ b/drivers/net/wireless/libertas/if_spi.c
> @@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
> spin_unlock_irqrestore(&card->buffer_lock, flags);
> break;
> default:
> + kfree(packet);
> netdev_err(priv->dev, "can't transfer buffer of type %d\n",
> type);
> err = -EINVAL;
> --
> 1.7.7.3
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-14 22:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-13 21:14 [PATCH] Net, libertas: Resolve memory leak in if_spi_host_to_card() Jesper Juhl
2011-11-14 22:43 ` Dan Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox