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

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

 



On Mon, 24 Sep 2012 11:42:48 +0200
Roi Dayan <roid@xxxxxxxxxxxx> wrote:

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

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@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