* [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode
@ 2026-04-21 9:23 sunliming
2026-04-21 9:45 ` Amir Goldstein
0 siblings, 1 reply; 3+ messages in thread
From: sunliming @ 2026-04-21 9:23 UTC (permalink / raw)
To: miklos, amir73il; +Cc: linux-unionfs, linux-kernel, sunliming
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.
Signed-off-by: sunliming <sunliming@kylinos.cn>
---
fs/overlayfs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 60f0b7ceef0a..4b8b5fd4ab59 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -218,7 +218,7 @@ static void ovl_destroy_inode(struct inode *inode)
ovl_stack_put(ovl_lowerstack(oi->oe), ovl_numlower(oi->oe));
if (S_ISDIR(inode->i_mode))
ovl_dir_cache_free(inode);
- else
+ else if (oi->lowerdata_redirect)
kfree(oi->lowerdata_redirect);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode
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
0 siblings, 1 reply; 3+ messages in thread
From: Amir Goldstein @ 2026-04-21 9:45 UTC (permalink / raw)
To: sunliming; +Cc: miklos, linux-unionfs, linux-kernel, sunliming, linux-fsdevel
On Tue, Apr 21, 2026 at 11:24 AM <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.
Sunliming,
This is nonsense.
kfree() is not a dereference and kfree(NULL) is allowed.
Please be more considerate of my time and the time of other
volunteer maintainers and do not post patches that you do not
understand yourself.
Thanks,
Amir.
>
> Signed-off-by: sunliming <sunliming@kylinos.cn>
> ---
> fs/overlayfs/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> index 60f0b7ceef0a..4b8b5fd4ab59 100644
> --- a/fs/overlayfs/super.c
> +++ b/fs/overlayfs/super.c
> @@ -218,7 +218,7 @@ static void ovl_destroy_inode(struct inode *inode)
> ovl_stack_put(ovl_lowerstack(oi->oe), ovl_numlower(oi->oe));
> if (S_ISDIR(inode->i_mode))
> ovl_dir_cache_free(inode);
> - else
> + else if (oi->lowerdata_redirect)
> kfree(oi->lowerdata_redirect);
> }
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ovl: Fix possible NULL pointer dereference in ovl_destroy_inode
2026-04-21 9:45 ` Amir Goldstein
@ 2026-04-21 11:37 ` sunliming
0 siblings, 0 replies; 3+ messages in thread
From: sunliming @ 2026-04-21 11:37 UTC (permalink / raw)
To: Amir Goldstein
Cc: miklos, linux-unionfs, linux-kernel, sunliming, linux-fsdevel
2026年4月21日 17:45, "Amir Goldstein" <amir73il@gmail.com mailto:amir73il@gmail.com?to=%22Amir%20Goldstein%22%20%3Camir73il%40gmail.com%3E > 写到:
>
> On Tue, Apr 21, 2026 at 11:24 AM <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.
> >
> Sunliming,
>
> This is nonsense.
> kfree() is not a dereference and kfree(NULL) is allowed.
>
> Please be more considerate of my time and the time of other
> volunteer maintainers and do not post patches that you do not
> understand yourself.
>
> Thanks,
> Amir.
>
I understand, I apologize for this patch, thank you.
> >
> > Signed-off-by: sunliming <sunliming@kylinos.cn>
> > ---
> > fs/overlayfs/super.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
> > index 60f0b7ceef0a..4b8b5fd4ab59 100644
> > --- a/fs/overlayfs/super.c
> > +++ b/fs/overlayfs/super.c
> > @@ -218,7 +218,7 @@ static void ovl_destroy_inode(struct inode *inode)
> > ovl_stack_put(ovl_lowerstack(oi->oe), ovl_numlower(oi->oe));
> > if (S_ISDIR(inode->i_mode))
> > ovl_dir_cache_free(inode);
> > - else
> > + else if (oi->lowerdata_redirect)
> > kfree(oi->lowerdata_redirect);
> > }
> >
> > --
> > 2.25.1
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-21 11:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox