[stgt] [PATCH] Fix show operation for lld mode accessing invalid memory address
Roi Dayan
roid at mellanox.com
Mon Sep 24 11:42:48 CEST 2012
When a module fails to initialize its target_list pointer
is not initialized.
Signed-off-by: Roi Dayan <roid at mellanox.com>
---
usr/target.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/usr/target.c b/usr/target.c
index a8bcdbb..def8d1f 100644
--- a/usr/target.c
+++ b/usr/target.c
@@ -2385,10 +2385,12 @@ tgtadm_err lld_show(struct concat_buf *b)
concat_printf(b, _TAB1 "%s: %s\n", tgt_drivers[i]->name,
driver_state_name(tgt_drivers[i]));
- list_for_each_entry(target, &tgt_drivers[i]->target_list,
- lld_siblings) {
- concat_printf(b, _TAB2 "Target %d: %s\n", target->tid,
- target->name);
+ if (tgt_drivers[i]->drv_state == DRIVER_INIT) {
+ list_for_each_entry(target, &tgt_drivers[i]->target_list,
+ lld_siblings) {
+ concat_printf(b, _TAB2 "Target %d: %s\n", target->tid,
+ target->name);
+ }
}
}
--
1.7.8.2
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list