From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAD80C4167D for ; Wed, 8 Nov 2023 14:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233672AbjKHOSj (ORCPT ); Wed, 8 Nov 2023 09:18:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232286AbjKHOSf (ORCPT ); Wed, 8 Nov 2023 09:18:35 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FCB8171B; Wed, 8 Nov 2023 06:18:33 -0800 (PST) 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> 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.