From: David Ahern <dsahern@gmail.com>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
Colin King <colin.king@canonical.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 08:55:08 -0600 [thread overview]
Message-ID: <c557d49d-b3ab-be82-d879-39f2e2098c47@gmail.com> (raw)
In-Reply-To: <8b73e872-c05e-e93f-1d2d-3466da4ddbcc@cumulusnetworks.com>
On 5/28/20 8:53 AM, 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>
>
I missed that as well.
Reviewed-by: David Ahern <dsahern@gmail.com>
Patch needs to go to -net
next prev parent reply other threads:[~2020-05-28 14:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 14:51 [PATCH][net-next] nexthop: fix incorrect allocation failure on nhg->spare Colin King
2020-05-28 14:53 ` Nikolay Aleksandrov
2020-05-28 14:55 ` David Ahern [this message]
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
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=c557d49d-b3ab-be82-d879-39f2e2098c47@gmail.com \
--to=dsahern@gmail.com \
--cc=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;
as well as URLs for NNTP newsgroup(s).