android: camera_device: Fix null pointer dereference

Commit 7532caa2c7 ("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: 7532caa2c7 ("android: camera_device: Reset config_ if Camera::configure() fails")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
This commit is contained in:
Laurent Pinchart 2021-06-28 09:41:27 +03:00
parent d3fef99844
commit 1684c3f930
4 changed files with 7 additions and 10 deletions

View file

@ -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_; }