lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0273aa12-60e1-85b0-1373-c5d0fc6bb2e8@cisco.com>
Date:   Thu, 27 Aug 2020 09:50:13 +0000
From:   "Hans-Christian Egtvedt (hegtvedt)" <hegtvedt@...co.com>
To:     Michal Kubecek <mkubecek@...e.cz>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH] ioctl: only memset non-NULL link settings

On 27/08/2020 10:23, Michal Kubecek wrote:
> On Mon, Aug 24, 2020 at 08:46:30AM +0200, Hans-Christian Noren Egtvedt wrote:
>> In commit bef780467fa ('ioctl: do not pass transceiver value back to
>> kernel') a regression slipped. If we have a kernel that does not support
>> the ETHTOOL_xLINKSETTINGS API, then the do_ioctl_glinksettings()
>> function will return a NULL pointer.
>>
>> Hence before memset'ing the pointer to zero we must first check it is
>> valid, as NULL return is perfectly fine when running on old kernels.
>>
> 
> Please add a standard "Fixes:" line here, i.e.
> 
> Fixes: bef780467fa7 ("ioctl: do not pass transceiver value back to kernel")
> 
>> Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@...co.com>
>> ---
>>   ethtool.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/ethtool.c b/ethtool.c
>> index c4ad186..8267d6b 100644
>> --- a/ethtool.c
>> +++ b/ethtool.c
>> @@ -2908,8 +2908,10 @@ static int do_sset(struct cmd_context *ctx)
>>   		struct ethtool_link_usettings *link_usettings;
>>   
>>   		link_usettings = do_ioctl_glinksettings(ctx);
>> -		memset(&link_usettings->deprecated, 0,
>> -		       sizeof(link_usettings->deprecated));
>> +		if (link_usettings) {
>> +			memset(&link_usettings->deprecated, 0,
>> +			       sizeof(link_usettings->deprecated));
>> +		}
>>   		if (link_usettings == NULL)
>>   			link_usettings = do_ioctl_gset(ctx);
> 
> This is correct fix but now we have two if statements with exactly
> opposite conditions here; please combine them into one if-else.

Thank you for the review, a v2 will arrive shortly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ