Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp102474ybg; Mon, 8 Jun 2020 17:38:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRON6A8L2k/L0nghKKEdKgJTA8LhadmaQsfPQTmtLLIvXLU8+ejgkZlDvd2JXQWr7UV2Mk X-Received: by 2002:aa7:c496:: with SMTP id m22mr20777524edq.187.1591663125613; Mon, 08 Jun 2020 17:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663125; cv=none; d=google.com; s=arc-20160816; b=RMrZGAjtrdCnEgpdtMRgSF2IXx5KbxZeF91kzscWRWSi7BtHafHQcKnP6lkvWLd/qD FR8lbkwtqkdKV98pLznTd/9kBnJdW/hrSnkzj+QqxhIZ06ellD/eMArLVN8Ps1ShJztO y+1GFHhfPviITVQ6/cTbyyZ6ritUlnqMuw/ecrtJAbTeby++q8YEtLJZx/Wvp2tHTIUR uq1UP4JxtR1/4EYr+4/2rUDzBZ4yjIBXVsRNck6K1PqDyVeHyZ2LeGtg7JGUVwvMfheh P34ZWuoF47r6uLwg5zIsnO6mQEBY/77kD1PRx3QD6Sj9UXjaupdOUNUOg/ExFzl5IBpz uoFA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wjj/3HeZPibayaXxJhHI/MAQB+wfYPgBJc/JP2YuxZI=; b=hHCdjZ1MvQrb8lDREdxtV47OV1/ND1GHysw5k0N3H5MAFTT/Wnus+5bWmWVExpwQVd TJ9swwZi1kq8b048fJSPWLQcRAdFtstvPNF9d2G1Asa4Zt8ATXLv/JcCPN+tU60qIbsr X14slrf3kQsYpDCeSllUP8RGN6hZ4F+Isu0vHnd8nsbKTA3Ldo2wCFlBMOY/bRhrvDcD hpZZaIWVhC9wLREnvEytL3wzZ+S1CiXsSQ/s4EdDijmhDNzbId+pt3Vw6XUsZn5hXqb7 QaBu/M1dvO15w8MQApUzMacIKUARDcTImUXjxfwu/xGJ2ZzJRGbb9VIio1Mljewq4Eli dh7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WZ7SEphq; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si8744006eja.348.2020.06.08.17.38.22; Mon, 08 Jun 2020 17:38:45 -0700 (PDT) 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=@kernel.org header.s=default header.b=WZ7SEphq; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729678AbgFHXOC (ORCPT + 99 others); Mon, 8 Jun 2020 19:14:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:58584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728931AbgFHXLh (ORCPT ); Mon, 8 Jun 2020 19:11:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 402C72100A; Mon, 8 Jun 2020 23:11:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657897; bh=khwqOgzIKy4HdyDJxlADdur1zwDQ2QxqGZxNDiHr2Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WZ7SEphqmAl7WwvXWSQVgN8OxL88Wm7Kutp7nfFP+ItfW4uZEtiQeYUcuUTc3U62h nXU2EUFsg71kgoKCbxpAyL2h/KXpyymvrX/I1Bl7Z+S2YquT3ihZ74V5o8kSH1ZVHF 2mhfy61x7YgvcbVf6yTpXAfUvnBF/PPigqL16FRI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jacob Keller , Andrew Bowers , Jeff Kirsher , Sasha Levin , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 251/274] ice: fix potential double free in probe unrolling Date: Mon, 8 Jun 2020 19:05:44 -0400 Message-Id: <20200608230607.3361041-251-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jacob Keller [ Upstream commit bc3a024101ca497bea4c69be4054c32a5c349f1d ] If ice_init_interrupt_scheme fails, ice_probe will jump to clearing up the interrupts. This can lead to some static analysis tools such as the compiler sanitizers complaining about double free problems. Since ice_init_interrupt_scheme already unrolls internally on failure, there is no need to call ice_clear_interrupt_scheme when it fails. Add a new unroll label and use that instead. Signed-off-by: Jacob Keller Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 545817dbff67..69e50331e08e 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -3298,7 +3298,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) if (err) { dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err); err = -EIO; - goto err_init_interrupt_unroll; + goto err_init_vsi_unroll; } /* Driver is mostly up */ @@ -3387,6 +3387,7 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) ice_free_irq_msix_misc(pf); err_init_interrupt_unroll: ice_clear_interrupt_scheme(pf); +err_init_vsi_unroll: devm_kfree(dev, pf->vsi); err_init_pf_unroll: ice_deinit_pf(pf); -- 2.25.1