Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10425775ybi; Wed, 24 Jul 2019 23:00:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEZvoLw5zRFyW9pJYenEbqEqfkFUdL6IzHhG8AM80wk3W7v6n1HLHlvoL9c8mvcpCI1NJU X-Received: by 2002:a17:90a:9bc5:: with SMTP id b5mr91803509pjw.109.1564034449136; Wed, 24 Jul 2019 23:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034449; cv=none; d=google.com; s=arc-20160816; b=gN80x9JvxoUZAQp0DhEZ4zsRQWgXgkD8g9a3qH5+9kMCzE6x+mIdko6GHbeKq6uKbB 9kVTpcNIQ7HYQYRaxvSpRRF8iMoyBdJ3nzxXTYzvcdoIlrl+YvCgM3yEcQYosLkuk2Co FqGBcvMi2rMsR2RWhXvpxX405j1zDRmNiCy/zicxCq2KMmhEeSDg3jMCDzHDpv9PuggM VLuMfxhUudtPekiF3vKzS+e62KjxjPqvBiQ0ZKPidvta6085NICWr9QTXzYyylO2bAl+ VWOPim94C9IIVPXDun4PQ6cKW24JBKMYBwK6KyzTNocimEF5iIe0x1OwjzJDQnlkOpY2 jm1Q== 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=kXnjO/d04DuAO0MoXgJI4fJtowHvg7Zoi+QfoO92h6s=; b=AAeveNZb05w2DLjtY1fBqJX8UyWt1LKdh4gj1Oi6uxU12IzJhkQef8pH12PyKMkBNg eP1FO02Adxvfg7kjDP6KYVKZ8HYa6hKSlfnoN53vdQnvB132JRw7OnXHse77BuYQFt/G OSLBZszoOjMz0Ib1IXqe6OuhA9RGCh61qC4OgIHsKTjLeFzc19oaTgVfNH6uCaocr3or JUgpa/jD3W28x9P2jhLAEE5sVVZNi9EiNpWWPpYWhj1BfajhOEeKVciPj9tI9u8v7T9h 6nJJy5ePRqmeBt6nRdhz3Hqw/T7gc/iBlYSeP4gDOVSlrQ9P/FW3Mls3E4QRvhOin7hK T13w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TZpYrFa6; 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 68si14382962ple.89.2019.07.24.23.00.34; Wed, 24 Jul 2019 23:00:49 -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=TZpYrFa6; 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 S2391035AbfGYFn3 (ORCPT + 99 others); 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);