stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH AUTOSEL 4.9 07/14] scsi: qla2xxx: Fix an endian bug in fcpcmd_is_corrupted()
Date: Fri,  5 Oct 2018 12:16:57 -0400	[thread overview]
Message-ID: <20181005161704.20704-7-sashal@kernel.org> (raw)
In-Reply-To: <20181005161704.20704-1-sashal@kernel.org>

From: Dan Carpenter <dan.carpenter@oracle.com>

[ Upstream commit cbe3fd39d223f14b1c60c80fe9347a3dd08c2edb ]

We should first do the le16_to_cpu endian conversion and then apply the
FCP_CMD_LENGTH_MASK mask.

Fixes: 5f35509db179 ("qla2xxx: Terminate exchange if corrupted")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Quinn Tran <Quinn.Tran@cavium.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
 drivers/scsi/qla2xxx/qla_target.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 0824a8164a24..07ea4fcf4f88 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -440,8 +440,8 @@ struct atio_from_isp {
 static inline int fcpcmd_is_corrupted(struct atio *atio)
 {
 	if (atio->entry_type == ATIO_TYPE7 &&
-	    (le16_to_cpu(atio->attr_n_length & FCP_CMD_LENGTH_MASK) <
-	    FCP_CMD_LENGTH_MIN))
+	    ((le16_to_cpu(atio->attr_n_length) & FCP_CMD_LENGTH_MASK) <
+	     FCP_CMD_LENGTH_MIN))
 		return 1;
 	else
 		return 0;
-- 
2.17.1

  parent reply	other threads:[~2018-10-05 23:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 16:16 [PATCH AUTOSEL 4.9 01/14] ASoC: wm8804: Add ACPI support Sasha Levin
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 02/14] ASoC: sigmadsp: safeload should not have lower byte limit Sasha Levin
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 03/14] selftests/efivarfs: add required kernel configs Sasha Levin
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 04/14] selftests: memory-hotplug: add required configs Sasha Levin
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 05/14] mfd: omap-usb-host: Fix dts probe of children Sasha Levin
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 06/14] scsi: iscsi: target: Don't use stack buffer for scatterlist Sasha Levin
2018-10-05 16:16 ` Sasha Levin [this message]
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 08/14] sound: enable interrupt after dma buffer initialization Sasha Levin
2018-10-05 16:16 ` [PATCH AUTOSEL 4.9 09/14] stmmac: fix valid numbers of unicast filter entries Sasha Levin
2018-10-05 16:17 ` [PATCH AUTOSEL 4.9 10/14] net: macb: disable scatter-gather for macb on sama5d3 Sasha Levin
2018-10-05 16:17 ` [PATCH AUTOSEL 4.9 11/14] ARM: dts: at91: add new compatibility string " Sasha Levin
2018-10-05 16:17 ` [PATCH AUTOSEL 4.9 12/14] x86/kvm/lapic: always disable MMIO interface in x2APIC mode Sasha Levin
2018-10-05 16:17 ` [PATCH AUTOSEL 4.9 13/14] drm/amdgpu: Fix SDMA HQD destroy error on gfx_v7 Sasha Levin
2018-10-05 16:17 ` [PATCH AUTOSEL 4.9 14/14] ubifs: Check for name being NULL while mounting Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181005161704.20704-7-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alexander.levin@microsoft.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).