Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3019388rwb; Mon, 15 Aug 2022 16:16:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR6fJx7NJo3tLAYtngO0BGW18tqmwZP38+ilsO+xsybNhSwyAF/irffKZSxXD094yddQhl3Z X-Received: by 2002:a17:907:a0c6:b0:731:87ce:5289 with SMTP id hw6-20020a170907a0c600b0073187ce5289mr11940427ejc.465.1660605377187; Mon, 15 Aug 2022 16:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605377; cv=none; d=google.com; s=arc-20160816; b=ncXime7ITAjTM9t6FIY76ur9zFh/EoN1AJGp8+d2SEJWkSBkOrkAtyrpGNoidOPl1J Q20xJWjRhPjZN0F/kHeENoF3Mtac24iEJwUU050tpdlEFHKUs4AuPoZ+a1HKcrkseKJq zItuhd/gWIZoIlxR8eIhyeteV6X3dvmsaJ2JAZCiK/gnQXAG6DI7dHN7qa4Fm7+XIuRj 2k/wGbZ5wMlKuQS1gaObxHbBzYxHamOcfvn/ojfd3INluiNMQ3uSAFWkHsUN0w7qci1a AepQVBu4bBf6iYRsmQ6nRmiEns0Ma+1obzXv5viPk7LD8mbHcer+WUdxblvKU6svFYyC uesg== 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=dapStEWHiQXubTt/8+WVnrYYxYbX1wWCiR5emhRaPHw=; b=LurJMLSMZP+QZZFBkct/JOSbZBkk7Ef96Mnba8MD+9U96ZBxhdaYQytA4gHOUNLDwQ MRgoJpNGLp1Asc52ajfj7A4TQlmj94/9eWeLM4V+M6+vYl/gj0PionGxwe6H0kh6DQ+f HO/HLZz2BQaqZEQqHiK+XUzd2WVs6x1f0yH1BefEHUGv2pyA1RH9zX7wqkxYFcmnH1XR GuvufbXYRGtXDxmRHYTwEuvriIMSTGrex2DIr4vYi0FSPypAJgFmrlRn8XA5rNV0WWSc OlxlI/YUxXYiS8Jti6Ju7ixzMIgqcK9nY4YP7RbOgA5VOeI298nzUQDwq5n4AJRW1C6x 8Jzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k6+2xmL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga33-20020a1709070c2100b00732f83eb741si9256713ejc.985.2022.08.15.16.15.51; Mon, 15 Aug 2022 16:16:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k6+2xmL2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1347464AbiHOWAL (ORCPT + 99 others); Mon, 15 Aug 2022 18:00:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244035AbiHOV7V (ORCPT ); Mon, 15 Aug 2022 17:59:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DCB810E952; Mon, 15 Aug 2022 12:35:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 751F5B80EA8; Mon, 15 Aug 2022 19:35:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DA44C433C1; Mon, 15 Aug 2022 19:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592100; bh=49uVIo5yxX6YOHCXdzDZ21EmAzU5bpz2xA4aVGHhjq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6+2xmL2LESP2Rtlads+8xGoHogmQzhf2jI+5xHHgdLaXgP0El0orkodqZAyreNkU 7w7qmQhFcrU+/qgWCNlM9d9kLwTYCkfK2ngP7Mva0AOJJM4gcoIZ3p/TA828+8uCmM JjiYPC0QsEZbanMAj1bSeNO9wRLfRiaaIlatmT4s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Christophe JAILLET , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.18 0734/1095] intel_th: Fix a resource leak in an error handling path Date: Mon, 15 Aug 2022 20:02:13 +0200 Message-Id: <20220815180459.755182054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe JAILLET [ Upstream commit 086c28ab7c5699256aced0049aae9c42f1410313 ] If an error occurs after calling 'pci_alloc_irq_vectors()', 'pci_free_irq_vectors()' must be called as already done in the remove function. Fixes: 7b7036d47c35 ("intel_th: pci: Use MSI interrupt signalling") Reviewed-by: Andy Shevchenko Signed-off-by: Christophe JAILLET Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-2-alexander.shishkin@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/hwtracing/intel_th/pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c index 7da4f298ed01..fcd0aca75007 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -100,8 +100,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, } th = intel_th_alloc(&pdev->dev, drvdata, resource, r); - if (IS_ERR(th)) - return PTR_ERR(th); + if (IS_ERR(th)) { + err = PTR_ERR(th); + goto err_free_irq; + } th->activate = intel_th_pci_activate; th->deactivate = intel_th_pci_deactivate; @@ -109,6 +111,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); return 0; + +err_free_irq: + pci_free_irq_vectors(pdev); + return err; } static void intel_th_pci_remove(struct pci_dev *pdev) -- 2.35.1