From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69DBC1A23A7 for ; Fri, 17 Jan 2025 17:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737134528; cv=none; b=orILwgKjtfRrc7djoryWqtRaC0bhmkYG7yFOvomDeKYBdWXR8QjPjJAP8DnAXpEqb1mSVmzn3VDP6DCPSxFAuLhwvV2ZgxWIhd/FpT/3rHadHggGtfjH+bnWaJp/S0ZDuxXsoturQVdQTCZG8noMpSUdd6n6RJwRzTzA0QORDWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737134528; c=relaxed/simple; bh=ch50kTqbrDd4nioi7l4WdUI2b/cPEQrG5hSaj1AwiKk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P7ritvzYzrowGwzdUW5Q7842h6VkfqD2cFTK/UgYsyoMfGijN5Uk63g2vp3isGDFx4HdRA0U2qabiLZ0NA7QgOkfvsRLJaUuzKnMg3qUIzjhjE4Byz0AWoaDrD6J3yT+SnhnI3co+PTAr17VdL8/Oot2yZn3eCY7pW9Broia9uo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=Q4YLbo4k; arc=none smtp.client-ip=209.85.160.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="Q4YLbo4k" Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-4678664e22fso22177861cf.2 for ; Fri, 17 Jan 2025 09:22:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1737134525; x=1737739325; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=mWqWCCvq4dit7q8wATuPZSt1vsy56MaPXRmal5Pwnng=; b=Q4YLbo4kZz1nLM/t//X9aLNIqvprwROt6pq5gIQr7IpUUi9LnfPyjf6k+3Xm/QLgiW Hstda+UveOiAEvLvfBfdvkAbEI995nIkuh61QaCuKRoQKcgqWduL7FN8gcERb19Tm77G 1ZXnGekGVeN1on/c3Pc6CQnCT72o7Z8huTXrBVIqsflgIH8xv25HM52NQGE8EmPEsb5z BqIa9JOvIU1LgjvcccfziarlLXiqDy18lCcIuBaNzBHCxbPSGhC7DDXJLC9SnLzdloRH wzBtqpA0004hQg98pNWHcBSe2UA35i2NkJibwDs21kEjcIYpHEIoyTPq46eDnnCyqKCh MV1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737134525; x=1737739325; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=mWqWCCvq4dit7q8wATuPZSt1vsy56MaPXRmal5Pwnng=; b=TvmuAjM4BVhVpusDVJ/gpm4QVDuvSsTYVg9EzpqujpGsfgzJO17N1fbwnlr4NV+ceJ oS+DQX3KpDvE0qt8MMtCJoQCBFanQi2aSpUfexkcNxPStcKG0w2Cht4MVABy0GW99Obs L88jAggBJXlaarEoXYNHrb8RCGF8mU++x5S/9RhgAnZLRYrPCY62Pmlv13xfSxsmWLdr //TM7E9Hv+/jY41nqzZBue6DhSrVUvs3MZ1n2dZe3UhLDCmBCxcackzhFLOTMWmQXc0e UrXQLrvYOZzOCAAfx/8UVChw8S1g5NdfdWCWFxn5qazyFI/4tfVQAwvWFeHhTqxr/02N d6eQ== X-Forwarded-Encrypted: i=1; AJvYcCXRXW6Xz23QOKlQtPeWo/E6laugfY9qGsD/jk8rDbWSLNq82YBuZ0jpZ7SATqDYBUrArRkDgQ2H/YeGla4=@vger.kernel.org X-Gm-Message-State: AOJu0YymhsU5vq43qiiIAC5DdGO7tFa9KQRaMJeq1fmpJDqDQBDjIS/V YfJCyqXvCWjBFApHDu/p9hGz5mjY4DHuZUIdRO6IvunAcD1dET4JZeLXIa0FaQ4= X-Gm-Gg: ASbGncsJX8KkfpLbmRxqB3AyW0CgOgWPZ/HsGBZ+R1fDnIQhveP8M5xEmJ7I2v0sSMQ z4nb7319993XpNmlCvCVWTFBnelSJqoJssXZYKrrS8rPychzyABtLTyyPRLQUatoA64YqrhvkeB wZz0Wzv4tPFfpyIrsBBKQQqlmUKIjeKrYx8av/6KjPN4u8Kbe0PSrrskjlGNbV7hK/IgjzgwSxM MhcNHdd56ArsPQahYcfcFQwv/wah/sKiNrMeRLCYWnWdNq8jC4cR/Pj8hFbmsjepEICf+tkUQAH //nrkjMWj2KqpCJI4oAsSmlGXvbQ1A== X-Google-Smtp-Source: AGHT+IEnvvopAuzyNCplmhKG8x3URwahSJDU3h5PkIakjZhO1icASJvI6Z9lh5kjv0X8/rjJ2Q/m1A== X-Received: by 2002:ac8:7c47:0:b0:467:45b7:c495 with SMTP id d75a77b69052e-46e12a56246mr46152611cf.15.1737134525304; Fri, 17 Jan 2025 09:22:05 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-128-5.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.128.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46e10436f3asm13244941cf.80.2025.01.17.09.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2025 09:22:04 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1tYq2m-000000036J2-15UA; Fri, 17 Jan 2025 13:22:04 -0400 Date: Fri, 17 Jan 2025 13:22:04 -0400 From: Jason Gunthorpe To: Lu Baolu Cc: Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/1] iommu: Fix potential memory leak in iopf_queue_remove_device() Message-ID: <20250117172204.GH674319@ziepe.ca> References: <20250117055800.782462-1-baolu.lu@linux.intel.com> 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: <20250117055800.782462-1-baolu.lu@linux.intel.com> On Fri, Jan 17, 2025 at 01:58:00PM +0800, Lu Baolu wrote: > The iopf_queue_remove_device() helper removes a device from the per-iommu > iopf queue when PRI is disabled on the device. It responds to all > outstanding iopf's with an IOMMU_PAGE_RESP_INVALID code and detaches the > device from the queue. > > However, it fails to release the group structure that represents a group > of iopf's awaiting for a response after responding to the hardware. This > can cause a memory leak if iopf_queue_remove_device() is called with > pending iopf's. > > Fix it by calling iopf_free_group() after the iopf group is responded. > > Fixes: 199112327135 ("iommu: Track iopf group instead of last fault") > Cc: stable@vger.kernel.org > Suggested-by: Kevin Tian > Signed-off-by: Lu Baolu > --- > drivers/iommu/io-pgfault.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Jason Gunthorpe Jason