From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0507C7618B for ; Thu, 25 Jul 2019 05:43:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4BEC22BEB for ; Thu, 25 Jul 2019 05:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033410; bh=8jquslMfJrHO/u6zdtWiaDegJLVLe+UUycpnduUcL5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WWPVblteHf6wTAKADQonycVre/+NBf/tUskJDdBpCSuBPbR1BQGfoeOkqPwBk31zU Lx6tU7AE34qNizuB+gKcP7LEaqvUWTqGWkTjtRLoN/1MFFVL2vXgQP55n/o0BI9osR PaZX90220VaDKGE16VwnaVQjwyV7XIbTyqWjO9wI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391039AbfGYFn3 (ORCPT ); Thu, 25 Jul 2019 01:43:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:58368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391026AbfGYFnZ (ORCPT ); Thu, 25 Jul 2019 01:43:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D8F321850; Thu, 25 Jul 2019 05:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033404; bh=8jquslMfJrHO/u6zdtWiaDegJLVLe+UUycpnduUcL5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZpYrFa6lYhRgHYh5MrTGT8JtN421NJZgMEzKJxM5BwyIbmm2srY3pxbVOxmGLPuw b7InzmvOgBcDAdhKbcXGl/yZawOT45D1dEkwjosykaXfHuxgWYD3KHsicOKBo9cd4y LcjLjOSbVkiekdTDnQH44nbog941dBQdKh0kGWf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shivasharan S , "Martin K. Petersen" Subject: [PATCH 4.19 169/271] scsi: megaraid_sas: Fix calculation of target ID Date: Wed, 24 Jul 2019 21:20:38 +0200 Message-Id: <20190724191709.649278970@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shivasharan S 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 Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5862,7 +5862,8 @@ megasas_get_target_prop(struct megasas_i int ret; struct megasas_cmd *cmd; struct megasas_dcmd_frame *dcmd; - u16 targetId = (sdev->channel % 2) + sdev->id; + u16 targetId = ((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + + sdev->id; cmd = megasas_get_cmd(instance);