From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Wei Liu <wei.liu2@citrix.com>, Joe Jin <joe.jin@oracle.com>
Cc: Ian Campbell <ian.campbell@citrix.com>,
"David S. Miller" <davem@davemloft.net>,
"annie.li@oracle.com" <annie.li@oracle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
netdev@vger.kernel.org, xen-devel@lists.xenproject.org,
stable@vger.kernel.org, David Vrabel <david.vrabel@citrix.com>
Subject: Re: [PATCH 1/1] xen-netfront: update num_queues to real created
Date: Fri, 16 Oct 2015 08:15:32 -0400 [thread overview]
Message-ID: <5620EA64.50604@oracle.com> (raw)
In-Reply-To: <20151016105657.GN32638@zion.uk.xensource.com>
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@oracle.com>
>> Cc: Wei Liu <wei.liu2@citrix.com>
>> Cc: Ian Campbell <ian.campbell@citrix.com>
>> Cc: David S. Miller <davem@davemloft.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
next prev parent reply other threads:[~2015-10-16 12:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-15 2:34 [PATCH 1/1] xen-netfront: update num_queues to real created Joe Jin
2015-10-16 10:56 ` Wei Liu
2015-10-16 10:56 ` Wei Liu
2015-10-16 12:15 ` Boris Ostrovsky [this message]
2015-10-16 12:15 ` Boris Ostrovsky
-- strict thread matches above, loose matches on Subject: below --
2015-10-15 2:34 Joe Jin
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=5620EA64.50604@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=annie.li@oracle.com \
--cc=davem@davemloft.net \
--cc=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=joe.jin@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.