[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180616081127.oqendremoierdndg@mwanda>
Date: Sat, 16 Jun 2018 11:11:27 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Zhouyang Jia <jiazhouyang09@...il.com>
Cc: devel@...verdev.osuosl.org, Kees Cook <keescook@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Shreeya Patel <shreeya.patel23498@...il.com>,
Colin Ian King <colin.king@...onical.com>
Subject: Re: [PATCH v4] staging: rtl8192u: add error handling for
usb_alloc_urb
I was actually OK with v1 on the theory that everything else leaked and
so this didn't really introduce anything new... :P
On Sat, Jun 16, 2018 at 10:01:22AM +0800, Zhouyang Jia wrote:
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -1639,8 +1639,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb)
> static short rtl8192_usb_initendpoints(struct net_device *dev)
> {
> struct r8192_priv *priv = ieee80211_priv(dev);
> + int i;
>
> - priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1),
> + priv->rx_urb = kcalloc(MAX_RX_URB + 1, sizeof(struct urb *),
> GFP_KERNEL);
> if (!priv->rx_urb)
> return -ENOMEM;
> @@ -1649,12 +1650,12 @@ static short rtl8192_usb_initendpoints(struct net_device *dev)
> for (i = 0; i < (MAX_RX_URB + 1); i++) {
> priv->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
> if (!priv->rx_urb[i])
> - return -ENOMEM;
> + goto out_release_mem;
>
> priv->rx_urb[i]->transfer_buffer =
> kmalloc(RX_URB_SIZE, GFP_KERNEL);
You need to free priv->rx_urb[i]->transfer_buffer as well and there are
several other resources which are also not freed.
regards,
dan carpenter
Powered by blists - more mailing lists