Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4621076ybf; Wed, 4 Mar 2020 07:28:54 -0800 (PST) X-Google-Smtp-Source: ADFU+vtAfFIBn24k04cxSEr/u2PSmVm+JTvz/VMnS3IO4FjSS0TSTHWTDfYz8EQwQHq4IQ2DdEiM X-Received: by 2002:aca:c044:: with SMTP id q65mr2095595oif.68.1583335734669; Wed, 04 Mar 2020 07:28:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583335734; cv=none; d=google.com; s=arc-20160816; b=P+iJe/1+UbsJ1D3n2wbQoyEZeKQwG36YQ3btvUAfw4rDr06hbDxs0FshftbwF3HVTq NI8XX16/OlI4WT9ADnQwS/nlily+5WvO1od3Mk7e8oXKYAEwQT7JOy8MO1NjuyFE7TB0 o93PDklzPGO0LdFcW4WpqLL7skKht4L5hanGHYT76cdTOP2Mz7vs+qLGuSi45m2XqWib 2MxFmWTJOKwSBEn1Tjr/hYPFUCE15rJRwFXuJOWr1XQ99sIahnnbxMOpAoAqedFl4eij FnDyEAh5Aq6JZimNGs2ODnGrHVHoTi61FLTK1eG1ClVCaUPOqm5CxROKGLGopZ4KgSQP 87/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CQztMgZqdEvWMkJ5IC/uoChiv1GJG/nSL3MXJ3Kqo2Y=; b=ZJidHtanPQfVGFElnmZQCh9VkXrCvFqZgQDvU7QmQdD6uzZpJ7otpr9JO5X3YprSpF X0QPCAM5QOOQ2fFyG/HY0Bz7D0bRC/DP9oVZpXaUzio1aIHMb+A8stejngF32a7anxPQ aEuBt2BqeFt3OvpvPHGKTZzdyS8YtpXIhfImO+gHBjEaE03Te8uf6k1KgDHDOJYqb2LN zFBlBrei0c+DleSWzDULToKuy9/th3fLIwpOA88J5SG31J07aVCv20TE7a83C2HdZx8R DdfTW8k+INJIs2n4MeVhWOTUuVKLtL0MNA/vJXfYgBrGrUwAF9hC9cySKX46YlSw0iaU 9GYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e7si1515915oti.301.2020.03.04.07.28.42; Wed, 04 Mar 2020 07:28:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729647AbgCDP2Y (ORCPT + 99 others); Wed, 4 Mar 2020 10:28:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:33846 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727084AbgCDP2X (ORCPT ); Wed, 4 Mar 2020 10:28:23 -0500 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Eric Auger , Robin Murphy , Will Deacon , stable@vger.kernel.org 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200304111117.3540-1-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.