[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <AF039109-A03A-4822-96ED-E4F70F90B2B9@sebastianhaas.info>
Date: Sun, 8 Dec 2013 17:52:33 +0100
From: Sebastian Haas <sebastian@...astianhaas.info>
To: Oliver Hartkopp <socketcan@...tkopp.net>,
Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc: Sebastian Haas <dev@...astianhaas.info>,
Wolfgang Grandegger <wg@...ndegger.com>,
Marc Kleine-Budde <mkl@...gutronix.de>,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org
Subject: Re: [PATCH] can: ems_usb: fix urb leaks on failure paths
Looks good. Thanks Alexey.
Acked-by: Sebastian Haas <dev@...astianhaas.info>
On 07 Dec 2013, at 12:42, Oliver Hartkopp <socketcan@...tkopp.net> wrote:
> Hello Alexey,
>
> looks better :-)
>
> I added the author of this driver to double check the patch and for his
> Acked-by ...
>
> @Sebastian: Would you like to update your e-mail address too?
>
> Best regards,
> Oliver
>
>
> On 07.12.2013 00:10, Alexey Khoroshilov wrote:
>> There are a couple failure paths where urb leaks.
>> Is spare code within ems_usb_start_xmit(),
>> usb_free_urb() should be used to deallocate urb instead of usb_unanchor_urb().
>> In ems_usb_start() there is no usb_free_urb() if usb_submit_urb() fails.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
>>
>> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
>> ---
>> drivers/net/can/usb/ems_usb.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
>> index 5f9a7ad9b964..8aeec0b4601a 100644
>> --- a/drivers/net/can/usb/ems_usb.c
>> +++ b/drivers/net/can/usb/ems_usb.c
>> @@ -625,6 +625,7 @@ static int ems_usb_start(struct ems_usb *dev)
>> usb_unanchor_urb(urb);
>> usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
>> urb->transfer_dma);
>> + usb_free_urb(urb);
>> break;
>> }
>>
>> @@ -798,8 +799,8 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
>> * allowed (MAX_TX_URBS).
>> */
>> if (!context) {
>> - usb_unanchor_urb(urb);
>> usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
>> + usb_free_urb(urb);
>>
>> netdev_warn(netdev, "couldn't find free context\n");
>>
>>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists