Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3286345ybb; Tue, 31 Mar 2020 02:07:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs3bY/QEdDowrxIyXMMubhOHnUTys4mNu2dxEqcLeZkrCU/3IxpO4PXnvL/dF2L7MXPsJt0 X-Received: by 2002:a05:6830:1ae9:: with SMTP id c9mr11625942otd.298.1585645643906; Tue, 31 Mar 2020 02:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645643; cv=none; d=google.com; s=arc-20160816; b=kiEw4IAElp1FxMAjZuu6uERRpm0JeE5ikc0RgQL3z0j/5SzAgiOCQjyG20pLdCdtUV c1fu3jgHgD/BeGKfmpiQBsKi8zXZM/0WZGffCIyp/lSzC+0cUmaesmQeGWmhri5hZeeY pt+w56Bytr52Iw4pceiPtAOE7wuMRmkWv3ELLsfkOzXBM564aAXdW01+fwXsslkRskrR va+BK3tGaS4mGdwr2mgyxCvlyCPfhht9/5hsVe1NV2zy4Amtrb/Dm7Tp9nnkkQPVV1hi zRpHA9XBl89kSbrgIitXcP5avEZQJ8C2rd+LZ5cBcB2j/GFMq1EGycP3OYAGpD4sMIsu ml/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3cSV44ScmtUd2f08/rFics0rW16jrkBKRmqTIifk96s=; b=SXf3f31yaXWYcZfZveO9EbWvxd3JZCICoW4IjjGiXjRdGTGkljfNKsp4O0Rw1lXuhw NakSl9J6LDu43RIUUbp4RaWlOhTU1XpGxFl2yPMOnCwfD9Yyyas+7ugy1Ky8Q2YAyKiL /FOZcRQnOUnpbz+QXrcRJIssJDb6/waJ7IfQ19nvw6DLDJcoRTK/Z6xGDj7FxC2CK+N6 FXzQGhrfsEHcyF5Yyouqicn/SjaoApyyNyOxGLm5E+FGVJxeF9itNk9D1XWaQ7LjhDTS 3Wowh/uk2Eu0CT1pvNYXosv4roLM+wWoA+rdWhXtL6WjlGDYLhMuynGGS5zzFEDcKJyy Uq3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zd17KOK+; 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 q25si7633589otn.323.2020.03.31.02.07.11; Tue, 31 Mar 2020 02:07:23 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=Zd17KOK+; 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 S1731014AbgCaJG6 (ORCPT + 99 others); Tue, 31 Mar 2020 05:06:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:48374 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730763AbgCaJGu (ORCPT ); Tue, 31 Mar 2020 05:06:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0655B20675; Tue, 31 Mar 2020 09:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645609; bh=OAysM2RXWC2WsCwakJq2FQM7u+XDvtE4gRUhwGYw+yU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zd17KOK+B569+OgM59Ir+7HO8lyXMy6ZUCXx7tZ+knpxy6nYd7BXiProEePfUffmd wwyAmxhl6+63qDk6TnTaNSHwBYHv9zG7kjVMBxFeyHzSRa5jnaUDZ1aYRLr1iK/LmL 85cDL/F5R31Y3owiAulbpQd5SdYzOCQ4e0GUnXyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shane Francis , "Michael J. Ruhl" , Alex Deucher Subject: [PATCH 5.5 105/170] drm/radeon: fix scatter-gather mapping with user pages Date: Tue, 31 Mar 2020 10:58:39 +0200 Message-Id: <20200331085435.340112787@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shane Francis commit 47f7826c520ecd92ffbffe59ecaa2fe61e42ec70 upstream. Calls to dma_map_sg may return less segments / entries than requested if they fall on page bounderies. The old implementation did not support this use case. Fixes: be62dbf554c5 ("iommu/amd: Convert AMD iommu driver to the dma-iommu api") Bug: https://bugzilla.kernel.org/show_bug.cgi?id=206461 Bug: https://bugzilla.kernel.org/show_bug.cgi?id=206895 Bug: https://gitlab.freedesktop.org/drm/amd/issues/1056 Signed-off-by: Shane Francis Reviewed-by: Michael J. Ruhl Signed-off-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/msgid/20200325090741.21957-4-bigbeeshane@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -528,7 +528,7 @@ static int radeon_ttm_tt_pin_userptr(str r = -ENOMEM; nents = dma_map_sg(rdev->dev, ttm->sg->sgl, ttm->sg->nents, direction); - if (nents != ttm->sg->nents) + if (nents == 0) goto release_sg; drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,