Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1535339rdb; Wed, 31 Jan 2024 01:17:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5n9ZQxFW7I0JSDKbatxNKb5beyXhEQ2rrfGZ4hYl5ii7kB6b2SDcdnnZ3NX+7LCjwI25H X-Received: by 2002:a25:6411:0:b0:dc6:ba5e:66d0 with SMTP id y17-20020a256411000000b00dc6ba5e66d0mr937176ybb.65.1706692647482; Wed, 31 Jan 2024 01:17:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706692647; cv=pass; d=google.com; s=arc-20160816; b=0g7sEN8XpNH77prqHBTEMCptyIYz8uJG3XCsdNyLuoPo9ibrSK9tHp/OLxQLs9l+Ao PHzg6R1ASbm7Edy4ufrMYGn3ucxZNnc2kirPEpIyAq1d4mmb/hnXod4ed5vy+GDN4XZG kSsIRI0Hmwk8jm/4Qwe4pAZ4dqmxTYyvcSI3X0yougpstAUurEtm/DI3Zq298kOb2vLo nx7s1v6F7Y1NRK08vmaOQpnGiL4DOGqJVN/2tTMv5oYR+92FAb/EsmWJDvAeyP5iFaRW wJrybya1ChuZWaHqu3JXYyV1fH2S29HDhzqHgrnJlPTxQlD+CZPlLa/VHuaX5OpKXyYS FR7Q== 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=VhYWoTM9X0w/Kq9HlUFMUAfHDWwPTTeyK5VzHazbnv4=; b=iC7Vn3DB4AI19pkm7At0wn4i56h7o2uSEJE5Q4K8H+XyWUVyh9VlKWy6X9W0VvOuAx oZbWStpVe6ODJ+tujPsOqoOvcYC1CGeufYVa/Q4d2NVPCssBbS/NxQ+KPiF2hzMx6nYk sTZnJelE501NiSlSGa3IgmNSjxHI7a1Dq9WGmjonFh1NymEfcMLfp+/xsbX0D8baXC8e XA0DCbUJYC2GYjoOCdsY46pRa7KTlPbk4zYhintr5udFygZnV2D+kDGcb6LbA46X0fzT GbCZXSIXtlaZM2KuVxi1aSl0nnxWT0Ki/cB66AAy06s2C6gr07mqypnSYpXJg3cr9NZ5 DinQ==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCWUkMRVdxMY/CvLGTMWK4q2R4UmY+eoT8uRaQkkKHBSQtq/4salXyA27/KrcIX/YeNnW6doBEKxkMXITnkWT80d3Vx4YtZiwdSK5IVReg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id w26-20020a63935a000000b0057760853706si9265740pgm.578.2024.01.31.01.17.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 01:17:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46092-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46092-linux.lists.archive=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 6BD4729126A for ; Wed, 31 Jan 2024 09:06:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E92F3762C9; Wed, 31 Jan 2024 09:00:52 +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 Content-Transfer-Encoding: 8bit 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); -- 2.43.0