Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2516955imm; Mon, 24 Sep 2018 05:48:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbxFAgHokIxCcoxJ3w8Hy+NQ9XRYp/RxBKWIbU4rLy7beZqvvMxVj91odu8QOWQcZvhYLFR X-Received: by 2002:a62:868b:: with SMTP id x133-v6mr10354150pfd.252.1537793287090; Mon, 24 Sep 2018 05:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793287; cv=none; d=google.com; s=arc-20160816; b=kVT292S2hcDjU0hDcrs4zFznWGGBqIibWCFJQ39JVs1+nNHmXk0NEQoH6MpAA16U8x thBGZaVmxlIGxAfxh2st/C4glWkAs5JfMCwfLfR71PUH/K97SilQ2i719zqB0Qz4tp5H kDhSlR7aQuHwHotZ6T3DShIIqd1/d08GDOogjTXWxYRB3VRFOR1l3rLLIJmGbPtvdR8p sj63z0W0eJSTNx4r4+E/JMF0f+x36MLCGpt2kzsexDsfpYWzsXKMW64JHCbBvREkJbPW fEejqDqjjS1KBknEhDeOBajYH8AJlwAvsbHJ5zornwDo4G58S1TLIjtlshMBTbBMQ6Qt 8uPg== 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; bh=XW4CmBWm8thsYw1sx70Gi2aHHqFlRTZyFcG79fXRPAM=; b=HLKJbeDNr6tFJlFhgpu8hhV9oIyLgMMHrV83La57PB1NoBAz1vFfrWA/mpT1hV6XbJ vPQi/9fAChISK4XvRnvfDOIWFaCJF8louEY9oRpysfxKG+oho8M4VUeu8pjXt+jI1Udq FA998qOy8rc4qNJ4zs8JFtdurGJq+wTyStUeV9eVa/xZE8+a7BH9mPH4pcN02yJuJvUZ K/YfhR1Zug857WVPRJaNn1Q/7cF/QK7EjjOo/R5eoAceNLflWybaxLsdMjmATgWcj6/0 xrQfIUcTpd8Yrukgg/U3MiA+8qCUNYnNUfflcuITAhGAP5rZ2Rtdqe1IFYySKdVaLgF8 PRfw== ARC-Authentication-Results: i=1; mx.google.com; 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 m23-v6si7487282pgk.424.2018.09.24.05.47.51; Mon, 24 Sep 2018 05:48:07 -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; 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 S2389429AbeIXSro (ORCPT + 99 others); Mon, 24 Sep 2018 14:47:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59824 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388898AbeIXSrn (ORCPT ); Mon, 24 Sep 2018 14:47:43 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9FA14109A; Mon, 24 Sep 2018 12:45:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Lu , Felix Kuehling , =?UTF-8?q?Christian=20K=C3=B6nig?= , Oded Gabbay , Sasha Levin Subject: [PATCH 4.18 209/235] drm/amdkfd: Fix error codes in kfd_get_process Date: Mon, 24 Sep 2018 13:53:15 +0200 Message-Id: <20180924113124.753977236@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wei Lu [ Upstream commit e47cb828eb3fca3e8999a0b9aa053dda18552071 ] Return ERR_PTR(-EINVAL) if kfd_get_process fails to find the process. This fixes kernel oopses when a child process calls KFD ioctls with a file descriptor inherited from the parent process. Signed-off-by: Wei Lu Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Acked-by: Christian König Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -244,6 +244,8 @@ struct kfd_process *kfd_get_process(cons return ERR_PTR(-EINVAL); process = find_process(thread); + if (!process) + return ERR_PTR(-EINVAL); return process; }