[SCSI] qla4xxx: Restrict logout from boot target session using session id
authorAdheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Fri, 5 Apr 2013 11:06:07 +0000 (07:06 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 11 Apr 2013 23:49:58 +0000 (16:49 -0700)
Signed-off-by: Adheer Chandravanshi <adheer.chandravanshi@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/qla4xxx/ql4_os.c

index 5f7a2bc32069e9659249f2be20e4b64991b4b159..f82efcb826847e21d8b88cb884a789ef19002b89 100644 (file)
@@ -5916,6 +5916,14 @@ static int qla4xxx_sysfs_ddb_logout_sid(struct iscsi_cls_session *cls_sess)
                goto exit_ddb_logout;
        }
 
+       if (test_bit(DF_BOOT_TGT, &ddb_entry->flags)) {
+               ql4_printk(KERN_ERR, ha,
+                          "%s: Logout from boot target entry is not permitted.\n",
+                          __func__);
+               ret = -EPERM;
+               goto exit_ddb_logout;
+       }
+
        options = LOGOUT_OPTION_CLOSE_SESSION;
        if (qla4xxx_session_logout_ddb(ha, ddb_entry, options) == QLA_ERROR) {
                ql4_printk(KERN_ERR, ha, "%s: Logout failed\n", __func__);