Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756183AbdC2NWQ (ORCPT ); Wed, 29 Mar 2017 09:22:16 -0400 Received: from pegasos-out.vodafone.de ([80.84.1.38]:59598 "EHLO pegasos-out.vodafone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755920AbdC2NWO (ORCPT ); Wed, 29 Mar 2017 09:22:14 -0400 X-Spam-Flag: NO X-Spam-Score: -0.045 Authentication-Results: rohrpostix1.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de E3905261C9C Subject: Re: [PATCH] Fix IB va_start+ib_bytes range check on 32Bit systems To: Jan Burgmeier , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20170329091839.5246-1-jan.burgmeier@unicon-software.com> <20170329091839.5246-2-jan.burgmeier@unicon-software.com> Cc: airlied@linux.ie From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: <6dc2814c-c32b-220a-daa7-da530d13f20d@vodafone.de> Date: Wed, 29 Mar 2017 15:22:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170329091839.5246-2-jan.burgmeier@unicon-software.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1405 Lines: 42 Am 29.03.2017 um 11:18 schrieb Jan Burgmeier: > Signed-off-by: Jan Burgmeier > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > index 99424cb8020b..583d22974e14 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c > @@ -908,6 +908,7 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, > struct amdgpu_bo *aobj = NULL; > uint64_t offset; > uint8_t *kptr; > + uint64_t it_last; > > m = amdgpu_cs_find_mapping(parser, chunk_ib->va_start, > &aobj); > @@ -916,8 +917,9 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, > return -EINVAL; > } > > + it_last = m->it.last; > if ((chunk_ib->va_start + chunk_ib->ib_bytes) > > - (m->it.last + 1) * AMDGPU_GPU_PAGE_SIZE) { > + (it_last + 1) * AMDGPU_GPU_PAGE_SIZE) { Nice catch, but just adding a u64 case should do here as well. E.g: if ((chunk_ib->va_start + chunk_ib->ib_bytes) > (u64)(m->it.last + 1) * AMDGPU_GPU_PAGE_SIZE) { With that fixed the patch is Reviewed-by: Christian König . Regards, Christian. > DRM_ERROR("IB va_start+ib_bytes is invalid\n"); > return -EINVAL; > }