Re: [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode
From: Al Viro
Date: Wed Apr 22 2026 - 00:07:02 EST
On Tue, Apr 21, 2026 at 05:23:49PM +0800, sunliming@xxxxxxxxx wrote:
> From: sunliming <sunliming@xxxxxxxxxx>
>
> In the ovl_destroy_inode function, a variable reference oi->lowerdata_redirect
> that might be NULL is directly freed. Add a non-null check, and only free
> the space when it is not NULL.
Which NULL pointer dereferencing is that change supposed to prevent? If oi is
NULL, your condition would have exact same NULL pointer dereference (as would
several places in earlier lines, while we are at it).
And kfree(NULL) is NOT dereferencing anything; it's explicitly defined as
an empty operation, same as for userland free(NULL) and for the same reason.