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.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 E7F7AC433E0 for ; Wed, 24 Jun 2020 11:55:18 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 9F97820857 for ; Wed, 24 Jun 2020 11:55:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F97820857 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=8bytes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 719AA883DD; Wed, 24 Jun 2020 11:55:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i0ZsAb-vhzvW; Wed, 24 Jun 2020 11:55:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id CC6ED86382; Wed, 24 Jun 2020 11:55:17 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B857AC088E; Wed, 24 Jun 2020 11:55:17 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id A0749C016F for ; Wed, 24 Jun 2020 11:55:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 8A2D186382 for ; Wed, 24 Jun 2020 11:55:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xc6iHoiZ+JAx for ; Wed, 24 Jun 2020 11:55:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from theia.8bytes.org (8bytes.org [81.169.241.247]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5CF18882AE for ; Wed, 24 Jun 2020 11:55:14 +0000 (UTC) Received: by theia.8bytes.org (Postfix, from userid 1000) id E135B2AF; Wed, 24 Jun 2020 13:55:10 +0200 (CEST) Date: Wed, 24 Jun 2020 13:55:05 +0200 From: Joerg Roedel To: Suravee Suthikulpanit Subject: Re: [PATCH v2] iommu: amd: Fix IO_PAGE_FAULT due to __unmap_single() size overflow Message-ID: <20200624115505.GN3701@8bytes.org> References: <20200624084121.6588-1-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200624084121.6588-1-suravee.suthikulpanit@amd.com> User-Agent: Mutt/1.10.1 (2018-07-13) Cc: gregkh@linuxfoundation.org, iommu@lists.linux-foundation.org, stable@vger.kernel.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Wed, Jun 24, 2020 at 08:41:21AM +0000, Suravee Suthikulpanit wrote: > Currently, an integer is used to specify the size in unmap_sg(). > With 2GB worth of pages (512k 4k pages), it requires 31 bits > (i.e. (1 << 19) << 12), which overflows the integer, and ends up > unmapping more pages than intended. Subsequently, this results in > IO_PAGE_FAULT. > > Uses size_t instead of int to pass parameter to __unmap_single(). > > Please note that this patch is only for the stable-kernels tree > because the commit be62dbf554c5 ("iommu/amd: Convert AMD iommu driver > to the dma-iommu api"), which removes the function unmap_sg() > was introduced in v5.5. This patch is not applicable in subsequent > kernel versions. > > Cc: stable@vger.kernel.org > Cc: iommu@lists.linux-foundation.org > Reported-by: Robert Lippert > Signed-off-by: Suravee Suthikulpanit Acked-by: Joerg Roedel _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu