Commit b426a836 authored by Jesper Juhl's avatar Jesper Juhl Committed by Greg Kroah-Hartman

Net, libertas: Resolve memory leak in if_spi_host_to_card()

commit fe09b32a 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: default avatarJesper Juhl <jj@chaosbits.net>
Acked-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 92fd7a89
...@@ -999,6 +999,7 @@ static int if_spi_host_to_card(struct lbs_private *priv, ...@@ -999,6 +999,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
spin_unlock_irqrestore(&card->buffer_lock, flags); spin_unlock_irqrestore(&card->buffer_lock, flags);
break; break;
default: default:
kfree(packet);
netdev_err(priv->dev, "can't transfer buffer of type %d\n", netdev_err(priv->dev, "can't transfer buffer of type %d\n",
type); type);
err = -EINVAL; err = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment