Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9096746pxu; Mon, 28 Dec 2020 06:33:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxK2qA/mwlbiSOQbZq5vV3tKZjrbulgGZmURGkJ2837eOazO7ASbvxkqPg7N72JLZjD2h1K X-Received: by 2002:a05:6402:8d9:: with SMTP id d25mr42086147edz.278.1609166012362; Mon, 28 Dec 2020 06:33:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166012; cv=none; d=google.com; s=arc-20160816; b=p69qY1tIM86HjKYL2r5dZJSQKEjEAqx7wQoMLkrF2C6W0DEOt7EcGaIigI1sz2cLjx AaK8Cku2qtay6irNFgcDxClN6+H1/CvxdUUl3rEIbbayYb3ynoUEq8jXsPdlMDZmD0/0 MZIZ4/8E6GpI5Tw7xg2W1xi2C3xyDUMJCmN3Kj+RAitOXZ87mdv+dJ/XEtnXKO40643k EAh2swXOUIZ1RPIORvNBdvou8Gd65AwGtz/2a4MQiuyBH9GzPZlEsfbHhl1jieK5Rkvm MI3lLmo/sGF/Zun30OehmLyzPGtebiIuuFocQbHuVyuOFsmOWhIih+2/KqtmLVU2bY5M 7sqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q+QtL0iijaJe8ijrDfgZvBVjp+r45nFMoMhuCMY5onE=; b=hJKx0/fpKR2F5KsGAcaOT4b/++dLbwGfm79Kp2cXgb19bIMUwgOgzplsojKk7NbY37 iUrqN2PPkN8HnFmm1mFJsLx6derSknHsGdwb+xwoxsn1mkvQHsCChCSZ/C5+pdqCktgY zk+wAqiTF8ZIoMafUTkW75t/sbjnSZ4sml4Gu0Sk2F3g5KhFsnA7AKw3rAw9WR67pFw5 luU9A6R25fnCGtPunWG19hW4M4o/UBtr5vE12oh25OC1ck/8FG/I0TfJ76hfvkIfTPf6 poXF6oKToJCw4Qi0mXbiwaaitY1M/1BDsoLWRsR2h/i2B+qfTP5iJc/anNqReX/yeAl1 TO3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=trMbM+uJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si17715849ejq.369.2020.12.28.06.33.09; Mon, 28 Dec 2020 06:33:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=trMbM+uJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504064AbgL1Oaw (ORCPT + 99 others); Mon, 28 Dec 2020 09:30:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:38520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503720AbgL1Oap (ORCPT ); Mon, 28 Dec 2020 09:30:45 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 00A29221F0; Mon, 28 Dec 2020 14:30:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165829; bh=xoMTF1CXZZJ2IdsDi+XgdSgAMz+QyCa6IwiMQ7TtPz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trMbM+uJ7O0+Yqb7l5/tn4vpNr+X/iQKzWzb8OXE0Q7QLMrQ9x0IreVsBtz1YW0Fy a1eSc00h0q5uGKs9OrA9pIOHTBa7hyp34kxOvPZsMCfks411iHpLvSMxGegC2p4AZJ pNqmJlp5FT91ioUqFLArZ0I+V9E0t4RxDrE7OGdY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.10 669/717] scsi: qla2xxx: Fix crash during driver load on big endian machines Date: Mon, 28 Dec 2020 13:51:07 +0100 Message-Id: <20201228125053.036506065@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arun Easi commit 8de309e7299a00b3045fb274f82b326f356404f0 upstream. Crash stack: [576544.715489] Unable to handle kernel paging request for data at address 0xd00000000f970000 [576544.715497] Faulting instruction address: 0xd00000000f880f64 [576544.715503] Oops: Kernel access of bad area, sig: 11 [#1] [576544.715506] SMP NR_CPUS=2048 NUMA pSeries : [576544.715703] NIP [d00000000f880f64] .qla27xx_fwdt_template_valid+0x94/0x100 [qla2xxx] [576544.715722] LR [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx] [576544.715726] Call Trace: [576544.715731] [c0000004d0ffb000] [c0000006fe02c350] 0xc0000006fe02c350 (unreliable) [576544.715750] [c0000004d0ffb080] [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx] [576544.715770] [c0000004d0ffb170] [d00000000f7aa034] .qla81xx_load_risc+0x84/0x1a0 [qla2xxx] [576544.715789] [c0000004d0ffb210] [d00000000f79f7c8] .qla2x00_setup_chip+0xc8/0x910 [qla2xxx] [576544.715808] [c0000004d0ffb300] [d00000000f7a631c] .qla2x00_initialize_adapter+0x4dc/0xb00 [qla2xxx] [576544.715826] [c0000004d0ffb3e0] [d00000000f78ce28] .qla2x00_probe_one+0xf08/0x2200 [qla2xxx] Link: https://lore.kernel.org/r/20201202132312.19966-8-njavali@marvell.com Fixes: f73cb695d3ec ("[SCSI] qla2xxx: Add support for ISP2071.") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_tmpl.c | 9 +++++---- drivers/scsi/qla2xxx/qla_tmpl.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) --- a/drivers/scsi/qla2xxx/qla_tmpl.c +++ b/drivers/scsi/qla2xxx/qla_tmpl.c @@ -928,7 +928,8 @@ qla27xx_template_checksum(void *p, ulong static inline int qla27xx_verify_template_checksum(struct qla27xx_fwdt_template *tmp) { - return qla27xx_template_checksum(tmp, tmp->template_size) == 0; + return qla27xx_template_checksum(tmp, + le32_to_cpu(tmp->template_size)) == 0; } static inline int @@ -944,7 +945,7 @@ qla27xx_execute_fwdt_template(struct scs ulong len = 0; if (qla27xx_fwdt_template_valid(tmp)) { - len = tmp->template_size; + len = le32_to_cpu(tmp->template_size); tmp = memcpy(buf, tmp, len); ql27xx_edit_template(vha, tmp); qla27xx_walk_template(vha, tmp, buf, &len); @@ -960,7 +961,7 @@ qla27xx_fwdt_calculate_dump_size(struct ulong len = 0; if (qla27xx_fwdt_template_valid(tmp)) { - len = tmp->template_size; + len = le32_to_cpu(tmp->template_size); qla27xx_walk_template(vha, tmp, NULL, &len); } @@ -972,7 +973,7 @@ qla27xx_fwdt_template_size(void *p) { struct qla27xx_fwdt_template *tmp = p; - return tmp->template_size; + return le32_to_cpu(tmp->template_size); } int --- a/drivers/scsi/qla2xxx/qla_tmpl.h +++ b/drivers/scsi/qla2xxx/qla_tmpl.h @@ -12,7 +12,7 @@ struct __packed qla27xx_fwdt_template { __le32 template_type; __le32 entry_offset; - uint32_t template_size; + __le32 template_size; uint32_t count; /* borrow field for running/residual count */ __le32 entry_count;