Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752105AbbGIJby (ORCPT ); Thu, 9 Jul 2015 05:31:54 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:34525 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbbGIJbr (ORCPT ); Thu, 9 Jul 2015 05:31:47 -0400 MIME-Version: 1.0 In-Reply-To: <1436433113-36487-1-git-send-email-maninder1.s@samsung.com> References: <1436433113-36487-1-git-send-email-maninder1.s@samsung.com> From: Oded Gabbay Date: Thu, 9 Jul 2015 12:31:16 +0300 Message-ID: Subject: Re: [PATCH v2] drm/amdkfd: validate pdd where it acquired first To: Maninder Singh Cc: David Airlie , Maling list - DRI developers , "Linux-Kernel@Vger. Kernel. Org" , pankaj.m@samsung.com Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1809 Lines: 51 On Thu, Jul 9, 2015 at 12:11 PM, Maninder Singh wrote: > Currently pdd is validate after dereferencing it, which is > not correct, Thus validate pdd before its first use. > > Signed-off-by: Maninder Singh > --- > v1: remove validation of pdd after its usage > v2: do validation at first place rather than removing > > drivers/gpu/drm/amd/amdkfd/kfd_process.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > index 8a1f999..9be0070 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c > @@ -420,6 +420,12 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) > pqm_uninit(&p->pqm); > > pdd = kfd_get_process_device_data(dev, p); > + > + if (!pdd) { > + mutex_unlock(&p->mutex); > + return; > + } > + > if (pdd->reset_wavefronts) { > dbgdev_wave_reset_wavefronts(pdd->dev, p); > pdd->reset_wavefronts = false; > @@ -431,8 +437,7 @@ void kfd_unbind_process_from_device(struct kfd_dev *dev, unsigned int pasid) > * We don't call amd_iommu_unbind_pasid() here > * because the IOMMU called us. > */ > - if (pdd) > - pdd->bound = false; > + pdd->bound = false; > > mutex_unlock(&p->mutex); > } > -- > 1.7.9.5 > Thanks! Applied to my -fixes tree. Oded -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/