media: rkisp1: Initialize color space on resizer sink and source pads
Subsystems (11)
Sasha Levin
maintainerPATCH 1/14 media: rkisp1: Initialize color space on resizer sink and source pads
From: Laurent Pinchart <[email protected]>
[ Upstream commit 83b9296e399367862845d3b19984444fc756bd61 ]
Initialize the four color space fields on the sink and source video pads of the resizer in the .init_cfg() operation. The resizer can't perform any color space conversion, so set the sink and source color spaces to the same defaults, which match the ISP source video pad default.
--- drivers/staging/media/rkisp1/rkisp1-resizer.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/staging/media/rkisp1/rkisp1-resizer.c +4 -0
@@ -500,6 +500,10 @@ static int rkisp1_rsz_init_config(struct v4l2_subdev *sd, sink_fmt->height =RKISP1_DEFAULT_HEIGHT ; sink_fmt->field =V4L2_FIELD_NONE ; sink_fmt->code =RKISP1_DEF_FMT ; + sink_fmt->colorspace =V4L2_COLORSPACE_SRGB ; + sink_fmt->xfer_func =V4L2_XFER_FUNC_SRGB ; + sink_fmt->ycbcr_enc =V4L2_YCBCR_ENC_601 ; + sink_fmt->quantization =V4L2_QUANTIZATION_LIM_RANGE ; sink_crop =v4l2_subdev_get_try_crop (sd, cfg,RKISP1_RSZ_PAD_SINK ); sink_crop->width =RKISP1_DEFAULT_WIDTH ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 2/14 media: rkisp1: Zero v4l2_subdev_format fields in when validating links
From: Laurent Pinchart <[email protected]>
[ Upstream commit c53e3a049f35978a150526671587fd46b1ae7ca1 ]
The local sd_fmt variable in rkisp1_capture_link_validate() has uninitialized fields, which causes random failures when calling the subdev .get_fmt() operation. Fix it by initializing the variable when declaring it, which zeros all other fields.
--- drivers/staging/media/rkisp1/rkisp1-capture.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/staging/media/rkisp1/rkisp1-capture.c +4 -3
@@ -1258,11 +1258,12 @@ static int rkisp1_capture_link_validate(struct media_link *link)struct rkisp1_capture *cap =video_get_drvdata (vdev);const struct rkisp1_capture_fmt_cfg *fmt =rkisp1_find_fmt_cfg (cap, cap->pix.fmt.pixelformat); -struct v4l2_subdev_format sd_fmt; +struct v4l2_subdev_format sd_fmt = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + .pad = link->source->index, + };int ret; - sd_fmt.which =V4L2_SUBDEV_FORMAT_ACTIVE ; - sd_fmt.pad = link->source->index; ret =v4l2_subdev_call (sd, pad, get_fmt,NULL , &sd_fmt);if (ret)return ret;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 4/14 media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 2dc73b48665411a08c4e5f0f823dea8510761603 ]
I expect that the hardware will have limited this to 16, but just in case it hasn't, check for this corner case.
--- drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/cec/platform/cros-ec/cros-ec-cec.c +2 -0
@@ -44,6 +44,8 @@ static void handle_cec_message(struct cros_ec_cec *cros_ec_cec)uint8_t *cec_message = cros_ec->event_data.data.cec_message;unsigned int len = cros_ec->event_size; +if (len >CEC_MAX_MSG_SIZE ) + len =CEC_MAX_MSG_SIZE ; cros_ec_cec->rx_msg.len = len;memcpy (cros_ec_cec->rx_msg.msg, cec_message, len);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 6/14 media: meson: vdec: fix possible refcount leak in vdec_probe()
In reply to Sasha LevinFrom: Hangyu Hua <[email protected]>
[ Upstream commit 7718999356234d9cc6a11b4641bb773928f1390f ]
v4l2_device_unregister need to be called to put the refcount got by v4l2_device_register when vdec_probe fails or vdec_remove is called.
--- drivers/staging/media/meson/vdec/vdec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/media/meson/vdec/vdec.c +2 -0
@@ -1109,6 +1109,7 @@ static int vdec_probe(struct platform_device *pdev) err_vdev_release:video_device_release (vdev); +v4l2_device_unregister (&core->v4l2_dev);return ret; }
@@ -1117,6 +1118,7 @@ static int vdec_remove(struct platform_device *pdev)struct amvdec_core *core =platform_get_drvdata (pdev);video_unregister_device (core->vdev_dec); +v4l2_device_unregister (&core->v4l2_dev);return 0 ; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 7/14 media: atomisp: Ensure that USERPTR pointers are page aligned
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 6e6c4ae0f0ba295dbf6cbd48d93bec169d6ce431 ]
The atomisp code needs USERPTR pointers to be page aligned, otherwise bad things (scribbling over other parts of the process' RAM) happen.
Add a check to ensure this and exit VIDIOC_QBUF calls with unaligned pointers with -EINVAL.
--- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +6 -0
@@ -1290,6 +1290,12 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)* address and reprograme out page table properly */ if (buf->memory ==V4L2_MEMORY_USERPTR ) { +if (offset_in_page (buf->m.userptr)) { +dev_err (isp->dev,"Error userptr is not page aligned.\n" ); + ret = -EINVAL ; + goto error; + } + vb = pipe->capq.bufs[buf->index]; vm_mem = vb->priv;if (!vm_mem) {
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 8/14 media: atomisp: Fix v4l2_fh resource leak on open errors
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 5b9853ad1329be49343a608d574eb232ff1273d0 ]
When atomisp_open() fails then it must call v4l2_fh_release() to undo the results of v4l2_fh_open().
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/atomisp/pci/atomisp_fops.c +1 -0
@@ -890,6 +890,7 @@ static int atomisp_open(struct file *file)hmm_pool_unregister (HMM_POOL_TYPE_DYNAMIC );pm_runtime_put (vdev->v4l2_dev->dev);rt_mutex_unlock (&isp->mutex); +v4l2_fh_release (file);return ret; }
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 13/14 drm/amdgpu: set vm_update_mode=0 as default for Sienna Cichlid in SRIOV case
In reply to Sasha LevinFrom: Danijel Slivka <[email protected]>
[ Upstream commit 65f8682b9aaae20c2cdee993e6fe52374ad513c9 ]
For asic with VF MMIO access protection avoid using CPU for VM table updates. CPU pagetable updates have issues with HDP flush as VF MMIO access protection blocks write to mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL register during sriov runtime.
v3: introduce virtualization capability flag AMDGPU_VF_MMIO_ACCESS_PROTECT which indicates that VF MMIO write access is not allowed in sriov runtime
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6 -0
@@ -670,6 +670,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev) adev->virt.caps |=AMDGPU_PASSTHROUGH_MODE ; } +if (amdgpu_sriov_vf (adev) && adev->asic_type ==CHIP_SIENNA_CICHLID ) +/* VF MMIO access (except mailbox range) from CPU +* will be blocked during sriov runtime +*/ + adev->virt.caps |=AMDGPU_VF_MMIO_ACCESS_PROTECT ; +/* we have the ability to check now */ if (amdgpu_sriov_vf (adev)) {switch (adev->asic_type) {
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +4 -0
@@ -31,6 +31,7 @@#define AMDGPU_SRIOV_CAPS_IS_VF (1 << 2)/* this GPU is a virtual function */ #define AMDGPU_PASSTHROUGH_MODE (1 << 3)/* thw whole GPU is pass through for VM */ #define AMDGPU_SRIOV_CAPS_RUNTIME (1 << 4)/* is out of full access mode */ +#define AMDGPU_VF_MMIO_ACCESS_PROTECT (1 << 5)/* MMIO write access is not allowed in sriov runtime */ /* all asic after AI use this offset */ #define mmRCC_IOV_FUNC_IDENTIFIER 0xDE5
@@ -241,6 +242,9 @@ struct amdgpu_virt {#define amdgpu_passthrough (adev) \ ((adev)->virt.caps & AMDGPU_PASSTHROUGH_MODE) +#define amdgpu_sriov_vf_mmio_access_protection (adev) \ +((adev)->virt.caps & AMDGPU_VF_MMIO_ACCESS_PROTECT) +static inline bool is_virtual_machine (void ) {#ifdef CONFIG_X86
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +5 -1
@@ -3200,7 +3200,11 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev)*/ #ifdef CONFIG_X86_64 if (amdgpu_vm_update_mode ==-1 ) { -if (amdgpu_gmc_vram_full_visible (&adev->gmc)) +/* For asic with VF MMIO access protection +* avoid using CPU for VM table updates +*/ +if (amdgpu_gmc_vram_full_visible (&adev->gmc) && + !amdgpu_sriov_vf_mmio_access_protection (adev)) adev->vm_manager.vm_update_mode =AMDGPU_VM_USE_CPU_FOR_COMPUTE ;else
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 3/14 media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 93f65ce036863893c164ca410938e0968964b26c ]
I expect that the hardware will have limited this to 16, but just in case it hasn't, check for this corner case.
--- drivers/media/cec/platform/s5p/s5p_cec.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/cec/platform/s5p/s5p_cec.c +2 -0
@@ -115,6 +115,8 @@ static irqreturn_t s5p_cec_irq_handler(int irq, void *priv)dev_dbg (cec->dev,"Buffer overrun (worker did not process previous message)\n" ); cec->rx =STATE_BUSY ; cec->msg.len = status >>24 ; +if (cec->msg.len >CEC_MAX_MSG_SIZE ) + cec->msg.len =CEC_MAX_MSG_SIZE ; cec->msg.rx_status =CEC_RX_STATUS_OK ;s5p_cec_get_rx_buf (cec, cec->msg.len, cec->msg.msg);
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 5/14 media: dvb-frontends/drxk: initialize err to 0
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit 20694e96ca089ce6693c2348f8f628ee621e4e74 ]
Fix a compiler warning:
drivers/media/dvb-frontends/drxk_hard.c: In function 'drxk_read_ucblocks':drivers/media/dvb-frontends/drxk_hard.c:6673:21: warning: 'err' may be used uninitialized [-Wmaybe-uninitialized]
6673 | *ucblocks = (u32) err;
| ^~~~~~~~~drivers/media/dvb-frontends/drxk_hard.c:6663:13: note: 'err' was declared here
6663 | u16 err;
| ^~~
--- drivers/media/dvb-frontends/drxk_hard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb-frontends/drxk_hard.c +1 -1
@@ -6672,7 +6672,7 @@ static int drxk_read_snr(struct dvb_frontend *fe, u16 *snr)static int drxk_read_ucblocks (struct dvb_frontend *fe,u32 *ucblocks) {struct drxk_state *state = fe->demodulator_priv; -u16 err; +u16 err =0 ;dprintk (1 ,"\n" );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 9/14 ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init()
In reply to Sasha LevinFrom: Ashish Kalra <[email protected]>
[ Upstream commit 43d2748394c3feb86c0c771466f5847e274fc043 ]
Change num_ghes from int to unsigned int, preventing an overflow and causing subsequent vmalloc() to fail.
The overflow happens in ghes_estatus_pool_init() when calculating len during execution of the statement below as both multiplication operands here are signed int:
len += (num_ghes * GHES_ESOURCE_PREALLOC_MAX_SIZE);
The following call trace is observed because of this bug:
[ 9.317108] swapper/0: vmalloc error: size 18446744071562596352, exceeds total pages, mode:0xcc0(GFP_KERNEL), nodemask=(null),cpuset=/,mems_allowed=0-1 [ 9.317131] Call Trace: [ 9.317134] <TASK> [ 9.317137] dump_stack_lvl+0x49/0x5f [ 9.317145] dump_stack+0x10/0x12 [ 9.317146] warn_alloc.cold+0x7b/0xdf [ 9.317150] ? __device_attach+0x16a/0x1b0 [ 9.317155] __vmalloc_node_range+0x702/0x740 [ 9.317160] ? device_add+0x17f/0x920 [ 9.317164] ? dev_set_name+0x53/0x70 [ 9.317166] ? platform_device_add+0xf9/0x240 [ 9.317168] __vmalloc_node+0x49/0x50 [ 9.317170] ? ghes_estatus_pool_init+0x43/0xa0 [ 9.317176] vmalloc+0x21/0x30 [ 9.317177] ghes_estatus_pool_init+0x43/0xa0 [ 9.317179] acpi_hest_init+0x129/0x19c [ 9.317185] acpi_init+0x434/0x4a4 [ 9.317188] ? acpi_sleep_proc_init+0x2a/0x2a [ 9.317190] do_one_initcall+0x48/0x200 [ 9.317195] kernel_init_freeable+0x221/0x284 [ 9.317200] ? rest_init+0xe0/0xe0 [ 9.317204] kernel_init+0x1a/0x130 [ 9.317205] ret_from_fork+0x22/0x30 [ 9.317208] </TASK>
--- drivers/acpi/apei/ghes.c | 2 +- include/acpi/ghes.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/apei/ghes.c +1 -1
@@ -163,7 +163,7 @@ static void ghes_unmap(void __iomem *vaddr, enum fixed_addresses fixmap_idx)clear_fixmap (fixmap_idx); } -int ghes_estatus_pool_init (int num_ghes) +int ghes_estatus_pool_init (unsigned int num_ghes) {unsigned long addr, len;int rc;
include/acpi/ghes.h +1 -1
@@ -71,7 +71,7 @@ int ghes_register_vendor_record_notifier(struct notifier_block *nb);void ghes_unregister_vendor_record_notifier (struct notifier_block *nb);#endif -int ghes_estatus_pool_init (int num_ghes); +int ghes_estatus_pool_init (unsigned int num_ghes);/* From drivers/edac/ghes_edac.c */
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 14/14 i2c: xiic: Add platform module alias
In reply to Sasha LevinFrom: Martin Tůma <[email protected]>
[ Upstream commit b8caf0a0e04583fb71e21495bef84509182227ea ]
The missing "platform" alias is required for the mgb4 v4l2 driver to load the i2c controller driver when probing the HW.
--- drivers/i2c/busses/i2c-xiic.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-xiic.c +1 -0
@@ -935,6 +935,7 @@ static struct platform_driver xiic_i2c_driver = {module_platform_driver (xiic_i2c_driver); +MODULE_ALIAS ("platform:" DRIVER_NAME );MODULE_AUTHOR ("[email protected]" );MODULE_DESCRIPTION ("Xilinx I2C bus driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 10/14 hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax()
In reply to Sasha LevinFrom: "Jason A. Donenfeld" <[email protected]>
[ Upstream commit 96cb9d0554457086664d3bd10630b11193d863f1 ]
Rather than busy looping, yield back to the scheduler and sleep for a bit in the event that there's no data. This should hopefully prevent the stalls that Mark reported:
<6>[ 3.362859] Freeing initrd memory: 16196K <3>[ 23.160131] rcu: INFO: rcu_sched self-detected stall on CPU <3>[ 23.166057] rcu: 0-....: (2099 ticks this GP) idle=03b4/1/0x40000002 softirq=28/28 fqs=1050 <4>[ 23.174895] (t=2101 jiffies g=-1147 q=2353 ncpus=4) <4>[ 23.180203] CPU: 0 PID: 49 Comm: hwrng Not tainted 6.0.0 #1 <4>[ 23.186125] Hardware name: BCM2835 <4>[ 23.189837] PC is at bcm2835_rng_read+0x30/0x6c <4>[ 23.194709] LR is at hwrng_fillfn+0x71/0xf4 <4>[ 23.199218] pc : [<c07ccdc8>] lr : [<c07cb841>] psr: 40000033 <4>[ 23.205840] sp : f093df70 ip : 00000000 fp : 00000000 <4>[ 23.211404] r10: c3c7e800 r9 : 00000000 r8 : c17e6b20 <4>[ 23.216968] r7 : c17e6b64 r6 : c18b0a74 r5 : c07ccd99 r4 : c3f171c0 <4>[ 23.223855] r3 : 000fffff r2 : 00000040 r1 : c3c7e800 r0 : c3f171c0 <4>[ 23.230743] Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment none <4>[ 23.238426] Control: 50c5387d Table: 0020406a DAC: 00000051 <4>[ 23.244519] CPU: 0 PID: 49 Comm: hwrng Not tainted 6.0.0 #1
--- drivers/char/hw_random/bcm2835-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/bcm2835-rng.c +1 -1
@@ -69,7 +69,7 @@ static int bcm2835_rng_read(struct hwrng *rng, void *buf, size_t max,while ((rng_readl (priv,RNG_STATUS ) >>24 ) ==0 ) {if (!wait)return 0 ; -cpu_relax (); +hwrng_msleep (rng,1000 ); } num_words =rng_readl (priv,RNG_STATUS ) >>24 ;
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 12/14 HID: saitek: add madcatz variant of MMO7 mouse device ID
In reply to Sasha LevinFrom: Samuel Bailey <[email protected]>
[ Upstream commit 79425b297f56bd481c6e97700a9a4e44c7bcfa35 ]
The MadCatz variant of the MMO7 mouse has the ID 0738:1713 and the same quirks as the Saitek variant.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-quirks.c | 1 + drivers/hid/hid-saitek.c | 2 ++ 3 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -827,6 +827,7 @@#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540#define USB_DEVICE_ID_MADCATZ_RAT5 0x1705#define USB_DEVICE_ID_MADCATZ_RAT9 0x1709 +#define USB_DEVICE_ID_MADCATZ_MMO7 0x1713#define USB_VENDOR_ID_MCC 0x09db#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
drivers/hid/hid-quirks.c +1 -0
@@ -609,6 +609,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT5) }, { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_MMO7) }, #endif #if IS_ENABLED(CONFIG_HID_SAMSUNG) { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
drivers/hid/hid-saitek.c +2 -0
@@ -187,6 +187,8 @@ static const struct hid_device_id saitek_devices[] = { .driver_data = SAITEK_RELEASE_MODE_RAT7 }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7), .driver_data = SAITEK_RELEASE_MODE_MMO7 }, + { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_MMO7), + .driver_data = SAITEK_RELEASE_MODE_MMO7 }, { } };
Signature · 1 line
2.35.1
Sasha Levin
maintainerPATCH 11/14 scsi: core: Restrict legal sdev_state transitions via sysfs
In reply to Sasha LevinFrom: Uday Shankar <[email protected]>
[ Upstream commit 2331ce6126be8864b39490e705286b66e2344aac ]
Userspace can currently write to sysfs to transition sdev_state to RUNNING or OFFLINE from any source state. This causes issues because proper transitioning out of some states involves steps besides just changing sdev_state, so allowing userspace to change sdev_state regardless of the source state can result in inconsistencies; e.g. with ISCSI we can end up with sdev_state == SDEV_RUNNING while the device queue is quiesced. Any task attempting I/O on the device will then hang, and in more recent kernels, iscsid will hang as well.
More detail about this bug is provided in my first attempt:
https://groups.google.com/g/open-iscsi/c/PNKca4HgPDs/m/CXaDkntOAQAJ
--- drivers/scsi/scsi_sysfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/scsi/scsi_sysfs.c +8 -0
@@ -815,6 +815,14 @@ store_state_field(struct device *dev, struct device_attribute *attr, }mutex_lock (&sdev->state_mutex); +switch (sdev->sdev_state) { +case SDEV_RUNNING : +case SDEV_OFFLINE : +break ; +default : +mutex_unlock (&sdev->state_mutex); +return -EINVAL ; + }if (sdev->sdev_state ==SDEV_RUNNING && state ==SDEV_RUNNING ) { ret =0 ; }else {
Signature · 1 line
2.35.1