Skip to content

Commit aa4af50

Browse files
jjuhllinvjw
authored andcommitted
Net, libertas: Resolve memory leak in if_spi_host_to_card()
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 <[email protected]> Acked-by: Dan Williams <[email protected]> Cc: [email protected] Signed-off-by: John W. Linville <[email protected]>
1 parent b2ebe6a commit aa4af50

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/wireless/libertas/if_spi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,7 @@ static int if_spi_host_to_card(struct lbs_private *priv,
995995
spin_unlock_irqrestore(&card->buffer_lock, flags);
996996
break;
997997
default:
998+
kfree(packet);
998999
netdev_err(priv->dev, "can't transfer buffer of type %d\n",
9991000
type);
10001001
err = -EINVAL;

0 commit comments

Comments
 (0)