From: Aleksandr Burakov <a.burakov@rosalinux.ru>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Aleksandr Burakov <a.burakov@rosalinux.ru>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-project@linuxtesting.org
Subject: [PATCH] media: v4l2-flash: fix NULL dereference in v4l2_flash_s_ctrl()
Date: Wed, 7 Dec 2022 17:18:07 +0300 [thread overview]
Message-ID: <20221207141808.22922-1-a.burakov@rosalinux.ru> (raw)
The NULL check added for fled_cdev before dereference.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Aleksandr Burakov <a.burakov@rosalinux.ru>
Fixes: 42bd6f59ae90 ("media: Add registration helpers for V4L2 flash sub-devices")
---
drivers/media/v4l2-core/v4l2-flash-led-class.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
index 355595a0fefa..36cc46e80eea 100644
--- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
+++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
@@ -291,12 +291,16 @@ static int v4l2_flash_s_ctrl(struct v4l2_ctrl *c)
* No conversion is needed as LED Flash class also uses
* microseconds for flash timeout units.
*/
+ if (!fled_cdev)
+ return -EINVAL;
return led_set_flash_timeout(fled_cdev, c->val);
case V4L2_CID_FLASH_INTENSITY:
/*
* No conversion is needed as LED Flash class also uses
* microamperes for flash intensity units.
*/
+ if (!fled_cdev)
+ return -EINVAL;
return led_set_flash_brightness(fled_cdev, c->val);
}
--
2.25.1
next reply other threads:[~2022-12-07 14:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 14:18 Aleksandr Burakov [this message]
2022-12-07 14:18 ` [PATCH 2/2] misc: genwqe: card_dev: Array index overflow fix in ddcb_cmd_fixups() Aleksandr Burakov
2022-12-07 16:23 ` Greg Kroah-Hartman
2022-12-08 10:55 ` Александр Бураков
2022-12-08 13:16 ` Greg Kroah-Hartman
2023-01-16 21:01 ` [PATCH] media: v4l2-flash: fix NULL dereference in v4l2_flash_s_ctrl() Sakari Ailus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221207141808.22922-1-a.burakov@rosalinux.ru \
--to=a.burakov@rosalinux.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®