md/raid5-ppl: check for NULL ppl_conf in ppl_write_stripe_run()
PATCH 1/1 md/raid5-ppl: check for NULL ppl_conf in ppl_write_stripe_run()
Syzbot reported a general protection fault
due to a NULL pointer dereference in ppl_write_stripe_run().
When a RAID 5 array operates without Partial Parity Log (PPL) enabled or before its initialization, conf->log_private remains NULL. ppl_write_stripe_run() assigns ppl_conf = conf->log_private and immediately attempts to access ppl_conf->count in the loop header. This triggers a NULL pointer dereference.
Fix this by returning early
from ppl_write_stripe_run() if ppl_conf is NULL.
--- drivers/md/raid5-ppl.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/md/raid5-ppl.c +3 -0
@@ -535,6 +535,9 @@ void ppl_write_stripe_run(struct r5conf *conf)struct ppl_log *log;int i; +if (!ppl_conf) +return ; +for (i =0 ; i < ppl_conf->count; i++) { log = &ppl_conf->child_logs[i];
Signature · 1 line
2.47.3
yu kuai
maintainerHi,
Quoted 12 lines · Svyatoslav Nikolenko
Syzbot reported a general protection fault
due to a NULL pointer dereference inppl_write_stripe_run().When a RAID 5 array operates without Partial Parity Log (PPL) enabled or before its initialization,
conf->log_privateremains NULL.ppl_write_stripe_run()assignsppl_conf=conf->log_privateand immediately attempts to accessppl_conf->countin the loop header. This triggers a NULL pointer dereference.Fix this by returning early
fromppl_write_stripe_run()ifppl_confis NULL.
Quoted 8 lines
Tested-by [email protected]Reported-by [email protected]Fixes 3418d036c81d ("raid5-ppl: Partial Parity Log write logging implementation")Signed-off-by Svyatoslav Nikolenko <[email protected]>--- drivers/md/raid5-ppl.c | 3 +++ 1 file changed, 3 insertions(+)
Another patch is applied for this problem, you can check the notes:
[PATCH] md: take reconfig_mutex when enabling PPL on an inactive array -
Nguyen Ngoc Thang <https://lore.kernel.org/linux-raid/[email protected]/>
Quoted 15 lines
drivers/md/raid5-ppl.c +3
-0@@ -535,6 +535,9 @@ void ppl_write_stripe_run(struct r5conf *conf)struct ppl_log *log;int i; +if (!ppl_conf) +return ; +for (i =0 ; i < ppl_conf->count; i++) { log = &ppl_conf->child_logs[i];
Signature · 2 lines
Thanks, Kuai