Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5458067imm; Tue, 16 Oct 2018 10:31:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV60fD1RsCROfCXEAddFSfvDZSsIzumIPu5CzFPrko8qKBPPRxYco/20t6feaZY0kl2W8l3KC X-Received: by 2002:a63:1302:: with SMTP id i2-v6mr21465326pgl.380.1539711084753; Tue, 16 Oct 2018 10:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539711084; cv=none; d=google.com; s=arc-20160816; b=kjNuxhyKNFRdX8oUGE4cO5VUa3kG2VGzadRTyjy7DqgXvzMWwkyZYSJD7a3CcLDAlm vGeO6UR/MvjzLW4aLphOwMMhrE0NQY60grjJAR417TZFeDk6EYy1E9XaG18zjjYU5e3f oczUt3E+2YgKEpcZpVY9ofBgEzv4zLJh0OyDoT5Gpyc/JFUYhBQp+fTWnECdHvjYbuQA 7Y/qRssWHzQfkZ+l0PyUWrUSWksNEKjIak0cMIvmunh9zwznaymJ20Zb+aAwX+cQ0FMk I/9EOQyA5aLa6Up2emsTgayAQseAk6Fm8rr7zpr5blLqp4N8k7vj6ykUEk6Z2DZD00oi FrBA== 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=kyqLsTGsPCIbIVgajOKaOyO+fD4g8/pAAypJShvTo98=; b=0oMVuyzAIPKUrfDlXfexKQajE+YDQZoJY+y85cX6kY8sXwJ6W1v23Pq1TFi7mShN/n XupYa2z5iiT6iliP1SC7BLh1aPWPa3SlC4UT0EjImcjP9ApcQ15cHhcBtVQxPVHzM1gQ bSM4KTh6yOA6hf6mUAWMAMfZQvQlbW9BAD74QDWJ2trdcdVnOqHLJt5LadviUJUa/Ry7 rjUc8E8/C9ZqMB7UeP1Qh2hzRghTkQdRfDN2k65AdRiF1njyZIEiEXsFiuLJ/LnUCtET b3+PQ9N36kg3iLCWImAQOaHw2/60mu0i1DmYoiU2F8LWV6HUWP3tSxp2tMcUbvo3t/qp h/mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ebFNjIOW; 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 k62-v6si14445769pgc.79.2018.10.16.10.31.08; Tue, 16 Oct 2018 10:31:24 -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=ebFNjIOW; 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 S1731399AbeJQBOw (ORCPT + 99 others); Tue, 16 Oct 2018 21:14:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:33324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730397AbeJQBOv (ORCPT ); Tue, 16 Oct 2018 21:14:51 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 EE71B2098A; Tue, 16 Oct 2018 17:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539710605; bh=hfhCmn5zSjUA1s8HcqHU6I+SzEuuxmKov/22585+2Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ebFNjIOWtUMozE4F+mLpBdlQI63qyojqtUBUm9P7LdsDb+wx7aepf0nTH0ZRJXMax 9wmVZEGHZcFS6FKR/e4t9SuK1OCboPan8v/SaBgLtpQnj2KKbMM1Ob0vgHVv+uovC6 pQgzgC1jT648gGr7ePN7FkfgCCcznodbc61mQQG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Quinn Tran , Himanshu Madhani , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.9 07/71] scsi: qla2xxx: Fix an endian bug in fcpcmd_is_corrupted() Date: Tue, 16 Oct 2018 19:09:04 +0200 Message-Id: <20181016170539.778784383@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181016170539.315587743@linuxfoundation.org> References: <20181016170539.315587743@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter [ 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 Acked-by: Quinn Tran Acked-by: Himanshu Madhani Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_target.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- 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;