Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3820395ybi; Mon, 29 Jul 2019 13:15:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhqcqZJZ/ykGpv/usBIvcKu/mt1UnpsE5a//aupjp0dlj8czIwJs/mRcZXS18madIW3lP8 X-Received: by 2002:a17:90a:ac13:: with SMTP id o19mr114089581pjq.143.1564431351626; Mon, 29 Jul 2019 13:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431351; cv=none; d=google.com; s=arc-20160816; b=xj3qCMdsGbH194GwV7OKU1tVZFpeRWPtSEfkXY1VKEW0jia5HxaAhLcuB2hsRnLM/c S7ffeOYa28PGKsb2MS+lrqh/9PpzIw+6t1vvQ9MCk2fKRj0EatkK710PFZ+bhfXhLFtt DayJTS1MpVQABaH8V7YmVyp/1RMBzfzdtIL4PF6L3KhjZuIHwFPfpMsbeE2oGv9Nwlbj IyluuMRVq4nunyknsDKysLJt9lK6trl6kODDhhWip5RjrK2VP4r1fmJQLO/HjLYhliFf xRDR/8yII6vBosW7EhKmMz5NmqhywggS03Mc9UrB75ywH/RPZ8+noXDywvWeqZqVAMsw SC6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WFuoPSEYshoEqCJYJsu3wQqItxIQVTD7WKAPnXEc9/I=; b=evBmlQAJ9/DZ/zNUQWZErRkHsXKgdXRIuroldw5ewDtjHnDN6zficCU/esUSSbfkz5 zooSjihkQs3mLIh4IV4iyi+cSBQHqSyALsIVTOK0ZgMJ3xVoy8ZPUl1nCVLtDkdDccrb +qFoeV+JFjZIsC0lqSPdzNVXinZOOOFsgCGO06Rrs6toNbwPbU+fN3J+MrVvk0ZfrMF5 jl+plMqp5DVdz4yA9nOP5NpAChCRACMiY1UoH/12AsByUk8zasx2AQxgMpzT7Xty44MV ucaXQPfl6aVYKvSNVUyTtnsBx6CpEqg0nfGK8JH9WkKLClmpw1flVIUGRJQ4KmWU0rQw WeRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AwvmJDkH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b20si28158604pfo.108.2019.07.29.13.15.36; Mon, 29 Jul 2019 13:15:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AwvmJDkH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728842AbfG2T33 (ORCPT + 99 others); Mon, 29 Jul 2019 15:29:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:42074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728345AbfG2T3W (ORCPT ); Mon, 29 Jul 2019 15:29:22 -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 4B8B52070B; Mon, 29 Jul 2019 19:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428561; bh=aW/DoCHxhgIWen+f8hrgEFLzKXjHLURQXKYaosEwwJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AwvmJDkHLYuPHD1zfvNqxdNj4PCncHsvdava+XsaaRJUM7Npf3X2lfE0IsIDiYAwS 4JLYAq3BrRvuXvrusnv1DFz1e0eftlYRBVF6BcDQJxpp1a58zlW9wLq1heqz6HyZB7 fBY+CG/5FLv+m5WbkHgkUFm4UsJNDf3rmUixB4cI= 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.14 116/293] scsi: megaraid_sas: Fix calculation of target ID Date: Mon, 29 Jul 2019 21:20:07 +0200 Message-Id: <20190729190833.487686220@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 @@ -5806,7 +5806,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);