From: Stephen Hemminger <stephen@networkplumber.org>
To: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com
Cc: devel@linuxdriverproject.org, netdev@vger.kernel.org
Subject: [PATCH net-next v3 6/7] netvsc: fix error unwind on device setup failure
Date: Fri, 28 Jul 2017 08:59:46 -0700 [thread overview]
Message-ID: <20170728155947.10062-7-sthemmin@microsoft.com> (raw)
In-Reply-To: <20170728155947.10062-1-sthemmin@microsoft.com>
If setting receive buffer fails, the error unwind would cause
kernel panic because it was not correctly doing RCU and NAPI
unwind. RCU'd pointer needs to be reset to NULL, and NAPI needs
to be disabled not deleted.
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
drivers/net/hyperv/netvsc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 4c709b454d34..db95487807fd 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -1307,7 +1307,8 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
return net_device;
close:
- netif_napi_del(&net_device->chan_table[0].napi);
+ RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
+ napi_disable(&net_device->chan_table[0].napi);
/* Now, we can close the channel safely */
vmbus_close(device->channel);
--
2.11.0
next prev parent reply other threads:[~2017-07-28 15:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 15:59 [PATCH net-next v3 0/7] netvsc: minor fixes and optimization Stephen Hemminger
2017-07-28 15:59 ` [PATCH net-next v3 1/7] netvsc: fix return value for set_channels Stephen Hemminger
2017-07-28 15:59 ` [PATCH net-next v3 2/7] netvsc: fix warnings reported by lockdep Stephen Hemminger
2017-08-24 8:36 ` David Woodhouse
2017-08-24 22:50 ` Stephen Hemminger
2017-07-28 15:59 ` [PATCH net-next v3 3/7] netvsc: don't print pointer value in error message Stephen Hemminger
2017-07-28 15:59 ` [PATCH net-next v3 4/7] netvsc: remove unnecessary indirection of page_buffer Stephen Hemminger
2017-07-28 15:59 ` [PATCH net-next v3 5/7] netvsc: optimize receive completions Stephen Hemminger
2017-07-28 15:59 ` Stephen Hemminger [this message]
2017-07-28 15:59 ` [PATCH net-next v3 7/7] netvsc: signal host if receive ring is emptied Stephen Hemminger
2017-07-29 22:26 ` [PATCH net-next v3 0/7] netvsc: minor fixes and optimization 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=20170728155947.10062-7-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=sthemmin@microsoft.com \
/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 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).