From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E51586772E; Tue, 23 Jan 2024 02:01:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705975296; cv=none; b=XvqXj7alqjpo59mE/aLlQxN2KARKMoGIWQUa5RdGi15j4YzMDXSU1dlX/VgUSAR58PjkZcqa91D1XkJosUuP2Sm0ZHyroVsoGcbrgtfv0RyYhuPEYXdQ9YV17lzLCTzRCNL2A65W8yx9DMFr4pobgfUYfewSHBKNfFxrAK5LQ1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705975296; c=relaxed/simple; bh=0XbKgeMh1op5oPG1iu2T44JCu/zNICjl6j7gmpZZZz0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NrQsf22SeeUdzr5jY4muLVQGTEhtOSe4eggW65N7BVgbs/Ee45zZD88SxGmRZzusr8siG2qLhMOnJ51cw16ZhqNiPfyn8RKwsTTIHCkJVo4kZw/uJA7piQqhYTjRUwsHGQkUgtRn+T66ipT9W5cGPZjl4DxHWaIvZLO+ZAvJzCU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=y0hWfhnq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="y0hWfhnq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D6AC43394; Tue, 23 Jan 2024 02:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705975295; bh=0XbKgeMh1op5oPG1iu2T44JCu/zNICjl6j7gmpZZZz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y0hWfhnq0d5OfpvZ5eCUFxo2pNxGa5uBm6gm0prMLoB6TYEM+//E+KAMsEFbQekio oSCF+VURQ0Qf5XKpzLtbX99mBehpVBbLDckMgq3omeDlV7R++DZDXF6SwZsSx8sR7N QE353dyA7ae3OGLhNr0MEkrae+7yfFbAe50ovdQg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yang Yingliang , Alex Deucher , Sasha Levin Subject: [PATCH 6.6 260/583] drm/radeon: check the alloc_workqueue return value in radeon_crtc_init() Date: Mon, 22 Jan 2024 15:55:11 -0800 Message-ID: <20240122235819.962766605@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235812.238724226@linuxfoundation.org> References: <20240122235812.238724226@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yang Yingliang [ Upstream commit 7a2464fac80d42f6f8819fed97a553e9c2f43310 ] check the alloc_workqueue return value in radeon_crtc_init() to avoid null-ptr-deref. Fixes: fa7f517cb26e ("drm/radeon: rework page flip handling v4") Signed-off-by: Yang Yingliang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/radeon_display.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 901e75ec70ff..efd18c8d84c8 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -687,11 +687,16 @@ static void radeon_crtc_init(struct drm_device *dev, int index) if (radeon_crtc == NULL) return; + radeon_crtc->flip_queue = alloc_workqueue("radeon-crtc", WQ_HIGHPRI, 0); + if (!radeon_crtc->flip_queue) { + kfree(radeon_crtc); + return; + } + drm_crtc_init(dev, &radeon_crtc->base, &radeon_crtc_funcs); 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); rdev->mode_info.crtcs[index] = radeon_crtc; if (rdev->family >= CHIP_BONAIRE) { -- 2.43.0