Skip to content

Commit

Permalink
Net, libertas: Resolve memory leak in if_spi_host_to_card()
Browse files Browse the repository at this point in the history
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>
Cc: stable@vger.kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Jesper Juhl authored and John W. Linville committed Nov 15, 2011
1 parent ed66ba4 commit fe09b32
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/libertas/if_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fe09b32

Please sign in to comment.