[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230602210440.8411-3-quic_jhugo@quicinc.com>
Date: Fri, 2 Jun 2023 15:04:40 -0600
From: Jeffrey Hugo <quic_jhugo@...cinc.com>
To: <dri-devel@...ts.freedesktop.org>
CC: <ogabbay@...nel.org>, <jacek.lawrynowicz@...ux.intel.com>,
<stanislaw.gruszka@...ux.intel.com>, <quic_carlv@...cinc.com>,
<quic_ajitpals@...cinc.com>, <linux-arm-msm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Jeffrey Hugo <quic_jhugo@...cinc.com>,
Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@...cinc.com>
Subject: [PATCH 2/2] accel/qaic: Fix NULL pointer deref in qaic_destroy_drm_device()
If qaic_destroy_drm_device() is called before the device has fully
initialized it will cause a NULL pointer dereference as the drm device
has not yet been created. Fix this with a NULL check.
Fixes: c501ca23a6a3 ("accel/qaic: Add uapi and core driver file")
Signed-off-by: Jeffrey Hugo <quic_jhugo@...cinc.com>
Reviewed-by: Carl Vanderlip <quic_carlv@...cinc.com>
Reviewed-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@...cinc.com>
---
drivers/accel/qaic/qaic_drv.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/accel/qaic/qaic_drv.c b/drivers/accel/qaic/qaic_drv.c
index 961cd341b414..b5ba550a0c04 100644
--- a/drivers/accel/qaic/qaic_drv.c
+++ b/drivers/accel/qaic/qaic_drv.c
@@ -225,6 +225,9 @@ static void qaic_destroy_drm_device(struct qaic_device *qdev, s32 partition_id)
struct qaic_user *usr;
qddev = qdev->qddev;
+ qdev->qddev = NULL;
+ if (!qddev)
+ return;
/*
* Existing users get unresolvable errors till they close FDs.
--
2.40.1
Powered by blists - more mailing lists