Re: [PATCH] usb : Free previuos allocated memory when function call fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, I will drop this patch.

On Tue, Nov 8, 2016 at 9:06 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 8 Nov 2016, Souptick Joarder wrote:
>
>> In usb_parse_interface() when usb_parse_endpoint() fails it returns
>> error whithout freeing alt->endpoint and we may have a memory leak.
>> Fix this by freeing alt->endpoint before return.
>>
>> Signed-off-by: Souptick joarder <jrdr.linux@xxxxxxxxx>
>
> NAK.  alt->endpoint is deallocated in usb_release_interface_cache()
> even if usb_parse_endpoint() fails.
>
> Alan Stern
>
>> ---
>>  drivers/usb/core/config.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
>> index a2d90ac..6f599b6 100644
>> --- a/drivers/usb/core/config.c
>> +++ b/drivers/usb/core/config.c
>> @@ -492,8 +492,10 @@ static int usb_parse_interface(struct device *ddev, int cfgno,
>>                       break;
>>               retval = usb_parse_endpoint(ddev, cfgno, inum, asnum, alt,
>>                   num_ep, buffer, size);
>> -             if (retval < 0)
>> +             if (retval < 0) {
>> +                     kfree(alt->endpoint);
>>                       return retval;
>> +             }
>>               ++n;
>>
>>               buffer += retval;
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux