Commit 30260501 authored by Dan Carpenter's avatar Dan Carpenter Committed by Sebastian Reichel

HSI: ssi_protocol: double free in ssip_pn_xmit()

If skb_pad() fails then it frees skb and we don't need to free it again
at the end of the function.

Fixes: dc7bf5d7 ("HSI: Introduce driver for SSI Protocol")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarSebastian Reichel <sre@kernel.org>
parent c1ae3cfa
...@@ -980,7 +980,7 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -980,7 +980,7 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev)
goto drop; goto drop;
/* Pad to 32-bits - FIXME: Revisit*/ /* Pad to 32-bits - FIXME: Revisit*/
if ((skb->len & 3) && skb_pad(skb, 4 - (skb->len & 3))) if ((skb->len & 3) && skb_pad(skb, 4 - (skb->len & 3)))
goto drop; goto inc_dropped;
/* /*
* Modem sends Phonet messages over SSI with its own endianess... * Modem sends Phonet messages over SSI with its own endianess...
...@@ -1032,8 +1032,9 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1032,8 +1032,9 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev)
drop2: drop2:
hsi_free_msg(msg); hsi_free_msg(msg);
drop: drop:
dev->stats.tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
inc_dropped:
dev->stats.tx_dropped++;
return 0; return 0;
} }
......
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