From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (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 E836B199B6 for ; Wed, 8 Nov 2023 14:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: by verein.lst.de (Postfix, from userid 2407) id F2F3C67373; Wed, 8 Nov 2023 15:18:28 +0100 (CET) Date: Wed, 8 Nov 2023 15:18:28 +0100 From: Christoph Hellwig To: Petr =?utf-8?B?VGVzYcWZw61r?= Cc: Petr Tesarik , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Petr Tesarik , Greg Kroah-Hartman , "open list:DMA MAPPING HELPERS" , open list , Wangkefeng , Roberto Sassu , Petr Tesarik , Niklas Schnelle , Halil Pasic , stable@vger.kernel.org Subject: Re: [PATCH 1/1] swiotlb: fix out-of-bounds TLB allocations with CONFIG_SWIOTLB_DYNAMIC Message-ID: <20231108141828.GA1574@lst.de> References: <20231108111249.261-1-petrtesarik@huaweicloud.com> <20231108132120.0538a778@meshulam.tesarici.cz> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231108132120.0538a778@meshulam.tesarici.cz> User-Agent: Mutt/1.5.17 (2007-11-01) On Wed, Nov 08, 2023 at 01:21:20PM +0100, Petr Tesařík wrote: > On Wed, 8 Nov 2023 12:12:49 +0100 > Petr Tesarik wrote: > > > From: Petr Tesarik > > > > Limit the free list length to the size of the IO TLB. Transient pool can be > > smaller than IO_TLB_SEGSIZE, but the free list is initialized with the > > assumption that the total number of slots is a multiple of IO_TLB_SEGSIZE. > > As a result, swiotlb_area_find_slots() may allocate slots past the end of > > a transient IO TLB buffer. > > Just to make it clear, this patch addresses only the memory corruption > reported by Niklas, without addressing the underlying issues. Where > corruption happened before, allocations will fail with this patch. Thanks, I've applied so that we can get it into -rc1.