Re: [PATCH] kernfs: fix potential NULL dereference in mmap handler
From: Greg KH
Date: Tue Apr 01 2025 - 11:52:47 EST
On Tue, Apr 01, 2025 at 11:18:59PM +0800, Wentao Liang wrote:
> The kernfs_fop_mmap() invokes the '->mmap' callback without verifying its
> existence. This leads to a NULL pointer dereference when the kernfs node
> does not define the operation, resulting in an invalid memory access.
How can that happen with any in-kernel user of kernfs? If you try to
mmap any sysfs file today does this trigger?
thanks,
greg k-h