lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb095a2e-24e9-ff99-8ba1-7ddf6609f996@wanadoo.fr>
Date:   Thu, 11 Nov 2021 09:24:00 +0100
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Ricardo Ribalda <ribalda@...omium.org>
Cc:     laurent.pinchart@...asonboard.com, mchehab@...nel.org,
        hverkuil-cisco@...all.nl, linux-media@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] media: uvcvideo: Fix a memory leak in an error handling
 path of 'uvc_ioctl_ctrl_map()'

Le 11/11/2021 à 09:12, Ricardo Ribalda a écrit :
> Hi Christophe
> 
> I believe this is a dup of:
> https://lore.kernel.org/lkml/20210917114930.47261-1-colin.king@canonical.com/

Yes it is, and Colin's proposal is cleaner than mine.

Sorry for the noise.

CJ

> 
> Thanks
> 
> On Thu, 11 Nov 2021 at 09:06, Christophe JAILLET
> <christophe.jaillet@...adoo.fr> wrote:
>>
>> If 'map->name' can't be allocated, 'map' must be released before returning.
>>
>> Fixes: 70fa906d6fce ("media: uvcvideo: Use control names from framework")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
>> ---
>>   drivers/media/usb/uvc/uvc_v4l2.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
>> index f4e4aff8ddf7..5aa76a9a6080 100644
>> --- a/drivers/media/usb/uvc/uvc_v4l2.c
>> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
>> @@ -44,8 +44,10 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,
>>          if (v4l2_ctrl_get_name(map->id) == NULL) {
>>                  map->name = kmemdup(xmap->name, sizeof(xmap->name),
>>                                      GFP_KERNEL);
>> -               if (!map->name)
>> +               if (!map->name) {
>> +                       kfree(map);
>>                          return -ENOMEM;
>> +               }
>>          }
>>          memcpy(map->entity, xmap->entity, sizeof(map->entity));
>>          map->selector = xmap->selector;
>> --
>> 2.30.2
>>
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ