From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9CC8EB64DC for ; Fri, 21 Jul 2023 14:43:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbjGUOnm (ORCPT ); Fri, 21 Jul 2023 10:43:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbjGUOnl (ORCPT ); Fri, 21 Jul 2023 10:43:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CD1A30DB for ; Fri, 21 Jul 2023 07:43:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29F5261CBC for ; Fri, 21 Jul 2023 14:43:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E3FBC433C8; Fri, 21 Jul 2023 14:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689950606; bh=YMOUSIfRzHkXsl1F5me1+QiS00jTbSKdvaTXYuzAjiI=; h=Subject:To:Cc:From:Date:From; b=SVPMbg6MatFafa8XT5HXwb58IWzalB+tc2cXgIKJonzpGO87oA6GucuJqeYdjOsRo rwkKAbPNhyvZ7/MpktzT/UNCoOXXERHzGlG48nheBg2+nNrp5HvrwUkjcy3ABuiAaN cAbYen/X2EUL1SPdQxxF8UFcCSpiH80665KHrTcM= Subject: FAILED: patch "[PATCH] scsi: qla2xxx: Fix buffer overrun" failed to apply to 5.4-stable tree To: qutran@marvell.com, himanshu.madhani@oracle.com, martin.petersen@oracle.com, njavali@marvell.com Cc: From: Date: Fri, 21 Jul 2023 16:43:23 +0200 Message-ID: <2023072123-oink-gains-2382@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x b68710a8094fdffe8dd4f7a82c82649f479bb453 # git commit -s git send-email --to '' --in-reply-to '2023072123-oink-gains-2382@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: b68710a8094f ("scsi: qla2xxx: Fix buffer overrun") 44f5a37d1e3e ("scsi: qla2xxx: Fix buffer-buffer credit extraction error") 897d68eb816b ("scsi: qla2xxx: Fix WARN_ON in qla_nvme_register_hba") 9f2475fe7406 ("scsi: qla2xxx: SAN congestion management implementation") 62e9dd177732 ("scsi: qla2xxx: Change in PUREX to handle FPIN ELS requests") 818dbde78e0f ("Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi") thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b68710a8094fdffe8dd4f7a82c82649f479bb453 Mon Sep 17 00:00:00 2001 From: Quinn Tran Date: Wed, 7 Jun 2023 17:08:40 +0530 Subject: [PATCH] scsi: qla2xxx: Fix buffer overrun Klocwork warning: Buffer Overflow - Array Index Out of Bounds Driver uses fc_els_flogi to calculate size of buffer. The actual buffer is nested inside of fc_els_flogi which is smaller. Replace structure name to allow proper size calculation. Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Link: https://lore.kernel.org/r/20230607113843.37185-6-njavali@marvell.com Reviewed-by: Himanshu Madhani Signed-off-by: Martin K. Petersen diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 0df6eae7324e..b0225f6f3221 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5549,7 +5549,7 @@ static void qla_get_login_template(scsi_qla_host_t *vha) __be32 *q; memset(ha->init_cb, 0, ha->init_cb_size); - sz = min_t(int, sizeof(struct fc_els_flogi), ha->init_cb_size); + sz = min_t(int, sizeof(struct fc_els_csp), ha->init_cb_size); rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma, ha->init_cb, sz); if (rval != QLA_SUCCESS) {