Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2709038rdb; Mon, 4 Dec 2023 05:36:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IH98+WYosnS35jCrl23K6BdF4mKNuDKXGyheVheGVgdlNTyT031UbyjMHvJAYN8yBCFakIW X-Received: by 2002:a17:902:da91:b0:1cf:cf0f:cc3a with SMTP id j17-20020a170902da9100b001cfcf0fcc3amr5011437plx.17.1701696992902; Mon, 04 Dec 2023 05:36:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701696992; cv=none; d=google.com; s=arc-20160816; b=r7kNudW1RRA28VmtI8bcKJIBYcdV1u+U3apMZB44VlXhSqU+UqXblA0Rfe0qQWCx7g drTEpvva4ikx8h5fnyCZIAzN+uQ3kBrANnrfJzGWrP3jFmf+fnHRne50y35Mv5JKof/n /Wir3DHnGkME220K9g3Cl5TaCDZY8K1JHjw3dGwZsuxeS+95DqfyCsPq6nayemyc8Gej oIe4d4iH9p4hbO6LTkoR8jzw53Fdhe3zlQaDY6+LaU9UMI70vuOSXAqDxlPmGMUgFSdg EF4qGnwgWAUfmbPvEJrKsG8JD0fRL8wnLrLDIA3PMor05WksbQtzCZWvhPBV3oNfc79a iRgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature:dkim-signature; bh=p7D+Xo7sPEhZfUDgxFaHhcvI5/bJ/iLJpT6NsvxsYAY=; fh=glSl0KQRcmU0CwmOJcxT3pP2RubBZqUMb4tj5MCTTAg=; b=ESgZB26cmZCHRFbhD9eQBzcmeWZYDIj8uDPnjAX4XrIr5A1iUFgQVh7nedSMu1hyrT w765aCIlwn5yHwprlK+RG4dUTyExLvh8x5LTF1sY4keJKb6upGZNNPHjf0wbZ3g9Wjs7 s0iUy99jGykywQkzr5e/q/lzZA2w/rmO/WBuDLclH1sfxCD57PSDoL6sYN7PjyLgr8UT JLU+7TJSyc08da5mRy1ThBXGougTGHShyCSDhkMHBII8YQxNqkovK0R4f47xAJgeJALw 1VGlWNlq7i4DiQe34fiD5szmv+J0Q/n9GAJqXtAsL7+MZmu5EfdtJMkMtp/EaYoNTB+b M52A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=IZGCjp5+; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UvYgSbRf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id iw3-20020a170903044300b001d0b42fa984si858257plb.159.2023.12.04.05.36.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 05:36:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm3 header.b=IZGCjp5+; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=UvYgSbRf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id F1C5780966CE; Mon, 4 Dec 2023 05:36:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233875AbjLDNgN (ORCPT + 99 others); Mon, 4 Dec 2023 08:36:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233683AbjLDNgL (ORCPT ); Mon, 4 Dec 2023 08:36:11 -0500 Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF92EDF; Mon, 4 Dec 2023 05:36:17 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 1EABB5809B6; Mon, 4 Dec 2023 08:36:17 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Mon, 04 Dec 2023 08:36:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1701696977; x=1701704177; bh=p7D+Xo7sPEhZfUDgxFaHhcvI5/bJ/iLJpT6 NsvxsYAY=; b=IZGCjp5+KhZHYP9OKsgoOTX1yVwwhMfz0Ru/FpC/dhIWHyccv21 xA0VVCYUSMQc5j97Gl/y2//YuV9ukG8cOnYnyyfOO/XyQ0EWdKuJ2/OikOCxLeUT CFf3WiSdjNC+QvBWRD+9JUw/xMDNVhG9CxceOnEpzPCCi7L6XxHT3DSsfFOLLGAS Z+SzyaITptKsIY+avthMJbnND3lS99R+CmmAIgvP2vfdZ1CzSyWaohyx3BERlL1q 54/vE725FufSZ6+ZLnLJcfnanLvaV224Zw2z5MpD5wKQAL5sbrjeY+BVGFXn/zTd OEoUpQzMIREsaNiGt2rlVJUeN1Dx+mwhNaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1701696977; x=1701704177; bh=p7D+Xo7sPEhZfUDgxFaHhcvI5/bJ/iLJpT6 NsvxsYAY=; b=UvYgSbRfNSyVnc26zENUs39xAWEyRCnlO9+zMXCzIYBQJ/hkiJ9 hjzl4n3E6oiF/tbMteud8wxzDaP/z7gapO233sMAROkhmlPSoNIDsQN69HAUFUXM r+d1IfDGbljeGLX0cvRrV0H3JnU1ji6dr8HkyDppTo82iqkJ0l7Q2N++36AIDvxN je8iG+9ehO8KDvrs6ZPwHaai8zeyR1yD9Gq0rR1NPqfb6Ex461GCdmhj/iTLurdw jE68mZqXTYnepCof2kGvMoDLJhirYglTiUc9LNqwKD2JlSlpialeF2FhmXaLx8HY oCCzcuIvlGYeS1PEmFkCfy05/U+dT4CUjSA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudejiedgheehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeegfeejhedvledvffeijeeijeeivddvhfeliedvleevheejleetgedukedt gfejveenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7849CB60089; Mon, 4 Dec 2023 08:36:15 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1178-geeaf0069a7-fm-20231114.001-geeaf0069 MIME-Version: 1.0 Message-Id: In-Reply-To: <20231204123834.29247-2-pstanner@redhat.com> References: <20231204123834.29247-1-pstanner@redhat.com> <20231204123834.29247-2-pstanner@redhat.com> Date: Mon, 04 Dec 2023 14:35:55 +0100 From: "Arnd Bergmann" To: "Philipp Stanner" , "Bjorn Helgaas" , "Hanjun Guo" , "Neil Brown" , "Kent Overstreet" , "Jakub Kicinski" , "Niklas Schnelle" , "Uladzislau Koshchanka" , "John Sanpe" , "Dave Jiang" , "Masami Hiramatsu" , "Kees Cook" , "David Gow" , "Herbert Xu" , "Shuah Khan" , "wuqiang.matt" , "Yury Norov" , "Jason Baron" , "Andrew Morton" , "Ben Dooks" , "Danilo Krummrich" Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Linux-Arch , stable@vger.kernel.org, "Arnd Bergmann" Subject: Re: [PATCH v3 1/5] lib/pci_iomap.c: fix cleanup bugs in pci_iounmap() Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 05:36:29 -0800 (PST) On Mon, Dec 4, 2023, at 13:38, Philipp Stanner wrote: > pci_iounmap() in lib/pci_iomap.c is supposed to check whether an addre= ss > is within ioport-range IF the config specifies that ioports exist. If > so, the port should be unmapped with ioport_unmap(). If not, it's a > generic MMIO address that has to be passed to iounmap(). > > The bugs are: > 1. ioport_unmap() is missing entirely, so this function will never > actually unmap a port. > 2. the #ifdef for the ioport-ranges accidentally also guards > iounmap(), potentially compiling an empty function. This would > cause the mapping to be leaked. > > Implement the missing call to ioport_unmap(). > > 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=20 > sense of it all") > Reported-by: Danilo Krummrich > Suggested-by: Arnd Bergmann > Signed-off-by: Philipp Stanner > --- > In case someone wants to look into that and provide patches for kernels > older than v5.15: > Note that this patch only applies to v5.15+ =E2=80=93 the leaks, howev= er, are > older. I went through the log briefly and it seems f5810e5c32923 alrea= dy > contains them in asm-generic/io.h. Reviewed-by: Arnd Bergmann