Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6889459ybe; Wed, 18 Sep 2019 10:40:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzh8WvJZQjoRsyYhSenHAUrqVa1eTWIYTahhiYmul14XVKphMXrrS0+hOa7GBc4zgWdJ0h2 X-Received: by 2002:a17:906:5214:: with SMTP id g20mr10327021ejm.220.1568828453654; Wed, 18 Sep 2019 10:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568828453; cv=none; d=google.com; s=arc-20160816; b=Netp8YvHNBOrDYS6mVajxd98kOY4Ba1nQ2ZCmK6rgH36Qrt2EpUK37mLgxdgTqzJTH QGKuM9IkiTmmEb/LF7zKGwtbTAeztcLNW+XZISdFpV8CGe+LZJIeTkqb5e86al7BihUl ynTu/SS7nLSR7s0qNS5a9zch5jMeh+IBwbnNkmqraVVLhT2YmbbEd7uMr9dDPJXUED35 OlE6i3Qju6Q020r7seCrXaycEq5N/woICTtPhC5R3nuN/g0R5XV3rkyaKo7yswHXxqPf ppBZmqj03lxT1K2Ww+4lX595v8K6MDGudhojIif5xJMMYbbvGvuV1w27IA6zpblRJ/dc HRuA== 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=JOeXBgFpap6hbPYDZwnqzFOoJIRBSAjBdsCXmG6t548=; b=plabvAfOdNQO+4MdsPTTodmAAOSU0+7+xL4TMZQV4wHQat6fN00aiRoSHZAidrghCo TW4zq4C/mqG+B1tuKYgdGycCgdFOMHiibPRFvd/0E16PRvq/8tKCeAzTXWhe9oVtVowK 9h0MQghKYLzcdbE67okgGgy9/gYh/KVn6vRoi4l47cYp7Ygz/D2pFTuIVJG4zaq67irr 4/vVziA4tzAuvZcdNeY+wEnEC1vkZHYxUI/GNmXxWlZdiJESfA+XSFglyhR+Uc9Os+aA DUrka0KRZp3OMKrTjEmsIPg/dASvBlE1M/IomHFNTKy9pQXHqdJ/7nDEe1Z1WPp4cgZQ sKeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=czwpzDkk; 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 y1si1989788ejr.272.2019.09.18.10.40.30; Wed, 18 Sep 2019 10:40:53 -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=czwpzDkk; 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 S1730840AbfIRQbn (ORCPT + 99 others); Wed, 18 Sep 2019 12:31:43 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:53484 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728053AbfIRQbn (ORCPT ); Wed, 18 Sep 2019 12:31:43 -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 x8IGNYFC178508; Wed, 18 Sep 2019 16:31:40 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=JOeXBgFpap6hbPYDZwnqzFOoJIRBSAjBdsCXmG6t548=; b=czwpzDkkypI7XnCJTlhZfQIRHfQ1TIxg/tUVDvIvei/9QZR1yFMse4SzKendmNuGp/wU W9JgU58BsZriqRa2mMBubDk4gQCII8tuE89mLRRxH4Kh2DEh5AhPJuHsNTh/hItjMYiV TIaFAaQMATXRpXlZ8U8tVBBSkxCNANX13b2mqFn90/dvVwYaShftic7rDaXekeuUsUbX YDzndLBPRIX2CbL5iI8CaKRVr0yB1naWdFKmDU2K1OJsXpvcyJSbRvMGctjL5KejkiRA gyvn7q+UNejGztkVpqgOV2uBVNQxE5tOxxX0Zh5PxEMnONH//vSo2vynBOAXRCXXKcWm hA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2120.oracle.com with ESMTP id 2v385e53u9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2019 16:31:40 +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 x8IGMrLq173711; Wed, 18 Sep 2019 16:31:40 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 2v37mmwqag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 18 Sep 2019 16:31:39 +0000 Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x8IGVbII022554; Wed, 18 Sep 2019 16:31:37 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:31:36 -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/radeon: fix a potential NULL pointer dereference Date: Wed, 18 Sep 2019 22:01:22 +0530 Message-Id: <1568824282-4081-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=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=984 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=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 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/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) { -- 1.9.1