From e0050ae99783e8c187edb198c025281008964a83 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 4 Jun 2014 02:33:08 +0800 Subject: [PATCH] LU-5324 lfsck: invalidly memory access in lfsck_del_target In lfsck_del_target(), if the given index exceeds the LFSCK targets bitmap size, then reset the local variable @ltd to avoid to access non-related memory unexpectedly. Signed-off-by: Fan Yong Change-Id: Ia06c24632352667cb452108ba094adea56ce5518 Reviewed-on: http://review.whamcloud.com/11060 Reviewed-by: Bobi Jam Tested-by: Jenkins Reviewed-by: frank zago Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/lfsck/lfsck_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index fe3fcad..430522b 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -2636,7 +2636,7 @@ void lfsck_del_target(const struct lu_env *env, struct dt_device *key, { struct lfsck_instance *lfsck; struct lfsck_tgt_descs *ltds; - struct lfsck_tgt_desc *ltd = NULL; + struct lfsck_tgt_desc *ltd; struct list_head *head; if (for_ost) @@ -2655,6 +2655,7 @@ void lfsck_del_target(const struct lu_env *env, struct dt_device *key, } } + ltd = NULL; lfsck = __lfsck_instance_find(key, true, false); spin_unlock(&lfsck_instance_lock); if (unlikely(lfsck == NULL)) -- 1.8.3.1