summaryrefslogtreecommitdiff
path: root/drivers/hsi
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-04-21 13:39:09 +0300
committerSebastian Reichel <sre@kernel.org>2017-04-21 17:58:45 +0200
commit3026050179a3a9a6f5c892c414b5e36ecf092081 (patch)
tree58717781486b999bcade01632288a373a3885a14 /drivers/hsi
parentc1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201 (diff)
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: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/hsi')
-rw-r--r--drivers/hsi/clients/ssi_protocol.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 7ef819680acd..26b05106f0d3 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -980,7 +980,7 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev)
goto drop;
/* Pad to 32-bits - FIXME: Revisit*/
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...
@@ -1032,8 +1032,9 @@ static int ssip_pn_xmit(struct sk_buff *skb, struct net_device *dev)
drop2:
hsi_free_msg(msg);
drop:
- dev->stats.tx_dropped++;
dev_kfree_skb(skb);
+inc_dropped:
+ dev->stats.tx_dropped++;
return 0;
}