[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c557d49d-b3ab-be82-d879-39f2e2098c47@gmail.com>
Date: Thu, 28 May 2020 08:55:08 -0600
From: David Ahern <dsahern@...il.com>
To: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>,
Colin King <colin.king@...onical.com>,
David Ahern <dsahern@...nel.org>,
"David S . Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][net-next] nexthop: fix incorrect allocation failure on
nhg->spare
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@...onical.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@...onical.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@...ulusnetworks.com>
>
I missed that as well.
Reviewed-by: David Ahern <dsahern@...il.com>
Patch needs to go to -net
Powered by blists - more mailing lists