* [PATCH] HSI: ssi_protocol: double free in ssip_pn_xmit()
@ 2017-04-21 10:39 Dan Carpenter
2017-04-28 7:56 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-04-21 10:39 UTC (permalink / raw)
To: Sebastian Reichel
Cc: Jarod Wilson, David S. Miller, linux-kernel, kernel-janitors
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>
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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] HSI: ssi_protocol: double free in ssip_pn_xmit()
2017-04-21 10:39 [PATCH] HSI: ssi_protocol: double free in ssip_pn_xmit() Dan Carpenter
@ 2017-04-28 7:56 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2017-04-28 7:56 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jarod Wilson, David S. Miller, linux-kernel, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]
Hi,
On Fri, Apr 21, 2017 at 01:39:09PM +0300, Dan Carpenter wrote:
> 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>
>
> 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;
> }
Thanks, queued.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-28 7:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-21 10:39 [PATCH] HSI: ssi_protocol: double free in ssip_pn_xmit() Dan Carpenter
2017-04-28 7:56 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).