From: "John W. Linville" <linville@tuxdriver.com>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-usb@vger.kernel.org, Michael Wu <flamingice@sourmilk.net>,
Andrea Merello <andreamrl@tiscali.it>
Subject: Re: [patch] resource leak in error case in rtl8187
Date: Thu, 15 May 2008 14:57:24 -0400 [thread overview]
Message-ID: <20080515185724.GA17690@tuxdriver.com> (raw)
In-Reply-To: <200805151617.37968.oliver@neukum.org>
On Thu, May 15, 2008 at 04:17:36PM +0200, Oliver Neukum wrote:
> Hi,
>
> this fixes a resource leak in the error case of the write code path.
>
> Regards
> Oliver
>
> Signed-off-by: Oliver Neukum <oneukum@suse.de>
>
> ---
>
> --- linux-2.6.26-rc1/drivers/net/wireless/rtl8187_dev.c.alt 2008-05-15 15:53:58.000000000 +0200
> +++ linux-2.6.26-rc1/drivers/net/wireless/rtl8187_dev.c 2008-05-15 15:57:35.000000000 +0200
> @@ -169,6 +169,7 @@ static int rtl8187_tx(struct ieee80211_h
> struct urb *urb;
> __le16 rts_dur = 0;
> u32 flags;
> + int rv;
>
> urb = usb_alloc_urb(0, GFP_ATOMIC);
> if (!urb) {
> @@ -208,7 +209,11 @@ static int rtl8187_tx(struct ieee80211_h
> info->dev = dev;
> usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2),
> hdr, skb->len, rtl8187_tx_cb, skb);
> - usb_submit_urb(urb, GFP_ATOMIC);
> + rv = usb_submit_urb(urb, GFP_ATOMIC);
> + if (rv < 0) {
> + usb_free_urb(urb);
> + kfree_skb(skb);
> + }
>
> return 0;
> }
Don't we need the same type of fix applied to rtl8187_iowrite_async
as well? Would you like to resubmit (or submit a second patch)
with that fix included?
Also, a nit: I would prefer "rc" instead of "rv" just for idiomatic
purposes.
John
--
John W. Linville
linville@tuxdriver.com
WARNING: multiple messages have this Message-ID (diff)
From: "John W. Linville" <linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
To: Oliver Neukum <oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Michael Wu <flamingice-R9e9/4HEdknk1uMJSBkQmQ@public.gmane.org>,
Andrea Merello
<andreamrl-IWqWACnzNjyonA0d6jMUrA@public.gmane.org>
Subject: Re: [patch] resource leak in error case in rtl8187
Date: Thu, 15 May 2008 14:57:24 -0400 [thread overview]
Message-ID: <20080515185724.GA17690@tuxdriver.com> (raw)
In-Reply-To: <200805151617.37968.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
On Thu, May 15, 2008 at 04:17:36PM +0200, Oliver Neukum wrote:
> Hi,
>
> this fixes a resource leak in the error case of the write code path.
>
> Regards
> Oliver
>
> Signed-off-by: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>
>
> ---
>
> --- linux-2.6.26-rc1/drivers/net/wireless/rtl8187_dev.c.alt 2008-05-15 15:53:58.000000000 +0200
> +++ linux-2.6.26-rc1/drivers/net/wireless/rtl8187_dev.c 2008-05-15 15:57:35.000000000 +0200
> @@ -169,6 +169,7 @@ static int rtl8187_tx(struct ieee80211_h
> struct urb *urb;
> __le16 rts_dur = 0;
> u32 flags;
> + int rv;
>
> urb = usb_alloc_urb(0, GFP_ATOMIC);
> if (!urb) {
> @@ -208,7 +209,11 @@ static int rtl8187_tx(struct ieee80211_h
> info->dev = dev;
> usb_fill_bulk_urb(urb, priv->udev, usb_sndbulkpipe(priv->udev, 2),
> hdr, skb->len, rtl8187_tx_cb, skb);
> - usb_submit_urb(urb, GFP_ATOMIC);
> + rv = usb_submit_urb(urb, GFP_ATOMIC);
> + if (rv < 0) {
> + usb_free_urb(urb);
> + kfree_skb(skb);
> + }
>
> return 0;
> }
Don't we need the same type of fix applied to rtl8187_iowrite_async
as well? Would you like to resubmit (or submit a second patch)
with that fix included?
Also, a nit: I would prefer "rc" instead of "rv" just for idiomatic
purposes.
John
--
John W. Linville
linville-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-05-15 19:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 14:17 [patch] resource leak in error case in rtl8187 Oliver Neukum
2008-05-15 14:17 ` Oliver Neukum
2008-05-15 18:57 ` John W. Linville [this message]
2008-05-15 18:57 ` John W. Linville
2008-05-15 19:46 ` Oliver Neukum
2008-05-15 19:46 ` Oliver Neukum
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=20080515185724.GA17690@tuxdriver.com \
--to=linville@tuxdriver.com \
--cc=andreamrl@tiscali.it \
--cc=flamingice@sourmilk.net \
--cc=linux-usb@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oliver@neukum.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.