From patchwork Wed Jan 31 09:00:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Stanner X-Patchwork-Id: 194630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1765557dyb; Wed, 31 Jan 2024 01:17:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdaqlghvfaKbzVvS0Dnl9QOSoZD1apqHwM8kQC9t9WPtoMfMH1z5pZkXUicAXPcKmhk1/2 X-Received: by 2002:a05:6a20:1e4a:b0:19c:b4ef:3fa5 with SMTP id cy10-20020a056a201e4a00b0019cb4ef3fa5mr953843pzb.29.1706692660194; Wed, 31 Jan 2024 01:17:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706692660; cv=pass; d=google.com; s=arc-20160816; b=p5Goeur9VIelRnpuhDJmgd3DEPAatirGs+4wxjZoQoA0pHN9NHzblNMAOCh+lCtCCv 8b12Eh47QgIZjDNZA9QuPAao2DcbsX7o/sdPstV0KTwaHRKHs1f+dPMKQIC5LDB2w1o/ WRx958VPbO2d37FzQPT9savmrhzi4SoOzn3kBH/aazHx9oN/XBA+d9QMyiieloyWffVC oO3BLbCEHFgD81iZoemhG6hHeHC3VIiziQHrk2q1cT1lJZ5KKHFbDe8YlneY55u8inoH 1TxQb+gatzC2E2wB6FVQURpN0HoKh66Zixfr//RUMARfA04/uaxj+6kxBOaSdMkMQhSi wIvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7vzi2j4G3178It/+rST4Ai2Ba1aZ21wL7YawLdngYBs=; fh=hGRKx3jko6I0I9RE4DYVo3CqVnjDvMCANG3TyyofgdQ=; b=yqwqZ1aqo246uWSgcblnotB2eUeFFKhXUEIUy+rpOu4TX6gXgKcXrHs37it5OWmbNs 9bwVDrm9xTi2nVvjkRtmq4b1ASzfcShzh6dLCYGUveUALQJwLZxWkX03EaxpsG/WtwmS umrrBW1m+JQLAkTgJqUr4m3n6a5chojMlA4fxtPy6Zqwc3Rgy0I8ZEI6IalcHsvZlurO 2zqtCGJleucrlxHfkD2IcC2KYtO2ruuB8LY2Q+k2SqsqM+Ih/Ud2yr1JLKjdvqWPzdN0 MPyy2rP+IzF2WmkFNC/1CsVTSGGPLUyuTspDB1cPzO/v9twUyW+hF31+i758ZjXtPr76 wwng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VfVOq0DW; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-46092-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46092-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCWNqlBKQt3/HG98cxE/FFS62z16BoaNTphjLaY+0MEcQ4lMiktqbsGx7cw/H4iTgQwu3+A1A0R9wclHxrPB61X8njqa5w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x8-20020a17090a0bc800b00295c3c001efsi806126pjd.12.2024.01.31.01.17.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 01:17:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46092-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VfVOq0DW; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-46092-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46092-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1BCBB291804 for ; Wed, 31 Jan 2024 09:06:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 203BD78673; Wed, 31 Jan 2024 09:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VfVOq0DW" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 367A16DD12 for ; Wed, 31 Jan 2024 09:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706691652; cv=none; b=mkAPMAf28L4ByhOprH6GRkw8Q0MFHKraarFctNHa+whC5bMxKuUs4BbIxC67XWJGMzcX4GWYXoYRaFYfkgpOtmny/NCTdZv+jaGW1B9/jP1OSJpwM/ce9KUnHYWmG8/EIzLjkudSI8txVSb2KVpHBMcq0OI+7DagvpOtMQ/d1JI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706691652; c=relaxed/simple; bh=vH3oPgaI8JxuUuwWch/HQ93o84vdfvLqDCcNgnv6A3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YpvfOe4PTyvsW3RgvMXszg/BNPzTNzPgue/aNIJKLqVSst1LUpVyQaKFnh7VFHcBLDWyLZ3BlbnAFoSaYXTglPszT/oGdz4t+FGLCipWJU+szf1pUdzrhh3v/rX59aiJN7NGU4oB7iRL//ikruwpAZAJGoqCHSzACbYqvuRJt1s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VfVOq0DW; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706691649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7vzi2j4G3178It/+rST4Ai2Ba1aZ21wL7YawLdngYBs=; b=VfVOq0DWaVGwz4S8ZrqOv1yh0dPziEyx6ceMt6dXpMX+qVhGC7+GoVmUvPd3oohkU6mldd 5YDCfcoaCqvoumekNFZHvyvCAL4o+HStw9IXw11vK+k25smFS8kWhH6tDZTngT+0lY7TJ/ z1Fbe+ZZwj10mAA+FG4GjHEOXvBgN/A= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-537-TiYa8bbFO2KIVEWvpCF5CA-1; Wed, 31 Jan 2024 04:00:47 -0500 X-MC-Unique: TiYa8bbFO2KIVEWvpCF5CA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-51025633d3cso554868e87.1 for ; Wed, 31 Jan 2024 01:00:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706691646; x=1707296446; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7vzi2j4G3178It/+rST4Ai2Ba1aZ21wL7YawLdngYBs=; b=DGZK/9GNdCElC1uAMz2vS0YZYp/qAjoai7KMH2ZIA/MBwTWcYDlg8uSYwLw/3SQMTR oyu/hrZmkZ2kmjWdxTinVidpH7tk5AQLpGDdw2XMmpxwSWLN4mTXRcjBoU2oMV34ExJp RGoHkl1ubwfrXj2x26BP84TlGJlq0zJ4D8oHaXUsviCFAv7idXAiodTvGp3aBJkTnG4w Ore2ygkfC9ovbOZlobLRDcqsk9lyjJrl44V0Fd5ixCW9b3yJH6cE+jn/rI8zlsjcNWmB UYa4AflP9o1tcVut0exaT3lXiz6rKaWmKPN5qDRbTibghK4M54XybN1AfsX51jXqLSuf B1jw== X-Gm-Message-State: AOJu0YynOlQiZnf5LCdGXGr/mDsrxxOFgwRLd5uA3k+KVjShvbLfmJtw i4+vLfXXNzWKwA+Q+WA9ka4X7a6wtqJe9ubO5H4tZI2bT5h2w4yp9ilef8yy3euSOZGCTjs3d0Y XPJV7qR9XFglVo4558p+lb8MI7QArlnjK3spm9NDy8PzbyHKeEBe/E1ek3c6FIA== X-Received: by 2002:a19:8c4b:0:b0:50e:337b:f316 with SMTP id i11-20020a198c4b000000b0050e337bf316mr713631lfj.1.1706691646096; Wed, 31 Jan 2024 01:00:46 -0800 (PST) X-Received: by 2002:a19:8c4b:0:b0:50e:337b:f316 with SMTP id i11-20020a198c4b000000b0050e337bf316mr713612lfj.1.1706691645825; Wed, 31 Jan 2024 01:00:45 -0800 (PST) Received: from pstanner-thinkpadt14sgen1.muc.redhat.com (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id t15-20020a05600c198f00b0040ee51f1025sm940261wmq.43.2024.01.31.01.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 01:00:45 -0800 (PST) From: Philipp Stanner To: Bjorn Helgaas , Arnd Bergmann , Johannes Berg , Randy Dunlap , NeilBrown , John Sanpe , Kent Overstreet , Niklas Schnelle , Philipp Stanner , Dave Jiang , Uladzislau Koshchanka , "Masami Hiramatsu (Google)" , David Gow , Kees Cook , Rae Moar , Geert Uytterhoeven , "wuqiang.matt" , Yury Norov , Jason Baron , Thomas Gleixner , Marco Elver , Andrew Morton , Ben Dooks , dakr@redhat.com Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, stable@vger.kernel.org, Arnd Bergmann Subject: [PATCH v6 1/4] lib/pci_iomap.c: fix cleanup bug in pci_iounmap() Date: Wed, 31 Jan 2024 10:00:20 +0100 Message-ID: <20240131090023.12331-2-pstanner@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240131090023.12331-1-pstanner@redhat.com> References: <20240131090023.12331-1-pstanner@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789596962458044932 X-GMAIL-MSGID: 1789596962458044932 The #ifdef for the ioport-ranges accidentally also guards iounmap(), potentially compiling an empty function. This would cause the mapping to be leaked. Move the guard so that iounmap() will always be part of the function. CC: # v5.15+ Fixes: 316e8d79a095 ("pci_iounmap'2: Electric Boogaloo: try to make sense of it all") Reported-by: Danilo Krummrich Suggested-by: Arnd Bergmann Signed-off-by: Philipp Stanner Reviewed-by: Arnd Bergmann --- lib/pci_iomap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c index ce39ce9f3526..2829ddb0e316 100644 --- a/lib/pci_iomap.c +++ b/lib/pci_iomap.c @@ -170,8 +170,8 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *p) if (addr >= start && addr < start + IO_SPACE_LIMIT) return; - iounmap(p); #endif + iounmap(p); } EXPORT_SYMBOL(pci_iounmap);