[PATCH] Fix show operation for lld mode accessing invalid memory address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a module fails to initialize its target_list pointer
is not initialized.

Signed-off-by: Roi Dayan <roid@xxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux