Netdev List
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Peter Heise <mail@pheise.de>,
	Arvid Brodin <arvid.brodin@alten.se>,
	"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] Fix net/hsr/hsr_device to check for freed skb buffer.
Date: Thu, 20 Apr 2017 13:15:43 +0300	[thread overview]
Message-ID: <f9b4402d-3af8-ae34-c8c8-bea1ff72a844@cogentembedded.com> (raw)
In-Reply-To: <0102015b8a4332ea-1e523746-5fd0-48d9-9045-d9de973fcd1a-000000@eu-west-1.amazonses.com>

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@pheise.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

      reply	other threads:[~2017-04-20 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  7:28 [PATCH net] Fix net/hsr/hsr_device to check for freed skb buffer Peter Heise
2017-04-20 10:15 ` Sergei Shtylyov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9b4402d-3af8-ae34-c8c8-bea1ff72a844@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=arvid.brodin@alten.se \
    --cc=davem@davemloft.net \
    --cc=mail@pheise.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox