aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-03-24media: i2c: video-i2c: fix build errors due to 'imply hwmon'Matt Ranostay1-1/+1
Fix build fault when CONFIG_HWMON is a module, and CONFIG_VIDEO_I2C as builtin. This is due to 'imply hwmon' in the respective Kconfig. Issue build log: ld: drivers/media/i2c/video-i2c.o: in function `amg88xx_hwmon_init': video-i2c.c:(.text+0x2e1): undefined reference to `devm_hwmon_device_register_with_info Cc: [email protected] Fixes: acbea6798955 (media: video-i2c: add hwmon support for amg88xx) Signed-off-by: Matt Ranostay <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-24media: MAINTAINERS: add myself to co-maintain Hantro G1/G2 for i.MX8MQPhilipp Zabel1-0/+2
Add path and co-maintainer entry for i.MX8MQ device tree bindings. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-24media: hantro: add initial i.MX8MQ supportPhilipp Zabel5-4/+239
This enables h.264, MPEG-2, and VP8 decoding on the Hantro G1 on i.MX8MQ, with post-processing support. Signed-off-by: Philipp Zabel <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-24media: dt-bindings: Document i.MX8MQ VPU bindingsPhilipp Zabel1-0/+77
Add devicetree binding documentation for the Hantro G1/G2 VPU on i.MX8MQ. Signed-off-by: Philipp Zabel <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-24media: vivid: fix incorrect PA assignment to HDMI outputsHans Verkuil1-2/+2
The initial physical address was one too low for the outputs. E.g. if 1.0.0.0 was expected, then it was set to 0.0.0.0, and 2.0.0.0 became 1.0.0.0. Signed-off-by: Hans Verkuil <[email protected]> Cc: Johan Korsnes <[email protected]> Fixes: 4ee895e71abb ("media: vivid: reorder CEC allocation and control set-up") Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-24media: hantro: Add linux-rockchip mailing list to MAINTAINERSEzequiel Garcia1-0/+1
The linux-rockchip mailing list is relevant for the Hantro driver, given this support the VPU present in Rockchip SoCs. Signed-off-by: Ezequiel Garcia <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-24media: cedrus: h264: Fix 4K decoding on H6Jernej Skrabec1-1/+5
Due to unknown reason, H6 needs larger intraprediction buffer for 4K videos than other SoCs. This was discovered by playing 4096x2304 video, which is maximum what H6 VPU is supposed to support. Fixes: 03e612e701a6 ("media: cedrus: Fix H264 4k support") Signed-off-by: Jernej Skrabec <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: siano: Use scnprintf() for avoiding potential buffer overflowTakashi Iwai1-104/+110
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sean Young <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: rc: Use scnprintf() for avoiding potential buffer overflowTakashi Iwai1-2/+2
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sean Young <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: create new struct for channel parametersMichael Tretter2-64/+80
Add a new struct for the channel parameters that is contained in the CREATE_CHANNEL message. This is in preparation for newer firmwares that pass the channel parameters in a dedicated buffer instead of embedding the parameters into the CREATE_CHANNEL message. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: move mail definitions to separate fileMichael Tretter4-274/+302
Move the mail definitions from the driver core to a dedicated file. The mails that are exchanged between driver and firmware are not stable across firmware versions. This is in preparation to make the driver able to handle multiple firmware version by having dedicated code for handling mails. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: pass buffers through firmwareMichael Tretter1-21/+103
As we know which buffers are processed by the codec from the address in the ENCODE_FRAME response, we can queue multiple buffers in the firmware and retrieve the buffer from the response of the firmware. This enables the firmware to use the internal scheduling the codec and avoids round trips through the driver when fetching the next frame. Remove buffers that have been passed to the firmware from the m2m buffer queue and put them into a shadow queue for tracking the buffer in the driver. When we receive a ENCODE_FRAME response from the firmware, get the buffer from the shadow queue and finish the buffer. Furthermore, it is necessary to finish the job straight after passing the buffer to the firmware to allow the V4L2 framework to send further buffers to the driver. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: verify source and destination buffer in VCU responseMichael Tretter1-6/+26
The PUT_STREAM_BUFFER and ENCODE_FRAME request have fields that allow to pass arbitrary 64 bit values through the firmware to the ENCODE_FRAME response. Use these values to verify that the buffers when finishing the frame are actually the same buffers that have been sent for encoding a frame. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: handle dependency of bitrate and bitrate_peakMichael Tretter1-8/+41
The peak bitrate must not be smaller than the configured bitrate. Update the other control whenever one of the controls changes to reflect this dependency. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: read bitrate mode directly from controlMichael Tretter1-7/+3
There is no need to copy the bitrate mode to a field in the channel and the value can be read directly from the control. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: make QP configurableMichael Tretter1-10/+102
The V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE control allows to enable/disable rate control on a channel. When rate control is disabled, the driver shall use constant QP, which are set by the application. Also implement the controls for configuring the QP. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: make frame rate configurableMichael Tretter1-5/+58
The allegro dvt codec adjust the encoding speed according to a configured frame rate. Furthermore, the frame rate is written into the coded stream. Ensure that the coded video data has the correct frame rate by implementing s_parm for setting the frame rate from user space. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: skip filler data if possibleMichael Tretter1-10/+15
The driver instructs the firmware to leave some space space in front of the coded frame data for SPS/PPS data. If the driver receives an IDR, it writes the SPS/PPS into that free space and fills the rest with filler data. However, if there is no additional data, the driver can use the plane offset to skip this space instead of adding filler data. As the size of the SPS/PPS is only available after writing it, keep the filler data between the SPS/PPS and the coded frame data. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: warn if response message has an unexpected sizeMichael Tretter1-0/+12
The driver uses structs to parse the responses from the VCU and expects a certain size of the responses. However, the size and format of the mails is not stable across firmware versions. Therefore, print a warning if the size does not match the expected size to warn the user that strange things might happen. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: extract mcu and codec address calculationMichael Tretter1-11/+33
The mcu and the codec use 32 bit addresses which are sent via the firmware messages. Add helper functions for this address calculation to make it obvious which address is used in the message. As the mcu and the codec have a limited address space, print warnings if the addresses are outside the respective address space. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: fix reset if WAKEUP has not been set properlyMichael Tretter1-0/+8
The Zynq UltraScale+ Devices Register Reference states that the WAKEUP bit "should be set to 0 after the MCU sleep status bit gets back to 0." If this is not done, the mcu is not going to sleep on reset and fail the reset. Set WAKEUP to 0 before triggering a reset to make sure that the reset is successful. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: fix calculation of CPB sizeMichael Tretter1-5/+20
The cpb_size is given in kilobytes, but the bitrate is given in bits per second. Therefore, the calculation of the initial removal delay and the cpb size for the firmware were wrong. Convert the bitrate to kilobytes before calculating the cpb size in 90 kHz units for sending it to the firmware. Also reuse the result for the initial removal delay, to make it obvious that we are setting the initial removal delay to the maximum value. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: start a GOP with an IDR frameMichael Tretter1-2/+2
When creating a channel, freq_idr defines the number of frames between IDR frames in the coded stream. In V4L2, the period between IDR frames shall be taken from the GOP_SIZE control. Set the IDR frame frequency equal to the GOP size and let every GOP start with an IDR frame. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: remove unknown39 field from create_channelMichael Tretter1-3/+1
The subframe_latency and lda_control_mode fields directly follow freq_golden_ref field and there is no unknown field in between. The unknown field it at the end of the message. Reorder the fields accordingly. This further allows to drop the hard coded value from the lda_control_mode field and set the mode to 0. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: fix type of gop_length in channel_create messageMichael Tretter1-1/+4
The gop_length field is actually only u16 and there are two more u8 fields in the message: - the number of consecutive b-frames - frequency of golden frames Fix the message and thus fix the configuration of the GOP length. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: fail encoding only on actual errorsMichael Tretter1-1/+1
Only negative values are actual errors and positive values are used for warnings. Warnings should not fail the encoding process. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: allegro: print message on mcu errorMichael Tretter1-4/+58
The codec firmware uses error codes to report errors during the configuration of a channel or while encoding a frame. Translate them into human readable strings for debugging. Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: staging: allegro: fix broken registration of controlsMichael Tretter1-1/+2
Since commit cc62c74749a3 ("media: allegro: add missed checks in allegro_open()") the allegro device does provide v4l2 controls to user space anymore. The reason is that v4l2_fh_init() initializes fh->ctrl_handler to vdev->ctrl_handler, which invalidates the previous driver override of the ctrl_handler. Therefore, v4l2_fh_init() must be called before the driver overrides the fh->ctrl_handler with its own handler. Move the initialization of the fh back to the top, as the initialization does not does not need to be reverted on errors, but it is enough to free the channel. Fixes: cc62c74749a3 ("media: allegro: add missed checks in allegro_open()") Signed-off-by: Michael Tretter <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: cec-notifier: make cec_notifier_get_conn() staticHans Verkuil2-25/+15
This function is no longer used by other drivers, so it can be made static. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: cec-notifier: rename conn_name to port_nameHans Verkuil2-20/+20
This argument refers to a stable name for an HDMI port, mostly i915 (ACPI) specific. Since we'll be introducing a more generic 'name' argument as well later, rename this now to avoid confusion. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: am437x-vpfe: Make use of to_vpfe() to get a pointer to vpfe_deviceLad Prabhakar1-5/+5
This patch makes use of to_vpfe() to get a pointer to vpfe_device Signed-off-by: Lad Prabhakar <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: v4l: Add 1X14 14-bit greyscale media bus code definitionDaniel Glöckner2-1/+39
The code is called MEDIA_BUS_FMT_Y14_1X14 and behaves just like MEDIA_BUS_FMT_Y12_1X12 with two more bits. Signed-off-by: Daniel Glöckner <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: v4l: Add 14-bit raw greyscale pixel formatDaniel Glöckner4-0/+75
The new format is called V4L2_PIX_FMT_Y14. Like V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y12 it is stored in two bytes per pixel but has only two unused bits at the top. Signed-off-by: Daniel Glöckner <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Acked-by: Sakari Ailus <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-20media: v4l: Add 14-bit raw bayer pixel formatsSakari Ailus4-0/+91
The formats added by this patch are: V4L2_PIX_FMT_SBGGR14 V4L2_PIX_FMT_SGBRG14 V4L2_PIX_FMT_SGRBG14 V4L2_PIX_FMT_SRGGB14 Signed-off-by: Jouni Ukkonen <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> [[email protected]: rebased onto current media_tree] Signed-off-by: Daniel Glöckner <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-16device property: Export fwnode_get_name()Heikki Krogerus1-0/+1
This makes it possible to take advantage of the function in the device drivers. Signed-off-by: Heikki Krogerus <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-03-12media: imx: imx7-media-csi: Support clamping Y10 and Y12 to Y8Laurent Pinchart1-0/+8
10-bit and 12-bit greyscale input data to the CSI can be written as 8-bit data to memory. Support this. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7-media-csi: Add Y10 and Y12 formats supportLaurent Pinchart1-0/+8
Support capturing the 10- and 12-bit greyscale formats. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx6-media-csi: Support clamping Y10 and Y12 to Y8Laurent Pinchart1-1/+5
10-bit and 12-bit greyscale input data to the CSI can be written as 8-bit data to memory. Support this. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Steve Longerbeam <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx6-media-csi: Replace Y16 with Y10 and Y12Laurent Pinchart2-6/+10
The driver doesn't really support V4L2_PIX_FMT_Y16, as there's no 16-bit greyscale media bus code defined by the kernel. It (ab)uses the format to capture 10-bit and 12-bit greyscale formats. Fix it to properly support MEDIA_BUS_FMT_Y10_1X10 and MEDIA_BUS_FMT_Y12_1X12 instead. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Acked-by: Steve Longerbeam <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7-media-csi: Fix video field handlingLaurent Pinchart1-0/+4
Commit 4791bd7d6adc ("media: imx: Try colorimetry at both sink and source pads") reworked the way that formats are set on the sink pad of the CSI subdevice, and accidentally removed video field handling. Restore it by defaulting to V4L2_FIELD_NONE if the field value isn't supported, with the only two supported value being V4L2_FIELD_NONE and V4L2_FIELD_INTERLACED. Fixes: 4791bd7d6adc ("media: imx: Try colorimetry at both sink and source pads") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7-media-csi: Remove unneeded register readLaurent Pinchart1-1/+1
The imx7_csi_dma_reflash() function starts by reading the unrelated register CSI_CSICR18 to then overwrite the read value with a read from register CSI_CSICR3. This is likely due to a bad copy&paste, and is not needed. Remove the extraneous read from register CSI_CSICR18. Fixes: 9e5fa4e1e5b5b ("media: imx7-media-csi: Use u32 for storing register reads") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7-mipi-csis: Filter on CSI-2 data typeLaurent Pinchart1-0/+1
Enable filtering based on CSI-2 data type. Otherwise sources that send multiple data types (such as sensors that send embedded data) will not be properly supported. They will both result in additional non-image lines being captured, and in the receiver being confused as it doesn't resynchronise on vsync. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7_mipi_csis: Add greyscale formats supportLaurent Pinchart1-0/+12
Add support for the 8-, 10- and 12-bit greyscale media bus formats, and map them to the CSI-2 RAW8, RAW10 and RAW12 formats respectively. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7_mipi_csis: Print the RESOL_CH0 registerLaurent Pinchart1-0/+1
Add the RESOL_CH0 register to the list of registers printed through the debugfs debug infrastructure for the driver, as it can be useful to verify proper configuration of the CSI-2 receiver. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: imx: imx7_mipi_csis: Power off the source when stopping streamingLaurent Pinchart1-1/+1
The .s_stream() implementation incorrectly powers on the source when stopping the stream. Power it off instead. Fixes: 7807063b862b ("media: staging/imx7: add MIPI CSI-2 receiver subdev for i.MX7") Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: Rui Miguel Silva <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: mtk-mdp: Check return value of of_clk_getMatthias Brugger1-0/+6
Check the return value of of_clk_get and print an error message if not EPROBE_DEFER. Signed-off-by: Matthias Brugger <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: platform: stm32: don't print an error on probe deferralEtienne Carriere1-1/+3
Change stm32-cec driver to not print an error message when the device probe operation is deferred. Signed-off-by: Etienne Carriere <[email protected]> Reviewed-by: Philippe Cornu <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: platform: stm32: defer probe for auxiliary clockEtienne Carriere1-1/+5
Change stm32-cec driver to defer probe when auxiliary clock "hdmi-cec" is registered in the system not has not been probed yet. Signed-off-by: Etienne Carriere <[email protected]> Reviewed-by: Philippe Cornu <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: xirlink_cit: add missing descriptor sanity checksJohan Hovold1-1/+17
Make sure to check that we have two alternate settings and at least one endpoint before accessing the second altsetting structure and dereferencing the endpoint arrays. This specifically avoids dereferencing NULL-pointers or corrupting memory when a device does not have the expected descriptors. Note that the sanity check in cit_get_packet_size() is not redundant as the driver is mixing looking up altsettings by index and by number, which may not coincide. Fixes: 659fefa0eb17 ("V4L/DVB: gspca_xirlink_cit: Add support for camera with a bcd version of 0.01") Fixes: 59f8b0bf3c12 ("V4L/DVB: gspca_xirlink_cit: support bandwidth changing for devices with 1 alt setting") Cc: stable <[email protected]> # 2.6.37 Cc: Hans de Goede <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2020-03-12media: stv06xx: add missing descriptor sanity checksJohan Hovold2-1/+22
Make sure to check that we have two alternate settings and at least one endpoint before accessing the second altsetting structure and dereferencing the endpoint arrays. This specifically avoids dereferencing NULL-pointers or corrupting memory when a device does not have the expected descriptors. Note that the sanity checks in stv06xx_start() and pb0100_start() are not redundant as the driver is mixing looking up altsettings by index and by number, which may not coincide. Fixes: 8668d504d72c ("V4L/DVB (12082): gspca_stv06xx: Add support for st6422 bridge and sensor") Fixes: c0b33bdc5b8d ("[media] gspca-stv06xx: support bandwidth changing") Cc: stable <[email protected]> # 2.6.31 Cc: Hans de Goede <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>