netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hin-Tak Leung <htl10@users.sourceforge.net>
To: larry.finger@lwfinger.net, khoroshilov@ispras.ru, herton@canonical.com
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] rtl8187: fix use after free on failure path in rtl8187_probe()
Date: Tue, 8 Apr 2014 01:12:44 +0100 (BST)	[thread overview]
Message-ID: <1396915964.55973.YahooMailBasic@web172301.mail.ir2.yahoo.com> (raw)

------------------------------
On Sun, Mar 30, 2014 10:31 PM BST Larry Finger wrote:

>On 03/28/2014 03:26 PM, Alexey Khoroshilov wrote:
> If allocation of io_dmabuf fails, rtl8187_probe() calls usb_put_dev(udev)
> while usb_get_dev(udev) is not called yet. As a result refcnt is decremented
> incorrectly and usb_dev can be used after memory deallocation.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
>
>Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
>
>Thanks,
>
>Larry

Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>

Hin-Tak

>
>   drivers/net/wireless/rtl818x/rtl8187/dev.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/rtl818x/rtl8187/dev.c b/drivers/net/wireless/rtl818x/rtl8187/dev.c
> index fd78df813a85..d7f540a9dc9b 100644
> --- a/drivers/net/wireless/rtl818x/rtl8187/dev.c
> +++ b/drivers/net/wireless/rtl818x/rtl8187/dev.c
> @@ -1636,10 +1636,10 @@ static int rtl8187_probe(struct usb_interface *intf,
>
>    err_free_dmabuf:
>       kfree(priv->io_dmabuf);
> - err_free_dev:
> -    ieee80211_free_hw(dev);
>       usb_set_intfdata(intf, NULL);
>       usb_put_dev(udev);
> + err_free_dev:
> +    ieee80211_free_hw(dev);
>       return err;
>   }
>
>
>

             reply	other threads:[~2014-04-08  0:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08  0:12 Hin-Tak Leung [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-03-28 20:26 [PATCH] rtl8187: fix use after free on failure path in rtl8187_probe() Alexey Khoroshilov
2014-03-30 21:31 ` Larry Finger

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=1396915964.55973.YahooMailBasic@web172301.mail.ir2.yahoo.com \
    --to=htl10@users.sourceforge.net \
    --cc=herton@canonical.com \
    --cc=khoroshilov@ispras.ru \
    --cc=larry.finger@lwfinger.net \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --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).