md/raid5: fix NULL pointer dereference in raid5_has_ppl
PATCH 1/1 md/raid5: fix NULL pointer dereference in raid5_has_ppl
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 [email protected]
Tested-by [email protected]
Signed-off-by Svyatoslav Nikolenko <[email protected]>
--- drivers/md/raid5-log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5-log.h +1 -1
@@ -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)
Signature · 1 line
2.47.3
yu kuai
maintainerHi,
Quoted 9 lines · Svyatoslav Nikolenko
Check if
conf->mddevis non-NULL inraid5_has_ppl()before testing flags to prevent a KASAN null-ptr-deref duringfree_conf()cleanup paths.Reported-by [email protected]Tested-by [email protected]Signed-off-by Svyatoslav Nikolenko <[email protected]>--- drivers/md/raid5-log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Looks like this is already fixed by:
https://patch.msgid.link/[email protected]
Quoted 14 lines
drivers/md/raid5-log.h +1
-1@@ -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)
Signature · 2 lines
Thanks, Kuai