Re: [PATCH 3/5] platform/x86: dell: dcdbas: Release the SMI buffer in remove

From: Andy Shevchenko

Date: Mon Nov 16 2026 - 06:34:09 EST


On Fri, Nov 13, 2026 at 10:17:56PM -0800, Rosen Penev wrote:
> dcdbas_exit() frees the SMI data buffer before
> platform_device_unregister() removes the sysfs attributes, and without
> holding smi_data_lock. The comment claims that only at module exit can
> all sysfs attributes be released, but device attributes do not pin the
> module: while rmmod runs, smi_data_write() or smi_data_buf_size_store()
> can still be executing. They can then memcpy() into the buffer as it is
> freed, or allocate a new buffer that is never freed.
>
> sysfs_remove_group() in dcdbas_remove() waits for running attribute
> handlers, and dcdbas_pdev is still valid at that point. Free the buffer
> there, or unmap the firmware-provided buffer when WSMT is in use, and
> also do it when probe fails after dcdbas_check_wsmt() mapped the
> firmware buffer. Reset the WSMT state with it so a later probe starts
> clean.

...

> +/**

Really? If so, can you validate this with kernel-doc?

> + * dcdbas_release_buffer: free the SMI data buffer or unmap the WSMT one
> + */

--
With Best Regards,
Andy Shevchenko