[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f9b4402d-3af8-ae34-c8c8-bea1ff72a844@cogentembedded.com>
Date: Thu, 20 Apr 2017 13:15:43 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Peter Heise <mail@...ise.de>, Arvid Brodin <arvid.brodin@...en.se>,
"David S. Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net] Fix net/hsr/hsr_device to check for freed skb buffer.
Hello!
On 4/20/2017 10:28 AM, Peter Heise wrote:
> Fixed an unchecked call of skb_put_padto. Return value was ignored
> before, however, skb_put_padto frees skb buffer in case of error.
>
> As reported by Dan Carpenter on kernel-janitors.
>
> Signed-off-by: Peter Heise <mail@...ise.de>
> ---
> net/hsr/hsr_device.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
> index c73160fb11e7..22d693f213be 100644
> --- a/net/hsr/hsr_device.c
> +++ b/net/hsr/hsr_device.c
> @@ -314,7 +314,8 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
> hsr_sp = (typeof(hsr_sp)) skb_put(skb, sizeof(struct hsr_sup_payload));
> ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr);
>
> - skb_put_padto(skb, ETH_ZLEN + HSR_HLEN);
> + if(skb_put_padto(skb, ETH_ZLEN + HSR_HLEN))
Need a space after *if*. Pleae run your patches thru scripts/checkpatch.pl
before sending.
> + return;
>
> hsr_forward_skb(skb, master);
> return;
MBR, Seregi
Powered by blists - more mailing lists