diff mbox

[V2,08/11] aacraid: IOCTL fix

Message ID 1427380892-1978-9-git-send-email-Mahesh.Rajashekhara@pmcs.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mahesh Rajashekhara March 26, 2015, 2:41 p.m. UTC
Add cfg IOCTL command fix

Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h  |    1 +
 drivers/scsi/aacraid/comminit.c |    3 +++
 drivers/scsi/aacraid/linit.c    |    4 +++-
 3 files changed, 7 insertions(+), 1 deletions(-)

Comments

Hannes Reinecke March 27, 2015, 10:21 a.m. UTC | #1
On 03/26/2015 03:41 PM, Mahesh Rajashekhara wrote:
> Add cfg IOCTL command fix
> 
> Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

Same here; this patch could do with some more information.
Otherwise:

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Mahesh Rajashekhara March 27, 2015, 11:30 a.m. UTC | #2
Thanks Hannes,

After getting the platform shutdown command "VM_CloseAll" response from the firmware, driver was getting configuration IOCTL request from the upper layers and it sends down to firmware. This causes firmware assert issue.

This patch fixes the firmware assert issue. During the shutdown, if driver gets commands from the upper layer, driver sends error code to the upper layers. 

-----Original Message-----
From: Hannes Reinecke [mailto:hare@suse.de] 
Sent: Friday, March 27, 2015 3:51 PM
To: Mahesh Rajashekhara; JBottomley@Parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner
Subject: Re: [V2 PATCH 08/11] aacraid: IOCTL fix

On 03/26/2015 03:41 PM, Mahesh Rajashekhara wrote:
> Add cfg IOCTL command fix
> 
> Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

Same here; this patch could do with some more information.
Otherwise:

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Murthy Bhat March 30, 2015, 10:15 a.m. UTC | #3
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>


-----Original Message-----
From: Mahesh Rajashekhara 
Sent: Friday, March 27, 2015 5:00 PM
To: Hannes Reinecke; JBottomley@Parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner
Subject: RE: [V2 PATCH 08/11] aacraid: IOCTL fix

Thanks Hannes,

After getting the platform shutdown command "VM_CloseAll" response from the firmware, driver was getting configuration IOCTL request from the upper layers and it sends down to firmware. This causes firmware assert issue.

This patch fixes the firmware assert issue. During the shutdown, if driver gets commands from the upper layer, driver sends error code to the upper layers. 

-----Original Message-----
From: Hannes Reinecke [mailto:hare@suse.de] 
Sent: Friday, March 27, 2015 3:51 PM
To: Mahesh Rajashekhara; JBottomley@Parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner
Subject: Re: [V2 PATCH 08/11] aacraid: IOCTL fix

On 03/26/2015 03:41 PM, Mahesh Rajashekhara wrote:
> Add cfg IOCTL command fix
> 
> Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>

Same here; this patch could do with some more information.
Otherwise:

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9b469a4..43d8076 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1222,6 +1222,7 @@  struct aac_dev
 	int			msi_enabled;	/* MSI/MSI-X enabled */
 	struct msix_entry	msixentry[AAC_MAX_MSIX];
 	struct aac_msix_ctx	aac_msix[AAC_MAX_MSIX]; /* context */
+	u8			adapter_shutdown;
 };
 
 #define aac_adapter_interrupt(dev) \
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 284b1c5..27432b9 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -231,6 +231,7 @@  int aac_send_shutdown(struct aac_dev * dev)
 	/* FIB should be freed only after getting the response from the F/W */
 	if (status != -ERESTARTSYS)
 		aac_fib_free(fibctx);
+	dev->adapter_shutdown = 1;
 	if ((dev->pdev->device == PMC_DEVICE_S7 ||
 	     dev->pdev->device == PMC_DEVICE_S8 ||
 	     dev->pdev->device == PMC_DEVICE_S9) &&
@@ -400,6 +401,7 @@  struct aac_dev *aac_init_adapter(struct aac_dev *dev)
 	}
 	dev->max_msix = 0;
 	dev->msi_enabled = 0;
+	dev->adapter_shutdown = 0;
 	if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS,
 	  0, 0, 0, 0, 0, 0,
 	  status+0, status+1, status+2, status+3, status+4))
@@ -511,6 +513,7 @@  static void aac_define_int_mode(struct aac_dev *dev)
 
 	int i, msi_count;
 
+	msi_count = i = 0;
 	/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
 	if (dev->max_msix == 0 ||
 	    dev->pdev->device == PMC_DEVICE_S6 ||
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 75c3501..36653a9 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -713,7 +713,9 @@  static long aac_cfg_ioctl(struct file *file,
 		unsigned int cmd, unsigned long arg)
 {
 	int ret;
-	if (!capable(CAP_SYS_RAWIO))
+	struct aac_dev *aac;
+	aac = (struct aac_dev *)file->private_data;
+	if (!capable(CAP_SYS_RAWIO) || aac->adapter_shutdown)
 		return -EPERM;
 	mutex_lock(&aac_mutex);
 	ret = aac_do_ioctl(file->private_data, cmd, (void __user *)arg);