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

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Tue Sep 25 01:11:56 CEST 2012


On Mon, 24 Sep 2012 11:42:48 +0200
Roi Dayan <roid at mellanox.com> wrote:

> When a module fails to initialize its target_list pointer
> is not initialized.
> 
> Signed-off-by: Roi Dayan <roid at mellanox.com>

How about always initializing target_list?


diff --git a/usr/tgtd.c b/usr/tgtd.c
index b4c78ec..9f0650b 100644
--- a/usr/tgtd.c
+++ b/usr/tgtd.c
@@ -426,13 +426,13 @@ int lld_init_one(int lld_index)
 {
 	int err;
 
+	INIT_LIST_HEAD(&tgt_drivers[lld_index]->target_list);
 	if (tgt_drivers[lld_index]->init) {
 		err = tgt_drivers[lld_index]->init(lld_index, spare_args);
 		if (err) {
 			tgt_drivers[lld_index]->drv_state = DRIVER_ERR;
 			return err;
 		}
-		INIT_LIST_HEAD(&tgt_drivers[lld_index]->target_list);
 		tgt_drivers[lld_index]->drv_state = DRIVER_INIT;
 	}
 	return 0;
--
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