From: "Yavuz, Tuba" <tuba@ece.ufl.edu>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH] net: hso: do not unregister if not registered
Date: Sat, 9 Feb 2019 16:24:20 +0000 [thread overview]
Message-ID: <89a423a522834affadda4aaf7ab4d333@exmbxprd18.ad.ufl.edu> (raw)
On an error path inside the hso_create_net_device function of the hso
driver, hso_free_net_device gets called. This causes potentially a
negative reference count in the net device if register_netdev has not
been called yet as hso_free_net_device calls unregister_netdev
regardless. I think the driver should distinguish these cases and call
unregister_netdev only if register_netdev has been called.
Signed-off-by: Tuba Yavuz <tuba@ece.ufl.edu>
---
--- linux-stable/drivers/net/usb/hso.c.orig 2019-01-27 14:45:58.232683119 -0500
+++ linux-stable/drivers/net/usb/hso.c 2019-02-05 17:54:17.056496019 -0500
@@ -2377,7 +2377,9 @@ static void hso_free_net_device(struct h
remove_net_device(hso_net->parent);
- if (hso_net->net)
+ if (hso_net->net &&
+ hso_net->net->reg_state == NETREG_REGISTERED)
unregister_netdev(hso_net->net);
/* start freeing */
next reply other threads:[~2019-02-09 16:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 16:24 Yavuz, Tuba [this message]
2019-02-09 17:35 ` [PATCH] net: hso: do not unregister if not registered David Miller
-- strict thread matches above, loose matches on Subject: below --
2019-02-06 0:40 Yavuz, Tuba
2019-02-08 23:08 ` David Miller
2019-02-09 0:02 ` Yavuz, Tuba
2019-02-09 3:40 ` 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=89a423a522834affadda4aaf7ab4d333@exmbxprd18.ad.ufl.edu \
--to=tuba@ece.ufl.edu \
--cc=netdev@vger.kernel.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 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).