From 1684c3f930b2a27884037bc38856477b80cddd50 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 28 Jun 2021 09:41:27 +0300 Subject: android: camera_device: Fix null pointer dereference Commit 7532caa2c77b ("android: camera_device: Reset config_ if Camera::configure() fails") reworked the configuration sequence to ensure that the CameraConfiguration pointers gets reset when configuration fails. This inadvertently causes a null pointer dereference, as the CameraStream constructor accesses the camera configuration through CameraDevice::cameraConfiguration() before the internal config_ pointer is set. Fix this by passing the configuration pointer explicitly to the CameraStream constructor. Fixes: 7532caa2c77b ("android: camera_device: Reset config_ if Camera::configure() fails") Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Tested-by: Paul Elder Reviewed-by: Umang Jain Tested-by: Umang Jain Reviewed-by: Hirokazu Honda --- src/android/camera_stream.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/android/camera_stream.h') diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index 34016722..8ecc6e34 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -110,7 +110,8 @@ public: Internal, Mapped, }; - CameraStream(CameraDevice *const cameraDevice, Type type, + CameraStream(CameraDevice *const cameraDevice, + libcamera::CameraConfiguration *config, Type type, camera3_stream_t *camera3Stream, unsigned int index); Type type() const { return type_; } -- cgit v1.2.1