iscsi-target: Fix NULL dereference on allocation failure
authorDan Carpenter <error27@gmail.com>
Wed, 27 Jul 2011 09:58:17 +0000 (12:58 +0300)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 27 Jul 2011 20:28:04 +0000 (20:28 +0000)
This patch fixes a bug in iscsi_target_init_negotiation() where
the "goto out" path dereferences "login" which is NULL upon a
memory allocation failure.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target_nego.c

index 713a4d23557a9e6e5c8d0817b83eb143da5ba258..4d087ac110675cd531619ae1e0b60a037df37b2e 100644 (file)
@@ -978,7 +978,7 @@ struct iscsi_login *iscsi_target_init_negotiation(
                pr_err("Unable to allocate memory for struct iscsi_login.\n");
                iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR,
                                ISCSI_LOGIN_STATUS_NO_RESOURCES);
-               goto out;
+               return NULL;
        }
 
        login->req = kzalloc(ISCSI_HDR_LEN, GFP_KERNEL);