Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6887365ybe; Wed, 18 Sep 2019 10:38:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIKIVUpKSlUwY/NxZPlugkCFilOKh+vFSbx0IPaU3lbzCdmx+cFVZBeNDEx1ZsyBvUkANZ X-Received: by 2002:a50:dac2:: with SMTP id s2mr11678450edj.26.1568828324715; Wed, 18 Sep 2019 10:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568828324; cv=none; d=google.com; s=arc-20160816; b=rOQTbat4lipmkVMbDBLb+VNYcpo1z51oGhArqJEn89bbl5LswVmstZjqytvuKfHRpD 9JVXyRMLMQ0opxmE2fP8hYMkykYRNDXSyiBU+SB1eb/BN6+jtOE8fy7gQU4mLf8oKSPt 9YBZDkZvatZf9c3HXAfi85VGgh+f/6bDiROZjqgtxnQs3EVnANDPTCfBDdG7wBUdFWBV 0EEmZknX4/V7DSph2dyAtalft+YcZ7aOzJk+PNMgFL184+Vw47HnQukUBKHIa1QCQgoF NwAh5Hsbs42vO6Bpg3tcFlymub9nJD12qdQS6KowIAyrJLIjIrm5AwRFSvcDjfRY/i2z G2EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=TgunZWBu9b1BmO6HitEFm1hFDnIkgPngmteT+Ahcq04=; b=kyZ5Zr1JbuASrcBsZ9NJ76DbdF/Qd3UjDZIGGckq5h3i7Abl5X8Yv5pvTx/YNeKcyP 8bE5c9o9GeqsOrF+ufQNHXzfZBN1RltqlajKXYAj3M/uep6Gfawberij94YZyx9X9lAr Q4434vBKsnl5KERUdEvK0j8BfwDEzUCxvxuidcXAjpXPrdIGIPPvK+Z0OopNSrCtIle4 uHRjCQ41D0WxYlY6PmUAa6y29We38o3dxGYQzLdle2JyYbBSiMyzXYfqWEXVwD/0rEtq zTCAOP4wE4VWgwAopG2IBac088eSX14QPg7kfDNpePlT7RJbCntV+lyVpCPXofY2ZAFi hnGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=dUmAIMPg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l15si1157600eja.290.2019.09.18.10.38.20; Wed, 18 Sep 2019 10:38:44 -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=@oracle.com header.s=corp-2019-08-05 header.b=dUmAIMPg; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727534AbfIRQbB (ORCPT + 99 others); Wed, 18 Sep 2019 12:31:01 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:52874 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbfIRQbB (ORCPT ); Wed, 18 Sep 2019 12:31:01 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IGNamU178592; Wed, 18 Sep 2019 16:30:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2019-08-05; bh=TgunZWBu9b1BmO6HitEFm1hFDnIkgPngmteT+Ahcq04=; b=dUmAIMPgBJ+Xkoa8RFOcS0medzQ6GpZKULtyguw8tJVvVctGRhH2GGT1oNNGCt8z88nq 9HTPPdKJWtYjazcdipL9h+0y1LvUJK4p2cObiccwCfeE4PPVgqVxdAuLC7LsSHPU4GmA 3+wMBjGiH0AK+tE8jy6PPbiz8j30xCgMq1ZcqoKTjYtPDwgLBxsDEaPaP9QLnIx4N12x yxUHoc0b2STtuXTL/P3MeRbtJ0bWAi56veY63rqhQW5U812WW70ODnI33guG5QzWbazK pgEZyCZDLfb9F4CeQqXElAv2FFUGC+wMV/L3YfJjK50gSYVjRNxhubv+/KhH4caRSwxj 0A== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2v385e53qu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2019 16:30:53 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x8IGMr64173715; Wed, 18 Sep 2019 16:30:52 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 2v37mmwng8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2019 16:30:52 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x8IGUkb2029057; Wed, 18 Sep 2019 16:30:47 GMT Received: from x250.idc.oracle.com (/10.191.241.104) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 18 Sep 2019 09:30:45 -0700 From: Allen Pais To: dri-devel@lists.freedesktop.org Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, daniel@ffwll.ch Subject: [PATCH] drm/amdkfd: fix a potential NULL pointer dereference Date: Wed, 18 Sep 2019 22:00:31 +0530 Message-Id: <1568824231-4007-1-git-send-email-allen.pais@oracle.com> X-Mailer: git-send-email 1.9.1 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=899 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909180156 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9384 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=983 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1909180156 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org alloc_workqueue is not checked for errors and as a result, a potential NULL dereference could occur. Signed-off-by: Allen Pais --- drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c index c56ac47..caa82a8 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c @@ -62,6 +62,11 @@ int kfd_interrupt_init(struct kfd_dev *kfd) } kfd->ih_wq = alloc_workqueue("KFD IH", WQ_HIGHPRI, 1); + if (unlikely(!kfd->ih_wq)) { + fifo_free(&kfd->ih_fifo); + dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n"); + return kfd->ih_wq; + } spin_lock_init(&kfd->interrupt_lock); INIT_WORK(&kfd->interrupt_work, interrupt_wq); -- 1.9.1