netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Roi Dayan <roid@nvidia.com>, Jia-Ju Bai <baijiaju1990@gmail.com>,
	j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
	davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Saeed Mahameed <saeedm@nvidia.com>
Subject: Re: [PATCH] net: bonding: fix error return code of bond_neigh_init()
Date: Wed, 10 Mar 2021 17:55:04 +0100	[thread overview]
Message-ID: <5d4cbafa-dbad-9b66-c5be-bca6ecc8e6f3@gmail.com> (raw)
In-Reply-To: <e15f36f7-6421-69a3-f10a-45b83621b96f@nvidia.com>



On 3/10/21 10:24 AM, Roi Dayan wrote:
> 
> 
> On 2021-03-08 5:11 AM, Jia-Ju Bai wrote:
>> When slave is NULL or slave_ops->ndo_neigh_setup is NULL, no error
>> return code of bond_neigh_init() is assigned.
>> To fix this bug, ret is assigned with -EINVAL in these cases.
>>
>> Fixes: 9e99bfefdbce ("bonding: fix bond_neigh_init()")
>> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
>> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
>> ---
>>   drivers/net/bonding/bond_main.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> index 74cbbb22470b..456315bef3a8 100644
>> --- a/drivers/net/bonding/bond_main.c
>> +++ b/drivers/net/bonding/bond_main.c
>> @@ -3978,11 +3978,15 @@ static int bond_neigh_init(struct neighbour *n)
>>         rcu_read_lock();
>>       slave = bond_first_slave_rcu(bond);
>> -    if (!slave)
>> +    if (!slave) {
>> +        ret = -EINVAL;
>>           goto out;
>> +    }
>>       slave_ops = slave->dev->netdev_ops;
>> -    if (!slave_ops->ndo_neigh_setup)
>> +    if (!slave_ops->ndo_neigh_setup) {
>> +        ret = -EINVAL;
>>           goto out;
>> +    }
>>         /* TODO: find another way [1] to implement this.
>>        * Passing a zeroed structure is fragile,
>>
> 
> 
> Hi,
> 
> This breaks basic functionally that always worked. A slave doesn't need
> to exists nor to implement ndo_neigh_setup.
> Now trying to add a neigh entry because of that fails.
> This commit needs to be reverted.
> 
> Thanks,
> Roi

Agreed, this commit made no sense, please revert.

  parent reply	other threads:[~2021-03-10 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08  3:11 Jia-Ju Bai
2021-03-08 23:00 ` patchwork-bot+netdevbpf
2021-03-10  9:24 ` Roi Dayan
2021-03-10  9:29   ` Jia-Ju Bai
2021-03-10 16:55   ` Eric Dumazet [this message]
2021-03-12 20:16     ` 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=5d4cbafa-dbad-9b66-c5be-bca6ecc8e6f3@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=baijiaju1990@gmail.com \
    --cc=davem@davemloft.net \
    --cc=j.vosburgh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=vfalico@gmail.com \
    --subject='Re: [PATCH] net: bonding: fix error return code of bond_neigh_init()' \
    /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

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).