netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: tuba@ece.ufl.edu
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH]: net: hso: do not call unregister if not registered
Date: Tue, 05 Feb 2019 16:36:40 -0800 (PST)	[thread overview]
Message-ID: <20190205.163640.175589510190486514.davem@davemloft.net> (raw)
In-Reply-To: <1549407687058.71019@ece.ufl.edu>

From: "Yavuz, Tuba" <tuba@ece.ufl.edu>
Date: Tue, 5 Feb 2019 23:01:25 +0000

> 
> 
> 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
> +          )

This is not formatted correctly, the final closing ')' should end the
previous line, like this:

       if (hso_net->net &&
           hso_net->net->reg_state == NETREG_REGISTERED)

  reply	other threads:[~2019-02-06  0:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 23:01 [PATCH]: net: hso: do not call unregister if not registered Yavuz, Tuba
2019-02-06  0:36 ` David Miller [this message]
2019-02-06  0:38   ` Yavuz, Tuba
  -- strict thread matches above, loose matches on Subject: below --
2019-02-09  0:02 [PATCH] " Yavuz, Tuba

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=20190205.163640.175589510190486514.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=tuba@ece.ufl.edu \
    /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).