public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] drivers: staging: greybus: fix GPF issue in gb_camera_capture
@ 2023-05-04 13:58 Dongliang Mu
  2023-05-04 14:34 ` Alex Elder
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Dongliang Mu @ 2023-05-04 13:58 UTC (permalink / raw)
  To: Johan Hovold, Alex Elder, Greg Kroah-Hartman, Jacopo Mondi,
	Laurent Pinchart
  Cc: Dongliang Mu, Greg Kroah-Hartman, greybus-dev, linux-staging,
	linux-kernel

In gb_camera_capture(), it does not check the value of settings
before dereferencing it. And gb_camera_debugfs_capture calls
gb_camera_capture with the 6th parameter settings as NULL.

Fix this by checking the value of setting at the starting of
gb_camera_capture.

Fixes: 3265edaf0d70 ("greybus: Add driver for the camera class protocol")
Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
---
 drivers/staging/greybus/camera.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c
index cdbb42cd413b..5a4b26e7f645 100644
--- a/drivers/staging/greybus/camera.c
+++ b/drivers/staging/greybus/camera.c
@@ -659,7 +659,7 @@ static int gb_camera_capture(struct gb_camera *gcam, u32 request_id,
 	size_t req_size;
 	int ret;
 
-	if (settings_size > GB_CAMERA_MAX_SETTINGS_SIZE)
+	if (settings_size > GB_CAMERA_MAX_SETTINGS_SIZE || !settings)
 		return -EINVAL;
 
 	req_size = sizeof(*req) + settings_size;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-04 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04 13:58 [PATCH] drivers: staging: greybus: fix GPF issue in gb_camera_capture Dongliang Mu
2023-05-04 14:34 ` Alex Elder
2023-05-04 14:53 ` Dan Carpenter
2023-05-04 15:08   ` Dongliang Mu
2023-05-04 14:54 ` Johan Hovold
2023-05-04 15:09   ` Dongliang Mu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox