Re: [PATCH v1] platform/x86/dell/dell-rbtn: Fix resources leaking on error path

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

 



On Mon, Jun 12, 2023 at 07:52:05PM +0200, Pali Rohár wrote:
> On Monday 12 June 2023 12:02:50 Michal Wilczynski wrote:
> > Currently rbtn_add() in case of failure is leaking resources. Fix this
> > by adding a proper rollback. While at it, remove unnecessary assignment
> > of NULL to device->driver_data and unnecessary whitespace, plus add a
> > break for the default case in a switch.

...

> Hello! I'm looking at rbtn_add() function and there is also code:
> 
> 	rbtn_data = devm_kzalloc(&device->dev, sizeof(*rbtn_data), GFP_KERNEL);
> 	if (!rbtn_data)
> 		return -ENOMEM;
> 
> which is called after rbtn_acquire(). So it looks like when kzalloc
> fails then there is another leak...

Side note: In that case we would need a devm wrapper on acquire call.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux