mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] md/raid5: fix NULL pointer dereference in raid5_has_ppl
@ 2026-09-22 12:54 Svyatoslav Nikolenko
  2026-09-23 11:23 ` yu kuai
  0 siblings, 1 reply; 2+ messages in thread
From: Svyatoslav Nikolenko @ 2026-09-22 12:54 UTC (permalink / raw)
  To: song, yukuai
  Cc: magiclinan, xiao, linux-raid, linux-kernel, Svyatoslav Nikolenko,
	syzbot+270624bb31d478afe62e

Check if conf->mddev is non-NULL in raid5_has_ppl() before testing flags to
prevent a KASAN null-ptr-deref during free_conf() cleanup paths.

Reported-by: syzbot+270624bb31d478afe62e@syzkaller.appspotmail.com
Tested-by: syzbot+270624bb31d478afe62e@syzkaller.appspotmail.com
Signed-off-by: Svyatoslav Nikolenko <nsvatoslav515@gmail.com>
---
 drivers/md/raid5-log.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h
index c8332502669e..5a144051b142 100644
--- a/drivers/md/raid5-log.h
+++ b/drivers/md/raid5-log.h
@@ -51,7 +51,7 @@ static inline bool raid5_has_log(struct r5conf *conf)
 
 static inline bool raid5_has_ppl(struct r5conf *conf)
 {
-	return test_bit(MD_HAS_PPL, &conf->mddev->flags);
+	return conf->mddev && test_bit(MD_HAS_PPL, &conf->mddev->flags);
 }
 
 static inline int log_stripe(struct stripe_head *sh, struct stripe_head_state *s)
-- 
2.47.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] md/raid5: fix NULL pointer dereference in raid5_has_ppl
  2026-09-22 12:54 [PATCH] md/raid5: fix NULL pointer dereference in raid5_has_ppl Svyatoslav Nikolenko
@ 2026-09-23 11:23 ` yu kuai
  0 siblings, 0 replies; 2+ messages in thread
From: yu kuai @ 2026-09-23 11:23 UTC (permalink / raw)
  To: Svyatoslav Nikolenko, song, yu kuai
  Cc: magiclinan, xiao, linux-raid, linux-kernel, syzbot+270624bb31d478afe62e

Hi,

在 2026/9/22 20:54, Svyatoslav Nikolenko 写道:
> Check if conf->mddev is non-NULL in raid5_has_ppl() before testing flags to
> prevent a KASAN null-ptr-deref during free_conf() cleanup paths.
>
> Reported-by: syzbot+270624bb31d478afe62e@syzkaller.appspotmail.com
> Tested-by: syzbot+270624bb31d478afe62e@syzkaller.appspotmail.com
> Signed-off-by: Svyatoslav Nikolenko <nsvatoslav515@gmail.com>
> ---
>   drivers/md/raid5-log.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Looks like this is already fixed by:

https://patch.msgid.link/20260915081731.122933-1-chengzhihao1@huawei.com

>
> diff --git a/drivers/md/raid5-log.h b/drivers/md/raid5-log.h
> index c8332502669e..5a144051b142 100644
> --- a/drivers/md/raid5-log.h
> +++ b/drivers/md/raid5-log.h
> @@ -51,7 +51,7 @@ static inline bool raid5_has_log(struct r5conf *conf)
>   
>   static inline bool raid5_has_ppl(struct r5conf *conf)
>   {
> -	return test_bit(MD_HAS_PPL, &conf->mddev->flags);
> +	return conf->mddev && test_bit(MD_HAS_PPL, &conf->mddev->flags);
>   }
>   
>   static inline int log_stripe(struct stripe_head *sh, struct stripe_head_state *s)

-- 
Thanks,
Kuai

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-23 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 12:54 [PATCH] md/raid5: fix NULL pointer dereference in raid5_has_ppl Svyatoslav Nikolenko
2026-09-23 11:23 ` yu kuai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®