Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp649350pxv; Thu, 15 Jul 2021 12:26:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZjz7iGZ4RW0dDn8dP7A65kUxe3Lx8Qw90aK2HzC1/7eg4kwaVDiYvMrqtWtM68usoeeTp X-Received: by 2002:a05:6402:1d37:: with SMTP id dh23mr9145924edb.360.1626377207826; Thu, 15 Jul 2021 12:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377207; cv=none; d=google.com; s=arc-20160816; b=K2vtMCmUvD3qaiY4MNsvevRCnUXTkLC4nKq7txtt547mZIfkiUSb1aiRx2ttEVuN8x VdAfGLP9IW6O6nEeP6SlZgLfxLVPp/uE4IqVY6Cgo1wkIqupeQ04flx/waIeAJVpfIoa ZZk7pQoQHWarGytqhgmp/7ktr7xr1lyVO2jLpgpFQmHbaGRQeYahiG2ERiSC+ZhAuONt 9ly9tsF85CmS3m+LxT+WlueAlCplMWvle9OoCf298RXIHRkdj/zakpTHQOp6RL3ZhwDi 3Laf25c6YlfsYD/miyxqrEQ8nCS2jKkLhVIIBXlrE9z1bof7Hh4d6fKEVv/juUAKrZfG +azw== 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=olR1Oy752pC9jgJNbgwZCw6vMigGg28lyoR8wiZxYqo=; b=rsL5dWkZ7oiVAOeXh+aVgrrFpQbf9Sw59Lukp2X4kWmDY6KNFdFM926rjkzZrujpEw pLqJ4XGytpGad0rUSIvcWo3y6MceLfABvKdMa6TvxAYhU2iS+dd7vEMHg8l0YFcGVrPv qa5Nvb9a+cH0CL0Lxf6SQaVAaUCCYPsf7m5slNFRHrsVoUdVNGHJlElv+oVSKr1syT8a /U7oaKH0oyByojSRvujGXxTF700wCFlDcxIsqXWvq4wgzSjh2rMyvLSVwVuvPMDBsQAl c5UNhJ51RycPTGk4iMHlhPpeB8kM+NuP0TjYdjMW4/fKmxqYdufARX/Vv3kWxdym5ZIj hjNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KdcFFyw0; 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 6si9171427eje.471.2021.07.15.12.26.25; Thu, 15 Jul 2021 12:26:47 -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=@linuxfoundation.org header.s=korg header.b=KdcFFyw0; 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 S1343587AbhGOTYc (ORCPT + 99 others); Thu, 15 Jul 2021 15:24:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:46340 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242114AbhGOTHn (ORCPT ); Thu, 15 Jul 2021 15:07:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 883A4613D0; Thu, 15 Jul 2021 19:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375818; bh=oDj4QzskaiCbEtmnzszlg04IE4Xh1gAq207OnqONIEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KdcFFyw0ZOfN8Y3BfcFcgxWJS3rPTcyDcKnHL+KTgS6L/ofJPwsS8r0/niKs8bMO/ 6013VMJzU/P7SIhmY9a1DB5v27u5DZjRtx+A7FekIZo9CcCDMyIDN5o7t9gXu6U+20 8ruc2UwfRU3GFTEN+c83R3Yn6R//r8etG+4Tsq5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Iglesias Gonsalvez , Lv Yunlong Subject: [PATCH 5.12 212/242] ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe Date: Thu, 15 Jul 2021 20:39:34 +0200 Message-Id: <20210715182630.516082374@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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: Lv Yunlong commit 9272e5d0028d45a3b45b58c9255e6e0df53f7ad9 upstream. In the out_err_bus_register error branch of tpci200_pci_probe, tpci200->info->cfg_regs is freed by tpci200_uninstall()-> tpci200_unregister()->pci_iounmap(..,tpci200->info->cfg_regs) in the first time. But later, iounmap() is called to free tpci200->info->cfg_regs again. My patch sets tpci200->info->cfg_regs to NULL after tpci200_uninstall() to avoid the double free. Fixes: cea2f7cdff2af ("Staging: ipack/bridges/tpci200: Use the TPCI200 in big endian mode") Cc: stable Acked-by: Samuel Iglesias Gonsalvez Signed-off-by: Lv Yunlong Link: https://lore.kernel.org/r/20210524093205.8333-1-lyl2019@mail.ustc.edu.cn Signed-off-by: Greg Kroah-Hartman --- drivers/ipack/carriers/tpci200.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/ipack/carriers/tpci200.c +++ b/drivers/ipack/carriers/tpci200.c @@ -596,8 +596,11 @@ static int tpci200_pci_probe(struct pci_ out_err_bus_register: tpci200_uninstall(tpci200); + /* tpci200->info->cfg_regs is unmapped in tpci200_uninstall */ + tpci200->info->cfg_regs = NULL; out_err_install: - iounmap(tpci200->info->cfg_regs); + if (tpci200->info->cfg_regs) + iounmap(tpci200->info->cfg_regs); out_err_ioremap: pci_release_region(pdev, TPCI200_CFG_MEM_BAR); out_err_pci_request: