Re: [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode
Al Viro <[email protected]>
| Newsgroups | org.kernel.vger.linux-unionfs,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260422041032.GH3518998@ZenIV> |
On Tue, Apr 21, 2026 at 05:23:49PM +0800, [email protected] wrote: > From: sunliming <[email protected]> > > 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.