Message ID | alpine.LNX.2.00.1111132211580.3368@swampdragon.chaosbits.net |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
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 > > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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;
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.