Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1916971rdb; Wed, 31 Jan 2024 13:09:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnUuZKrtdjJI9Lb5tjMnl6OXC9PDtOXPGgvZvq1joPybXwiK4iRvb8EWe+Yp23yWhCRn/x X-Received: by 2002:a05:6a20:52a8:b0:19c:b3db:7aed with SMTP id o40-20020a056a2052a800b0019cb3db7aedmr5464019pzg.46.1706735396948; Wed, 31 Jan 2024 13:09:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706735396; cv=pass; d=google.com; s=arc-20160816; b=0Y1FM0pqstwnJZqkK4mk/3+F7cZ290Emu5XiEobXqfw9sufhp1gmNfP2NqKyKPxiZw kHnMWZF7VQLCKYUOdguqSU4UO6kpYvCQXjtdBnkmWSt71UO/pNG9y3aQGM8tGlzISfn2 Y3cjcVgMfG5CVdl2ecrA1upth/HQecUqJS8YicpsBzamBBnueuccojyJDTaDYlc3jGKE 7RCDUfLId7qD6rBOYiyTMe04UtYYf3Grb65xcoxZa4vZnfAphP62yYhXN7j6MsuayWYz icM6c5mQT4opv8VshXc4sMP+dy1tS/LP+Um/BWtup8fvKE/PXvnc9DdsYz92a6gmq/eF k/KA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=xPeipBuhzPeEr6iPJm07N/Fu+6kuwMHx3UH+yXMizII=; fh=a89AIP2yADK00iAj9C//shske9p++wkA/JyEsBG6BOA=; b=IvSye9Y36gn62mUI0byJqbXLkRz/qJKPpX7IzRdbSk6VFc+gwTZX+T9ehFM6Ye9SIo PYnO8EOemvCxasFx02WWcx/iTUk5K9dUemoFbtX9JuBkx10P947tpMYl1t9YQbWhxuIM at1MUo4O7OWXDCvJyj+CyfQMdupPn9Nni+Y2PkCBJYBnzA6PnTrHzIj+4wJl+3dxEq+3 d0h+J6gn9yLfTTTut26RnDm/JLI7kDPCVX+y2UvhjMIXqRl3PUftu+gKd8o8yZ9zXm5U YsIsTOQSVsRt4e4joU71/+7v6T1bhryFndP439YySzzN7Q94cnd/hcmVx27xsT1KKCdT PV5g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k+UBbeYy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47111-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVKXMi06uzJGmmhozHJovBEPWprLCKisohp9NiBB93aQuX+2MUnMH77d60aT0mOYeeG2ycNCU3vqNWCEZtjd82PZFNR/9NgR5bnSS9oLQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r135-20020a632b8d000000b005d8fdbbd5c4si4132495pgr.19.2024.01.31.13.09.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:09:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47111-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=@kernel.org header.s=k20201202 header.b=k+UBbeYy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47111-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47111-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 97D9B28B30A for ; Wed, 31 Jan 2024 21:09:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DC7638DDB; Wed, 31 Jan 2024 21:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k+UBbeYy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7682638DE4; Wed, 31 Jan 2024 21:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735386; cv=none; b=t6XNK0XOWZGII+lUZgt7kQUpNxr/Vi+zB4dwcKociyiGzbT2BFCPh1HdoJtoz4eZKEOeHDwNmoRwCz1Jw5XI6ADX4+9p70wDoywnQ03rAMCFs2FBma5BVeyff1Kn2QUcydPgbdzx3vLgOGoJGSotGwaDGRVMc7PwErqoI3lWQbI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735386; c=relaxed/simple; bh=7bVKxwIoaeqCS0+5AkL8/ahDS4KgCUDPD8Zj2gZaMa4=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=FRBJHJi2IJlWT/pYH6zsXe4ApkqtgGPYu+N4noHLf+fua5NHpJv8SSNx28bkKm1XeophnJPNiQhOexaaSl0cqyg9WMgu3myUUpjiLsNzl2SU/gtFHW1o7AGPuACMKum3+bMzg7RDSDy2FGVvtOnUyvBskhsoLjGNnvoaOoMJUP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k+UBbeYy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C33A8C433F1; Wed, 31 Jan 2024 21:09:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706735386; bh=7bVKxwIoaeqCS0+5AkL8/ahDS4KgCUDPD8Zj2gZaMa4=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=k+UBbeYyHR6ZTwLYivg54Ff5rluVBj9+W52TMTxMWv/37OJmHdLH8E0a3etwswaNe QBzJEApL416/pZKTTY5O7WK3aabKPkVIFJpfnHG4F+AtpIskS9lRo4MBFdzxAQFpVf qHGelaGAq/uEGGiR7kP7S6In6IichuUBevuOA86fu3ZarPyYhV5nHRKRsDs9LT1j80 Peg0cBwOnDz7/fR+rSx4qCb1A9neoAFbbaQ6e5Ou2ZfojnMsWB5th1OoxPlbiDM1E4 M15ObeoyW0z7wnwWo0ppwen/sgbGdvUQ8HzCQezH83al+Fbn+D8VNUw7eof4vlM4Az IxoHjjAJYunqQ== Date: Wed, 31 Jan 2024 15:09:44 -0600 From: Bjorn Helgaas To: Philipp Stanner Cc: Bjorn Helgaas , Arnd Bergmann , Johannes Berg , Randy Dunlap , NeilBrown , John Sanpe , Kent Overstreet , Niklas Schnelle , 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, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, stable@vger.kernel.org, Arnd Bergmann Subject: Re: [PATCH v6 1/4] lib/pci_iomap.c: fix cleanup bug in pci_iounmap() Message-ID: <20240131210944.GA599710@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240131090023.12331-2-pstanner@redhat.com> On Wed, Jan 31, 2024 at 10:00:20AM +0100, Philipp Stanner wrote: > 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. I tweaked the subject and commit log to be more explicit about what the bug is. Let me know if I got it wrong: pci_iounmap(): Fix MMIO mapping leak The #ifdef ARCH_HAS_GENERIC_IOPORT_MAP accidentally also guards iounmap(), which means MMIO mappings are leaked. Move the guard so we call iounmap() for MMIO mappings. Bjorn