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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E07C3F2D1 for ; Wed, 4 Mar 2020 15:28:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AB32721739 for ; Wed, 4 Mar 2020 15:28:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WpngFBVP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB32721739 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YnR9YSg0TtKIlvacSx0ZpFCPW4zjDuv4AQbIIl0/c24=; b=WpngFBVPQ8pTGe EaN+Dz8zCsVEOS9/u8FBxDhKGXnpLPyt13RRyTyYFyFmw5wt92Oo4vRlwoke9vvjA/s/CsSCZhU7N JP5wJpus27VCRrkqRGIJv/3iP8pSGT6h7T2ooaUFEKjGrmQmZCADkxQKPumnJ9/HI8P2BuN3z4M/5 sQbWCw69IX4T6wjCC2sRsTZBucOaEeKdA4L24Eb4V22SYxVIq2mn2byETVXYz8Kt0Wkbkyu6ksUAk iZtmy7zyxDwrcGzCQo20XRuWhDYiUMt+LLw+0SNz6ULZJ82kzKYkqBk6VZITbLvKmP5mWiOQQBftU kp+6Neq/a0Un6dyhKmXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j9Vwi-0007XG-Hi; Wed, 04 Mar 2020 15:28:28 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j9Vwf-0007W5-6b for linux-arm-kernel@lists.infradead.org; Wed, 04 Mar 2020 15:28:26 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2FAA5ACC2; Wed, 4 Mar 2020 15:28:22 +0000 (UTC) Date: Wed, 4 Mar 2020 16:28:16 +0100 From: Joerg Roedel To: Marc Zyngier Subject: Re: [PATCH v2] iommu/dma: Fix MSI reservation allocation Message-ID: <20200304152816.GA3619@suse.de> References: <20200304111117.3540-1-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200304111117.3540-1-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200304_072825_446882_298A1B86 X-CRM114-Status: GOOD ( 14.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robin Murphy , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Eric Auger , Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Mar 04, 2020 at 11:11:17AM +0000, Marc Zyngier wrote: > The way cookie_init_hw_msi_region() allocates the iommu_dma_msi_page > structures doesn't match the way iommu_put_dma_cookie() frees them. > > The former performs a single allocation of all the required structures, > while the latter tries to free them one at a time. It doesn't quite > work for the main use case (the GICv3 ITS where the range is 64kB) > when the base granule size is 4kB. > > This leads to a nice slab corruption on teardown, which is easily > observable by simply creating a VF on a SRIOV-capable device, and > tearing it down immediately (no need to even make use of it). > Fortunately, this only affects systems where the ITS isn't translated > by the SMMU, which are both rare and non-standard. > > Fix it by allocating iommu_dma_msi_page structures one at a time. > > Fixes: 7c1b058c8b5a3 ("iommu/dma: Handle IOMMU API reserved regions") > Signed-off-by: Marc Zyngier > Reviewed-by: Eric Auger > Cc: Robin Murphy > Cc: Joerg Roedel > Cc: Will Deacon > Cc: stable@vger.kernel.org Applied for v5.6, thanks. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel