media: bdisp: Add missing check for create_workqueue
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Wed, 8 Feb 2023 07:14:42 +0000 (08:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:10 +0000 (23:03 +0900)
[ Upstream commit 2371adeab717d8fe32144a84f3491a03c5838cfb ]

Add the check for the return value of the create_workqueue
in order to avoid NULL pointer dereference.

Fixes: 28ffeebbb7bd ("[media] bdisp: 2D blitter driver using v4l2 mem2mem framework")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c

index dd74cc4..080da25 100644 (file)
@@ -1309,6 +1309,8 @@ static int bdisp_probe(struct platform_device *pdev)
        init_waitqueue_head(&bdisp->irq_queue);
        INIT_DELAYED_WORK(&bdisp->timeout_work, bdisp_irq_timeout);
        bdisp->work_queue = create_workqueue(BDISP_NAME);
+       if (!bdisp->work_queue)
+               return -ENOMEM;
 
        spin_lock_init(&bdisp->slock);
        mutex_init(&bdisp->lock);