[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877ewuoabu.fsf@miraculix.mork.no>
Date: Tue, 19 Sep 2017 19:41:09 +0200
From: Bjørn Mork <bjorn@...k.no>
To: Douglas Anderson <dianders@...omium.org>
Cc: Oliver Neukum <oneukum@...e.com>, groeck@...omium.org,
grundler@...omium.org, netdev@...r.kernel.org,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 3/3] usbnet: Fix memory leak when rx_submit() fails
Douglas Anderson <dianders@...omium.org> writes:
> If rx_submit() returns an error code then nobody calls usb_free_urb().
> That means it's leaked.
Nope. rx_submit() will call usb_free_urb() before returning an error:
static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
..
if (!skb) {
netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
usb_free_urb (urb);
return -ENOMEM;
}
..
if (retval) {
dev_kfree_skb_any (skb);
usb_free_urb (urb);
}
Bjørn
Powered by blists - more mailing lists