[stgt] [PATCH] Fix show operation for lld mode accessing invalid memory address
Roi Dayan
roid at mellanox.com
Tue Sep 25 08:51:14 CEST 2012
On Tue, Sep 25, 2012 at 1:11 AM, FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp> wrote:
> 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;
> --
I chose not to show the targets if a driver is in error state but maybe it should.
This looks better.
Thanks,
Roi
--
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