gpu: ipu-v3: Fix i.MX51 CSI control registers offset
Subsystems (8)
Sasha Levin
maintainerPATCH 1/12 gpu: ipu-v3: Fix i.MX51 CSI control registers offset
From: Alexander Shiyan <[email protected]>
[ Upstream commit 2c0408dd0d8906b26fe8023889af7adf5e68b2c2 ]
The CSI0/CSI1 registers offset is at +0xe030000/+0xe038000 relative to the control module registers on IPUv3EX.
This patch fixes wrong values for i.MX51 CSI0/CSI1.
--- drivers/gpu/ipu-v3/ipu-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/ipu-v3/ipu-common.c +2 -2
@@ -884,8 +884,8 @@ static struct ipu_devtype ipu_type_imx51 = { .cpmem_ofs = 0x1f000000, .srm_ofs = 0x1f040000, .tpm_ofs = 0x1f060000, - .csi0_ofs = 0x1f030000, - .csi1_ofs = 0x1f038000, + .csi0_ofs = 0x1e030000, + .csi1_ofs = 0x1e038000, .ic_ofs = 0x1e020000, .disp0_ofs = 0x1e040000, .disp1_ofs = 0x1e048000,
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 2/12 gpu: ipu-v3: Fix CSI offsets for imx53
From: Steve Longerbeam <[email protected]>
[ Upstream commit bb867d219fda7fbaabea3314702474c4eac2b91d ]
The CSI offsets are wrong for both CSI0 and CSI1. They are at physical address 0x1e030000 and 0x1e038000 respectively.
--- drivers/gpu/ipu-v3/ipu-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/ipu-v3/ipu-common.c +2 -2
@@ -900,8 +900,8 @@ static struct ipu_devtype ipu_type_imx53 = { .cpmem_ofs = 0x07000000, .srm_ofs = 0x07040000, .tpm_ofs = 0x07060000, - .csi0_ofs = 0x07030000, - .csi1_ofs = 0x07038000, + .csi0_ofs = 0x06030000, + .csi1_ofs = 0x06038000, .ic_ofs = 0x06020000, .disp0_ofs = 0x06040000, .disp1_ofs = 0x06048000,
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 3/12 s390/dasd: fix using offset into zero size array error
In reply to Sasha LevinFrom: Stefan Haberland <[email protected]>
[ Upstream commit 4a8ef6999bce998fa5813023a9a6b56eea329dba ]
Dan Carpenter reported the following:
The patch 52898025cf7d: "[S390] dasd: security and PSF update patch for EMC CKD ioctl" from Mar 8, 2010, leads to the following static checker warning:
drivers/s390/block/dasd_eckd.c:4486 dasd_symm_io() error: using offset into zero size array 'psf_data[]'
drivers/s390/block/dasd_eckd.c
4458 /* Copy parms from caller */
4459 rc = -EFAULT;
4460 if (copy_from_user(&usrparm, argp, sizeof(usrparm)))
^^^^^^^The user can specify any "usrparm.psf_data_len". They choose zero by mistake.
4461 goto out;
4462 if (is_compat_task()) {
4463 /* Make sure pointers are sane even on 31 bit. */ 4464 rc = -EINVAL; 4465 if ((usrparm.psf_data >> 32) != 0) 4466 goto out; 4467 if ((usrparm.rssd_result >> 32) != 0) 4468 goto out; 4469 usrparm.psf_data &= 0x7fffffffULL; 4470 usrparm.rssd_result &= 0x7fffffffULL; 4471 } 4472 /* alloc I/O data area */ 4473 psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA); 4474 rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
4475 if (!psf_data || !rssd_result) {
kzalloc() returns a ZERO_SIZE_PTR (0x16).
4476 rc = -ENOMEM; 4477 goto out_free; 4478 } 4479 4480 /* get syscall header from user space */ 4481 rc = -EFAULT; 4482 if (copy_from_user(psf_data, 4483 (void __user *)(unsigned long) usrparm.psf_data, 4484 usrparm.psf_data_len))
That all works great.
4485 goto out_free; 4486 psf0 = psf_data[0]; 4487 psf1 = psf_data[1];
But now we're assuming that "->psf_data_len" was at least 2 bytes.
Fix this by checking the user specified length psf_data_len.
--- drivers/s390/block/dasd_eckd.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/s390/block/dasd_eckd.c +8 -0
@@ -4508,6 +4508,14 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) usrparm.psf_data &=0x7fffffffULL ; usrparm.rssd_result &=0x7fffffffULL ; } +/* at least 2 bytes are accessed and should be allocated */ +if (usrparm.psf_data_len <2 ) { +DBF_DEV_EVENT (DBF_WARNING , device, +"Symmetrix ioctl invalid data length %d" , + usrparm.psf_data_len); + rc = -EINVAL ; + goto out; + }/* alloc I/O data area */ psf_data =kzalloc (usrparm.psf_data_len,GFP_KERNEL |GFP_DMA ); rssd_result =kzalloc (usrparm.rssd_result_len,GFP_KERNEL |GFP_DMA );
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 4/12 ARM: OMAP2+: Variable "reg" in function omap4_dsi_mux_pads() could be uninitialized
In reply to Sasha LevinFrom: Yizhuo <[email protected]>
[ Upstream commit dc30e70391376ba3987aeb856ae6d9c0706534f1 ]
In function omap4_dsi_mux_pads(), local variable "reg" could be uninitialized if function regmap_read() returns -EINVAL. However, it will be used directly in the later context, which is potentially unsafe.
--- arch/arm/mach-omap2/display.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/display.c +6 -1
@@ -115,6 +115,7 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)u32 enable_mask, enable_shift;u32 pipd_mask, pipd_shift;u32 reg; +int ret;if (dsi_id ==0 ) { enable_mask =OMAP4_DSI1_LANEENABLE_MASK ;
@@ -130,7 +131,11 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)return -ENODEV ; } -regmap_read (omap4_dsi_mux_syscon,OMAP4_DSIPHY_SYSCON_OFFSET , ®); + ret =regmap_read (omap4_dsi_mux_syscon, +OMAP4_DSIPHY_SYSCON_OFFSET , + ®); +if (ret) +return ret; reg &= ~enable_mask; reg &= ~pipd_mask;
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 5/12 Input: cap11xx - switch to using set_brightness_blocking()
In reply to Sasha LevinFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit 628442880af8c201d307a45f3862a7a17df8a189 ]
Updating LED state requires access to regmap and therefore we may sleep, so we could not do that directly form set_brightness() method. Historically we used private work to adjust the brightness, but with the introduction of set_brightness_blocking() we no longer need it.
As a bonus, not having our own work item means we do not have use-after-free issue as we neglected to cancel outstanding work on driver unbind.
--- drivers/input/keyboard/cap11xx.c | 35 ++++++++++---------------------- 1 file changed, 11 insertions(+), 24 deletions(-)
drivers/input/keyboard/cap11xx.c +11 -24
@@ -75,9 +75,7 @@struct cap11xx_led {struct cap11xx_priv *priv;struct led_classdev cdev; -struct work_struct work;u32 reg; -enum led_brightness new_brightness; };#endif
@@ -233,30 +231,21 @@ static void cap11xx_input_close(struct input_dev *idev) }#ifdef CONFIG_LEDS_CLASS -static void cap11xx_led_work (struct work_struct *work) +static int cap11xx_led_set (struct led_classdev *cdev, +enum led_brightness value) { - struct cap11xx_led *led = container_of(work, struct cap11xx_led, work); + struct cap11xx_led *led = container_of(cdev, struct cap11xx_led, cdev);struct cap11xx_priv *priv = led->priv; -int value = led->new_brightness;/* -* All LEDs share the same duty cycle as this is a HW limitation. -* Brightness levels per LED are either 0 (OFF) and 1 (ON). +* All LEDs share the same duty cycle as this is a HW +* limitation. Brightness levels per LED are either +* 0 (OFF) and 1 (ON). */ -regmap_update_bits (priv->regmap,CAP11XX_REG_LED_OUTPUT_CONTROL , -BIT (led->reg), value ?BIT (led->reg) :0 ); -} - -static void cap11xx_led_set (struct led_classdev *cdev, -enum led_brightness value) -{ - struct cap11xx_led *led = container_of(cdev, struct cap11xx_led, cdev); - -if (led->new_brightness == value) -return ; - - led->new_brightness = value; -schedule_work (&led->work); +return regmap_update_bits (priv->regmap, +CAP11XX_REG_LED_OUTPUT_CONTROL , +BIT (led->reg), + value ?BIT (led->reg) :0 ); } static int cap11xx_init_leds(struct device *dev,
@@ -299,7 +288,7 @@ static int cap11xx_init_leds(struct device *dev, led->cdev.default_trigger =of_get_property (child,"linux,default-trigger" ,NULL ); led->cdev.flags =0 ; - led->cdev.brightness_set = cap11xx_led_set; + led->cdev.brightness_set_blocking = cap11xx_led_set; led->cdev.max_brightness =1 ; led->cdev.brightness =LED_OFF ;
@@ -312,8 +301,6 @@ static int cap11xx_init_leds(struct device *dev, led->reg = reg; led->priv = priv; -INIT_WORK (&led->work, cap11xx_led_work); - error =devm_led_classdev_register (dev, &led->cdev);if (error) {of_node_put (child);
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 6/12 Input: matrix_keypad - use flush_delayed_work()
In reply to Sasha LevinFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a342083abe576db43594a32d458a61fa81f7cb32 ]
We should be using flush_delayed_work() instead of flush_work() in matrix_keypad_stop() to ensure that we are not missing work that is scheduled but not yet put in the workqueue (i.e. its delay timer has not expired yet).
--- drivers/input/keyboard/matrix_keypad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/matrix_keypad.c +1 -1
@@ -220,7 +220,7 @@ static void matrix_keypad_stop(struct input_dev *dev) keypad->stopped = true;spin_unlock_irq (&keypad->lock); -flush_work (&keypad->work.work); +flush_delayed_work (&keypad->work);/* * matrix_keypad_scan() will leave IRQs enabled; * we should disable them now.
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 7/12 floppy: check_events callback should not return a negative number
In reply to Sasha LevinFrom: Yufen Yu <[email protected]>
[ Upstream commit 96d7cb932e826219ec41ac02e5af037ffae6098c ]
floppy_check_events() is supposed to return bit flags to say which events occured. We should return zero to say that no event flags are set. Only BIT(0) and BIT(1) are used in the caller. And .check_events interface also expect to return an unsigned int value.
However, after commit a0c80efe5956, it may return -EINTR (-4u). Here, both BIT(0) and BIT(1) are cleared. So this patch shouldn't affect runtime, but it obviously is still worth fixing.
--- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/floppy.c +1 -1
@@ -3752,7 +3752,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,if (time_after (jiffies,UDRS ->last_checked +UDP ->checkfreq)) {if (lock_fdc (drive)) -return -EINTR ; +return 0 ;poll_drive (false,0 );process_fd_request (); }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 8/12 mm/gup: fix gup_pmd_range() for dax
In reply to Sasha LevinFrom: Yu Zhao <[email protected]>
[ Upstream commit 414fd080d125408cb15d04ff4907e1dd8145c8c7 ]
For dax pmd, pmd_trans_huge() returns false but pmd_huge() returns true on x86. So the function works as long as hugetlb is configured. However, dax doesn't depend on hugetlb.
--- mm/gup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/gup.c +2 -1
@@ -1423,7 +1423,8 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,if (pmd_none (pmd))return 0 ; -if (unlikely (pmd_trans_huge (pmd) ||pmd_huge (pmd))) { +if (unlikely (pmd_trans_huge (pmd) ||pmd_huge (pmd) || +pmd_devmap (pmd))) {/* * NUMA hinting faults need to be handled in the GUP * slowpath for accounting purposes and so that they
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 9/12 mm: page_alloc: fix ref bias in page_frag_alloc() for 1-byte allocs
In reply to Sasha LevinFrom: Jann Horn <[email protected]>
[ Upstream commit 2c2ade81741c66082f8211f0b96cf509cc4c0218 ]
The basic idea behind ->pagecnt_bias is: If we pre-allocate the maximum number of references that we might need to create in the fastpath later, the bump-allocation fastpath only has to modify the non-atomic bias value that tracks the number of extra references we hold instead of the atomic refcount. The maximum number of allocations we can serve (under the assumption that no allocation is made with size 0) is nc->size, so that's the bias used.
However, even when all memory in the allocation has been given away, a reference to the page is still held; and in the offset < 0 slowpath, the page may be reused if everyone else has dropped their references. This means that the necessary number of references is actually nc->size+1.
Luckily, from a quick grep, it looks like the only path that can call page_frag_alloc(fragsz=1) is TAP with the IFF_NAPI_FRAGS flag, which requires CAP_NET_ADMIN in the init namespace and is only intended to be used for kernel testing and fuzzing.
To test for this issue, put a WARN_ON(page_ref_count(page) == 0) in the offset < 0 path, below the virt_to_page() call, and then repeatedly call writev() on a TAP device with IFF_TAP|IFF_NO_PI|IFF_NAPI_FRAGS|IFF_NAPI, with a vector consisting of 15 elements containing 1 byte each.
--- mm/page_alloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/page_alloc.c +4 -4
@@ -3955,11 +3955,11 @@ void *__alloc_page_frag(struct page_frag_cache *nc,/* Even if we own the page, we do not use atomic_set(). * This would break get_page_unless_zero() users. */ -page_ref_add (page, size -1 ); +page_ref_add (page, size);/* reset page count bias and offset to start of new frag */ nc->pfmemalloc =page_is_pfmemalloc (page); - nc->pagecnt_bias = size; + nc->pagecnt_bias = size +1 ; nc->offset = size; }
@@ -3975,10 +3975,10 @@ void *__alloc_page_frag(struct page_frag_cache *nc, size = nc->size;#endif /* OK, page count is 0, we can safely set it */ -set_page_count (page, size); +set_page_count (page, size +1 );/* reset page count bias and offset to start of new frag */ - nc->pagecnt_bias = size; + nc->pagecnt_bias = size +1 ; offset = size - fragsz; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 10/12 net: hns: Fix object reference leaks in hns_dsaf_roce_reset()
In reply to Sasha LevinFrom: Huang Zijiang <[email protected]>
[ Upstream commit c969c6e7ab8cb42b5c787c567615474fdbad9d6a ]
The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference.
--- drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c +2 -0
@@ -2820,6 +2820,7 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset) dsaf_dev =dev_get_drvdata (&pdev->dev);if (!dsaf_dev) {dev_err (&pdev->dev,"dsaf_dev is NULL\n" ); +put_device (&pdev->dev);return -ENODEV ; }
@@ -2827,6 +2828,7 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)if (AE_IS_VER1 (dsaf_dev->dsaf_ver)) {dev_err (dsaf_dev->dev,"%s v1 chip doesn't support RoCE!\n" , dsaf_dev->ae_dev.name); +put_device (&pdev->dev);return -ENODEV ; }
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 11/12 i2c: cadence: Fix the hold bit setting
In reply to Sasha LevinFrom: Shubhrajyoti Datta <[email protected]>
[ Upstream commit d358def706880defa4c9e87381c5bf086a97d5f9 ]
In case the hold bit is not needed we are carrying the old values. Fix the same by resetting the bit when not needed.
Fixes the sporadic i2c bus lockups on National Instruments Zynq-based devices.
--- drivers/i2c/busses/i2c-cadence.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-cadence.c +7 -2
@@ -382,8 +382,10 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)* Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ -if (id->recv_count >CDNS_I2C_FIFO_DEPTH ) +if ((id->recv_count >CDNS_I2C_FIFO_DEPTH ) || id->bus_hold_flag) ctrl_reg |=CDNS_I2C_CR_HOLD ; +else + ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD ;cdns_i2c_writereg (ctrl_reg,CDNS_I2C_CR_OFFSET );
@@ -440,8 +442,11 @@ static void cdns_i2c_msend(struct cdns_i2c *id)* Check for the message size against FIFO depth and set the * 'hold bus' bit if it is greater than FIFO depth. */ -if (id->send_count >CDNS_I2C_FIFO_DEPTH ) +if ((id->send_count >CDNS_I2C_FIFO_DEPTH ) || id->bus_hold_flag) ctrl_reg |=CDNS_I2C_CR_HOLD ; +else + ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD ; +cdns_i2c_writereg (ctrl_reg,CDNS_I2C_CR_OFFSET );/* Clear the interrupts in interrupt status register. */
Signature · 1 line
2.19.1
Sasha Levin
maintainerPATCH 12/12 Input: st-keyscan - fix potential zalloc NULL dereference
In reply to Sasha LevinFrom: Gabriel Fernandez <[email protected]>
[ Upstream commit 2439d37e1bf8a34d437573c086572abe0f3f1b15 ]
This patch fixes the following static checker warning:
drivers/input/keyboard/st-keyscan.c:156 keyscan_probe()
error: potential zalloc NULL dereference: 'keypad_data->input_dev'
--- drivers/input/keyboard/st-keyscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/keyboard/st-keyscan.c +2 -2
@@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev) input_dev->id.bustype =BUS_HOST ; + keypad_data->input_dev = input_dev; + error =keypad_matrix_key_parse_dt (keypad_data);if (error)return error;
@@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)input_set_drvdata (input_dev, keypad_data); - keypad_data->input_dev = input_dev; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); keypad_data->base =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (keypad_data->base))
Signature · 1 line
2.19.1