[SRU,Bionic,1/1] scsi: aacraid: Correct hba_send to include iu_type

Message ID c4aacf48771bf6549ba8312b427fb39ea944313f.1525868932.git.joseph.salisbury@canonical.com
State New
Headers show
Series
  • scsi: aacraid: Correct hba_send to include iu_type
Related show

Commit Message

Joseph Salisbury June 13, 2018, 3:21 p.m.
From: Dave Carroll <david.carroll@microsemi.com>

BugLink: http://bugs.launchpad.net/bugs/1770095

commit b60710ec7d7a ("scsi: aacraid: enable sending of TMFs from
aac_hba_send()") allows aac_hba_send() to send scsi commands, and TMF
requests, but the existing code only updates the iu_type for scsi
commands. For TMF requests we are sending an unknown iu_type to
firmware, which causes a fault.

Include iu_type prior to determining the validity of the command

Reported-by: Noah Misner <nmisner@us.ibm.com>
Fixes: b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")
Fixes: 423400e64d377 ("aacraid: Include HBA direct interface")
Tested-by: Noah Misner <nmisner@us.ibm.com>
cc: stable@vger.kernel.org
Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 7d3af7d96af7b9f51e1ef67b6f4725f545737da2)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>

---
 drivers/scsi/aacraid/commsup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Stefan Bader June 15, 2018, 12:36 p.m. | #1
On 13.06.2018 17:21, Joseph Salisbury wrote:
> From: Dave Carroll <david.carroll@microsemi.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1770095
> 
> commit b60710ec7d7a ("scsi: aacraid: enable sending of TMFs from
> aac_hba_send()") allows aac_hba_send() to send scsi commands, and TMF
> requests, but the existing code only updates the iu_type for scsi
> commands. For TMF requests we are sending an unknown iu_type to
> firmware, which causes a fault.
> 
> Include iu_type prior to determining the validity of the command
> 
> Reported-by: Noah Misner <nmisner@us.ibm.com>
> Fixes: b60710ec7d7ab ("aacraid: enable sending of TMFs from aac_hba_send()")
> Fixes: 423400e64d377 ("aacraid: Include HBA direct interface")
> Tested-by: Noah Misner <nmisner@us.ibm.com>
> cc: stable@vger.kernel.org
> Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
> Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
> Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
> (cherry picked from linux-next commit 7d3af7d96af7b9f51e1ef67b6f4725f545737da2)
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> 
> ---
>  drivers/scsi/aacraid/commsup.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
> index 84858d5..d9f22296 100644
> --- a/drivers/scsi/aacraid/commsup.c
> +++ b/drivers/scsi/aacraid/commsup.c
> @@ -724,6 +724,8 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
>  	int wait;
>  	unsigned long flags = 0;
>  	unsigned long mflags = 0;
> +	struct aac_hba_cmd_req *hbacmd = (struct aac_hba_cmd_req *)
> +			fibptr->hw_fib_va;
>  
>  	fibptr->flags = (FIB_CONTEXT_FLAG | FIB_CONTEXT_FLAG_NATIVE_HBA);
>  	if (callback) {
> @@ -734,11 +736,9 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
>  		wait = 1;
>  
>  
> -	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
> -		struct aac_hba_cmd_req *hbacmd =
> -			(struct aac_hba_cmd_req *)fibptr->hw_fib_va;
> +	hbacmd->iu_type = command;
>  
> -		hbacmd->iu_type = command;
> +	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
>  		/* bit1 of request_id must be 0 */
>  		hbacmd->request_id =
>  			cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);
>

Patch

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 84858d5..d9f22296 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -724,6 +724,8 @@  int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
 	int wait;
 	unsigned long flags = 0;
 	unsigned long mflags = 0;
+	struct aac_hba_cmd_req *hbacmd = (struct aac_hba_cmd_req *)
+			fibptr->hw_fib_va;
 
 	fibptr->flags = (FIB_CONTEXT_FLAG | FIB_CONTEXT_FLAG_NATIVE_HBA);
 	if (callback) {
@@ -734,11 +736,9 @@  int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
 		wait = 1;
 
 
-	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
-		struct aac_hba_cmd_req *hbacmd =
-			(struct aac_hba_cmd_req *)fibptr->hw_fib_va;
+	hbacmd->iu_type = command;
 
-		hbacmd->iu_type = command;
+	if (command == HBA_IU_TYPE_SCSI_CMD_REQ) {
 		/* bit1 of request_id must be 0 */
 		hbacmd->request_id =
 			cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);