Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3427477rdb; Wed, 13 Sep 2023 11:39:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGUS0+kjsg0WM8F6QzzEt+Er9mJSVoi+T8DrQw4MnyyNolEMc2Fec3W9O33fVpxawmWVASs X-Received: by 2002:aa7:8889:0:b0:68a:3e68:f896 with SMTP id z9-20020aa78889000000b0068a3e68f896mr3722772pfe.12.1694630384492; Wed, 13 Sep 2023 11:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694630384; cv=none; d=google.com; s=arc-20160816; b=nsl3lQvXSfRhxnRNXPA/l9ImiDorysFBVMfud6VM7WzUkElkl21d0A1C3Qc0HVmwKc btWRfEtuWVqXDWeoggDCHV/t1VA6vfJdQ6qMk9SqeDo/DaI0VFQFPidGQ6jfDGp1nsfI AxGbANBHCLCLu+3Jl+67R//YwRHr/1f4Sf04yFr4cg/kpVKEmZ023iGW7tPsrViNrptz xi658+U5pjk0FjEbCBXtQsOsutvuKFKxVJQtsdmUNy4SD03A6DSrbJrunbQEdXtmzxJS 8EDPKIY+7kBq+Pjx8l74HwakwqBtKg7u9tkUtJVe7u8QZEvRvqKPEYgoX9dftPSs8mTT m3HA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=AIyMvxxGP9p9iIM6Er7MAf6Bge5FuQgTctDUr2yM9GA=; fh=Tl0pcqVHvlXhI2+fkP7SYnC3xQkRhJuKOlQAV7cqjfE=; b=tj4j7cwCfs8otXbxur2RmRurrc+wrf/VhBgwEdp4sDTiZxKOJAGoqZSxiyYgnNDfoN VISEt620XxF6moGZLfUPN083q4yB7nQnEjys1lqq7paRDJm9lTZuRaDzOFau9Fuf288M SPNrWwLfypTlojISzcEctTSYa5cT5YcwBw+LTAAhYgKh8gD6CpvNiNdbaFUvamC46BKC Nhj/ryIqo7NJ0DlzxIfE4Cxu9t3odPGerNT8+1o1OMVD3P+KiEP5eOC6ZRIdEpSe9F6W SxhbGjYjSn6dfGlm75vYD65hi+P+aMbfTr/W+oZkydk9NSwbt/FTimf1D6JjSCOYSBAQ g6CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Ee365Tgh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id u1-20020a637901000000b0057763b28f63si7025708pgc.506.2023.09.13.11.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 11:39:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=Ee365Tgh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 05275811F273; Wed, 13 Sep 2023 03:42:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233408AbjIMKmI (ORCPT + 99 others); Wed, 13 Sep 2023 06:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbjIMKmH (ORCPT ); Wed, 13 Sep 2023 06:42:07 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.215]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B16119A0; Wed, 13 Sep 2023 03:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=AIyMv xxGP9p9iIM6Er7MAf6Bge5FuQgTctDUr2yM9GA=; b=Ee365Tgh7vq0LC2bAJEcw tzLDr84MJ6qcd/DY/lsuo1tEwv3yEqLlhnbWDGhVBi1+8ab8DlbspXZ/ow/qrOEi 8MWuHI7TrPgJ9LXXBP1aL6J5HZisRLY6WxBFA79Yi4N2r00cEmKy+vqk16NgCXKj uMPf0XuJwF+3fxLVP8fKtg= Received: from icess-ProLiant-DL380-Gen10.. (unknown [183.174.60.14]) by zwqz-smtp-mta-g2-1 (Coremail) with SMTP id _____wB3JXbRkQFlkrPhBw--.16168S4; Wed, 13 Sep 2023 18:41:39 +0800 (CST) From: Ma Ke To: shshaikh@marvell.com, manishc@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, GR-Linux-NIC-Dev@marvell.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ma Ke Subject: [PATCH] net/qlcnic: fix possible use-after-free bugs in qlcnic_alloc_rx_skb() Date: Wed, 13 Sep 2023 18:41:19 +0800 Message-Id: <20230913104119.3344592-1-make_ruc2021@163.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wB3JXbRkQFlkrPhBw--.16168S4 X-Coremail-Antispam: 1Uf129KBjvdXoW7GFWxuw45AFyfGFWUWF4UJwb_yoWfWFb_GF 4UZr18Za1DGr9Ikw42qr45A3429FyDXrZ3Aw4Fgay3JwnrAF4fGrW2kF95JryxW3yxZFyD G3Way3y5A342vjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRKJ5rDUUUUU== X-Originating-IP: [183.174.60.14] X-CM-SenderInfo: 5pdnvshuxfjiisr6il2tof0z/1tbiyAbpC1p7LvK8kAAAs9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Sep 2023 03:42:24 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email In qlcnic_alloc_rx_skb(), when dma_map_single() fails, skb is freed immediately. And skb could be freed again. This issue could allow a local attacker to crash the system due to a use-after-free flaw. Signed-off-by: Ma Ke --- drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index 41894d154013..6501aaf2b5ce 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c @@ -832,6 +832,7 @@ static int qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter, if (dma_mapping_error(&pdev->dev, dma)) { adapter->stats.rx_dma_map_error++; dev_kfree_skb_any(skb); + skb = NULL; return -ENOMEM; } -- 2.37.2