From 5da049d9ef1d26e606a333812630f87c29aa1a35 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Sun, 31 Jan 2021 00:20:47 -0700 Subject: [PATCH] LU-14389 lov: avoid NULL dereference in cleanup Running racer concurrently with file migration crashes easily when the layout changes for a file in an unexpected way: lov_init_composite() lustre-clilov: DOM entries with different sizes lov_layout_change() lustre-clilov: cannot apply new layout on [0x200000402:0x3e6a:0x0] : rc = -22 BUG: unable to handle kernel NULL pointer dereference at 0x00000014 IP: [] lov_delete_composite+0x104/0x540 [lov] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC CPU: 1 PID: 20227 Comm: ln Avoid the NULL dereference if the entry is not fully initialized during cleanup. Test-Parameters: testlist=racer env=DURATION=3600 Fixes: 61a002cd863 ("LU-13602 flr: skip unknown FLR component types") Signed-off-by: Andreas Dilger Change-Id: I8fe17f1b49ca2bccc7a285febe47032d023ebbe5 Reviewed-on: https://review.whamcloud.com/41398 Tested-by: jenkins Reviewed-by: Bobi Jam Reviewed-by: Yingjin Qian Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/lov/lov_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index cff9c1d..da7bfe6 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -861,7 +861,7 @@ static int lov_delete_composite(const struct lu_env *env, lov_layout_wait(env, lov); if (comp->lo_entries) lov_foreach_layout_entry(lov, entry) { - if (lsme_is_foreign(entry->lle_lsme)) + if (entry->lle_lsme && lsme_is_foreign(entry->lle_lsme)) continue; lov_delete_raid0(env, lov, entry); -- 1.8.3.1