diff mbox series

[03/41] lustre: lov: avoid NULL dereference in cleanup

Message ID 1617583870-32029-4-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to OpenSFS branch as of March 1 | expand

Commit Message

James Simmons April 5, 2021, 12:50 a.m. UTC
From: Andreas Dilger <adilger@whamcloud.com>

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: [<ffffffffa08baef4>] 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.

Fixes: 3219c662a46 ("lustre: flr: skip unknown FLR component types")
WC-bug-id: https://jira.whamcloud.com/browse/LU-14389
Lustre-commit: 5da049d9ef1d26e ("LU-14389 lov: avoid NULL dereference in cleanup")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41398
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/lov/lov_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c
index 5d0e257..5d618c1 100644
--- a/fs/lustre/lov/lov_object.c
+++ b/fs/lustre/lov/lov_object.c
@@ -860,7 +860,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);