mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
	David Ahern <dsahern@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][net-next] nexthop: fix incorrect allocation failure on nhg->spare
Date: Thu, 28 May 2020 16:56:02 +0100	[thread overview]
Message-ID: <aebf0df1-9157-45f5-dce0-1561999230e7@canonical.com> (raw)
In-Reply-To: <e2c038f3-4990-d958-84a8-2aeaba8195f5@cumulusnetworks.com>

On 28/05/2020 16:55, Nikolay Aleksandrov wrote:
> On 28/05/2020 18:53, Colin Ian King wrote:
>> On 28/05/2020 15:55, Nikolay Aleksandrov wrote:
>>> On 28/05/2020 17:53, Nikolay Aleksandrov wrote:
>>>> On 28/05/2020 17:51, Colin King wrote:
>>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>>
>>>>> The allocation failure check for nhg->spare is currently checking
>>>>> the pointer nhg rather than nhg->spare which is never false. Fix
>>>>> this by checking nhg->spare instead.
>>>>>
>>>>> Addresses-Coverity: ("Logically dead code")
>>>>> Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
>>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>>> ---
>>>>>  net/ipv4/nexthop.c | 2 +-
>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
>>>>> index ebafa5ed91ac..97423d6f2de9 100644
>>>>> --- a/net/ipv4/nexthop.c
>>>>> +++ b/net/ipv4/nexthop.c
>>>>> @@ -1185,7 +1185,7 @@ static struct nexthop *nexthop_create_group(struct net *net,
>>>>>  
>>>>>  	/* spare group used for removals */
>>>>>  	nhg->spare = nexthop_grp_alloc(num_nh);
>>>>> -	if (!nhg) {
>>>>> +	if (!nhg->spare) {
>>>>>  		kfree(nhg);
>>>>>  		kfree(nh);
>>>>>  		return NULL;
>>>>>
>>>>
>>>> Good catch, embarrassing copy paste error :-/
>>>> Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>>>>
>>>
>>> Wait - that should be targeted at -net, that's where the fixes went.
>>> And the fixes tag is wrong, nhg->spare was very recently added by:
>>> commit 90f33bffa382
>>> Author: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>>> Date:   Tue May 26 12:56:15 2020 -0600
>>>
>>>     nexthops: don't modify published nexthop groups
>>>
>>
>> Do you require me to fix this up and re-send?
>>
>> Colin
>>
> 
> Up to you, it will go to the same stable releases as that fix used the same
> Fixes tag, so it's really not an issue.
> 
OK, I'll let it slip and won't send a V2. Thanks


  reply	other threads:[~2020-05-28 15:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:51 Colin King
2020-05-28 14:53 ` Nikolay Aleksandrov
2020-05-28 14:55   ` David Ahern
2020-05-28 14:55   ` Nikolay Aleksandrov
2020-05-28 15:53     ` Colin Ian King
2020-05-28 15:55       ` Nikolay Aleksandrov
2020-05-28 15:56         ` Colin Ian King [this message]
2020-05-30  0:15 ` David Miller

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=aebf0df1-9157-45f5-dce0-1561999230e7@canonical.com \
    --to=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=yoshfuji@linux-ipv6.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

all inboxes | Powered by JetHome®