[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170428075559.kip75xju74m6qrkh@earth>
Date:   Fri, 28 Apr 2017 09:56:00 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     Dan Carpenter <dan.carpenter@...cle.com>
Cc:     Jarod Wilson <jarod@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] HSI: ssi_protocol: double free in ssip_pn_xmit()
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@...cle.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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists
 
