Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13472974ybl; Sun, 29 Dec 2019 12:44:56 -0800 (PST) X-Google-Smtp-Source: APXvYqwPzrnjtekTmYLEgwazs8lWWRuIfwjBu2t6W/MnmG2S9+BHmlgwqlbD+vkeI6ygiuN/trn8 X-Received: by 2002:a9d:7ad9:: with SMTP id m25mr66490168otn.13.1577652296351; Sun, 29 Dec 2019 12:44:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652296; cv=none; d=google.com; s=arc-20160816; b=Wh1xc/2K8+lJdHJ4LrU6wm64JAVsYXP06TZTxir5LqIWdQnRSieszn7TM7tSNZ0JUL eWzC44pJTia8z/rT3eWxUc76lI/+8roHvnTOQIW6cPQKVAV4GnM/jKmdsr7ZPTozSEDO UYdN28lnvDRXwBUBaqpVueFmr9rCgRi+5Abrwh97pa30zUsQ9oFpdru7DuNnsGSBL8mk gG7mjMa/35PD099u7fd6ZnGDNV3GB3w/lTYnlOVydNRy+b61bFSIn0s+/tRdjAY1FxE4 GfkZvqY0CTyq7zy9i819F4ll9r79amUI3ga36qM5kvJRHwu4q6CyfeJt4Fv9Qyivogdo Yfzg== 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=pQax2m6BMeSB/10W9J6EhbA/nIKTmblXADx6lXngCPs=; b=fOy9DKwYGRRv3kI4CZrDBLYJ4uhtY03e6licsWsXvbpK/iYW6/Ffkoyyb2GmYE/X1E dYmqb7qHUucShPPjOQViu0E1Q/Kaxq3wcktWltv0jvE5rNJyAUN5sbZW3XWReGkeKUN0 a4vVQCmaZsNK35eN6jMrZTk68OdjW/dqIGnb5jxm/M89Sivg4gDCRCCFO4ZEK+GaheNJ hdkrsMEvV4STMqgz0fPUa+uJx+ohDbIZaK7uXrUJ20dyj8pvUhBtSvyrHdpzFNaeOBIN 9fCbbUU6BrBKGi4Arn/pWAInHG+tYmmBIMzxGnv9VQPt4gbF+sqKMPEJOhhIJsABXtXP +61g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VkdAJ4kI; 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 d3si4545628oia.236.2019.12.29.12.44.45; Sun, 29 Dec 2019 12:44:56 -0800 (PST) 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=VkdAJ4kI; 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 S1730846AbfL2RpK (ORCPT + 99 others); Sun, 29 Dec 2019 12:45:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:53900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730816AbfL2RpH (ORCPT ); Sun, 29 Dec 2019 12:45:07 -0500 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 3B4A1206DB; Sun, 29 Dec 2019 17:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641506; bh=7Q4nsvkaGlRoybFthltF/3PxgZHKzpaUX9ZtKI5A5Cs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkdAJ4kITvZexWrpzD35qx5NQCXsLRFCeMXdn5IIYmNw3jT6D7Nyy/YhA2bOACt3c DyMN1M1AZXBSZCUqBMmyERK6ghJPwDY722oZvWzzKIODrAtiNWGP1rP9f/hitlDBwA krvkU9cfheBR8tHFzyyYFdrdyFbtxdQidfvKQkHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Allen Pais , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 093/434] drm/amdkfd: fix a potential NULL pointer dereference (v2) Date: Sun, 29 Dec 2019 18:22:26 +0100 Message-Id: <20191229172707.739171787@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@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: Allen Pais [ Upstream commit 81de29d842ccb776c0f77aa3e2b11b07fff0c0e2 ] alloc_workqueue is not checked for errors and as a result, a potential NULL dereference could occur. v2 (Felix Kuehling): * Fix compile error (kfifo_free instead of fifo_free) * Return proper error code Signed-off-by: Allen Pais Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- 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 c56ac47cd318..bc47f6a44456 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)) { + kfifo_free(&kfd->ih_fifo); + dev_err(kfd_chardev(), "Failed to allocate KFD IH workqueue\n"); + return -ENOMEM; + } spin_lock_init(&kfd->interrupt_lock); INIT_WORK(&kfd->interrupt_work, interrupt_wq); -- 2.20.1