mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] media: atomisp: fix UAF and memory leak in gc2335
       [not found] <54321DD5-808B-441A-8F68-B812A3D72E5E@psu.edu>
@ 2026-03-20  8:18 ` Andy Shevchenko
  2026-03-20 14:15   ` Choi, Yuho
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2026-03-20  8:18 UTC (permalink / raw)
  To: Choi, Yuho
  Cc: hansg, mchehab, andy, gregkh, sakari.ailus, linux-media,
	linux-staging, linux-kernel

On Thu, Mar 19, 2026 at 07:30:10PM +0000, Choi, Yuho wrote:
> From: Yuho Choi <yqc5929@psu.edu>
> Date: Wed, 18 Mar 2026 17:08:57 -0400
> Subject: [PATCH] media: atomisp: gc2335: fix UAF and memory leak

Make sure you understand the tools and how properly to send patches

Also note, your patch is mangled and may not be applied.

> This commit addresses two potential resource management vulnerabilities

Please, take your time to study Submitting Patches documentation,
in particular on how to use imperative mode.

> within the gc2235_probe function's error handling paths.

As below refer to the function as func():

gc2235_probe()

> 1.  UAF: If media_entity_pads_init fails, the driver
>     invokes gc2235_remove(), which frees the 'dev' object.
>     The execution flow then inadvertently fails through to
>     atomis_register_i2c_module(), dereferencing the freed 'dev' pointer.
> 2.  Memory Leak: If atomisp_register_i2c_module() fails, the function
>     returns the error code immediately without executing any teardown
>     routines. This leavs the 'dev' structure, v4l2 control handler,
>     and media entity permanently orphaned.
> 
> This fix follows a standard goto-based teadown routines to ensure all
> allocated resources are freed in reverse order.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: atomisp: fix UAF and memory leak in gc2335
  2026-03-20  8:18 ` [PATCH] media: atomisp: fix UAF and memory leak in gc2335 Andy Shevchenko
@ 2026-03-20 14:15   ` Choi, Yuho
  0 siblings, 0 replies; 2+ messages in thread
From: Choi, Yuho @ 2026-03-20 14:15 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: hansg, mchehab, andy, gregkh, sakari.ailus, linux-media,
	linux-staging, linux-kernel

Thank you for  the detailed feedback and I apologize of the mangled patch. It appears my mail client configuration interfered with the formatting. 
Also, I will review submitting patches document and resend the patch.

Best regard,
Yuho Choi

> On Mar 20, 2026, at 4:18 AM, Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> 
> [andriy.shevchenko@intel.com ?? ??? ?? ?? ??? ????. https://aka.ms/LearnAboutSenderIdentification ]?? ??? ?? ????
> 
> On Thu, Mar 19, 2026 at 07:30:10PM +0000, Choi, Yuho wrote:
>> From: Yuho Choi <yqc5929@psu.edu>
>> Date: Wed, 18 Mar 2026 17:08:57 -0400
>> Subject: [PATCH] media: atomisp: gc2335: fix UAF and memory leak
> 
> Make sure you understand the tools and how properly to send patches
> 
> Also note, your patch is mangled and may not be applied.
> 
>> This commit addresses two potential resource management vulnerabilities
> 
> Please, take your time to study Submitting Patches documentation,
> in particular on how to use imperative mode.
> 
>> within the gc2235_probe function's error handling paths.
> 
> As below refer to the function as func():
> 
> gc2235_probe()
> 
>> 1.  UAF: If media_entity_pads_init fails, the driver
>>    invokes gc2235_remove(), which frees the 'dev' object.
>>    The execution flow then inadvertently fails through to
>>    atomis_register_i2c_module(), dereferencing the freed 'dev' pointer.
>> 2.  Memory Leak: If atomisp_register_i2c_module() fails, the function
>>    returns the error code immediately without executing any teardown
>>    routines. This leavs the 'dev' structure, v4l2 control handler,
>>    and media entity permanently orphaned.
>> 
>> This fix follows a standard goto-based teadown routines to ensure all
>> allocated resources are freed in reverse order.
> 
> --
> With Best Regards,
> Andy Shevchenko
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-20 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <54321DD5-808B-441A-8F68-B812A3D72E5E@psu.edu>
2026-03-20  8:18 ` [PATCH] media: atomisp: fix UAF and memory leak in gc2335 Andy Shevchenko
2026-03-20 14:15   ` Choi, Yuho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®