From: David Miller <davem@davemloft.net>
To: mail@pheise.de
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net v2] Check for skb_put_padto return value
Date: Mon, 08 May 2017 15:03:54 -0400 (EDT) [thread overview]
Message-ID: <20170508.150354.183149674519514018.davem@davemloft.net> (raw)
In-Reply-To: <0102015be3e8a656-6cd75d31-ac07-4255-80d9-3c481165dfaa-000000@eu-west-1.amazonses.com>
From: Peter Heise <mail@pheise.de>
Date: Sun, 7 May 2017 17:15:26 +0000
> Return value of skb_put_padto is now checked as
> reported by Dan Carpenter. skb might be freed in
> case of error in skb_put_padto.
> ---
> 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..a1545d09a3c9 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))
> + return;
>
> hsr_forward_skb(skb, master);
> return;
You're adding a more serious bug than the one you are fixing.
Now, if skb_put_padto() fails, we leak the SKB.
prev parent reply other threads:[~2017-05-08 19:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-07 17:15 [PATCH net v2] Check for skb_put_padto return value Peter Heise
2017-05-08 19:03 ` David Miller [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=20170508.150354.183149674519514018.davem@davemloft.net \
--to=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