From: Jesper Juhl Date: Sun, 13 Nov 2011 21:14:32 +0000 (+0100) Subject: Net, libertas: Resolve memory leak in if_spi_host_to_card() X-Git-Tag: v3.1.3~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b426a8365ad707b0f700923a5c464c3b7fed234a;p=thirdparty%2Fkernel%2Fstable.git Net, libertas: Resolve memory leak in if_spi_host_to_card() commit fe09b32a4361bea44169b2063e8c867cabb6a8ba upstream. 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 Acked-by: Dan Williams Signed-off-by: John W. Linville Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c index e0286cfbc91d1..7be8b051aabcf 100644 --- a/drivers/net/wireless/libertas/if_spi.c +++ b/drivers/net/wireless/libertas/if_spi.c @@ -999,6 +999,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;