public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: sunliming@linux.dev
Cc: miklos@szeredi.hu, amir73il@gmail.com,
	linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	sunliming <sunliming@kylinos.cn>
Subject: Re: [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode
Date: Wed, 22 Apr 2026 05:10:32 +0100	[thread overview]
Message-ID: <20260422041032.GH3518998@ZenIV> (raw)
In-Reply-To: <20260421092349.148002-1-sunliming@linux.dev>

On Tue, Apr 21, 2026 at 05:23:49PM +0800, sunliming@linux.dev wrote:
> From: sunliming <sunliming@kylinos.cn>
> 
> 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.

      parent reply	other threads:[~2026-04-22  4:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21  9:23 [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode sunliming
2026-04-21  9:45 ` Amir Goldstein
2026-04-21 11:37   ` sunliming
2026-04-22  4:10 ` Al Viro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260422041032.GH3518998@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=amir73il@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=sunliming@kylinos.cn \
    --cc=sunliming@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox