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: <5620EA64.50604@oracle.com>
Date:	Fri, 16 Oct 2015 08:15:32 -0400
From:	Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:	Wei Liu <wei.liu2@...rix.com>, Joe Jin <joe.jin@...cle.com>
Cc:	Ian Campbell <ian.campbell@...rix.com>,
	"David S. Miller" <davem@...emloft.net>,
	"annie.li@...cle.com" <annie.li@...cle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	netdev@...r.kernel.org, xen-devel@...ts.xenproject.org,
	stable@...r.kernel.org, David Vrabel <david.vrabel@...rix.com>
Subject: Re: [PATCH 1/1] xen-netfront: update num_queues to real created



On 10/16/2015 06:56 AM, Wei Liu wrote:
> CC David and Boris (Konrad was already a recipient).
>
> On Thu, Oct 15, 2015 at 10:34:15AM +0800, Joe Jin wrote:
>> Sometimes xennet_create_queues() may failed to created all requested
>> queues, we need to update num_queues to real created to avoid NULL
>> pointer dereference.
>>
>> Signed-off-by: Joe Jin <joe.jin@...cle.com>
>> Cc: Wei Liu <wei.liu2@...rix.com>
>> Cc: Ian Campbell <ian.campbell@...rix.com>
>> Cc: David S. Miller <davem@...emloft.net>
>> ---
>>   drivers/net/xen-netfront.c |    9 ++++++---
>>   1 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
>> index f821a97..d580aec 100644
>> --- a/drivers/net/xen-netfront.c
>> +++ b/drivers/net/xen-netfront.c
>> @@ -1746,7 +1746,7 @@ static int xennet_create_queues(struct netfront_info *info,
>>   		dev_err(&info->netdev->dev, "no queues\n");
>>   		return -EINVAL;
>>   	}
>> -	return 0;
>> +	return num_queues;
>>   }
>>   
>>   /* Common code used when first setting up, and when resuming. */
>> @@ -1788,9 +1788,12 @@ static int talk_to_netback(struct xenbus_device *dev,
>>   	if (info->queues)
>>   		xennet_destroy_queues(info);
>>   
>> -	err = xennet_create_queues(info, num_queues);
>> -	if (err < 0)
>> +	/* Update queues number to real created */
>> +	num_queues = xennet_create_queues(info, num_queues);

I think it would be more natural to have

                     err = xennet_create_queues(info, &num_queues);

-boris

>> +	if (num_queues < 0) {
>> +		err = num_queues;
>>   		goto destroy_ring;
>> +	}
>>   
>>   	/* Create shared ring, alloc event channel -- for each queue */
>>   	for (i = 0; i < num_queues; ++i) {
>> -- 
>> 1.7.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ