5.4.62-rc1 review
Subsystems (2)
Greg Kroah-Hartman
maintainerPATCH 157/214 fbcon: prevent user font height or width change from causing potential out-of-bounds access
In reply to Greg Kroah-HartmanFrom: George Kennedy <[email protected]>
commit 39b3cffb8cf3111738ea993e2757ab382253d86a upstream.
Add a check to fbcon_resize() to ensure that a possible change to user font height or user font width will not allow a font data out-of-bounds access.
NOTE: must use original charcount in calculation as font charcount can change and cannot be used to determine the font data allocated size.
--- drivers/video/fbdev/core/fbcon.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c +23 -2
@@ -2185,6 +2185,9 @@ static void updatescrollmode(struct fbco } } +#define PITCH (w) (((w) + 7) >> 3) +#define CALC_FONTSZ (h, p, c) ((h) * (p) * (c))/* size = height * pitch * charcount */ +static int fbcon_resize (struct vc_data *vc,unsigned int width,unsigned int height,unsigned int user) {
@@ -2194,6 +2197,24 @@ static int fbcon_resize(struct vc_data *struct fb_var_screeninfo var = info->var;int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; +if (ops->p && ops->p->userfont &&FNTSIZE (vc->vc_font.data)) { +int size; +int pitch =PITCH (vc->vc_font.width); + +/* +* If user font, ensure that a possible change to user font +* height or width will not allow a font data out-of-bounds access. +* NOTE: must use original charcount in calculation as font +* charcount can change and cannot be used to determine the +* font data allocated size. +*/ +if (pitch <=0 ) +return -EINVAL ; + size =CALC_FONTSZ (vc->vc_font.height, pitch,FNTCHARCNT (vc->vc_font.data)); +if (size >FNTSIZE (vc->vc_font.data)) +return -EINVAL ; + } + virt_w =FBCON_SWAP (ops->rotate, width, height); virt_h =FBCON_SWAP (ops->rotate, height, width); virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width,
@@ -2645,7 +2666,7 @@ static int fbcon_set_font(struct vc_dataint size;int i, csum;u8 *new_data, *data = font->data; -int pitch = (font->width+7 ) >>3 ; +int pitch =PITCH (font->width);/* Is there a reason why fbconsole couldn't handle any charcount >256? * If not this check should be changed to charcount < 256 */
@@ -2661,7 +2682,7 @@ static int fbcon_set_font(struct vc_dataif (fbcon_invalid_charcount (info, charcount))return -EINVAL ; - size = h * pitch * charcount; + size =CALC_FONTSZ (h, pitch, charcount); new_data =kmalloc (FONT_EXTRA_WORDS *sizeof (int ) + size,GFP_USER );
Greg Kroah-Hartman
maintainerPATCH 158/214 USB: lvtest: return proper error code in probe
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
commit 531412492ce93ea29b9ca3b4eb5e3ed771f851dd upstream.
lvs_rh_probe() can return some nonnegative value from usb_control_msg() when it is less than "USB_DT_HUB_NONVAR_SIZE + 2" that is considered as a failure. Make lvs_rh_probe() return -EINVAL in this case.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/usb/misc/lvstest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/lvstest.c +1 -1
@@ -426,7 +426,7 @@ static int lvs_rh_probe(struct usb_inter USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT);if (ret < (USB_DT_HUB_NONVAR_SIZE +2 )) {dev_err (&hdev->dev,"wrong root hub descriptor read %d\n" , ret); -return ret; +return ret <0 ? ret : -EINVAL ; }/* submit urb to poll interrupt endpoint */
Greg Kroah-Hartman
maintainerPATCH 159/214 vt: defer kfree() of vc_screenbuf in vc_do_resize()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit f8d1653daec02315e06d30246cff4af72e76e54e upstream.
syzbot is reporting UAF bug in set_origin() from vc_do_resize() [1], for vc_do_resize() calls kfree(vc->vc_screenbuf) before calling set_origin().
Unfortunately, in set_origin(), vc->vc_sw->con_set_origin() might access vc->vc_pos when scroll is involved in order to manipulate cursor, but vc->vc_pos refers already released vc->vc_screenbuf until vc->vc_pos gets updated based on the result of vc->vc_sw->con_set_origin().
Preserving old buffer and tolerating outdated vc members until set_origin() completes would be easier than preventing vc->vc_sw->con_set_origin() from accessing outdated vc members.
[1] https://syzkaller.appspot.com/bug?id=6649da2081e2ebdc65c0642c214b27fe91099db3
--- drivers/tty/vt/vt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/vt/vt.c +3 -2
@@ -1196,7 +1196,7 @@ static int vc_do_resize(struct tty_strucunsigned int old_rows, old_row_size, first_copied_row;unsigned int new_cols, new_rows, new_row_size, new_screen_size;unsigned int user; -unsigned short *newscreen; +unsigned short *oldscreen, *newscreen;struct uni_screen *new_uniscr =NULL ;WARN_CONSOLE_UNLOCKED ();
@@ -1294,10 +1294,11 @@ static int vc_do_resize(struct tty_strucif (new_scr_end > new_origin)scr_memsetw ((void *)new_origin, vc->vc_video_erase_char, new_scr_end - new_origin); -kfree (vc->vc_screenbuf); + oldscreen = vc->vc_screenbuf; vc->vc_screenbuf = newscreen; vc->vc_screenbuf_size = new_screen_size;set_origin (vc); +kfree (oldscreen);/* do part of a reset_terminal() */ vc->vc_top =0 ;
Greg Kroah-Hartman
maintainerPATCH 160/214 vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize()
In reply to Greg Kroah-HartmanFrom: George Kennedy <[email protected]>
commit bc5269ca765057a1b762e79a1cfd267cd7bf1c46 upstream.
vc_resize() can return with an error after failure. Change VT_RESIZEX ioctl to save struct vc_data values that are modified and restore the original values in case of error.
--- drivers/tty/vt/vt_ioctl.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/tty/vt/vt_ioctl.c +11 -1
@@ -893,12 +893,22 @@ int vt_ioctl(struct tty_struct *tty,console_lock (); vcp = vc_cons[i].d;if (vcp) { +int ret; +int save_scan_lines = vcp->vc_scan_lines; +int save_font_height = vcp->vc_font.height; +if (v.v_vlin) vcp->vc_scan_lines = v.v_vlin;if (v.v_clin) vcp->vc_font.height = v.v_clin; vcp->vc_resize_user =1 ; -vc_resize (vcp, v.v_cols, v.v_rows); + ret =vc_resize (vcp, v.v_cols, v.v_rows); +if (ret) { + vcp->vc_scan_lines = save_scan_lines; + vcp->vc_font.height = save_font_height; +console_unlock (); +return ret; + } }console_unlock (); }
Greg Kroah-Hartman
maintainerPATCH 161/214 serial: samsung: Removes the IRQ not found warning
In reply to Greg Kroah-HartmanFrom: Tamseel Shams <[email protected]>
commit 8c6c378b0cbe0c9f1390986b5f8ffb5f6ff7593b upstream.
In few older Samsung SoCs like s3c2410, s3c2412 and s3c2440, UART IP is having 2 interrupt lines. However, in other SoCs like s3c6400, s5pv210, exynos5433, and exynos4210 UART is having only 1 interrupt line. Due to this, "platform_get_irq(platdev, 1)" call in the driver gives the following false-positive error:
"IRQ index 1 not found" on newer SoC's.
This patch adds the condition to check for Tx interrupt only for the those SoC's which have 2 interrupt lines.
--- drivers/tty/serial/samsung.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/serial/samsung.c +5 -3
@@ -1791,9 +1791,11 @@ static int s3c24xx_serial_init_port(stru ourport->tx_irq = ret +1 ; } - ret =platform_get_irq (platdev,1 ); -if (ret >0 ) - ourport->tx_irq = ret; +if (!s3c24xx_serial_has_interrupt_mask (port)) { + ret =platform_get_irq (platdev,1 ); +if (ret >0 ) + ourport->tx_irq = ret; + }/* * DMA is currently supported only on DT platforms, if DMA properties * are specified.
Greg Kroah-Hartman
maintainerPATCH 162/214 serial: pl011: Fix oops on -EPROBE_DEFER
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 27afac93e3bd7fa89749cf11da5d86ac9cde4dba upstream.
If probing of a pl011 gets deferred until after free_initmem(), an oops ensues because pl011_console_match() is called which has been freed.
Fix by removing the __init attribute from the function and those it calls.
Commit 10879ae5f12e ("serial: pl011: add console matching function") introduced pl011_console_match() not just for early consoles but regular preferred consoles, such as those added by acpi_parse_spcr(). Regular consoles may be registered after free_initmem() for various reasons, one being deferred probing, another being dynamic enablement of serial ports using a DeviceTree overlay.
Thus, pl011_console_match() must not be declared __init and the functions it calls mustn't either.
Stack trace for posterity:
Unable to handle kernel paging request at virtual address 80c38b58 Internal error: Oops: 8000000d [#1] PREEMPT SMP ARM PC is at pl011_console_match+0x0/0xfc LR is at register_console+0x150/0x468
[<80187004>] (register_console)
[<805a8184>] (uart_add_one_port)
[<805b2b68>] (pl011_register_port)
[<805b3ce4>] (pl011_probe)
[<80569214>] (amba_probe)
[<805ca088>] (really_probe)
[<805ca2ec>] (driver_probe_device)
[<805ca5b0>] (__device_attach_driver)
[<805c8060>] (bus_for_each_drv)
[<805c9dfc>] (__device_attach)
[<805ca630>] (device_initial_probe)
[<805c90a8>] (bus_probe_device)
[<805c95a8>] (deferred_probe_work_func)
--- drivers/tty/serial/amba-pl011.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/tty/serial/amba-pl011.c +5 -6
@@ -2252,9 +2252,8 @@ pl011_console_write(struct console *co,clk_disable (uap->clk); } -static void __init -pl011_console_get_options (struct uart_amba_port *uap,int *baud, -int *parity,int *bits) +static void pl011_console_get_options (struct uart_amba_port *uap,int *baud, +int *parity,int *bits) {if (pl011_read (uap,REG_CR ) & UART01x_CR_UARTEN) {unsigned int lcr_h, ibrd, fbrd;
@@ -2287,7 +2286,7 @@ pl011_console_get_options(struct uart_am } } -static int __init pl011_console_setup (struct console *co,char *options) +static int pl011_console_setup (struct console *co,char *options) {struct uart_amba_port *uap;int baud =38400 ;
@@ -2355,8 +2354,8 @@ static int __init pl011_console_setup(st* * Returns 0 if console matches; otherwise non-zero to use default matching */ -static int __init pl011_console_match (struct console *co,char *name,int idx, -char *options) +static int pl011_console_match (struct console *co,char *name,int idx, +char *options) {unsigned char iotype;resource_size_t addr;
Greg Kroah-Hartman
maintainerPATCH 163/214 serial: pl011: Dont leak amba_ports entry on driver register error
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit 89efbe70b27dd325d8a8c177743a26b885f7faec upstream.
pl011_probe() calls pl011_setup_port() to reserve an amba_ports[] entry, then calls pl011_register_port() to register the uart driver with the tty layer.
If registration of the uart driver fails, the amba_ports[] entry is not released. If this happens 14 times (value of UART_NR macro), then all amba_ports[] entries will have been leaked and driver probing is no longer possible. (To be fair, that can only happen if the DeviceTree doesn't contain alias IDs since they cause the same entry to be used for
a given port.) Fix it.
--- drivers/tty/serial/amba-pl011.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/amba-pl011.c +4 -1
@@ -2593,7 +2593,7 @@ static int pl011_setup_port(struct devicstatic int pl011_register_port (struct uart_amba_port *uap) { -int ret; +int ret, i;/* Ensure interrupts from this UART are masked and cleared */ pl011_write (0 , uap,REG_IMSC );
@@ -2604,6 +2604,9 @@ static int pl011_register_port(struct uaif (ret <0 ) {dev_err (uap->port.dev,"Failed to register AMBA-PL011 driver\n" ); +for (i =0 ; i <ARRAY_SIZE (amba_ports); i++) +if (amba_ports[i] == uap) + amba_ports[i] =NULL ;return ret; } }
Greg Kroah-Hartman
maintainerPATCH 164/214 serial: stm32: avoid kernel warning on absence of optional IRQ
In reply to Greg Kroah-HartmanFrom: Holger Assmann <[email protected]>
commit fdf16d78941b4f380753053d229955baddd00712 upstream.
stm32_init_port() of the stm32-usart may trigger a warning in platform_get_irq() when the device tree specifies no wakeup interrupt.
The wakeup interrupt is usually a board-specific GPIO and the driver functions correctly in its absence. The mainline stm32mp151.dtsi does not specify it, so all mainline device trees trigger an unnecessary kernel warning. Use of platform_get_irq_optional() avoids this.
--- drivers/tty/serial/stm32-usart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/stm32-usart.c +1 -1
@@ -937,7 +937,7 @@ static int stm32_init_port(struct stm32_stm32_init_rs485 (port, pdev);if (stm32port->info->cfg.has_wakeup) { - stm32port->wakeirq =platform_get_irq (pdev,1 ); + stm32port->wakeirq =platform_get_irq_optional (pdev,1 );if (stm32port->wakeirq <=0 && stm32port->wakeirq != -ENXIO )return stm32port->wakeirq ? : -ENODEV ; }
Greg Kroah-Hartman
maintainerPATCH 165/214 serial: 8250_exar: Fix number of ports for Commtech PCIe cards
In reply to Greg Kroah-HartmanFrom: Valmer Huhn <[email protected]>
commit c6b9e95dde7b54e6a53c47241201ab5a4035c320 upstream.
The following in 8250_exar.c line 589 is used to determine the number of ports for each Exar board:
nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
If the number of ports a card has is not explicitly specified, it defaults to the rightmost 4 bits of the PCI device ID. This is prone to error since not all PCI device IDs contain a number which corresponds to the number of ports that card provides.
This particular case involves COMMTECH_4222PCIE, COMMTECH_4224PCIE and COMMTECH_4228PCIE cards with device IDs 0x0022, 0x0020 and 0x0021. Currently the multiport cards receive 2, 0 and 1 port instead of 2, 4 and 8 ports respectively.
To fix this, each Commtech Fastcom PCIe card is given a struct where the number of ports is explicitly specified. This ensures 'board->num_ports' is used instead of the default 'pcidev->device & 0x0f'.
--- drivers/tty/serial/8250/8250_exar.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250_exar.c +21 -3
@@ -725,6 +725,24 @@ static const struct exar8250_board pbn_e .exit = pci_xr17v35x_exit, }; +static const struct exar8250_board pbn_fastcom35x_2 = { + .num_ports =2 , + .setup = pci_xr17v35x_setup, + .exit = pci_xr17v35x_exit, +}; + +static const struct exar8250_board pbn_fastcom35x_4 = { + .num_ports =4 , + .setup = pci_xr17v35x_setup, + .exit = pci_xr17v35x_exit, +}; + +static const struct exar8250_board pbn_fastcom35x_8 = { + .num_ports =8 , + .setup = pci_xr17v35x_setup, + .exit = pci_xr17v35x_exit, +}; +static const struct exar8250_board pbn_exar_XR17V4358 = { .num_ports =12 , .setup = pci_xr17v35x_setup,
@@ -795,9 +813,9 @@ static const struct pci_device_id exar_pEXAR_DEVICE (EXAR ,EXAR_XR17V358 , pbn_exar_XR17V35x),EXAR_DEVICE (EXAR ,EXAR_XR17V4358 , pbn_exar_XR17V4358),EXAR_DEVICE (EXAR ,EXAR_XR17V8358 , pbn_exar_XR17V8358), -EXAR_DEVICE (COMMTECH ,COMMTECH_4222PCIE , pbn_exar_XR17V35x), -EXAR_DEVICE (COMMTECH ,COMMTECH_4224PCIE , pbn_exar_XR17V35x), -EXAR_DEVICE (COMMTECH ,COMMTECH_4228PCIE , pbn_exar_XR17V35x), +EXAR_DEVICE (COMMTECH ,COMMTECH_4222PCIE , pbn_fastcom35x_2), +EXAR_DEVICE (COMMTECH ,COMMTECH_4224PCIE , pbn_fastcom35x_4), +EXAR_DEVICE (COMMTECH ,COMMTECH_4228PCIE , pbn_fastcom35x_8),EXAR_DEVICE (COMMTECH ,COMMTECH_4222PCI335 , pbn_fastcom335_2), EXAR_DEVICE(COMMTECH, COMMTECH_4224PCI335, pbn_fastcom335_4),
Greg Kroah-Hartman
maintainerPATCH 166/214 serial: 8250: change lock order in serial8250_do_startup()
In reply to Greg Kroah-HartmanFrom: Sergey Senozhatsky <[email protected]>
commit 205d300aea75623e1ae4aa43e0d265ab9cf195fd upstream.
We have a number of "uart.port->desc.lock vs desc.lock->uart.port" lockdep reports coming from 8250 driver; this causes a bit of trouble to people, so let's fix it.
The problem is reverse lock order in two different call paths:
chain #1:
serial8250_do_startup()
spin_lock_irqsave(&port->lock);
disable_irq_nosync(port->irq);
raw_spin_lock_irqsave(&desc->lock)chain #2:
__report_bad_irq()
raw_spin_lock_irqsave(&desc->lock)
for_each_action_of_desc()
printk()
spin_lock_irqsave(&port->lock);Fix this by changing the order of locks in serial8250_do_startup():
do disable_irq_nosync() first, which grabs desc->lock, and grab uart->port after that, so that chain #1 and chain #2 have same lock order.
Full lockdep splat:
======================================================
WARNING: possible circular locking dependency detected 5.4.39 #55 Not tainted
======================================================
swapper/0/0 is trying to acquire lock:
ffffffffab65b6c0 (console_owner){-...}, at: console_lock_spinning_enable+0x31/0x57
but task is already holding lock:
ffff88810a8e34c0 (&irq_desc_lock_class){-.-.}, at: __report_bad_irq+0x5b/0xba
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&irq_desc_lock_class){-.-.}:
_raw_spin_lock_irqsave+0x61/0x8d
__irq_get_desc_lock+0x65/0x89
__disable_irq_nosync+0x3b/0x93
serial8250_do_startup+0x451/0x75c
uart_startup+0x1b4/0x2ff
uart_port_activate+0x73/0xa0
tty_port_open+0xae/0x10a
uart_open+0x1b/0x26
tty_open+0x24d/0x3a0
chrdev_open+0xd5/0x1cc
do_dentry_open+0x299/0x3c8
path_openat+0x434/0x1100
do_filp_open+0x9b/0x10a
do_sys_open+0x15f/0x3d7
kernel_init_freeable+0x157/0x1dd
kernel_init+0xe/0x105
ret_from_fork+0x27/0x50-> #1 (&port_lock_key){-.-.}:
_raw_spin_lock_irqsave+0x61/0x8d
serial8250_console_write+0xa7/0x2a0
console_unlock+0x3b7/0x528
vprintk_emit+0x111/0x17f
printk+0x59/0x73
register_console+0x336/0x3a4
uart_add_one_port+0x51b/0x5be
serial8250_register_8250_port+0x454/0x55e
dw8250_probe+0x4dc/0x5b9
platform_drv_probe+0x67/0x8b
really_probe+0x14a/0x422
driver_probe_device+0x66/0x130
device_driver_attach+0x42/0x5b
__driver_attach+0xca/0x139
bus_for_each_dev+0x97/0xc9
bus_add_driver+0x12b/0x228
driver_register+0x64/0xed
do_one_initcall+0x20c/0x4a6
do_initcall_level+0xb5/0xc5
do_basic_setup+0x4c/0x58
kernel_init_freeable+0x13f/0x1dd
kernel_init+0xe/0x105
ret_from_fork+0x27/0x50-> #0 (console_owner){-...}:
__lock_acquire+0x118d/0x2714
lock_acquire+0x203/0x258
console_lock_spinning_enable+0x51/0x57
console_unlock+0x25d/0x528
vprintk_emit+0x111/0x17f
printk+0x59/0x73
__report_bad_irq+0xa3/0xba
note_interrupt+0x19a/0x1d6
handle_irq_event_percpu+0x57/0x79
handle_irq_event+0x36/0x55
handle_fasteoi_irq+0xc2/0x18a
do_IRQ+0xb3/0x157
ret_from_intr+0x0/0x1d
cpuidle_enter_state+0x12f/0x1fd
cpuidle_enter+0x2e/0x3d
do_idle+0x1ce/0x2ce
cpu_startup_entry+0x1d/0x1f
start_kernel+0x406/0x46a
secondary_startup_64+0xa4/0xb0other info that might help us debug this:
Chain exists of: console_owner --> &port_lock_key --> &irq_desc_lock_class Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&irq_desc_lock_class);
lock(&port_lock_key);
lock(&irq_desc_lock_class); lock(console_owner);
*** DEADLOCK ***
2 locks held by swapper/0/0:
#0: ffff88810a8e34c0 (&irq_desc_lock_class){-.-.}, at: __report_bad_irq+0x5b/0xba #1: ffffffffab65b5c0 (console_lock){+.+.}, at: console_trylock_spinning+0x20/0x181
stack backtrace: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.39 #55 Hardware name: XXXXXX Call Trace: <IRQ> dump_stack+0xbf/0x133 ? print_circular_bug+0xd6/0xe9 check_noncircular+0x1b9/0x1c3 __lock_acquire+0x118d/0x2714 lock_acquire+0x203/0x258 ? console_lock_spinning_enable+0x31/0x57 console_lock_spinning_enable+0x51/0x57 ? console_lock_spinning_enable+0x31/0x57 console_unlock+0x25d/0x528 ? console_trylock+0x18/0x4e vprintk_emit+0x111/0x17f ? lock_acquire+0x203/0x258 printk+0x59/0x73 __report_bad_irq+0xa3/0xba note_interrupt+0x19a/0x1d6 handle_irq_event_percpu+0x57/0x79 handle_irq_event+0x36/0x55 handle_fasteoi_irq+0xc2/0x18a do_IRQ+0xb3/0x157 common_interrupt+0xf/0xf </IRQ>
--- drivers/tty/serial/8250/8250_port.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/tty/serial/8250/8250_port.c +6 -3
@@ -2198,6 +2198,10 @@ int serial8250_do_startup(struct uart_poif (port->irq && !(up->port.flags &UPF_NO_THRE_TEST )) {unsigned char iir1; + +if (port->irqflags &IRQF_SHARED ) +disable_irq_nosync (port->irq); +/* * Test for UARTs that do not reassert THRE when the * transmitter is idle and the interrupt has already
@@ -2207,8 +2211,6 @@ int serial8250_do_startup(struct uart_po* allow register changes to become visible. */ spin_lock_irqsave (&port->lock, flags); -if (up->port.irqflags &IRQF_SHARED ) -disable_irq_nosync (port->irq);wait_for_xmitr (up,UART_LSR_THRE );serial_port_out_sync (port,UART_IER ,UART_IER_THRI );
@@ -2220,9 +2222,10 @@ int serial8250_do_startup(struct uart_po iir =serial_port_in (port,UART_IIR );serial_port_out (port,UART_IER ,0 ); +spin_unlock_irqrestore (&port->lock, flags); +if (port->irqflags &IRQF_SHARED )enable_irq (port->irq); -spin_unlock_irqrestore (&port->lock, flags);/* * If the interrupt is not reasserted, or we otherwise
Greg Kroah-Hartman
maintainerPATCH 167/214 writeback: Protect inode->i_io_list with inode->i_lock
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit b35250c0816c7cf7d0a8de92f5fafb6a7508a708 upstream.
Currently, operations on inode->i_io_list are protected by wb->list_lock. In the following patches we'll need to maintain consistency between inode->i_state and inode->i_io_list so change the code so that inode->i_lock protects also all inode's i_io_list handling.
--- fs/fs-writeback.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
fs/fs-writeback.c +17 -5
@@ -144,6 +144,7 @@ static void inode_io_list_del_locked(str struct bdi_writeback *wb) {assert_spin_locked (&wb->list_lock); +assert_spin_locked (&inode->i_lock);list_del_init (&inode->i_io_list);wb_io_lists_depopulated (wb);
@@ -1123,7 +1124,9 @@ void inode_io_list_del(struct inode *inostruct bdi_writeback *wb; wb =inode_to_wb_and_lock_list (inode); +spin_lock (&inode->i_lock);inode_io_list_del_locked (inode, wb); +spin_unlock (&inode->i_lock);spin_unlock (&wb->list_lock); }
@@ -1172,8 +1175,10 @@ void sb_clear_inode_writeback(struct ino* the case then the inode must have been redirtied while it was being written * out and we don't reset its dirtied_when. */ -static void redirty_tail (struct inode *inode,struct bdi_writeback *wb) +static void redirty_tail_locked (struct inode *inode,struct bdi_writeback *wb) { +assert_spin_locked (&inode->i_lock); +if (!list_empty (&wb->b_dirty)) {struct inode *tail;
@@ -1184,6 +1189,13 @@ static void redirty_tail(struct inode *iinode_io_list_move_locked (inode, wb, &wb->b_dirty); } +static void redirty_tail (struct inode *inode,struct bdi_writeback *wb) +{ +spin_lock (&inode->i_lock); +redirty_tail_locked (inode, wb); +spin_unlock (&inode->i_lock); +} +/* * requeue inode for re-scanning after bdi->b_io list is exhausted. */
@@ -1394,7 +1406,7 @@ static void requeue_inode(struct inode ** writeback is not making progress due to locked * buffers. Skip this inode for now. */ -redirty_tail (inode, wb); +redirty_tail_locked (inode, wb);return ; }
@@ -1414,7 +1426,7 @@ static void requeue_inode(struct inode ** retrying writeback of the dirty page/inode * that cannot be performed immediately. */ -redirty_tail (inode, wb); +redirty_tail_locked (inode, wb); } }else if (inode->i_state &I_DIRTY ) {/*
@@ -1422,7 +1434,7 @@ static void requeue_inode(struct inode ** such as delayed allocation during submission or metadata * updates after data IO completion. */ -redirty_tail (inode, wb); +redirty_tail_locked (inode, wb); }else if (inode->i_state &I_DIRTY_TIME ) { inode->dirtied_when = jiffies;inode_io_list_move_locked (inode, wb, &wb->b_dirty_time);
@@ -1669,8 +1681,8 @@ static long writeback_sb_inodes(struct s*/ spin_lock (&inode->i_lock);if (inode->i_state & (I_NEW |I_FREEING |I_WILL_FREE )) { +redirty_tail_locked (inode, wb);spin_unlock (&inode->i_lock); -redirty_tail (inode, wb);continue ; }if ((inode->i_state &I_SYNC ) && wbc.sync_mode !=WB_SYNC_ALL ) {
Greg Kroah-Hartman
maintainerPATCH 168/214 writeback: Avoid skipping inode writeback
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 5afced3bf28100d81fb2fe7e98918632a08feaf5 upstream.
Inode's i_io_list list head is used to attach inode to several different lists - wb->{b_dirty, b_dirty_time, b_io, b_more_io}. When flush worker prepares a list of inodes to writeback e.g. for sync(2), it moves inodes to b_io list. Thus it is critical for sync(2) data integrity guarantees that inode is not requeued to any other writeback list when inode is queued for processing by flush worker. That's the reason why writeback_single_inode() does not touch i_io_list (unless the inode is completely clean) and why __mark_inode_dirty() does not touch i_io_list if I_SYNC flag is set.
However there are two flaws in the current logic:
1) When inode has only I_DIRTY_TIME set but it is already queued in b_io list due to sync(2), concurrent __mark_inode_dirty(inode, I_DIRTY_SYNC) can still move inode back to b_dirty list resulting in skipping writeback of inode time stamps during sync(2).
2) When inode is on b_dirty_time list and writeback_single_inode() races with __mark_inode_dirty() like:
writeback_single_inode() __mark_inode_dirty(inode, I_DIRTY_PAGES)
inode->i_state |= I_SYNC
__writeback_single_inode()
inode->i_state |= I_DIRTY_PAGES; if (inode->i_state & I_SYNC) bail
if (!(inode->i_state & I_DIRTY_ALL))
- not true so nothing done
We end up with I_DIRTY_PAGES inode on b_dirty_time list and thus standard background writeback will not writeback this inode leading to possible dirty throttling stalls etc. (thanks to Martijn Coenen for this analysis).
Fix these problems by tracking whether inode is queued in b_io or b_more_io lists in a new I_SYNC_QUEUED flag. When this flag is set, we know flush worker has queued inode and we should not touch i_io_list. On the other hand we also know that once flush worker is done with the inode it will requeue the inode to appropriate dirty list. When I_SYNC_QUEUED is not set, __mark_inode_dirty() can (and must) move inode to appropriate dirty list.
--- fs/fs-writeback.c | 17 ++++++++++++----- include/linux/fs.h | 8 ++++++-- 2 files changed, 18 insertions(+), 7 deletions(-)
fs/fs-writeback.c +12 -5
@@ -146,6 +146,7 @@ static void inode_io_list_del_locked(strassert_spin_locked (&wb->list_lock);assert_spin_locked (&inode->i_lock); + inode->i_state &= ~I_SYNC_QUEUED ;list_del_init (&inode->i_io_list);wb_io_lists_depopulated (wb); }
@@ -1187,6 +1188,7 @@ static void redirty_tail_locked(struct i inode->dirtied_when = jiffies; }inode_io_list_move_locked (inode, wb, &wb->b_dirty); + inode->i_state &= ~I_SYNC_QUEUED ; }static void redirty_tail (struct inode *inode,struct bdi_writeback *wb)
@@ -1262,8 +1264,11 @@ static int move_expired_inodes(struct libreak ;list_move (&inode->i_io_list, &tmp); moved++; +spin_lock (&inode->i_lock);if (flags &EXPIRE_DIRTY_ATIME ) -set_bit (__I_DIRTY_TIME_EXPIRED, &inode->i_state); + inode->i_state |=I_DIRTY_TIME_EXPIRED ; + inode->i_state |=I_SYNC_QUEUED ; +spin_unlock (&inode->i_lock);if (sb_is_blkdev_sb (inode->i_sb))continue ;if (sb && sb != inode->i_sb)
@@ -1438,6 +1443,7 @@ static void requeue_inode(struct inode * }else if (inode->i_state &I_DIRTY_TIME ) { inode->dirtied_when = jiffies;inode_io_list_move_locked (inode, wb, &wb->b_dirty_time); + inode->i_state &= ~I_SYNC_QUEUED ; }else {/* The inode is clean. Remove from writeback lists. */ inode_io_list_del_locked (inode, wb);
@@ -2301,11 +2307,12 @@ void __mark_inode_dirty(struct inode *in inode->i_state |= flags;/* -* If the inode is being synced, just update its dirty state. -* The unlocker will place the inode on the appropriate -* superblock list, based upon its state. +* If the inode is queued for writeback by flush worker, just +* update its dirty state. Once the flush worker is done with +* the inode it will place it on the appropriate superblock +* list, based upon its state. */ -if (inode->i_state &I_SYNC ) +if (inode->i_state &I_SYNC_QUEUED ) goto out_unlock_inode;/*
include/linux/fs.h +6 -2
@@ -2140,6 +2140,10 @@ static inline void init_sync_kiocb(struc* * I_CREATING New object's inode in the middle of setting up. * +* I_SYNC_QUEUED Inode is queued in b_io or b_more_io writeback lists. +* Used to detect that mark_inode_dirty() should not move +* inode between dirty lists. +* * Q: What is the difference between I_WILL_FREE and I_FREEING? */ #define I_DIRTY_SYNC (1 << 0)
@@ -2157,11 +2161,11 @@ static inline void init_sync_kiocb(struc#define I_DIO_WAKEUP (1 << __I_DIO_WAKEUP)#define I_LINKABLE (1 << 10)#define I_DIRTY_TIME (1 << 11) -#define __I_DIRTY_TIME_EXPIRED 12 -#define I_DIRTY_TIME_EXPIRED (1 << __I_DIRTY_TIME_EXPIRED) +#define I_DIRTY_TIME_EXPIRED (1 << 12)#define I_WB_SWITCH (1 << 13)#define I_OVL_INUSE (1 << 14)#define I_CREATING (1 << 15) +#define I_SYNC_QUEUED (1 << 17)#define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)#define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
Greg Kroah-Hartman
maintainerPATCH 169/214 writeback: Fix sync livelock due to b_dirty_time processing
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit f9cae926f35e8230330f28c7b743ad088611a8de upstream.
When we are processing writeback for sync(2), move_expired_inodes() didn't set any inode expiry value (older_than_this). This can result in writeback never completing if there's steady stream of inodes added to b_dirty_time list as writeback rechecks dirty lists after each writeback round whether there's more work to be done. Fix the problem by using sync(2) start time is inode expiry value when processing b_dirty_time list similarly as for ordinarily dirtied inodes. This requires some refactoring of older_than_this handling which simplifies the code noticeably as a bonus.
--- fs/fs-writeback.c | 44 +++++++++++++++------------------------ include/trace/events/writeback.h | 13 +++++------ 2 files changed, 23 insertions(+), 34 deletions(-)
fs/fs-writeback.c +17 -27
@@ -42,7 +42,6 @@struct wb_writeback_work {long nr_pages;struct super_block *sb; -unsigned long *older_than_this;enum writeback_sync_modes sync_mode;unsigned int tagged_writepages:1 ;unsigned int for_kupdate:1 ;
@@ -1234,16 +1233,13 @@ static bool inode_dirtied_after(struct i#define EXPIRE_DIRTY_ATIME 0x0001/* -* Move expired (dirtied before work->older_than_this) dirty inodes from +* Move expired (dirtied before dirtied_before) dirty inodes from * @delaying_queue to @dispatch_queue. */ static int move_expired_inodes (struct list_head *delaying_queue,struct list_head *dispatch_queue, -int flags, -struct wb_writeback_work *work) +int flags,unsigned long dirtied_before) { -unsigned long *older_than_this =NULL ; -unsigned long expire_time;LIST_HEAD (tmp);struct list_head *pos, *node;struct super_block *sb =NULL ;
@@ -1251,16 +1247,9 @@ static int move_expired_inodes(struct liint do_sb_sort =0 ;int moved =0 ; -if ((flags &EXPIRE_DIRTY_ATIME ) ==0 ) - older_than_this = work->older_than_this; -else if (!work->for_sync) { - expire_time = jiffies - (dirtytime_expire_interval *HZ ); - older_than_this = &expire_time; - }while (!list_empty (delaying_queue)) { inode =wb_inode (delaying_queue->prev); -if (older_than_this && -inode_dirtied_after (inode, *older_than_this)) +if (inode_dirtied_after (inode, dirtied_before))break ;list_move (&inode->i_io_list, &tmp); moved++;
@@ -1306,18 +1295,22 @@ out:* | * +--> dequeue for IO */ -static void queue_io (struct bdi_writeback *wb,struct wb_writeback_work *work) +static void queue_io (struct bdi_writeback *wb,struct wb_writeback_work *work, +unsigned long dirtied_before) {int moved; +unsigned long time_expire_jif = dirtied_before;assert_spin_locked (&wb->list_lock);list_splice_init (&wb->b_more_io, &wb->b_io); - moved =move_expired_inodes (&wb->b_dirty, &wb->b_io,0 , work); + moved =move_expired_inodes (&wb->b_dirty, &wb->b_io,0 , dirtied_before); +if (!work->for_sync) + time_expire_jif = jiffies - dirtytime_expire_interval *HZ ; moved +=move_expired_inodes (&wb->b_dirty_time, &wb->b_io, -EXPIRE_DIRTY_ATIME , work); +EXPIRE_DIRTY_ATIME , time_expire_jif);if (moved)wb_io_lists_populated (wb); -trace_writeback_queue_io (wb, work, moved); +trace_writeback_queue_io (wb, work, dirtied_before, moved); }static int write_inode (struct inode *inode,struct writeback_control *wbc)
@@ -1829,7 +1822,7 @@ static long writeback_inodes_wb(struct bblk_start_plug (&plug);spin_lock (&wb->list_lock);if (list_empty (&wb->b_io)) -queue_io (wb, &work); +queue_io (wb, &work, jiffies);__writeback_inodes_wb (wb, &work);spin_unlock (&wb->list_lock);blk_finish_plug (&plug);
@@ -1849,7 +1842,7 @@ static long writeback_inodes_wb(struct b* takes longer than a dirty_writeback_interval interval, then leave a * one-second gap. * -* older_than_this takes precedence over nr_to_write. So we'll only write back +* dirtied_before takes precedence over nr_to_write. So we'll only write back * all dirty pages if they are all attached to "old" mappings. */ static long wb_writeback(struct bdi_writeback *wb,
@@ -1857,14 +1850,11 @@ static long wb_writeback(struct bdi_writ {unsigned long wb_start = jiffies;long nr_pages = work->nr_pages; -unsigned long oldest_jif; +unsigned long dirtied_before = jiffies;struct inode *inode;long progress;struct blk_plug plug; - oldest_jif = jiffies; - work->older_than_this = &oldest_jif; -blk_start_plug (&plug);spin_lock (&wb->list_lock);for (;;) {
@@ -1898,14 +1888,14 @@ static long wb_writeback(struct bdi_writ* safe. */ if (work->for_kupdate) { - oldest_jif = jiffies - + dirtied_before = jiffies -msecs_to_jiffies (dirty_expire_interval *10 ); }else if (work->for_background) - oldest_jif = jiffies; + dirtied_before = jiffies;trace_writeback_start (wb, work);if (list_empty (&wb->b_io)) -queue_io (wb, work); +queue_io (wb, work, dirtied_before);if (work->sb) progress =writeback_sb_inodes (work->sb, wb, work);else
include/trace/events/writeback.h +6 -7
@@ -499,8 +499,9 @@ DEFINE_WBC_EVENT(wbc_writepage); TRACE_EVENT(writeback_queue_io, TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work, + unsigned long dirtied_before, int moved), - TP_ARGS(wb, work, moved), + TP_ARGS(wb, work, dirtied_before, moved), TP_STRUCT__entry( __array(char, name, 32) __field(unsigned long, older)
@@ -510,19 +511,17 @@ TRACE_EVENT(writeback_queue_io, __field(unsigned int, cgroup_ino) ),TP_fast_assign ( - unsigned long *older_than_this = work->older_than_this; strscpy_pad(__entry->name, bdi_dev_name(wb->bdi), 32); - __entry->older = older_than_this ? *older_than_this :0 ; - __entry->age = older_than_this ? - (jiffies - *older_than_this) *1000 /HZ :-1 ; + __entry->older = dirtied_before; + __entry->age = (jiffies - dirtied_before) *1000 /HZ ; __entry->moved = moved; __entry->reason = work->reason; __entry->cgroup_ino =__trace_wb_assign_cgroup (wb); ),TP_printk ("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%u" , __entry->name, - __entry->older,/* older_than_this in jiffies */ - __entry->age,/* older_than_this in relative milliseconds */ + __entry->older,/* dirtied_before in jiffies */ + __entry->age,/* dirtied_before in relative milliseconds */ __entry->moved,__print_symbolic (__entry->reason,WB_WORK_REASON ), __entry->cgroup_ino
Greg Kroah-Hartman
maintainerPATCH 170/214 XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit c330fb1ddc0a922f044989492b7fcca77ee1db46 upstream.
handler data is meant for interrupt handlers and not for storing irq chip specific information as some devices require handler data to store internal per interrupt information, e.g. pinctrl/GPIO chained interrupt handlers.
This obviously creates a conflict of interests and crashes the machine because the XEN pointer is overwritten by the driver pointer.
As the XEN data is not handler specific it should be stored in irqdesc::irq_data::chip_data instead.
A simple sed s/irq_[sg]et_handler_data/irq_[sg]et_chip_data/ cures that.
--- drivers/xen/events/events_base.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/xen/events/events_base.c +8 -8
@@ -155,7 +155,7 @@ int get_evtchn_to_irq(unsigned evtchn)/* Get info for IRQ */ struct irq_info *info_for_irq (unsigned irq) { -return irq_get_handler_data (irq); +return irq_get_chip_data (irq); }/* Constructors for packed IRQ information. */
@@ -376,7 +376,7 @@ static void xen_irq_init(unsigned irq) info->type =IRQT_UNBOUND ; info->refcnt =-1 ; -irq_set_handler_data (irq, info); +irq_set_chip_data (irq, info);list_add_tail (&info->list, &xen_irq_list_head); }
@@ -425,14 +425,14 @@ static int __must_check xen_allocate_irqstatic void xen_free_irq (unsigned irq) { -struct irq_info *info =irq_get_handler_data (irq); +struct irq_info *info =irq_get_chip_data (irq);if (WARN_ON (!info))return ;list_del (&info->list); -irq_set_handler_data (irq,NULL ); +irq_set_chip_data (irq,NULL );WARN_ON (info->refcnt >0 );
@@ -602,7 +602,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);static void __unbind_from_irq (unsigned int irq) {int evtchn =evtchn_from_irq (irq); -struct irq_info *info =irq_get_handler_data (irq); +struct irq_info *info =irq_get_chip_data (irq);if (info->refcnt >0 ) { info->refcnt--;
@@ -1106,7 +1106,7 @@ int bind_ipi_to_irqhandler(enum ipi_vectvoid unbind_from_irqhandler (unsigned int irq,void *dev_id) { -struct irq_info *info =irq_get_handler_data (irq); +struct irq_info *info =irq_get_chip_data (irq);if (WARN_ON (!info))return ;
@@ -1140,7 +1140,7 @@ int evtchn_make_refcounted(unsigned intif (irq ==-1 )return -ENOENT ; - info =irq_get_handler_data (irq); + info =irq_get_chip_data (irq);if (!info)return -ENOENT ;
@@ -1168,7 +1168,7 @@ int evtchn_get(unsigned int evtchn)if (irq ==-1 ) goto done; - info =irq_get_handler_data (irq); + info =irq_get_chip_data (irq);if (!info) goto done;
Greg Kroah-Hartman
maintainerPATCH 171/214 usb: host: xhci: fix ep context print mismatch in debugfs
In reply to Greg Kroah-HartmanFrom: Li Jun <[email protected]>
commit 0077b1b2c8d9ad5f7a08b62fb8524cdb9938388f upstream.
dci is 0 based and xhci_get_ep_ctx() will do ep index increment to get the ep context.
--- drivers/usb/host/xhci-debugfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-debugfs.c +4 -4
@@ -273,7 +273,7 @@ static int xhci_slot_context_show(structstatic int xhci_endpoint_context_show (struct seq_file *s,void *unused) { -int dci; +int ep_index;dma_addr_t dma;struct xhci_hcd *xhci;struct xhci_ep_ctx *ep_ctx;
@@ -282,9 +282,9 @@ static int xhci_endpoint_context_show(st xhci =hcd_to_xhci (bus_to_hcd (dev->udev->bus)); -for (dci =1 ; dci <32 ; dci++) { - ep_ctx =xhci_get_ep_ctx (xhci, dev->out_ctx, dci); - dma = dev->out_ctx->dma + dci *CTX_SIZE (xhci->hcc_params); +for (ep_index =0 ; ep_index <31 ; ep_index++) { + ep_ctx =xhci_get_ep_ctx (xhci, dev->out_ctx, ep_index); + dma = dev->out_ctx->dma + (ep_index +1 ) *CTX_SIZE (xhci->hcc_params); seq_printf(s, "%pad: %s\n", &dma, xhci_decode_ep_context(le32_to_cpu(ep_ctx->ep_info), le32_to_cpu(ep_ctx->ep_info2),
Greg Kroah-Hartman
maintainerPATCH 172/214 xhci: Do warm-reset when both CAS and XDEV_RESUME are set
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit 904df64a5f4d5ebd670801d869ca0a6d6a6e8df6 upstream.
Sometimes re-plugging a USB device during system sleep renders the device useless:
[ 173.418345] xhci_hcd 0000:00:14.0: Get port status 2-4 read: 0x14203e2, return 0x10262 ... [ 176.496485] usb 2-4: Waited 2000ms for CONNECT [ 176.496781] usb usb2-port4: status 0000.0262 after resume, -19 [ 176.497103] usb 2-4: can't resume, status -19 [ 176.497438] usb usb2-port4: logical disconnect
Because PLS equals to XDEV_RESUME, xHCI driver reports U3 to usbcore, despite of CAS bit is flagged.
So proritize CAS over XDEV_RESUME to let usbcore handle warm-reset for the port.
--- drivers/usb/host/xhci-hub.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/usb/host/xhci-hub.c +10 -9
@@ -738,15 +738,6 @@ static void xhci_hub_report_usb3_link_st {u32 pls = status_reg &PORT_PLS_MASK ; -/* resume state is a xHCI internal state. -* Do not report it to usb core, instead, pretend to be U3, -* thus usb core knows it's not ready for transfer -*/ -if (pls ==XDEV_RESUME ) { - *status |=USB_SS_PORT_LS_U3 ; -return ; - } -/* When the CAS bit is set then warm reset * should be performed on port */
@@ -769,6 +760,16 @@ static void xhci_hub_report_usb3_link_st pls |=USB_PORT_STAT_CONNECTION ; }else {/* +* Resume state is an xHCI internal state. Do not report it to +* usb core, instead, pretend to be U3, thus usb core knows +* it's not ready for transfer. +*/ +if (pls ==XDEV_RESUME ) { + *status |=USB_SS_PORT_LS_U3 ; +return ; + } + +/* * If CAS bit isn't set but the Port is already at * Compliance Mode, fake a connection so the USB core * notices the Compliance state and resets the port.
Greg Kroah-Hartman
maintainerPATCH 173/214 xhci: Always restore EP_SOFT_CLEAR_TOGGLE even if ep reset failed
In reply to Greg Kroah-HartmanFrom: Ding Hui <[email protected]>
commit f1ec7ae6c9f8c016db320e204cb519a1da1581b8 upstream.
Some device drivers call libusb_clear_halt when target ep queue is not empty. (eg. spice client connected to qemu for usb redir)
Before commit f5249461b504 ("xhci: Clear the host side toggle manually when endpoint is soft reset"), that works well. But now, we got the error log:
EP not empty, refuse reset
xhci_endpoint_reset failed and left ep_state's EP_SOFT_CLEAR_TOGGLE bit still set
So all the subsequent urb sumbits to the ep will fail with the warn log:
Can't enqueue URB while manually clearing toggle
We need to clear ep_state EP_SOFT_CLEAR_TOGGLE bit after xhci_endpoint_reset, even if it failed.
--- drivers/usb/host/xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +2 -1
@@ -3236,10 +3236,11 @@ static void xhci_endpoint_reset(struct uwait_for_completion (cfg_cmd->completion); - ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE ;xhci_free_command (xhci, cfg_cmd); cleanup:xhci_free_command (xhci, stop_cmd); +if (ep->ep_state &EP_SOFT_CLEAR_TOGGLE ) + ep->ep_state &= ~EP_SOFT_CLEAR_TOGGLE ; } static int xhci_check_streams_endpoint(struct xhci_hcd *xhci,
Greg Kroah-Hartman
maintainerPATCH 174/214 arm64: vdso32: make vdso32 install conditional
In reply to Greg Kroah-HartmanFrom: Frank van der Linden <[email protected]>
commit 5d28ba5f8a0cfa3a874fa96c33731b8fcd141b3a upstream.
vdso32 should only be installed if CONFIG_COMPAT_VDSO is enabled, since it's not even supposed to be compiled otherwise, and arm64 builds without a 32bit crosscompiler will fail.
--- arch/arm64/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/Makefile +2 -1
@@ -146,7 +146,8 @@ zinstall install: PHONY += vdso_install vdso_install: $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ - $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@ + $(if $(CONFIG_COMPAT_VDSO), \ + $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) # We use MRPROPER_FILES and CLEAN_FILES now archclean:
Greg Kroah-Hartman
maintainerPATCH 175/214 PM: sleep: core: Fix the handling of pending runtime resume requests
In reply to Greg Kroah-HartmanFrom: Rafael J. Wysocki <[email protected]>
commit e3eb6e8fba65094328b8dca635d00de74ba75b45 upstream.
It has been reported that system-wide suspend may be aborted in the absence of any wakeup events due to unforseen interactions of it with the runtume PM framework.
One failing scenario is when there are multiple devices sharing an ACPI power resource and runtime-resume needs to be carried out for one of them during system-wide suspend (for example, because it needs to be reconfigured before the whole system goes to sleep). In that case, the runtime-resume of that device involves turning the ACPI power resource "on" which in turn causes runtime-resume requests to be queued up for all of the other devices sharing it. Those requests go to the runtime PM workqueue which is frozen during system-wide suspend, so they are not actually taken care of until the resume of the whole system, but the pm_runtime_barrier() call in __device_suspend() sees them and triggers system wakeup events for them which then cause the system-wide suspend to be aborted if wakeup source objects are in active use.
Of course, the logic that leads to triggering those wakeup events is questionable in the first place, because clearly there are cases in which a pending runtime resume request for a device is not connected to any real wakeup events in any way (like the one above). Moreover, it is racy, because the device may be resuming already by the time the pm_runtime_barrier() runs and so if the driver doesn't take care of signaling the wakeup event as appropriate, it will be lost. However, if the driver does take care of that, the extra pm_wakeup_event() call in the core is redundant.
Accordingly, drop the conditional pm_wakeup_event() call fron __device_suspend() and make the latter call pm_runtime_barrier() alone. Also modify the comment next to that call to reflect the new code and extend it to mention the need to avoid unwanted interactions between runtime PM and system-wide device suspend callbacks.
--- drivers/base/power/main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/base/power/main.c +10 -6
@@ -1728,13 +1728,17 @@ static int __device_suspend(struct devic }/* -* If a device configured to wake up the system from sleep states -* has been suspended at run time and there's a resume request pending -* for it, this is equivalent to the device signaling wakeup, so the -* system suspend operation should be aborted. +* Wait for possible runtime PM transitions of the device in progress +* to complete and if there's a runtime resume request pending for it, +* resume it before proceeding with invoking the system-wide suspend +* callbacks for it. +* +* If the system-wide suspend callbacks below change the configuration +* of the device, they must disable runtime PM for it or otherwise +* ensure that its runtime-resume callbacks will not be confused by that +* change in case they are invoked going forward. */ -if (pm_runtime_barrier (dev) &&device_may_wakeup (dev)) -pm_wakeup_event (dev,0 ); +pm_runtime_barrier (dev);if (pm_wakeup_pending ()) { dev->power.direct_complete = false;
Greg Kroah-Hartman
maintainerPATCH 176/214 powerpc/perf: Fix crashes with generic_compat_pmu & BHRB
In reply to Greg Kroah-HartmanFrom: Alexey Kardashevskiy <[email protected]>
commit b460b512417ae9c8b51a3bdcc09020cd6c60ff69 upstream.
The bhrb_filter_map ("The Branch History Rolling Buffer") callback is only defined in raw CPUs' power_pmu structs. The "architected" CPUs use generic_compat_pmu, which does not have this callback, and crashes occur if a user tries to enable branch stack for an event.
This add a NULL pointer check for bhrb_filter_map() which behaves as if the callback returned an error.
This does not add the same check for config_bhrb() as the only caller checks for cpuhw->bhrb_users which remains zero if bhrb_filter_map==0.
--- arch/powerpc/perf/core-book3s.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
arch/powerpc/perf/core-book3s.c +14 -5
@@ -1522,9 +1522,16 @@ nocheck: ret =0 ; out:if (has_branch_stack (event)) { -power_pmu_bhrb_enable (event); - cpuhw->bhrb_filter = ppmu->bhrb_filter_map ( - event->attr.branch_sample_type); +u64 bhrb_filter =-1 ; + +if (ppmu->bhrb_filter_map) + bhrb_filter = ppmu->bhrb_filter_map ( + event->attr.branch_sample_type); + +if (bhrb_filter !=-1 ) { + cpuhw->bhrb_filter = bhrb_filter; +power_pmu_bhrb_enable (event); + } }perf_pmu_enable (event->pmu);
@@ -1846,7 +1853,6 @@ static int power_pmu_event_init(struct pint n;int err;struct cpu_hw_events *cpuhw; -u64 bhrb_filter;if (!ppmu)return -ENOENT ;
@@ -1952,7 +1958,10 @@ static int power_pmu_event_init(struct p err =power_check_constraints (cpuhw, events, cflags, n +1 );if (has_branch_stack (event)) { - bhrb_filter = ppmu->bhrb_filter_map ( +u64 bhrb_filter =-1 ; + +if (ppmu->bhrb_filter_map) + bhrb_filter = ppmu->bhrb_filter_map ( event->attr.branch_sample_type);if (bhrb_filter ==-1 ) {
Greg Kroah-Hartman
maintainerPATCH 177/214 device property: Fix the secondary firmware node handling in set_primary_fwnode()
In reply to Greg Kroah-HartmanFrom: Heikki Krogerus <[email protected]>
commit c15e1bdda4365a5f17cdadf22bf1c1df13884a9e upstream.
When the primary firmware node pointer is removed from a device (set to NULL) the secondary firmware node pointer, when it exists, is made the primary node for the device. However, the secondary firmware node pointer of the original primary firmware node is never cleared (set to NULL).
To avoid situation where the secondary firmware node pointer is pointing to a non-existing object, clearing it properly when the primary node is removed from a device in set_primary_fwnode().
--- drivers/base/core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/base/core.c +8 -4
@@ -3400,9 +3400,9 @@ static inline bool fwnode_is_primary(str*/ void set_primary_fwnode (struct device *dev,struct fwnode_handle *fwnode) { -if (fwnode) { -struct fwnode_handle *fn = dev->fwnode; +struct fwnode_handle *fn = dev->fwnode; +if (fwnode) {if (fwnode_is_primary (fn)) fn = fn->secondary;
@@ -3412,8 +3412,12 @@ void set_primary_fwnode(struct device *d } dev->fwnode = fwnode; }else { - dev->fwnode =fwnode_is_primary (dev->fwnode) ? - dev->fwnode->secondary :NULL ; +if (fwnode_is_primary (fn)) { + dev->fwnode = fn->secondary; + fn->secondary =NULL ; + }else { + dev->fwnode =NULL ; + } } }EXPORT_SYMBOL_GPL (set_primary_fwnode);
Greg Kroah-Hartman
maintainerPATCH 178/214 crypto: af_alg - Work around empty control messages without MSG_MORE
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
commit c195d66a8a75c60515819b101975f38b7ec6577f upstream.
The iwd daemon uses libell which sets up the skcipher operation with two separate control messages. As the first control message is sent without MSG_MORE, it is interpreted as an empty request.
While libell should be fixed to use MSG_MORE where appropriate, this patch works around the bug in the kernel so that existing binaries continue to work.
We will print a warning however.
A separate issue is that the new kernel code no longer allows the control message to be sent twice within the same request. This restriction is obviously incompatible with what iwd was doing (first setting an IV and then sending the real control message). This patch changes the kernel so that this is explicitly allowed.
--- crypto/af_alg.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
crypto/af_alg.c +10 -3
@@ -16,6 +16,7 @@#include <linux/module.h> #include <linux/net.h> #include <linux/rwsem.h> +#include <linux/sched.h> #include <linux/sched/signal.h> #include <linux/security.h>
@@ -847,9 +848,15 @@ int af_alg_sendmsg(struct socket *sock, }lock_sock (sk); -if (ctx->init && (init || !ctx->more)) { - err = -EINVAL ; - goto unlock; +if (ctx->init && !ctx->more) { +if (ctx->used) { + err = -EINVAL ; + goto unlock; + } + +pr_info_once ( +"%s sent an empty control message without MSG_MORE.\n" , + current->comm); } ctx->init = true;
Greg Kroah-Hartman
maintainerPATCH 179/214 genirq/matrix: Deal with the sillyness of for_each_cpu() on UP
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit 784a0830377d0761834e385975bc46861fea9fa0 upstream.
Most of the CPU mask operations behave the same way, but for_each_cpu() and it's variants ignore the cpumask argument and claim that CPU0 is always in the mask. This is historical, inconsistent and annoying behaviour.
The matrix allocator uses for_each_cpu() and can be called on UP with an empty cpumask. The calling code does not expect that this succeeds but until commit e027fffff799 ("x86/irq: Unbreak interrupt affinity setting") this went unnoticed. That commit added a WARN_ON() to catch cases which move an interrupt from one vector to another on the same CPU. The warning triggers on UP.
Add a check for the cpumask being empty to prevent this.
--- kernel/irq/matrix.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/irq/matrix.c +7 -0
@@ -380,6 +380,13 @@ int irq_matrix_alloc(struct irq_matrix *unsigned int cpu, bit;struct cpumap *cm; +/* +* Not required in theory, but matrix_find_best_cpu() uses +* for_each_cpu() which ignores the cpumask on UP . +*/ +if (cpumask_empty (msk)) +return -EINVAL ; + cpu =matrix_find_best_cpu (m, msk);if (cpu ==UINT_MAX )return -ENOSPC ;
Greg Kroah-Hartman
maintainerPATCH 180/214 irqchip/stm32-exti: Avoid losing interrupts due to clearing pending bits by mistake
In reply to Greg Kroah-HartmanFrom: qiuguorui1 <[email protected]>
commit e579076ac0a3bebb440fab101aef3c42c9f4c709 upstream.
In the current code, when the eoi callback of the exti clears the pending bit of the current interrupt, it will first read the values of fpr and rpr, then logically OR the corresponding bit of the interrupt number, and finally write back to fpr and rpr.
We found through experiments that if two exti interrupts,
we call them int1/int2, arrive almost at the same time. in our scenario, the time difference is 30 microseconds, assuming int1 is triggered first.
there will be an extreme scenario: both int's pending bit are set to 1, the irq handle of int1 is executed first, and eoi handle is then executed, at this moment, all pending bits are cleared, but the int 2 has not finally been reported to the cpu yet, which eventually lost int2.
According to stm32's TRM description about rpr and fpr: Writing a 1 to this bit will trigger a rising edge event on event x, Writing 0 has no effect.
Therefore, when clearing the pending bit, we only need to clear the pending bit of the irq.
--- drivers/irqchip/irq-stm32-exti.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/irqchip/irq-stm32-exti.c +12 -2
@@ -431,6 +431,16 @@ static void stm32_irq_ack(struct irq_datirq_gc_unlock (gc); } +/* directly set the target bit without reading first. */ +static inline void stm32_exti_write_bit (struct irq_data *d,u32 reg) +{ +struct stm32_exti_chip_data *chip_data =irq_data_get_irq_chip_data (d); +void __iomem *base = chip_data->host_data->base; +u32 val =BIT (d->hwirq %IRQS_PER_BANK ); + +writel_relaxed (val, base + reg); +} +static inline u32 stm32_exti_set_bit (struct irq_data *d,u32 reg) {struct stm32_exti_chip_data *chip_data =irq_data_get_irq_chip_data (d);
@@ -464,9 +474,9 @@ static void stm32_exti_h_eoi(struct irq_raw_spin_lock (&chip_data->rlock); -stm32_exti_set_bit (d, stm32_bank->rpr_ofst); +stm32_exti_write_bit (d, stm32_bank->rpr_ofst);if (stm32_bank->fpr_ofst !=UNDEF_REG ) -stm32_exti_set_bit (d, stm32_bank->fpr_ofst); +stm32_exti_write_bit (d, stm32_bank->fpr_ofst);raw_spin_unlock (&chip_data->rlock);
Greg Kroah-Hartman
maintainerPATCH 181/214 x86/hotplug: Silence APIC only after all interrupts are migrated
In reply to Greg Kroah-HartmanFrom: Ashok Raj <[email protected]>
commit 52d6b926aabc47643cd910c85edb262b7f44c168 upstream.
There is a race when taking a CPU offline. Current code looks like this:
native_cpu_disable()
{
...
apic_soft_disable();
/*
* Any existing set bits for pending interrupt to
* this CPU are preserved and will be sent via IPI
* to another CPU by fixup_irqs().
*/
cpu_disable_common();
{
....
/*
* Race window happens here. Once local APIC has been
* disabled any new interrupts from the device to
* the old CPU are lost
*/
fixup_irqs(); // Too late to capture anything in IRR.
...
}
}The fix is to disable the APIC *after* cpu_disable_common().
Testing was done with a USB NIC that provided a source of frequent interrupts. A script migrated interrupts to a specific CPU and then took that CPU offline.
--- arch/x86/kernel/smpboot.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
arch/x86/kernel/smpboot.c +20 -6
@@ -1599,14 +1599,28 @@ int native_cpu_disable(void)if (ret)return ret; -/* -* Disable the local APIC. Otherwise IPI broadcasts will reach -* it. It still responds normally to INIT, NMI, SMI, and SIPI -* messages. -*/ -apic_soft_disable ();cpu_disable_common (); +/* +* Disable the local APIC. Otherwise IPI broadcasts will reach +* it. It still responds normally to INIT, NMI, SMI, and SIPI +* messages. +* +* Disabling the APIC must happen after cpu_disable_common() +* which invokes fixup_irqs(). +* +* Disabling the APIC preserves already set bits in IRR, but +* an interrupt arriving after disabling the local APIC does not +* set the corresponding IRR bit. +* +* fixup_irqs() scans IRR for set bits so it can raise a not +* yet handled interrupt on the new destination CPU via an IPI +* but obviously it can't do so for IRR bits which are not set. +* IOW, interrupts arriving after disabling the local APIC will +* be lost. +*/ +apic_soft_disable (); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 182/214 drm/amdgpu: Fix buffer overflow in INFO ioctl
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit b5b97cab55eb71daba3283c8b1d2cce456d511a1 upstream.
The values for "se_num" and "sh_num" come from the user in the ioctl. They can be in the 0-255 range but if they're more than AMDGPU_GFX_MAX_SE (4) or AMDGPU_GFX_MAX_SH_PER_SE (2) then it results in an out of bounds read.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -0
@@ -638,8 +638,12 @@ static int amdgpu_info_ioctl(struct drm_* in the bitfields */ if (se_num ==AMDGPU_INFO_MMR_SE_INDEX_MASK ) se_num =0xffffffff ; +else if (se_num >=AMDGPU_GFX_MAX_SE ) +return -EINVAL ;if (sh_num ==AMDGPU_INFO_MMR_SH_INDEX_MASK ) sh_num =0xffffffff ; +else if (sh_num >=AMDGPU_GFX_MAX_SH_PER_SE ) +return -EINVAL ;if (info->read_mmr_reg.count >128 )return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 183/214 drm/amdgpu/gfx10: refine mgcg setting
In reply to Greg Kroah-HartmanFrom: Jiansong Chen <[email protected]>
commit de7a1b0b8753e1b0000084f0e339ffab295d27ef upstream.
1. enable ENABLE_CGTS_LEGACY to fix specviewperf11 random hang.
2. remove obsolete RLC_CGTT_SCLK_OVERRIDE workaround.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -4
@@ -4094,10 +4094,8 @@ static void gfx_v10_0_update_medium_grai def = data =RREG32_SOC15 (GC ,0 , mmRLC_CGTT_MGCG_OVERRIDE); data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK |RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK | -RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK ); - -/* only for Vega10 & Raven1 */ - data |=RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK ; +RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGLS_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__ENABLE_CGTS_LEGACY_MASK );if (def != data)WREG32_SOC15 (GC ,0 , mmRLC_CGTT_MGCG_OVERRIDE, data);
Greg Kroah-Hartman
maintainerPATCH 184/214 drm/amd/powerplay: Fix hardmins not being sent to SMU for RV
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
commit e2bf3723db563457c0abe4eaeedac25bbbbd1d76 upstream.
[Why]
DC uses these to raise the voltage as needed for higher dispclk/dppclk and to ensure that we have enough bandwidth to drive the displays.
There's a bug preventing these from actuially sending messages since it's checking the actual clock (which is 0) instead of the incoming clock (which shouldn't be 0) when deciding to send the hardmin.
[How]
Check the clocks != 0 instead of the actual clocks.
--- drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +3 -6
@@ -209,8 +209,7 @@ static int smu10_set_min_deep_sleep_dcef {struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -if (smu10_data->need_min_deep_sleep_dcefclk && - smu10_data->deep_sleep_dcefclk != clock) { +if (clock && smu10_data->deep_sleep_dcefclk != clock) { smu10_data->deep_sleep_dcefclk = clock; smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetMinDeepSleepDcefclk,
@@ -223,8 +222,7 @@ static int smu10_set_hard_min_dcefclk_by {struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -if (smu10_data->dcf_actual_hard_min_freq && - smu10_data->dcf_actual_hard_min_freq != clock) { +if (clock && smu10_data->dcf_actual_hard_min_freq != clock) { smu10_data->dcf_actual_hard_min_freq = clock; smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetHardMinDcefclkByFreq,
@@ -237,8 +235,7 @@ static int smu10_set_hard_min_fclk_by_fr {struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend); -if (smu10_data->f_actual_hard_min_freq && - smu10_data->f_actual_hard_min_freq != clock) { +if (clock && smu10_data->f_actual_hard_min_freq != clock) { smu10_data->f_actual_hard_min_freq = clock; smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_SetHardMinFclkByFreq,
Greg Kroah-Hartman
maintainerPATCH 185/214 drm/amd/pm: correct Vega10 swctf limit setting
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit b05d71b51078fc428c6b72582126d9d75d3c1f4c upstream.
Correct the Vega10 thermal swctf limit.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c +5 -2
@@ -364,6 +364,9 @@ int vega10_thermal_get_temperature(strucstatic int vega10_thermal_set_temperature_range (struct pp_hwmgr *hwmgr,struct PP_TemperatureRange *range) { +struct phm_ppt_v2_information *pp_table_info = + (struct phm_ppt_v2_information *)(hwmgr->pptable); +struct phm_tdp_table *tdp_table = pp_table_info->tdp_table;struct amdgpu_device *adev = hwmgr->adev;int low =VEGA10_THERMAL_MINIMUM_ALERT_TEMP *PP_TEMPERATURE_UNITS_PER_CENTIGRADES ;
@@ -373,8 +376,8 @@ static int vega10_thermal_set_temperaturif (low < range->min) low = range->min; -if (high > range->max) - high = range->max; +if (high > tdp_table->usSoftwareShutdownTemp) + high = tdp_table->usSoftwareShutdownTemp;if (low > high)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 186/214 drm/amd/pm: correct Vega12 swctf limit setting
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit e0ffd340249699ad27a6c91abdfa3e89f7823941 upstream.
Correct the Vega12 thermal swctf limit.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c +4 -2
@@ -170,6 +170,8 @@ int vega12_thermal_get_temperature(strucstatic int vega12_thermal_set_temperature_range (struct pp_hwmgr *hwmgr,struct PP_TemperatureRange *range) { +struct phm_ppt_v3_information *pptable_information = + (struct phm_ppt_v3_information *)hwmgr->pptable;struct amdgpu_device *adev = hwmgr->adev;int low =VEGA12_THERMAL_MINIMUM_ALERT_TEMP *PP_TEMPERATURE_UNITS_PER_CENTIGRADES ;
@@ -179,8 +181,8 @@ static int vega12_thermal_set_temperaturif (low < range->min) low = range->min; -if (high > range->max) - high = range->max; +if (high > pptable_information->us_software_shutdown_temp) + high = pptable_information->us_software_shutdown_temp;if (low > high)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 187/214 drm/amd/pm: correct Vega20 swctf limit setting
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit 9b51c4b2ba31396f3894ccc7df8bdf067243e9f5 upstream.
Correct the Vega20 thermal swctf limit.
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c +4 -2
@@ -240,6 +240,8 @@ int vega20_thermal_get_temperature(strucstatic int vega20_thermal_set_temperature_range (struct pp_hwmgr *hwmgr,struct PP_TemperatureRange *range) { +struct phm_ppt_v3_information *pptable_information = + (struct phm_ppt_v3_information *)hwmgr->pptable;struct amdgpu_device *adev = hwmgr->adev;int low =VEGA20_THERMAL_MINIMUM_ALERT_TEMP *PP_TEMPERATURE_UNITS_PER_CENTIGRADES ;
@@ -249,8 +251,8 @@ static int vega20_thermal_set_temperaturif (low < range->min) low = range->min; -if (high > range->max) - high = range->max; +if (high > pptable_information->us_software_shutdown_temp) + high = pptable_information->us_software_shutdown_temp;if (low > high)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 188/214 drm/amd/pm: correct the thermal alert temperature limit settings
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
commit 28e628645333b7e581c4a7b04d958e4804ea10fe upstream.
Do the maths in celsius degree. This can fix the issues caused by the changes below:
drm/amd/pm: correct Vega20 swctf limit setting drm/amd/pm: correct Vega12 swctf limit setting drm/amd/pm: correct Vega10 swctf limit setting
--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c | 15 +++++++-------- drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c | 15 +++++++-------- drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c | 15 +++++++-------- 3 files changed, 21 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_thermal.c +7 -8
@@ -368,14 +368,13 @@ static int vega10_thermal_set_temperatur (struct phm_ppt_v2_information *)(hwmgr->pptable);struct phm_tdp_table *tdp_table = pp_table_info->tdp_table;struct amdgpu_device *adev = hwmgr->adev; -int low =VEGA10_THERMAL_MINIMUM_ALERT_TEMP * -PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; -int high =VEGA10_THERMAL_MAXIMUM_ALERT_TEMP * -PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; +int low =VEGA10_THERMAL_MINIMUM_ALERT_TEMP ; +int high =VEGA10_THERMAL_MAXIMUM_ALERT_TEMP ;uint32_t val; -if (low < range->min) - low = range->min; +/* compare them in unit celsius degree */ +if (low < range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ) + low = range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ;if (high > tdp_table->usSoftwareShutdownTemp) high = tdp_table->usSoftwareShutdownTemp;
@@ -386,8 +385,8 @@ static int vega10_thermal_set_temperatur val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,MAX_IH_CREDIT ,5 ); val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,THERM_IH_HW_ENA ,1 ); - val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTH , (high /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )); - val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTL , (low /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )); + val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTH , high); + val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTL , low); val &= (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK ) & (~THM_THERMAL_INT_CTRL__THERM_INTH_MASK_MASK ) & (~THM_THERMAL_INT_CTRL__THERM_INTL_MASK_MASK );
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_thermal.c +7 -8
@@ -173,14 +173,13 @@ static int vega12_thermal_set_temperaturstruct phm_ppt_v3_information *pptable_information = (struct phm_ppt_v3_information *)hwmgr->pptable;struct amdgpu_device *adev = hwmgr->adev; -int low =VEGA12_THERMAL_MINIMUM_ALERT_TEMP * -PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; -int high =VEGA12_THERMAL_MAXIMUM_ALERT_TEMP * -PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; +int low =VEGA12_THERMAL_MINIMUM_ALERT_TEMP ; +int high =VEGA12_THERMAL_MAXIMUM_ALERT_TEMP ;uint32_t val; -if (low < range->min) - low = range->min; +/* compare them in unit celsius degree */ +if (low < range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ) + low = range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ;if (high > pptable_information->us_software_shutdown_temp) high = pptable_information->us_software_shutdown_temp;
@@ -191,8 +190,8 @@ static int vega12_thermal_set_temperatur val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,MAX_IH_CREDIT ,5 ); val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,THERM_IH_HW_ENA ,1 ); - val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTH , (high /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )); - val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTL , (low /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )); + val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTH , high); + val =REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTL , low); val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , mmTHM_THERMAL_INT_CTRL, val);
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_thermal.c +7 -8
@@ -243,14 +243,13 @@ static int vega20_thermal_set_temperaturstruct phm_ppt_v3_information *pptable_information = (struct phm_ppt_v3_information *)hwmgr->pptable;struct amdgpu_device *adev = hwmgr->adev; -int low =VEGA20_THERMAL_MINIMUM_ALERT_TEMP * -PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; -int high =VEGA20_THERMAL_MAXIMUM_ALERT_TEMP * -PP_TEMPERATURE_UNITS_PER_CENTIGRADES ; +int low =VEGA20_THERMAL_MINIMUM_ALERT_TEMP ; +int high =VEGA20_THERMAL_MAXIMUM_ALERT_TEMP ;uint32_t val; -if (low < range->min) - low = range->min; +/* compare them in unit celsius degree */ +if (low < range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ) + low = range->min /PP_TEMPERATURE_UNITS_PER_CENTIGRADES ;if (high > pptable_information->us_software_shutdown_temp) high = pptable_information->us_software_shutdown_temp;
@@ -261,8 +260,8 @@ static int vega20_thermal_set_temperatur val =CGS_REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,MAX_IH_CREDIT ,5 ); val =CGS_REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,THERM_IH_HW_ENA ,1 ); - val =CGS_REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTH , (high /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )); - val =CGS_REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTL , (low /PP_TEMPERATURE_UNITS_PER_CENTIGRADES )); + val =CGS_REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTH , high); + val =CGS_REG_SET_FIELD (val,THM_THERMAL_INT_CTRL ,DIG_THERM_INTL , low); val = val & (~THM_THERMAL_INT_CTRL__THERM_TRIGGER_MASK_MASK );WREG32_SOC15 (THM ,0 , mmTHM_THERMAL_INT_CTRL, val);
Greg Kroah-Hartman
maintainerPATCH 189/214 USB: yurex: Fix bad gfp argument
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit f176ede3a3bde5b398a6777a7f9ff091baa2d3ff upstream.
The syzbot fuzzer identified a bug in the yurex driver: It passes GFP_KERNEL as a memory-allocation flag to usb_submit_urb() at a time when its state is TASK_INTERRUPTIBLE, not TASK_RUNNING:
do not call blocking ops when !TASK_RUNNING; state=1 set at [<00000000370c7c68>] prepare_to_wait+0xb1/0x2a0 kernel/sched/wait.c:247
WARNING: CPU: 1 PID: 340 at kernel/sched/core.c:7253 __might_sleep+0x135/0x190 kernel/sched/core.c:7253 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 340 Comm: syz-executor677 Not tainted 5.8.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xf6/0x16e lib/dump_stack.c:118 panic+0x2aa/0x6e1 kernel/panic.c:231 __warn.cold+0x20/0x50 kernel/panic.c:600 report_bug+0x1bd/0x210 lib/bug.c:198 handle_bug+0x41/0x80 arch/x86/kernel/traps.c:234 exc_invalid_op+0x14/0x40 arch/x86/kernel/traps.c:254 asm_exc_invalid_op+0x12/0x20 arch/x86/include/asm/idtentry.h:536 RIP: 0010:__might_sleep+0x135/0x190 kernel/sched/core.c:7253 Code: 65 48 8b 1c 25 40 ef 01 00 48 8d 7b 10 48 89 fe 48 c1 ee 03 80 3c 06 00 75
2b 48 8b 73 10 48 c7 c7 e0 9e 06 86 e8 ed 12 f6 ff <0f> 0b e9 46 ff ff ff e8 1f b2 4b 00 e9 29 ff ff ff e8 15 b2 4b 00
RSP: 0018:ffff8881cdb77a28 EFLAGS: 00010282
RAX: 0000000000000000 RBX: ffff8881c6458000 RCX: 0000000000000000
RDX: ffff8881c6458000 RSI: ffffffff8129ec93 RDI: ffffed1039b6ef37
RBP: ffffffff86fdade2 R08: 0000000000000001 R09: ffff8881db32f54f
R10: 0000000000000000 R11: 0000000030343354 R12: 00000000000001f2
R13: 0000000000000000 R14: 0000000000000068 R15: ffffffff83c1b1aa
slab_pre_alloc_hook.constprop.0+0xea/0x200 mm/slab.h:498 slab_alloc_node mm/slub.c:2816 [inline] slab_alloc mm/slub.c:2900 [inline] kmem_cache_alloc_trace+0x46/0x220 mm/slub.c:2917 kmalloc include/linux/slab.h:554 [inline] dummy_urb_enqueue+0x7a/0x880 drivers/usb/gadget/udc/dummy_hcd.c:1251 usb_hcd_submit_urb+0x2b2/0x22d0 drivers/usb/core/hcd.c:1547 usb_submit_urb+0xb4e/0x13e0 drivers/usb/core/urb.c:570 yurex_write+0x3ea/0x820 drivers/usb/misc/yurex.c:495
This patch changes the call to use GFP_ATOMIC instead of GFP_KERNEL.
--- drivers/usb/misc/yurex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/yurex.c +1 -1
@@ -492,7 +492,7 @@ static ssize_t yurex_write(struct file *prepare_to_wait (&dev->waitq, &wait,TASK_INTERRUPTIBLE );dev_dbg (&dev->interface->dev,"%s - submit %c\n" , __func__, dev->cntl_buffer[0 ]); - retval =usb_submit_urb (dev->cntl_urb,GFP_KERNEL ); + retval =usb_submit_urb (dev->cntl_urb,GFP_ATOMIC );if (retval >=0 ) timeout =schedule_timeout (YUREX_WRITE_TIMEOUT );finish_wait (&dev->waitq, &wait);
Greg Kroah-Hartman
maintainerPATCH 190/214 usb: uas: Add quirk for PNY Pro Elite
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit 9a469bc9f32dd33c7aac5744669d21a023a719cd upstream.
PNY Pro Elite USB 3.1 Gen 2 device (SSD) doesn't respond to ATA_12 pass-through command (i.e. it just hangs). If it doesn't support this command, it should respond properly to the host. Let's just add a quirk to be able to move forward with other operations.
--- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_uas.h +7 -0
@@ -80,6 +80,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_BROKEN_FUA), +/* Reported-by: Thinh Nguyen <[email protected]> */ +UNUSUAL_DEV (0x154b ,0xf00d ,0x0000 ,0x9999 , +"PNY" , +"Pro Elite SSD" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_ATA_1X ), +/* Reported-by: Hans de Goede <[email protected]> */ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, "VIA",
Greg Kroah-Hartman
maintainerPATCH 191/214 USB: quirks: Add no-lpm quirk for another Raydium touchscreen
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
commit 5967116e8358899ebaa22702d09b0af57fef23e1 upstream.
There's another Raydium touchscreen needs the no-lpm quirk:
[ 1.339149] usb 1-9: New USB device found, idVendor=2386, idProduct=350e, bcdDevice= 0.00 [ 1.339150] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 1.339151] usb 1-9: Product: Raydium Touch System [ 1.339152] usb 1-9: Manufacturer: Raydium Corporation ... [ 6.450497] usb 1-9: can't set config #1, error -110
--- drivers/usb/core/quirks.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/core/quirks.c +2 -0
@@ -465,6 +465,8 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, + { USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM }, + /* DJI CineSSD */ { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
Greg Kroah-Hartman
maintainerPATCH 192/214 USB: quirks: Ignore duplicate endpoint on Sound Devices MixPre-D
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 068834a2773b6a12805105cfadbb3d4229fc6e0a upstream.
The Sound Devices MixPre-D audio card suffers from the same defect as the Sound Devices USBPre2: an endpoint shared between a normal audio interface and a vendor-specific interface, in violation of the USB spec. Since the USB core now treats duplicated endpoints as bugs and ignores them, the audio endpoint isn't available and the card can't be used for audio capture.
Along the same lines as commit bdd1b147b802 ("USB: quirks: blacklist duplicate ep on Sound Devices USBPre2"), this patch adds a quirks entry saying to ignore ep5in for interface 1, leaving it available for use with standard audio interface 2.
--- drivers/usb/core/quirks.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/core/quirks.c +5 -0
@@ -370,6 +370,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x0926, 0x0202), .driver_info = USB_QUIRK_ENDPOINT_BLACKLIST }, + /* Sound Devices MixPre-D */ + { USB_DEVICE(0x0926, 0x0208), .driver_info = + USB_QUIRK_ENDPOINT_BLACKLIST }, + /* Keytouch QWERTY Panel keyboard */ { USB_DEVICE(0x0926, 0x3333), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
@@ -511,6 +515,7 @@ static const struct usb_device_id usb_am*/ static const struct usb_device_id usb_endpoint_blacklist[] = { {USB_DEVICE_INTERFACE_NUMBER (0x0926 ,0x0202 ,1 ), .driver_info =0x85 }, + {USB_DEVICE_INTERFACE_NUMBER (0x0926 ,0x0208 ,1 ), .driver_info =0x85 }, { } };
Greg Kroah-Hartman
maintainerPATCH 193/214 USB: Ignore UAS for JMicron JMS567 ATA/ATAPI Bridge
In reply to Greg Kroah-HartmanFrom: Cyril Roelandt <[email protected]>
commit 9aa37788e7ebb3f489fb4b71ce07adadd444264a upstream.
This device does not support UAS properly and a similar entry already exists in drivers/usb/storage/unusual_uas.h. Without this patch, storage_probe() defers the handling of this device to UAS, which cannot handle it either.
--- drivers/usb/storage/unusual_devs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/unusual_devs.h +1 -1
@@ -2328,7 +2328,7 @@ UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x "JMicron", "USB to ATA/ATAPI Bridge", USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_BROKEN_FUA ), + US_FL_BROKEN_FUA | US_FL_IGNORE_UAS ),/* Reported by Andrey Rahmatullin <[email protected]> */ UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100,
Greg Kroah-Hartman
maintainerPATCH 194/214 usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe()
In reply to Greg Kroah-HartmanFrom: Tang Bin <[email protected]>
commit 1d4169834628d18b2392a2da92b7fbf5e8e2ce89 upstream.
If the function platform_get_irq() failed, the negative value returned will not be detected here. So fix error handling in exynos_ohci_probe(). And when get irq failed, the function platform_get_irq() logs an error message, so remove redundant message here.
--- drivers/usb/host/ohci-exynos.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/usb/host/ohci-exynos.c +2 -3
@@ -171,9 +171,8 @@ static int exynos_ohci_probe(struct plat hcd->rsrc_len =resource_size (res); irq =platform_get_irq (pdev,0 ); -if (!irq) { -dev_err (&pdev->dev,"Failed to get IRQ\n" ); - err = -ENODEV ; +if (irq <0 ) { + err = irq; goto fail_io; }
Greg Kroah-Hartman
maintainerPATCH 195/214 USB: gadget: u_f: add overflow checks to VLA macros
In reply to Greg Kroah-HartmanFrom: Brooke Basile <[email protected]>
commit b1cd1b65afba95971fa457dfdb2c941c60d38c5b upstream.
size can potentially hold an overflowed value if its assigned expression is left unchecked, leading to a smaller than needed allocation when vla_group_size() is used by callers to allocate memory.
To fix this, add a test for saturation before declaring variables and an overflow check to (n) * sizeof(type).
If the expression results in overflow, vla_group_size() will return SIZE_MAX.
--- drivers/usb/gadget/u_f.h | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-)
drivers/usb/gadget/u_f.h +27 -11
@@ -14,6 +14,7 @@#define __U_F_H__#include <linux/usb/gadget.h> +#include <linux/overflow.h> /* Variable Length Array Macros **********************************************/ #define vla_group (groupname) size_t groupname##__next = 0
@@ -21,21 +22,36 @@#define vla_item (groupname, type, name, n) \ size_t groupname##_##name##__offset = ({ \ - size_t align_mask = __alignof__(type) - 1; \ - size_t offset = (groupname##__next + align_mask) & ~align_mask;\ - size_t size = (n) * sizeof(type); \ - groupname##__next = offset + size; \ + size_t offset = 0; \ + if (groupname##__next != SIZE_MAX) { \ + size_t align_mask = __alignof__(type) - 1; \ + size_t offset = (groupname##__next + align_mask) \ + & ~align_mask; \ + size_t size = array_size(n, sizeof(type)); \ + if (check_add_overflow(offset, size, \ + &groupname##__next)) { \ + groupname##__next = SIZE_MAX; \ + offset = 0; \ + } \ + } \ offset; \ })#define vla_item_with_sz (groupname, type, name, n) \ - size_t groupname##_##name##__sz = (n) * sizeof(type); \ - size_t groupname##_##name##__offset = ({ \ - size_t align_mask = __alignof__(type) - 1; \ - size_t offset = (groupname##__next + align_mask) & ~align_mask;\ - size_t size = groupname##_##name##__sz; \ - groupname##__next = offset + size; \ - offset; \ + size_t groupname##_##name##__sz = array_size(n, sizeof(type)); \ + size_t groupname##_##name##__offset = ({ \ + size_t offset = 0; \ + if (groupname##__next != SIZE_MAX) { \ + size_t align_mask = __alignof__(type) - 1; \ + size_t offset = (groupname##__next + align_mask) \ + & ~align_mask; \ + if (check_add_overflow(offset, groupname##_##name##__sz,\ + &groupname##__next)) { \ + groupname##__next = SIZE_MAX; \ + offset = 0; \ + } \ + } \ + offset; \ })#define vla_ptr (ptr, groupname, name) \
Greg Kroah-Hartman
maintainerPATCH 196/214 USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()
In reply to Greg Kroah-HartmanFrom: Brooke Basile <[email protected]>
commit 2b74b0a04d3e9f9f08ff026e5663dce88ff94e52 upstream.
Some values extracted by ncm_unwrap_ntb() could possibly lead to several different out of bounds reads of memory. Specifically the values passed to netdev_alloc_skb_ip_align() need to be checked so that memory is not overflowed.
Resolve this by applying bounds checking to a number of different indexes and lengths of the structure parsing logic.
--- drivers/usb/gadget/function/f_ncm.c | 81 ++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 12 deletions(-)
drivers/usb/gadget/function/f_ncm.c +69 -12
@@ -1181,12 +1181,15 @@ static int ncm_unwrap_ntb(struct getherint ndp_index;unsigned dg_len, dg_len2;unsigned ndp_len; +unsigned block_len;struct sk_buff *skb2;int ret = -EINVAL ; -unsigned max_size =le32_to_cpu (ntb_parameters.dwNtbOutMaxSize); +unsigned ntb_max =le32_to_cpu (ntb_parameters.dwNtbOutMaxSize); +unsigned frame_max =le16_to_cpu (ecm_desc.wMaxSegmentSize);const struct ndp_parser_opts *opts = ncm->parser_opts;unsigned crc_len = ncm->is_crc ?sizeof (uint32_t ) :0 ;int dgram_counter; +bool ndp_after_header;/* dwSignature */ if (get_unaligned_le32 (tmp) != opts->nth_sign) {
@@ -1205,25 +1208,37 @@ static int ncm_unwrap_ntb(struct gether } tmp++;/* skip wSequence */ + block_len =get_ncm (&tmp, opts->block_length);/* (d)wBlockLength */ -if (get_ncm (&tmp, opts->block_length) > max_size) { +if (block_len > ntb_max) {INFO (port->func.config->cdev,"OUT size exceeded\n" ); goto err; } ndp_index =get_ncm (&tmp, opts->ndp_index); + ndp_after_header = false;/* Run through all the NDP's in the NTB */ do { - /* NCM 3.2 */ - if (((ndp_index % 4) != 0) && - (ndp_index < opts->nth_size)) { + /* + * NCM 3.2 + * dwNdpIndex + */ + if (((ndp_index % 4) != 0) || + (ndp_index < opts->nth_size) || + (ndp_index > (block_len - + opts->ndp_size))) { INFO(port->func.config->cdev, "Bad index: %#X\n", ndp_index); goto err; } + if (ndp_index == opts->nth_size) + ndp_after_header = true; - /* walk through NDP */ + /* + * walk through NDP + * dwSignature + */ tmp = (void *)(skb->data + ndp_index); if (get_unaligned_le32(tmp) != ncm->ndp_sign) { INFO(port->func.config->cdev, "Wrong NDP SIGN\n");
@@ -1234,14 +1249,15 @@ static int ncm_unwrap_ntb(struct gether ndp_len =get_unaligned_le16 (tmp++);/* * NCM 3.3.1 +* wLength * entry is 2 items * item size is 16/32 bits, opts->dgram_item_len * 2 bytes * minimal: struct usb_cdc_ncm_ndpX + normal entry + zero entry * Each entry is a dgram index and a dgram length. */ if ((ndp_len < opts->ndp_size - +2 *2 * (opts->dgram_item_len *2 )) - || (ndp_len % opts->ndplen_align !=0 )) { + +2 *2 * (opts->dgram_item_len *2 )) || + (ndp_len % opts->ndplen_align !=0 )) {INFO (port->func.config->cdev,"Bad NDP length: %#X\n" , ndp_len); goto err;
@@ -1258,8 +1274,21 @@ static int ncm_unwrap_ntb(struct gether do { index = index2; + /* wDatagramIndex[0] */ + if ((index < opts->nth_size) || + (index > block_len - opts->dpe_size)) { + INFO(port->func.config->cdev, + "Bad index: %#X\n", index); + goto err; + } + dg_len = dg_len2; - if (dg_len < 14 + crc_len) { /* ethernet hdr + crc */ + /* + * wDatagramLength[0] + * ethernet hdr + crc or larger than max frame size + */ + if ((dg_len < 14 + crc_len) || + (dg_len > frame_max)) { INFO(port->func.config->cdev, "Bad dgram length: %#X\n", dg_len); goto err;
@@ -1283,6 +1312,37 @@ static int ncm_unwrap_ntb(struct gether index2 =get_ncm (&tmp, opts->dgram_item_len); dg_len2 =get_ncm (&tmp, opts->dgram_item_len); +if (index2 ==0 || dg_len2 ==0 ) +break ; + +/* wDatagramIndex[1] */ +if (ndp_after_header) { +if (index2 < opts->nth_size + opts->ndp_size) { +INFO (port->func.config->cdev, +"Bad index: %#X\n" , index2); + goto err; + } + }else { +if (index2 < opts->nth_size + opts->dpe_size) { +INFO (port->func.config->cdev, +"Bad index: %#X\n" , index2); + goto err; + } + } +if (index2 > block_len - opts->dpe_size) { +INFO (port->func.config->cdev, +"Bad index: %#X\n" , index2); + goto err; + } + +/* wDatagramLength[1] */ +if ((dg_len2 <14 + crc_len) || + (dg_len2 > frame_max)) { +INFO (port->func.config->cdev, +"Bad dgram length: %#X\n" , dg_len); + goto err; + } +/* * Copy the data into a new skb. * This ensures the truesize is correct
@@ -1299,9 +1359,6 @@ static int ncm_unwrap_ntb(struct gether ndp_len -=2 * (opts->dgram_item_len *2 ); dgram_counter++; - -if (index2 ==0 || dg_len2 ==0 ) -break ; }while (ndp_len >2 * (opts->dgram_item_len *2 )); }while (ndp_index);
Greg Kroah-Hartman
maintainerPATCH 197/214 USB: gadget: u_f: Unbreak offset calculation in VLAs
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
commit bfd08d06d978d0304eb6f7855b548aa2cd1c5486 upstream.
Inadvertently the commit b1cd1b65afba ("USB: gadget: u_f: add overflow checks to VLA macros") makes VLA macros to always return 0 due to different scope of two variables of the same name. Obviously we need to have only one.
--- drivers/usb/gadget/u_f.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/u_f.h +4 -4
@@ -25,9 +25,9 @@size_t offset =0 ; \ if (groupname##__next != SIZE_MAX) { \size_t align_mask = __alignof__(type ) -1 ; \ - size_t offset = (groupname##__next + align_mask) \ - & ~align_mask; \size_t size =array_size (n,sizeof (type)); \ + offset = (groupname##__next + align_mask) & \ + ~align_mask; \if (check_add_overflow (offset, size, \ &groupname##__next)) { \ groupname##__next = SIZE_MAX; \
@@ -43,8 +43,8 @@size_t offset =0 ; \ if (groupname##__next != SIZE_MAX) { \size_t align_mask = __alignof__(type ) -1 ; \ - size_t offset = (groupname##__next + align_mask) \ - & ~align_mask; \ + offset = (groupname##__next + align_mask) & \ + ~align_mask; \ if (check_add_overflow(offset, groupname##_##name##__sz,\ &groupname##__next)) { \ groupname##__next = SIZE_MAX; \
Greg Kroah-Hartman
maintainerPATCH 198/214 USB: cdc-acm: rework notification_buffer resizing
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit f4b9d8a582f738c24ebeabce5cc15f4b8159d74e upstream.
Clang static analysis reports this error
cdc-acm.c:409:3: warning: Use of memory after it is freed
acm_process_notification(acm, (unsigned char *)dr);
There are three problems, the first one is that dr is not reset
The variable dr is set with
if (acm->nb_index)
dr = (struct usb_cdc_notification *)acm->notification_buffer;
But if the notification_buffer is too small it is resized with
if (acm->nb_size) {
kfree(acm->notification_buffer);
acm->nb_size = 0;
}
alloc_size = roundup_pow_of_two(expected_size);
/*
* kmalloc ensures a valid notification_buffer after a
* use of kfree in case the previous allocation was too
* small. Final freeing is done on disconnect.
*/
acm->notification_buffer =
kmalloc(alloc_size, GFP_ATOMIC);dr should point to the new acm->notification_buffer.
The second problem is any data in the notification_buffer is lost when the pointer is freed. In the normal case, the current data is accumulated in the notification_buffer here.
memcpy(&acm->notification_buffer[acm->nb_index], urb->transfer_buffer, copy_size);
When a resize happens, anything before
notification_buffer[acm->nb_index] is garbage.
The third problem is the acm->nb_index is not reset on a resizing buffer error.
So switch resizing to using krealloc and reassign dr and reset nb_index.
--- drivers/usb/class/cdc-acm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
drivers/usb/class/cdc-acm.c +10 -12
@@ -378,21 +378,19 @@ static void acm_ctrl_irq(struct urb *urbif (current_size < expected_size) {/* notification is transmitted fragmented, reassemble */ if (acm->nb_size < expected_size) { -if (acm->nb_size) { -kfree (acm->notification_buffer); - acm->nb_size =0 ; - } +u8 *new_buffer; alloc_size =roundup_pow_of_two (expected_size); -/* -* kmalloc ensures a valid notification_buffer after a -* use of kfree in case the previous allocation was too -* small. Final freeing is done on disconnect. -*/ - acm->notification_buffer = -kmalloc (alloc_size,GFP_ATOMIC ); -if (!acm->notification_buffer) +/* Final freeing is done on disconnect. */ + new_buffer =krealloc (acm->notification_buffer, + alloc_size,GFP_ATOMIC ); +if (!new_buffer) { + acm->nb_index =0 ; goto exit; + } + + acm->notification_buffer = new_buffer; acm->nb_size = alloc_size; + dr = (struct usb_cdc_notification *)acm->notification_buffer; } copy_size = min(current_size,
Greg Kroah-Hartman
maintainerPATCH 199/214 usb: storage: Add unusual_uas entry for Sony PSZ drives
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 20934c0de13b49a072fb1e0ca79fe0fe0e40eae5 upstream.
The PSZ-HA* family of USB disk drives from Sony can't handle the REPORT OPCODES command when using the UAS protocol. This patch adds an appropriate quirks entry.
--- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_uas.h +7 -0
@@ -28,6 +28,13 @@* and don't forget to CC: the USB development list <[email protected]> */ +/* Reported-by: Till Dörges <[email protected]> */ +UNUSUAL_DEV (0x054c ,0x087d ,0x0000 ,0x9999 , +"Sony" , +"PSZ-HA*" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_NO_REPORT_OPCODES ), +/* Reported-by: Julian Groß <[email protected]> */ UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, "LaCie",
Greg Kroah-Hartman
maintainerPATCH 200/214 drm/i915: Fix cmd parser desc matching with masks
In reply to Greg Kroah-HartmanFrom: Mika Kuoppala <[email protected]>
[ Upstream commit e5f10d6385cda083037915c12b130887c8831d2b ]
Our variety of defined gpu commands have the actual command id field and possibly length and flags applied.
We did start to apply the mask during initialization of the cmd descriptors but forgot to also apply it on comparisons.
Fix comparisons in order to properly deny access with associated commands.
v2: fix lri with correct mask (Chris)
--- drivers/gpu/drm/i915/i915_cmd_parser.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_cmd_parser.c +10 -4
@@ -1207,6 +1207,12 @@ static u32 *copy_batch(struct drm_i915_gem_object *dst_obj,return dst; } +static inline bool cmd_desc_is (const struct drm_i915_cmd_descriptor *const desc, +const u32 cmd) +{ +return desc->cmd.value == (cmd & desc->cmd.mask); +} +static bool check_cmd (const struct intel_engine_cs *engine,const struct drm_i915_cmd_descriptor *desc,const u32 *cmd,u32 length)
@@ -1245,19 +1251,19 @@ static bool check_cmd(const struct intel_engine_cs *engine,* allowed mask/value pair given in the whitelist entry. */ if (reg->mask) { -if (desc->cmd.value ==MI_LOAD_REGISTER_MEM ) { +if (cmd_desc_is (desc,MI_LOAD_REGISTER_MEM )) {DRM_DEBUG_DRIVER ("CMD: Rejected LRM to masked register 0x%08X\n" , reg_addr);return false; } -if (desc->cmd.value ==MI_LOAD_REGISTER_REG ) { +if (cmd_desc_is (desc,MI_LOAD_REGISTER_REG )) {DRM_DEBUG_DRIVER ("CMD: Rejected LRR to masked register 0x%08X\n" , reg_addr);return false; } -if (desc->cmd.value ==MI_LOAD_REGISTER_IMM (1 ) && +if (cmd_desc_is (desc,MI_LOAD_REGISTER_IMM (1 )) && (offset +2 > length || (cmd[offset +1 ] & reg->mask) != reg->value)) { DRM_DEBUG_DRIVER("CMD: Rejected LRI to masked register 0x%08X\n",
@@ -1488,7 +1494,7 @@ int intel_engine_cmd_parser(struct i915_gem_context *ctx, goto err; } -if (desc->cmd.value ==MI_BATCH_BUFFER_START ) { +if (cmd_desc_is (desc,MI_BATCH_BUFFER_START )) { ret =check_bbstart (ctx, cmd, offset, length, batch_len, batch_start, shadow_batch_start);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 201/214 usb: dwc3: gadget: Dont setup more than requested
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit 5d187c0454ef4c5e046a81af36882d4d515922ec ]
The SG list may be set up with entry size more than the requested length. Check the usb_request->length and make sure that we don't setup the TRBs to send/receive more than requested. This case may occur when the SG entry is allocated up to a certain minimum size, but the request length is less than that. It can also occur when the request is reused for a different request length.
--- drivers/usb/dwc3/gadget.c | 51 +++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-)
drivers/usb/dwc3/gadget.c +35 -16
@@ -1017,26 +1017,24 @@ static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb,* dwc3_prepare_one_trb - setup one TRB from one request * @dep: endpoint for which this request is prepared * @req: dwc3_request pointer +* @trb_length: buffer size of the TRB * @chain: should this TRB be chained to the next? * @node: only for isochronous endpoints. First TRB needs different type. */ static void dwc3_prepare_one_trb (struct dwc3_ep *dep, -struct dwc3_request *req,unsigned chain,unsigned node) +struct dwc3_request *req,unsigned int trb_length, +unsigned chain,unsigned node) {struct dwc3_trb *trb; -unsigned int length;dma_addr_t dma;unsigned stream_id = req->request.stream_id;unsigned short_not_ok = req->request.short_not_ok;unsigned no_interrupt = req->request.no_interrupt; -if (req->request.num_sgs >0 ) { - length =sg_dma_len (req->start_sg); +if (req->request.num_sgs >0 ) dma =sg_dma_address (req->start_sg); - }else { - length = req->request.length; +else dma = req->request.dma; - } trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1048,7 +1046,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, req->num_trbs++; -__dwc3_prepare_one_trb (dep, trb, dma, length, chain, node, +__dwc3_prepare_one_trb (dep, trb, dma, trb_length, chain, node, stream_id, short_not_ok, no_interrupt); }
@@ -1058,16 +1056,27 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,struct scatterlist *sg = req->start_sg;struct scatterlist *s;int i; - +unsigned int length = req->request.length;unsigned int remaining = req->request.num_mapped_sgs - req->num_queued_sgs; +/* +* If we resume preparing the request, then get the remaining length of +* the request and resume where we left off. +*/ +for_each_sg (req->request.sg, s, req->num_queued_sgs, i) + length -=sg_dma_len (s); +for_each_sg (sg, s, remaining, i) { -unsigned int length = req->request.length;unsigned int maxp =usb_endpoint_maxp (dep->endpoint.desc);unsigned int rem = length % maxp; +unsigned int trb_length;unsigned chain = true; + trb_length = min_t(unsigned int, length, sg_dma_len(s)); + + length -= trb_length; +/* * IOMMU driver is coalescing the list of sgs which shares a * page boundary into one and giving it to USB driver. With
@@ -1075,7 +1084,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,* sgs passed. So mark the chain bit to false if it isthe last * mapped sg. */ -if (i == remaining -1 ) +if ((i == remaining -1 ) || !length) chain = false;if (rem &&usb_endpoint_dir_out (dep->endpoint.desc) && !chain) {
@@ -1085,7 +1094,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, req->needs_extra_trb = true;/* prepare normal TRB */ -dwc3_prepare_one_trb (dep, req, true, i); +dwc3_prepare_one_trb (dep, req, trb_length, true, i);/* Now prepare one extra TRB to align transfer size */ trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1096,7 +1105,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, req->request.short_not_ok, req->request.no_interrupt); }else { -dwc3_prepare_one_trb (dep, req, chain, i); +dwc3_prepare_one_trb (dep, req, trb_length, chain, i); }/*
@@ -1111,6 +1120,16 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, req->num_queued_sgs++; +/* +* The number of pending SG entries may not correspond to the +* number of mapped SG entries. If all the data are queued, then +* don't include unused SG entries. +*/ +if (length ==0 ) { + req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs; +break ; + } +if (!dwc3_calc_trbs_left (dep))break ; }
@@ -1130,7 +1149,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, req->needs_extra_trb = true;/* prepare normal TRB */ -dwc3_prepare_one_trb (dep, req, true,0 ); +dwc3_prepare_one_trb (dep, req, length, true,0 );/* Now prepare one extra TRB to align transfer size */ trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1147,7 +1166,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, req->needs_extra_trb = true;/* prepare normal TRB */ -dwc3_prepare_one_trb (dep, req, true,0 ); +dwc3_prepare_one_trb (dep, req, length, true,0 );/* Now prepare one extra TRB to handle ZLP */ trb = &dep->trb_pool[dep->trb_enqueue];
@@ -1157,7 +1176,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, req->request.short_not_ok, req->request.no_interrupt); }else { -dwc3_prepare_one_trb (dep, req, false,0 ); +dwc3_prepare_one_trb (dep, req, length, false,0 ); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 202/214 usb: dwc3: gadget: Fix handling ZLP
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit d2ee3ff79e6a3d4105e684021017d100524dc560 ]
The usb_request->zero doesn't apply for isoc. Also, if we prepare a 0-length (ZLP) TRB for the OUT direction, we need to prepare an extra TRB to pad up to the MPS alignment. Use the same bounce buffer for the ZLP TRB and the extra pad TRB.
--- drivers/usb/dwc3/gadget.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
drivers/usb/dwc3/gadget.c +22 -2
@@ -1159,6 +1159,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, req->request.short_not_ok, req->request.no_interrupt); }else if (req->request.zero && req->request.length && + !usb_endpoint_xfer_isoc (dep->endpoint.desc) && (IS_ALIGNED (req->request.length, maxp))) {struct dwc3 *dwc = dep->dwc;struct dwc3_trb *trb;
@@ -1168,13 +1169,23 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,/* prepare normal TRB */ dwc3_prepare_one_trb (dep, req, length, true,0 ); -/* Now prepare one extra TRB to handle ZLP */ +/* Prepare one extra TRB to handle ZLP */ trb = &dep->trb_pool[dep->trb_enqueue]; req->num_trbs++;__dwc3_prepare_one_trb (dep, trb, dwc->bounce_addr,0 , - false,1 , req->request.stream_id, + !req->direction,1 , req->request.stream_id, req->request.short_not_ok, req->request.no_interrupt); + +/* Prepare one more TRB to handle MPS alignment for OUT */ +if (!req->direction) { + trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; +__dwc3_prepare_one_trb (dep, trb, dwc->bounce_addr, maxp, + false,1 , req->request.stream_id, + req->request.short_not_ok, + req->request.no_interrupt); + } }else {dwc3_prepare_one_trb (dep, req, length, false,0 ); }
@@ -2578,8 +2589,17 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, status);if (req->needs_extra_trb) { +unsigned int maxp =usb_endpoint_maxp (dep->endpoint.desc); + ret =dwc3_gadget_ep_reclaim_trb_linear (dep, req, event, status); + +/* Reclaim MPS padding TRB for ZLP */ +if (!req->direction && req->request.zero && req->request.length && + !usb_endpoint_xfer_isoc (dep->endpoint.desc) && + (IS_ALIGNED (req->request.length, maxp))) + ret =dwc3_gadget_ep_reclaim_trb_linear (dep, req, event, status); + req->needs_extra_trb = false; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 203/214 usb: dwc3: gadget: Handle ZLP for sg requests
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
[ Upstream commit bc9a2e226ea95e1699f7590845554de095308b75 ]
Currently dwc3 doesn't handle usb_request->zero for SG requests. This change checks and prepares extra TRBs for the ZLP for SG requests.
--- drivers/usb/dwc3/gadget.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/usb/dwc3/gadget.c +29 -0
@@ -1104,6 +1104,35 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, req->request.stream_id, req->request.short_not_ok, req->request.no_interrupt); + }else if (req->request.zero && req->request.length && + !usb_endpoint_xfer_isoc (dep->endpoint.desc) && + !rem && !chain) { +struct dwc3 *dwc = dep->dwc; +struct dwc3_trb *trb; + + req->needs_extra_trb = true; + +/* Prepare normal TRB */ +dwc3_prepare_one_trb (dep, req, trb_length, true, i); + +/* Prepare one extra TRB to handle ZLP */ + trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; +__dwc3_prepare_one_trb (dep, trb, dwc->bounce_addr,0 , + !req->direction,1 , + req->request.stream_id, + req->request.short_not_ok, + req->request.no_interrupt); + +/* Prepare one more TRB to handle MPS alignment */ +if (!req->direction) { + trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; +__dwc3_prepare_one_trb (dep, trb, dwc->bounce_addr, maxp, + false,1 , req->request.stream_id, + req->request.short_not_ok, + req->request.no_interrupt); + } }else {dwc3_prepare_one_trb (dep, req, trb_length, chain, i); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 204/214 fbmem: pull fbcon_update_vcs() out of fb_set_var()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit d88ca7e1a27eb2df056bbf37ddef62e1c73d37ea ]
syzbot is reporting OOB read bug in vc_do_resize() [1] caused by memcpy() based on outdated old_{rows,row_size} values, for resize_screen() can recurse into vc_do_resize() which changes vc->vc_{cols,rows} that outdates old_{rows,row_size} values which were saved before calling resize_screen().
Daniel Vetter explained that resize_screen() should not recurse into fbcon_update_vcs() path due to FBINFO_MISC_USEREVENT being still set when calling resize_screen().
Instead of masking FBINFO_MISC_USEREVENT before calling fbcon_update_vcs(), we can remove FBINFO_MISC_USEREVENT by calling fbcon_update_vcs() only if fb_set_var() returned 0. This change assumes that it is harmless to call fbcon_update_vcs() when fb_set_var() returned 0 without reaching fb_notifier_call_chain().
[1] https://syzkaller.appspot.com/bug?id=c70c88cfd16dcf6e1d3c7f0ab8648b3144b5b25e
--- drivers/video/fbdev/core/fbmem.c | 8 ++------ drivers/video/fbdev/core/fbsysfs.c | 4 ++-- drivers/video/fbdev/ps3fb.c | 5 +++-- include/linux/fb.h | 2 -- 4 files changed, 7 insertions(+), 12 deletions(-)
drivers/video/fbdev/core/fbmem.c +2 -6
@@ -952,7 +952,6 @@ static int fb_check_caps(struct fb_info *info, struct fb_var_screeninfo *var,int fb_set_var (struct fb_info *info,struct fb_var_screeninfo *var) { -int flags = info->flags;int ret =0 ;u32 activate;struct fb_var_screeninfo old_var;
@@ -1047,9 +1046,6 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) event.data = &mode;fb_notifier_call_chain (FB_EVENT_MODE_CHANGE , &event); -if (flags &FBINFO_MISC_USEREVENT ) -fbcon_update_vcs (info, activate &FB_ACTIVATE_ALL ); -return 0 ; }EXPORT_SYMBOL (fb_set_var);
@@ -1100,9 +1096,9 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,return -EFAULT ;console_lock ();lock_fb_info (info); - info->flags |=FBINFO_MISC_USEREVENT ; ret =fb_set_var (info, &var); - info->flags &= ~FBINFO_MISC_USEREVENT ; +if (!ret) +fbcon_update_vcs (info, var.activate &FB_ACTIVATE_ALL );unlock_fb_info (info);console_unlock ();if (!ret &©_to_user (argp, &var,sizeof (var)))
drivers/video/fbdev/core/fbsysfs.c +2 -2
@@ -91,9 +91,9 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) var->activate |=FB_ACTIVATE_FORCE ;console_lock (); - fb_info->flags |=FBINFO_MISC_USEREVENT ; err =fb_set_var (fb_info, var); - fb_info->flags &= ~FBINFO_MISC_USEREVENT ; +if (!err) +fbcon_update_vcs (fb_info, var->activate &FB_ACTIVATE_ALL );console_unlock ();if (err)return err;
drivers/video/fbdev/ps3fb.c +3 -2
@@ -29,6 +29,7 @@#include <linux/freezer.h> #include <linux/uaccess.h> #include <linux/fb.h> +#include <linux/fbcon.h> #include <linux/init.h> #include <asm/cell-regs.h>
@@ -824,12 +825,12 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd, var = info->var;fb_videomode_to_var (&var, vmode);console_lock (); - info->flags |=FBINFO_MISC_USEREVENT ;/* Force, in case only special bits changed */ var.activate |=FB_ACTIVATE_FORCE ; par->new_mode_id = val; retval =fb_set_var (info, &var); - info->flags &= ~FBINFO_MISC_USEREVENT ; +if (!retval) +fbcon_update_vcs (info, var.activate &FB_ACTIVATE_ALL );console_unlock (); }break ;
include/linux/fb.h +0 -2
@@ -400,8 +400,6 @@ struct fb_tile_ops {#define FBINFO_HWACCEL_YPAN 0x2000/* optional */ #define FBINFO_HWACCEL_YWRAP 0x4000/* optional */ -#define FBINFO_MISC_USEREVENT 0x10000/* event request -from userspace */ #define FBINFO_MISC_TILEBLITTING 0x20000/* use tile blitting */ /* A driver may set this flag to indicate that it does want a set_par to be
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 205/214 kheaders: remove unneeded cat command piped to head / tail
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 9a066357184485784f782719093ff804d05b85db upstream.
The 'head' and 'tail' commands can take a file path directly. So, you do not need to run 'cat'.
cat kernel/kheaders.md5 | head -1
... is equivalent to:
head -1 kernel/kheaders.md5
and the latter saves forking one process.
While I was here, I replaced 'head -1' with 'head -n 1'.
I also replaced '==' with '=' since we do not have a good reason to use the bashism.
--- kernel/gen_kheaders.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/gen_kheaders.sh +4 -4
@@ -41,10 +41,10 @@ obj_files_md5="$(find $dir_list -name "* this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi if [ -f kernel/kheaders.md5 ] && - [ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] && - [ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] && - [ "$(cat kernel/kheaders.md5|head -3|tail -1)" == "$this_file_md5" ] && - [ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then + [ "$(head -n 1 kernel/kheaders.md5)" = "$src_files_md5" ] && + [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$obj_files_md5" ] && + [ "$(head -n 3 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && + [ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then exit fi
Greg Kroah-Hartman
maintainerPATCH 206/214 kheaders: optimize md5sum calculation for in-tree builds
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 0e11773e76098729552b750ccff79374d1e62002 upstream.
This script computes md5sum of headers in srctree and in objtree. However, when we are building in-tree, we know the srctree and the objtree are the same. That is, we end up with the same computation twice. In fact, the first two lines of kernel/kheaders.md5 are always the same for in-tree builds.
Unify the two md5sum calculations.
For in-tree builds ($building_out_of_srctree is empty), we check only two directories, "include", and "arch/$SRCARCH/include".
For out-of-tree builds ($building_out_of_srctree is 1), we check 4 directories, "$srctree/include", "$srctree/arch/$SRCARCH/include", "include", and "arch/$SRCARCH/include" since we know they are all different.
--- kernel/gen_kheaders.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
kernel/gen_kheaders.sh +16 -16
@@ -21,29 +21,30 @@ arch/$SRCARCH/include/ # Uncomment it for debugging. # if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter; # else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi -# find $src_file_list -name "*.h" | xargs ls -l > /tmp/src-ls-$iter -# find $obj_file_list -name "*.h" | xargs ls -l > /tmp/obj-ls-$iter +# find $all_dirs -name "*.h" | xargs ls -l > /tmp/ls-$iter + +all_dirs= +if [ "$building_out_of_srctree" ]; then + for d in $dir_list; do + all_dirs="$all_dirs $srctree/$d" + done +fi +all_dirs="$all_dirs $dir_list" # include/generated/compile.h is ignored because it is touched even when none # of the source files changed. This causes pointless regeneration, so let us # ignore them for md5 calculation. -pushd $srctree > /dev/null -src_files_md5="$(find $dir_list -name "*.h" | - grep -v "include/generated/compile.h" | - grep -v "include/generated/autoconf.h" | - xargs ls -l | md5sum | cut -d ' ' -f1)" -popd > /dev/null -obj_files_md5="$(find $dir_list -name "*.h" | - grep -v "include/generated/compile.h" | - grep -v "include/generated/autoconf.h" | +headers_md5="$(find $all_dirs -name "*.h" | + grep -v "include/generated/compile.h" | + grep -v "include/generated/autoconf.h" | xargs ls -l | md5sum | cut -d ' ' -f1)" + # Any changes to this script will also cause a rebuild of the archive. this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi if [ -f kernel/kheaders.md5 ] && - [ "$(head -n 1 kernel/kheaders.md5)" = "$src_files_md5" ] && - [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$obj_files_md5" ] && - [ "$(head -n 3 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && + [ "$(head -n 1 kernel/kheaders.md5)" = "$headers_md5" ] && + [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && [ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then exit fi
@@ -79,8 +80,7 @@ find $cpio_dir -printf "./%P\n" | LC_ALL --owner=0 --group=0 --numeric-owner --no-recursion \ -Jcf $tarfile -C $cpio_dir/ -T - > /dev/null -echo "$src_files_md5" > kernel/kheaders.md5 -echo "$obj_files_md5" >> kernel/kheaders.md5 +echo $headers_md5 > kernel/kheaders.md5 echo "$this_file_md5" >> kernel/kheaders.md5 echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5
Greg Kroah-Hartman
maintainerPATCH 207/214 kheaders: optimize header copy for in-tree builds
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit ea79e5168be644fdaf7d4e6a73eceaf07b3da76a upstream.
This script copies headers by the cpio command twice; first from srctree, and then from objtree. However, when we building in-tree, we know the srctree and the objtree are the same. That is, all the headers copied by the first cpio are overwritten by the second one.
Skip the first cpio when we are building in-tree.
--- kernel/gen_kheaders.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
kernel/gen_kheaders.sh +9 -7
@@ -56,14 +56,16 @@ fi rm -rf $cpio_dir mkdir $cpio_dir -pushd $srctree > /dev/null -for f in $dir_list; - do find "$f" -name "*.h"; -done | cpio --quiet -pd $cpio_dir -popd > /dev/null +if [ "$building_out_of_srctree" ]; then + pushd $srctree > /dev/null + for f in $dir_list + do find "$f" -name "*.h"; + done | cpio --quiet -pd $cpio_dir + popd > /dev/null +fi -# The second CPIO can complain if files already exist which can -# happen with out of tree builds. Just silence CPIO for now. +# The second CPIO can complain if files already exist which can happen with out +# of tree builds having stale headers in srctree. Just silence CPIO for now. for f in $dir_list; do find "$f" -name "*.h"; done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
Greg Kroah-Hartman
maintainerPATCH 208/214 kheaders: remove the last bashism to allow sh to run it
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit 1463f74f492eea7191f0178e01f3d38371a48210 upstream.
'pushd' ... 'popd' is the last bash-specific code in this script. One way to avoid it is to run the code in a sub-shell.
With that addressed, you can run this script with sh.
I replaced $(BASH) with $(CONFIG_SHELL), and I changed the hashbang to #!/bin/sh.
--- kernel/Makefile | 2 +- kernel/gen_kheaders.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-)
kernel/Makefile +1 -1
@@ -128,7 +128,7 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz - cmd_genikh = $(BASH) $(srctree)/kernel/gen_kheaders.sh $@ + cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@ $(obj)/kheaders_data.tar.xz: FORCE $(call cmd,genikh)
kernel/gen_kheaders.sh +7 -6
@@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: GPL-2.0 # This script generates an archive consisting of kernel headers
@@ -57,11 +57,12 @@ rm -rf $cpio_dir mkdir $cpio_dir if [ "$building_out_of_srctree" ]; then - pushd $srctree > /dev/null - for f in $dir_list - do find "$f" -name "*.h"; - done | cpio --quiet -pd $cpio_dir - popd > /dev/null + ( + cd $srctree + for f in $dir_list + do find "$f" -name "*.h"; + done | cpio --quiet -pd $cpio_dir + ) fi # The second CPIO can complain if files already exist which can happen with out
Greg Kroah-Hartman
maintainerPATCH 209/214 kheaders: explain why include/config/autoconf.h is excluded from md5sum
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit f276031b4e2f4c961ed6d8a42f0f0124ccac2e09 upstream.
This comment block explains why include/generated/compile.h is omitted, but nothing about include/generated/autoconf.h, which might be more difficult to understand. Add more comments.
--- kernel/gen_kheaders.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
kernel/gen_kheaders.sh +9 -2
@@ -32,8 +32,15 @@ fi all_dirs="$all_dirs $dir_list" # include/generated/compile.h is ignored because it is touched even when none -# of the source files changed. This causes pointless regeneration, so let us -# ignore them for md5 calculation. +# of the source files changed. +# +# When Kconfig regenerates include/generated/autoconf.h, its timestamp is +# updated, but the contents might be still the same. When any CONFIG option is +# changed, Kconfig touches the corresponding timestamp file include/config/*.h. +# Hence, the md5sum detects the configuration change anyway. We do not need to +# check include/generated/autoconf.h explicitly. +# +# Ignore them for md5 calculation to avoid pointless regeneration. headers_md5="$(find $all_dirs -name "*.h" | grep -v "include/generated/compile.h" | grep -v "include/generated/autoconf.h" |
Greg Kroah-Hartman
maintainerPATCH 210/214 kbuild: add variables for compression tools
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit 8dfb61dcbaceb19a5ded5e9c9dcf8d05acc32294 upstream.
Allow user to use alternative implementations of compression tools, such as pigz, pbzip2, pxz. For example, multi-threaded tools to speed up the build:
$ make GZIP=pigz BZIP2=pbzip2
Variables _GZIP, _BZIP2, _LZOP are used internally because original env vars are reserved by the tools. The use of GZIP in gzip tool is obsolete since 2015. However, alternative implementations (e.g., pigz) still rely on it. BZIP2, BZIP, LZOP vars are not obsolescent.
The credit goes to @grsecurity.
As a sidenote, for multi-threaded lzma, xz compression one can use:
$ export XZ_OPT="--threads=0"
--- Makefile | 25 +++++++++++++++++++++++-- arch/arm/boot/deflate_xip_data.sh | 2 +- arch/ia64/Makefile | 2 +- arch/m68k/Makefile | 8 ++++---- arch/parisc/Makefile | 2 +- kernel/gen_kheaders.sh | 2 +- scripts/Makefile.lib | 12 ++++++------ scripts/Makefile.package | 8 ++++---- scripts/package/buildtar | 6 +++--- scripts/xz_wrap.sh | 2 +- 10 files changed, 45 insertions(+), 24 deletions(-)
Makefile +23 -2
@@ -442,6 +442,26 @@ PYTHON = python PYTHON3 = python3 CHECK = sparse BASH = bash +GZIP = gzip +BZIP2 = bzip2 +LZOP = lzop +LZMA = lzma +LZ4 = lz4c +XZ = xz + +# GZIP, BZIP2, LZOP env vars are used by the tools. Support them as the command +# line interface, but use _GZIP, _BZIP2, _LZOP internally. +_GZIP := $(GZIP) +_BZIP2 := $(BZIP2) +_LZOP := $(LZOP) + +# Reset GZIP, BZIP2, LZOP in this Makefile +override GZIP= +override BZIP2= +override LZOP= + +# Reset GZIP, BZIP2, LZOP in recursive invocations +MAKEOVERRIDES += GZIP= BZIP2= LZOP= CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
@@ -490,6 +510,7 @@ CLANG_FLAGS := export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX +export _GZIP _BZIP2 _LZOP LZMA LZ4 XZ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
@@ -997,10 +1018,10 @@ export mod_strip_cmd mod_compress_cmd = true ifdef CONFIG_MODULE_COMPRESS ifdef CONFIG_MODULE_COMPRESS_GZIP - mod_compress_cmd = gzip -n -f + mod_compress_cmd = $(_GZIP) -n -f endif # CONFIG_MODULE_COMPRESS_GZIP ifdef CONFIG_MODULE_COMPRESS_XZ - mod_compress_cmd = xz -f + mod_compress_cmd = $(XZ) -f endif # CONFIG_MODULE_COMPRESS_XZ endif # CONFIG_MODULE_COMPRESS export mod_compress_cmd
arch/arm/boot/deflate_xip_data.sh +1 -1
@@ -56,7 +56,7 @@ trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 # substitute the data section by a compressed version $DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp" $DD if="$XIPIMAGE" skip=$data_start iflag=skip_bytes | -gzip -9 >> "$XIPIMAGE.tmp" +$_GZIP -9 >> "$XIPIMAGE.tmp" # replace kernel binary mv -f "$XIPIMAGE.tmp" "$XIPIMAGE"
arch/ia64/Makefile +1 -1
@@ -40,7 +40,7 @@ $(error Sorry, you need a newer version endif quiet_cmd_gzip = GZIP $@ -cmd_gzip = cat $(real-prereqs) | gzip -n -f -9 > $@ +cmd_gzip = cat $(real-prereqs) | $(_GZIP) -n -f -9 > $@ quiet_cmd_objcopy = OBJCOPY $@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
arch/m68k/Makefile +4 -4
@@ -135,10 +135,10 @@ vmlinux.gz: vmlinux ifndef CONFIG_KGDB cp vmlinux vmlinux.tmp $(STRIP) vmlinux.tmp - gzip -9c vmlinux.tmp >vmlinux.gz + $(_GZIP) -9c vmlinux.tmp >vmlinux.gz rm vmlinux.tmp else - gzip -9c vmlinux >vmlinux.gz + $(_GZIP) -9c vmlinux >vmlinux.gz endif bzImage: vmlinux.bz2
@@ -148,10 +148,10 @@ vmlinux.bz2: vmlinux ifndef CONFIG_KGDB cp vmlinux vmlinux.tmp $(STRIP) vmlinux.tmp - bzip2 -1c vmlinux.tmp >vmlinux.bz2 + $(_BZIP2) -1c vmlinux.tmp >vmlinux.bz2 rm vmlinux.tmp else - bzip2 -1c vmlinux >vmlinux.bz2 + $(_BZIP2) -1c vmlinux >vmlinux.bz2 endif archclean:
arch/parisc/Makefile +1 -1
@@ -156,7 +156,7 @@ vmlinuz: bzImage $(OBJCOPY) $(boot)/bzImage $@ else vmlinuz: vmlinux - @gzip -cf -9 $< > $@ + @$(_GZIP) -cf -9 $< > $@ endif install:
kernel/gen_kheaders.sh +1 -1
@@ -88,7 +88,7 @@ find $cpio_dir -type f -print0 | find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \ tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ --owner=0 --group=0 --numeric-owner --no-recursion \ - -Jcf $tarfile -C $cpio_dir/ -T - > /dev/null + -I $XZ -cf $tarfile -C $cpio_dir/ -T - > /dev/null echo $headers_md5 > kernel/kheaders.md5 echo "$this_file_md5" >> kernel/kheaders.md5
scripts/Makefile.lib +6 -6
@@ -230,7 +230,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) # --------------------------------------------------------------------------- quiet_cmd_gzip = GZIP $@ - cmd_gzip = cat $(real-prereqs) | gzip -n -f -9 > $@ + cmd_gzip = cat $(real-prereqs) | $(_GZIP) -n -f -9 > $@ # DTC # ---------------------------------------------------------------------------
@@ -322,19 +322,19 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ - cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9; $(size_append); } > $@ + cmd_bzip2 = { cat $(real-prereqs) | $(_BZIP2) -9; $(size_append); } > $@ # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ - cmd_lzma = { cat $(real-prereqs) | lzma -9; $(size_append); } > $@ + cmd_lzma = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@ quiet_cmd_lzo = LZO $@ - cmd_lzo = { cat $(real-prereqs) | lzop -9; $(size_append); } > $@ + cmd_lzo = { cat $(real-prereqs) | $(_LZOP) -9; $(size_append); } > $@ quiet_cmd_lz4 = LZ4 $@ - cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout; \ + cmd_lz4 = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \ $(size_append); } > $@ # U-Boot mkimage
@@ -381,7 +381,7 @@ quiet_cmd_xzkern = XZKERN $@ $(size_append); } > $@ quiet_cmd_xzmisc = XZMISC $@ - cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@ + cmd_xzmisc = cat $(real-prereqs) | $(XZ) --check=crc32 --lzma2=dict=1MiB > $@ # ASM offsets # ---------------------------------------------------------------------------
scripts/Makefile.package +4 -4
@@ -45,7 +45,7 @@ if test "$(objtree)" != "$(srctree)"; th false; \ fi ; \ $(srctree)/scripts/setlocalversion --save-scmversion; \ -tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ +tar -I $(_GZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ rm -f $(objtree)/.scmversion
@@ -127,9 +127,9 @@ util/PERF-VERSION-GEN $(CURDIR)/$(perf-t tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \ rm -r $(perf-tar); \ $(if $(findstring tar-src,$@),, \ -$(if $(findstring bz2,$@),bzip2, \ -$(if $(findstring gz,$@),gzip, \ -$(if $(findstring xz,$@),xz, \ +$(if $(findstring bz2,$@),$(_BZIP2), \ +$(if $(findstring gz,$@),$(_GZIP), \ +$(if $(findstring xz,$@),$(XZ), \ $(error unknown target $@)))) \ -f -9 $(perf-tar).tar)
scripts/package/buildtar +3 -3
@@ -28,15 +28,15 @@ case "${1}" in opts= ;; targz-pkg) - opts=--gzip + opts="-I ${_GZIP}" tarball=${tarball}.gz ;; tarbz2-pkg) - opts=--bzip2 + opts="-I ${_BZIP2}" tarball=${tarball}.bz2 ;; tarxz-pkg) - opts=--xz + opts="-I ${XZ}" tarball=${tarball}.xz ;; *)
scripts/xz_wrap.sh +1 -1
@@ -20,4 +20,4 @@ case $SRCARCH in sparc) BCJ=--sparc ;; esac -exec xz --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB +exec $XZ --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB
Greg Kroah-Hartman
maintainerPATCH 211/214 kbuild: fix broken builds because of GZIP,BZIP2,LZOP variables
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
commit e4a42c82e943b97ce124539fcd7a47445b43fa0d upstream.
Redefine GZIP, BZIP2, LZOP variables as KGZIP, KBZIP2, KLZOP resp. GZIP, BZIP2, LZOP env variables are reserved by the tools. The original attempt to redefine them internally doesn't work in makefiles/scripts intercall scenarios, e.g., "make GZIP=gzip bindeb-pkg" and results in broken builds. There can be other broken build commands because of this, so the universal solution is to use non-reserved env variables for the compression tools.
--- Makefile | 24 +++++------------------- arch/arm/boot/deflate_xip_data.sh | 2 +- arch/ia64/Makefile | 2 +- arch/m68k/Makefile | 8 ++++---- arch/parisc/Makefile | 2 +- scripts/Makefile.lib | 6 +++--- scripts/Makefile.package | 6 +++--- scripts/package/buildtar | 4 ++-- 8 files changed, 20 insertions(+), 34 deletions(-)
Makefile +5 -19
@@ -442,27 +442,13 @@ PYTHON = python PYTHON3 = python3 CHECK = sparse BASH = bash -GZIP = gzip -BZIP2 = bzip2 -LZOP = lzop +KGZIP = gzip +KBZIP2 = bzip2 +KLZOP = lzop LZMA = lzma LZ4 = lz4c XZ = xz -# GZIP, BZIP2, LZOP env vars are used by the tools. Support them as the command -# line interface, but use _GZIP, _BZIP2, _LZOP internally. -_GZIP := $(GZIP) -_BZIP2 := $(BZIP2) -_LZOP := $(LZOP) - -# Reset GZIP, BZIP2, LZOP in this Makefile -override GZIP= -override BZIP2= -override LZOP= - -# Reset GZIP, BZIP2, LZOP in recursive invocations -MAKEOVERRIDES += GZIP= BZIP2= LZOP= - CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) NOSTDINC_FLAGS :=
@@ -510,7 +496,7 @@ CLANG_FLAGS := export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF PAHOLE LEX YACC AWK INSTALLKERNEL export PERL PYTHON PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX -export _GZIP _BZIP2 _LZOP LZMA LZ4 XZ +export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
@@ -1018,7 +1004,7 @@ export mod_strip_cmd mod_compress_cmd = true ifdef CONFIG_MODULE_COMPRESS ifdef CONFIG_MODULE_COMPRESS_GZIP - mod_compress_cmd = $(_GZIP) -n -f + mod_compress_cmd = $(KGZIP) -n -f endif # CONFIG_MODULE_COMPRESS_GZIP ifdef CONFIG_MODULE_COMPRESS_XZ mod_compress_cmd = $(XZ) -f
arch/arm/boot/deflate_xip_data.sh +1 -1
@@ -56,7 +56,7 @@ trap 'rm -f "$XIPIMAGE.tmp"; exit 1' 1 2 # substitute the data section by a compressed version $DD if="$XIPIMAGE" count=$data_start iflag=count_bytes of="$XIPIMAGE.tmp" $DD if="$XIPIMAGE" skip=$data_start iflag=skip_bytes | -$_GZIP -9 >> "$XIPIMAGE.tmp" +$KGZIP -9 >> "$XIPIMAGE.tmp" # replace kernel binary mv -f "$XIPIMAGE.tmp" "$XIPIMAGE"
arch/ia64/Makefile +1 -1
@@ -40,7 +40,7 @@ $(error Sorry, you need a newer version endif quiet_cmd_gzip = GZIP $@ -cmd_gzip = cat $(real-prereqs) | $(_GZIP) -n -f -9 > $@ +cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@ quiet_cmd_objcopy = OBJCOPY $@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
arch/m68k/Makefile +4 -4
@@ -135,10 +135,10 @@ vmlinux.gz: vmlinux ifndef CONFIG_KGDB cp vmlinux vmlinux.tmp $(STRIP) vmlinux.tmp - $(_GZIP) -9c vmlinux.tmp >vmlinux.gz + $(KGZIP) -9c vmlinux.tmp >vmlinux.gz rm vmlinux.tmp else - $(_GZIP) -9c vmlinux >vmlinux.gz + $(KGZIP) -9c vmlinux >vmlinux.gz endif bzImage: vmlinux.bz2
@@ -148,10 +148,10 @@ vmlinux.bz2: vmlinux ifndef CONFIG_KGDB cp vmlinux vmlinux.tmp $(STRIP) vmlinux.tmp - $(_BZIP2) -1c vmlinux.tmp >vmlinux.bz2 + $(KBZIP2) -1c vmlinux.tmp >vmlinux.bz2 rm vmlinux.tmp else - $(_BZIP2) -1c vmlinux >vmlinux.bz2 + $(KBZIP2) -1c vmlinux >vmlinux.bz2 endif archclean:
arch/parisc/Makefile +1 -1
@@ -156,7 +156,7 @@ vmlinuz: bzImage $(OBJCOPY) $(boot)/bzImage $@ else vmlinuz: vmlinux - @$(_GZIP) -cf -9 $< > $@ + @$(KGZIP) -cf -9 $< > $@ endif install:
scripts/Makefile.lib +3 -3
@@ -230,7 +230,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) # --------------------------------------------------------------------------- quiet_cmd_gzip = GZIP $@ - cmd_gzip = cat $(real-prereqs) | $(_GZIP) -n -f -9 > $@ + cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@ # DTC # ---------------------------------------------------------------------------
@@ -322,7 +322,7 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ - cmd_bzip2 = { cat $(real-prereqs) | $(_BZIP2) -9; $(size_append); } > $@ + cmd_bzip2 = { cat $(real-prereqs) | $(KBZIP2) -9; $(size_append); } > $@ # Lzma # ---------------------------------------------------------------------------
@@ -331,7 +331,7 @@ quiet_cmd_lzma = LZMA $@ cmd_lzma = { cat $(real-prereqs) | $(LZMA) -9; $(size_append); } > $@ quiet_cmd_lzo = LZO $@ - cmd_lzo = { cat $(real-prereqs) | $(_LZOP) -9; $(size_append); } > $@ + cmd_lzo = { cat $(real-prereqs) | $(KLZOP) -9; $(size_append); } > $@ quiet_cmd_lz4 = LZ4 $@ cmd_lz4 = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \
scripts/Makefile.package +3 -3
@@ -45,7 +45,7 @@ if test "$(objtree)" != "$(srctree)"; th false; \ fi ; \ $(srctree)/scripts/setlocalversion --save-scmversion; \ -tar -I $(_GZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ +tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \ --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ rm -f $(objtree)/.scmversion
@@ -127,8 +127,8 @@ util/PERF-VERSION-GEN $(CURDIR)/$(perf-t tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \ rm -r $(perf-tar); \ $(if $(findstring tar-src,$@),, \ -$(if $(findstring bz2,$@),$(_BZIP2), \ -$(if $(findstring gz,$@),$(_GZIP), \ +$(if $(findstring bz2,$@),$(KBZIP2), \ +$(if $(findstring gz,$@),$(KGZIP), \ $(if $(findstring xz,$@),$(XZ), \ $(error unknown target $@)))) \ -f -9 $(perf-tar).tar)
scripts/package/buildtar +2 -2
@@ -28,11 +28,11 @@ case "${1}" in opts= ;; targz-pkg) - opts="-I ${_GZIP}" + opts="-I ${KGZIP}" tarball=${tarball}.gz ;; tarbz2-pkg) - opts="-I ${_BZIP2}" + opts="-I ${KBZIP2}" tarball=${tarball}.bz2 ;; tarxz-pkg)
Greg Kroah-Hartman
maintainerPATCH 212/214 HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
commit 25a097f5204675550afb879ee18238ca917cba7a upstream.
uref->usage_index is not always being properly checked, causing hiddev_ioctl_usage() to go out of bounds under some cases. Fix it.
--- drivers/hid/usbhid/hiddev.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/usbhid/hiddev.c +4 -0
@@ -519,12 +519,16 @@ static noinline int hiddev_ioctl_usage(sswitch (cmd) {case HIDIOCGUSAGE : +if (uref->usage_index >= field->report_count) + goto inval; uref->value = field->value[uref->usage_index];if (copy_to_user (user_arg, uref,sizeof (*uref))) goto fault; goto goodreturn;case HIDIOCSUSAGE : +if (uref->usage_index >= field->report_count) + goto inval; field->value[uref->usage_index] = uref->value; goto goodreturn;
Greg Kroah-Hartman
maintainerPATCH 213/214 libbpf: Fix build on ppc64le architecture
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
commit 3fb1a96a91120877488071a167d26d76be4be977 upstream.
On ppc64le we get the following warning:
In file included from btf_dump.c:16:0:
btf_dump.c: In function ‘btf_dump_emit_struct_def’:
../include/linux/kernel.h:20:17: error: comparison of distinct pointer types lacks a cast [-Werror]
(void) (&_max1 == &_max2); \
^
btf_dump.c:882:11: note: in expansion of macro ‘max’
m_sz = max(0LL, btf__resolve_size(d->btf, m->type));
^~~Fix by explicitly casting to __s64, which is a return type from btf__resolve_size().
--- tools/lib/bpf/btf_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +1 -1
@@ -906,7 +906,7 @@ static void btf_dump_emit_struct_def(strbtf_dump_printf (d,": %d" , m_sz); off = m_off + m_sz; }else { - m_sz =max (0LL ,btf__resolve_size (d->btf, m->type)); + m_sz =max ((__s64 )0 ,btf__resolve_size (d->btf, m->type)); off = m_off + m_sz *8 ; }btf_dump_printf (d,";" );
Greg Kroah-Hartman
maintainerPATCH 214/214 ALSA: usb-audio: Update documentation comment for MS2109 quirk
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
commit 74a2a7de81a2ef20732ec02087314e92692a7a1b upstream.
As the recent fix addressed the channel swap problem more properly, update the comment as well.
--- sound/usb/quirks-table.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/quirks-table.h +2 -2
@@ -3705,8 +3705,8 @@ ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* A* they pretend to be 96kHz mono as a workaround for stereo being broken * by that... * -* They also have swapped L-R channels, but that's for userspace to deal -* with. +* They also have an issue with initial stream alignment that causes the +* channels to be swapped and out of phase, which is dealt with in quirks.c. */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.62 release. There are 214 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 03 Sep 2020 15:09:01 +0000. Anything received after that time might be too late.
Building x86_64:tools/perf ... failed
--------------
Error log:
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h' Makefile.config:846: No libcap found, disables capability support, please install libcap-devel/libcap-dev Makefile.config:958: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
PERF_VERSION = 5.4.61.gf5583dd12e6f
In file included from btf_dump.c:16:0:btf_dump.c: In function ‘btf_align_of’:tools/include/linux/kernel.h:53:17: error: comparison of distinct pointer types lacks a cast [-Werror]
(void) (&_min1 == &_min2); \
^
btf_dump.c:770:10: note: in expansion of macro ‘min’
return min(sizeof(void *), t->size);
^~~cc1: all warnings being treated as errors
make[7]: *** [/tmp/buildbot-builddir/tools/perf/staticobjs/btf_dump.o] Error 1
Bisect log below. Reverting the following two patches fixes the problem.
497ef945f327 libbpf: Fix build on ppc64le architecture 401834f55ce7 libbpf: Handle GCC built-in types for Arm NEON
Guenter
---
$ git bisect log # bad: [f5583dd12e6fc8a3c11ae732f38bce8334e150a2] Linux 5.4.62-rc1 # good: [6576d69aac94cd8409636dfa86e0df39facdf0d2] Linux 5.4.61 git bisect start 'HEAD' 'v5.4.61' # good: [6c747bd0794c982b500bda7334ef55d9dabb6cc6] nvme-fc: Fix wrong return value in __nvme_fc_init_request() git bisect good 6c747bd0794c982b500bda7334ef55d9dabb6cc6 # bad: [81b5698e6d9ecdc9569df8f4b93be70d587f5ddf] serial: samsung: Removes the IRQ not found warning git bisect bad 81b5698e6d9ecdc9569df8f4b93be70d587f5ddf # bad: [973679736caa8e1b39b68866535bdc7899a46f25] ASoC: wm8994: Avoid attempts to read unreadable registers git bisect bad 973679736caa8e1b39b68866535bdc7899a46f25 # good: [1789df2a787c589dbe83bc3ed52af2abbc739d1b] ext4: correctly restore system zone info when remount fails git bisect good 1789df2a787c589dbe83bc3ed52af2abbc739d1b # good: [ba1fb0301a60cbded377e0f312c82847415a1820] drm/amd/powerplay: correct UVD/VCE PG state on custom pptable uploading git bisect good ba1fb0301a60cbded377e0f312c82847415a1820 # bad: [1ef070d29e73a50e98a93d9a68f69cfef4247170] netfilter: avoid ipv6 -> nf_defrag_ipv6 module dependency git bisect bad 1ef070d29e73a50e98a93d9a68f69cfef4247170 # bad: [401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c] libbpf: Handle GCC built-in types for Arm NEON git bisect bad 401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c # good: [ccb6e88cd42a9cb65bde705f7f8e7c9822dcb711] drm/amd/display: Switch to immediate mode for updating infopackets git bisect good ccb6e88cd42a9cb65bde705f7f8e7c9822dcb711 # first bad commit: [401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c] libbpf: Handle GCC built-in types for Arm NEON
Quoted 24 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.62 release. There are 214 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 03 Sep 2020 15:09:01 +0000. Anything received after that time might be too late.
Building x86_64:tools/perf ... failed
--------------
Error log:
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h' Makefile.config:846: No libcap found, disables capability support, please install libcap-devel/libcap-dev Makefile.config:958: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
PERF_VERSION= 5.4.61.gf5583dd12e6f
In file included from btf_dump.c:16:0:btf_dump.c: In function ‘btf_align_of’:tools/include/linux/kernel.h:53:17: error: comparison of distinct pointer types lacks a cast [-Werror]
Quoted 7 lines
(void) (&_min1 == &_min2); \ ^ btf_dump.c:770:10: note: in expansion of macro ‘min’ return min(sizeof(void *), t->size); ^~~cc1: all warnings being treated as errors
make[7]: *** [/tmp/buildbot-builddir/tools/perf/staticobjs/btf_dump.o] Error 1
This perf build break noticed and reported on mailing list [1]
Quoted 22 lines
Bisect log below. Reverting the following two patches fixes the problem.
497ef945f327libbpf: Fix build on ppc64le architecture401834f55ce7libbpf: Handle GCC built-in types for Arm NEONGuenter
---
$ git bisect log # bad: [f5583dd12e6fc8a3c11ae732f38bce8334e150a2] Linux 5.4.62-rc1 # good: [6576d69aac94cd8409636dfa86e0df39facdf0d2] Linux 5.4.61 git bisect start 'HEAD' 'v5.4.61' # good: [6c747bd0794c982b500bda7334ef55d9dabb6cc6] nvme-fc: Fix wrong return value in __nvme_fc_init_request() git bisect good 6c747bd0794c982b500bda7334ef55d9dabb6cc6 # bad: [81b5698e6d9ecdc9569df8f4b93be70d587f5ddf] serial: samsung: Removes the IRQ not found warning git bisect bad 81b5698e6d9ecdc9569df8f4b93be70d587f5ddf # bad: [973679736caa8e1b39b68866535bdc7899a46f25] ASoC: wm8994: Avoid attempts to read unreadable registers git bisect bad 973679736caa8e1b39b68866535bdc7899a46f25 # good: [1789df2a787c589dbe83bc3ed52af2abbc739d1b] ext4: correctly restore system zone info when remount fails git bisect good 1789df2a787c589dbe83bc3ed52af2abbc739d1b # good: [ba1fb0301a60cbded377e0f312c82847415a1820] drm/amd/powerplay: correct UVD/VCE PG state on custom pptable uploading
Quoted 8 lines
git bisect good ba1fb0301a60cbded377e0f312c82847415a1820 # bad: [1ef070d29e73a50e98a93d9a68f69cfef4247170] netfilter: avoid ipv6 -> nf_defrag_ipv6 module dependency git bisect bad 1ef070d29e73a50e98a93d9a68f69cfef4247170 # bad: [401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c] libbpf: Handle GCC built-in types for Arm NEON git bisect bad 401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c # good: [ccb6e88cd42a9cb65bde705f7f8e7c9822dcb711] drm/amd/display: Switch to immediate mode for updating infopackets git bisect good ccb6e88cd42a9cb65bde705f7f8e7c9822dcb711 # first bad commit: [401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c] libbpf: Handle GCC built-in types for Arm NEON
[1] https://lore.kernel.org/stable/CA+G9fYvsNkxvs7hdCB3LC9W+rP8hBa3F1fG3951S+xHfiOJwNA@mail.gmail.com/
- Naresh
Greg Kroah-Hartman
maintainerQuoted 66 lines · Naresh Kamboju
Quoted 24 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.62 release. There are 214 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 03 Sep 2020 15:09:01 +0000. Anything received after that time might be too late.
Building x86_64:tools/perf ... failed
--------------
Error log:
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h' Makefile.config:846: No libcap found, disables capability support, please install libcap-devel/libcap-dev Makefile.config:958: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
PERF_VERSION= 5.4.61.gf5583dd12e6f
In file included from btf_dump.c:16:0:btf_dump.c: In function ‘btf_align_of’:tools/include/linux/kernel.h:53:17: error: comparison of distinct pointer types lacks a cast [-Werror]Quoted 7 lines
(void) (&_min1 == &_min2); \ ^ btf_dump.c:770:10: note: in expansion of macro ‘min’ return min(sizeof(void *), t->size); ^~~cc1: all warnings being treated as errors
make[7]: *** [/tmp/buildbot-builddir/tools/perf/staticobjs/btf_dump.o] Error 1This perf build break noticed and reported on mailing list [1]
Quoted 22 lines
Bisect log below. Reverting the following two patches fixes the problem.
497ef945f327libbpf: Fix build on ppc64le architecture401834f55ce7libbpf: Handle GCC built-in types for Arm NEONGuenter
---
$ git bisect log # bad: [f5583dd12e6fc8a3c11ae732f38bce8334e150a2] Linux 5.4.62-rc1 # good: [6576d69aac94cd8409636dfa86e0df39facdf0d2] Linux 5.4.61 git bisect start 'HEAD' 'v5.4.61' # good: [6c747bd0794c982b500bda7334ef55d9dabb6cc6] nvme-fc: Fix wrong return value in __nvme_fc_init_request() git bisect good 6c747bd0794c982b500bda7334ef55d9dabb6cc6 # bad: [81b5698e6d9ecdc9569df8f4b93be70d587f5ddf] serial: samsung: Removes the IRQ not found warning git bisect bad 81b5698e6d9ecdc9569df8f4b93be70d587f5ddf # bad: [973679736caa8e1b39b68866535bdc7899a46f25] ASoC: wm8994: Avoid attempts to read unreadable registers git bisect bad 973679736caa8e1b39b68866535bdc7899a46f25 # good: [1789df2a787c589dbe83bc3ed52af2abbc739d1b] ext4: correctly restore system zone info when remount fails git bisect good 1789df2a787c589dbe83bc3ed52af2abbc739d1b # good: [ba1fb0301a60cbded377e0f312c82847415a1820] drm/amd/powerplay: correct UVD/VCE PG state on custom pptable uploadingQuoted 8 lines
git bisect good ba1fb0301a60cbded377e0f312c82847415a1820 # bad: [1ef070d29e73a50e98a93d9a68f69cfef4247170] netfilter: avoid ipv6 -> nf_defrag_ipv6 module dependency git bisect bad 1ef070d29e73a50e98a93d9a68f69cfef4247170 # bad: [401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c] libbpf: Handle GCC built-in types for Arm NEON git bisect bad 401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c # good: [ccb6e88cd42a9cb65bde705f7f8e7c9822dcb711] drm/amd/display: Switch to immediate mode for updating infopackets git bisect good ccb6e88cd42a9cb65bde705f7f8e7c9822dcb711 # first bad commit: [401834f55ce7f86bf2c0f8fdd8fbf9e1baf19f1c] libbpf: Handle GCC built-in types for Arm NEON
Quoted 1 line
[1] https://lore.kernel.org/stable/CA+G9fYvsNkxvs7hdCB3LC9W+rP8hBa3F1fG3951S+xHfiOJwNA@mail.gmail.com/
Yes, sorry, I thought the follow-on patch I added would solve this issue, I guess not :(
Odd that it works in Linus's tree? I'll go drop both of these patches now...
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.4.62 release. There are 214 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 03 Sep 2020 15:09:01 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.62-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah