scsi: megaraid_sas: Fix calculation of target ID
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Sat, 29 Jun 2019 01:02:12 +0000 (18:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Jul 2019 07:14:19 +0000 (09:14 +0200)
commit3e9534fa50463bfc7cd98bea2d0f933e94fbdb21
treed6939ad87d23f7fb086fe4bd01a980ca0b0f26b9
parent1334a3e2d6d03afa49590db9b7d2506d5ebd39de
scsi: megaraid_sas: Fix calculation of target ID

commit c8f96df5b8e633056b7ebf5d52a9d6fb1b156ce3 upstream.

In megasas_get_target_prop(), driver is incorrectly calculating the target
ID for devices with channel 1 and 3.  Due to this, firmware will either
fail the command (if there is no device with the target id sent from
driver) or could return the properties for a target which was not
intended.  Devices could end up with the wrong queue depth due to this.

Fix target id calculation for channel 1 and 3.

Fixes: 96188a89cc6d ("scsi: megaraid_sas: NVME interface target prop added")
Cc: stable@vger.kernel.org
Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/megaraid/megaraid_sas_base.c