Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp413613ybj; Thu, 19 Sep 2019 16:44:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYZTqRacBsNm2SuX8HsWLVliZ0H6GUAdRSA758degacAL5wWoEzzxb7SOIR0K0l7VvzugD X-Received: by 2002:a17:906:5584:: with SMTP id y4mr16579203ejp.89.1568936655376; Thu, 19 Sep 2019 16:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568936655; cv=none; d=google.com; s=arc-20160816; b=v3MVod5YjhIMsdS5PoyZxmxEQx4cb96eCXD1BFEZt9XcWA0jytiHQYoa0E8b8GXQ0r Y5JxQj38HwRgvi3MR3rSGNhP28TFRFLPdOVCFYTB1f74p9gisjFRNhKDRLQW4pDobUs/ IQo4FfU15h9O0zHwcDxkZVY/FOBJTy+pfz+7jXPgzS/3+MN74VGafcUBUGW88ARGesRo Txx0Rl50L7KHkeRAjYFOuV+W/w7Rdn7DKOyHcptJdjBmKIb/PwuKeRjgqE3sfUr8iAi3 1l1Att4NzJ4GTd+3P6FJlVJM/vi05fIHOs48Cl3kvtm6gKCrfpEiOuvTQF5TCoDLLbVh 3QEA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=vGmI6tFuDgzKeGHud54a0M7j4sFKGhaPwoCIq94+DO4=; b=qg/HL/u8GSjcrZZgv+Sr408h4tANGm8msCHvo9q/KAQEoaLB2ONhRdmwrZ/gkN8/qh OY7oc2cRMIpMY1EUekXm6sOzKe+oGTcrX5peOAzrVZUsyg+VLA1yNNW/C6dSZqM6HLMB DBWBWqPYkUhqUi+FvDcRKKudLUPL9tORTu6w+qbaQ4JziZuStOevDKR/Qsi1RjwS8iLF bveOeSTaxRC0Dl+geGiNF9xEp1wCshBxSULxCyBj3pl/F3dsd5VRjfSebXIb2GDLmQ6G /XRpVOCHmUDwic36loYm+0TD1eRi2uBcgLnpPFMAHhbMbFXk9fJm05/75K3NDy8anD6w T1XQ== 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 f21si191849eda.216.2019.09.19.16.43.47; Thu, 19 Sep 2019 16:44:15 -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 S2391887AbfISRLs (ORCPT + 99 others); Thu, 19 Sep 2019 13:11:48 -0400 Received: from mail.netline.ch ([148.251.143.178]:43747 "EHLO netline-mail3.netline.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389131AbfISRLr (ORCPT ); Thu, 19 Sep 2019 13:11:47 -0400 Received: from localhost (localhost [127.0.0.1]) by netline-mail3.netline.ch (Postfix) with ESMTP id 3ADAB2AA0FB; Thu, 19 Sep 2019 19:11:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at netline-mail3.netline.ch Received: from netline-mail3.netline.ch ([127.0.0.1]) by localhost (netline-mail3.netline.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id x1F0UOtU4EPY; Thu, 19 Sep 2019 19:11:42 +0200 (CEST) Received: from thor (116.245.63.188.dynamic.wline.res.cust.swisscom.ch [188.63.245.116]) by netline-mail3.netline.ch (Postfix) with ESMTPSA id C1D592AA0C6; Thu, 19 Sep 2019 19:11:42 +0200 (CEST) Received: from localhost ([::1]) by thor with esmtp (Exim 4.92.2) (envelope-from ) id 1iAzy2-00041o-Fl; Thu, 19 Sep 2019 19:11:42 +0200 Subject: Re: [PATCH] drm/radeon: fix a potential NULL pointer dereference To: Allen Pais Cc: dri-devel@lists.freedesktop.org, airlied@linux.ie, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org References: <1568824282-4081-1-git-send-email-allen.pais@oracle.com> From: =?UTF-8?Q?Michel_D=c3=a4nzer?= Openpgp: preference=signencrypt Autocrypt: addr=michel@daenzer.net; prefer-encrypt=mutual; keydata= mQGiBDsehS8RBACbsIQEX31aYSIuEKxEnEX82ezMR8z3LG8ktv1KjyNErUX9Pt7AUC7W3W0b LUhu8Le8S2va6hi7GfSAifl0ih3k6Bv1Itzgnd+7ZmSrvCN8yGJaHNQfAevAuEboIb+MaVHo 9EMJj4ikOcRZCmQWw7evu/D9uQdtkCnRY9iJiAGxbwCguBHtpoGMxDOINCr5UU6qt+m4O+UD /355ohBBzzyh49lTj0kTFKr0Ozd20G2FbcqHgfFL1dc1MPyigej2gLga2osu2QY0ObvAGkOu WBi3LTY8Zs8uqFGDC4ZAwMPoFy3yzu3ne6T7d/68rJil0QcdQjzzHi6ekqHuhst4a+/+D23h Za8MJBEcdOhRhsaDVGAJSFEQB1qLBACOs0xN+XblejO35gsDSVVk8s+FUUw3TSWJBfZa3Imp V2U2tBO4qck+wqbHNfdnU/crrsHahjzBjvk8Up7VoY8oT+z03sal2vXEonS279xN2B92Tttr AgwosujguFO/7tvzymWC76rDEwue8TsADE11ErjwaBTs8ZXfnN/uAANgPLQjTWljaGVsIERh ZW56ZXIgPG1pY2hlbEBkYWVuemVyLm5ldD6IXgQTEQIAHgUCQFXxJgIbAwYLCQgHAwIDFQID AxYCAQIeAQIXgAAKCRBaga+OatuyAIrPAJ9ykonXI3oQcX83N2qzCEStLNW47gCeLWm/QiPY jqtGUnnSbyuTQfIySkK5AQ0EOx6FRRAEAJZkcvklPwJCgNiw37p0GShKmFGGqf/a3xZZEpjI qNxzshFRFneZze4f5LhzbX1/vIm5+ZXsEWympJfZzyCmYPw86QcFxyZflkAxHx9LeD+89Elx bw6wT0CcLvSv8ROfU1m8YhGbV6g2zWyLD0/naQGVb8e4FhVKGNY2EEbHgFBrAAMGA/0VktFO CxFBdzLQ17RCTwCJ3xpyP4qsLJH0yCoA26rH2zE2RzByhrTFTYZzbFEid3ddGiHOBEL+bO+2 GNtfiYKmbTkj1tMZJ8L6huKONaVrASFzLvZa2dlc2zja9ZSksKmge5BOTKWgbyepEc5qxSju YsYrX5xfLgTZC5abhhztpYhGBBgRAgAGBQI7HoVFAAoJEFqBr45q27IAlscAn2Ufk2d6/3p4 Cuyz/NX7KpL2dQ8WAJ9UD5JEakhfofed8PSqOM7jOO3LCA== Message-ID: <5603dddb-8ae3-e145-69af-c6ccea68ca1b@daenzer.net> Date: Thu, 19 Sep 2019 19:11:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <1568824282-4081-1-git-send-email-allen.pais@oracle.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-09-18 6:31 p.m., Allen Pais wrote: > 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/radeon/radeon_display.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c > index bd52f15..1a41764 100644 > --- a/drivers/gpu/drm/radeon/radeon_display.c > +++ b/drivers/gpu/drm/radeon/radeon_display.c > @@ -683,6 +683,10 @@ static void radeon_crtc_init(struct drm_device *dev, int index) > drm_mode_crtc_set_gamma_size(&radeon_crtc->base, 256); > radeon_crtc->crtc_id = index; > radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0); > + if (unlikely(!radeon_crtc->flip_queue)) { > + kfree(radeon_crtc); > + return; > + } > rdev->mode_info.crtcs[index] = radeon_crtc; > > if (rdev->family >= CHIP_BONAIRE) { > I'm afraid just silently leaving the CRTC uninitialized isn't a good way to handle this. The failure would need to be propagated, probably resulting in the driver aborting its initialization altogether. -- Earthling Michel Dänzer | https://redhat.com Libre software enthusiast | Mesa and X developer