Commit 3026050179a3a9a6f5c892c414b5e36ecf092081

Authored by Dan Carpenter
Committed by Sebastian Reichel
1 parent c1ae3cfa0e

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>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

drivers/hsi/clients/ssi_protocol.c
... ... @@ -980,7 +980,7 @@
980 980 goto drop;
981 981 /* Pad to 32-bits - FIXME: Revisit*/
982 982 if ((skb->len & 3) && skb_pad(skb, 4 - (skb->len & 3)))
983   - goto drop;
  983 + goto inc_dropped;
984 984  
985 985 /*
986 986 * Modem sends Phonet messages over SSI with its own endianess...
987 987  
... ... @@ -1032,8 +1032,9 @@
1032 1032 drop2:
1033 1033 hsi_free_msg(msg);
1034 1034 drop:
1035   - dev->stats.tx_dropped++;
1036 1035 dev_kfree_skb(skb);
  1036 +inc_dropped:
  1037 + dev->stats.tx_dropped++;
1037 1038  
1038 1039 return 0;
1039 1040 }