locks: Fix UBSAN undefined behaviour in flock64_to_posix_lock
Subsystems (17)
Sasha Levin
maintainerPATCH 1/38 locks: Fix UBSAN undefined behaviour in flock64_to_posix_lock
From: Luo Meng <[email protected]>
[ Upstream commit 16238415eb9886328a89fe7a3cb0b88c7335fe16 ]
When the sum of fl->fl_start and l->l_len overflows, UBSAN shows the following warning:
UBSAN: Undefined behaviour in fs/locks.c:482:29 signed integer overflow: 2 + 9223372036854775806 cannot be represented in type 'long long int' Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xe4/0x14e lib/dump_stack.c:118 ubsan_epilogue+0xe/0x81 lib/ubsan.c:161 handle_overflow+0x193/0x1e2 lib/ubsan.c:192 flock64_to_posix_lock fs/locks.c:482 [inline] flock_to_posix_lock+0x595/0x690 fs/locks.c:515 fcntl_setlk+0xf3/0xa90 fs/locks.c:2262 do_fcntl+0x456/0xf60 fs/fcntl.c:387 __do_sys_fcntl fs/fcntl.c:483 [inline] __se_sys_fcntl fs/fcntl.c:468 [inline] __x64_sys_fcntl+0x12d/0x180 fs/fcntl.c:468 do_syscall_64+0xc8/0x5a0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Fix it by parenthesizing 'l->l_len - 1'.
--- fs/locks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/locks.c +1 -1
@@ -434,7 +434,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,if (l->l_len >0 ) {if (l->l_len -1 >OFFSET_MAX - fl->fl_start)return -EOVERFLOW ; - fl->fl_end = fl->fl_start + l->l_len -1 ; + fl->fl_end = fl->fl_start + (l->l_len -1 ); }else if (l->l_len <0 ) {if (fl->fl_start + l->l_len <0 )
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 2/38 tomoyo: fix clang pointer arithmetic warning
From: Arnd Bergmann <[email protected]>
[ Upstream commit d9594e0409651a237903a13c9718df889f43d43b ]
clang warns about additions on NULL pointers being undefined in C:
security/tomoyo/securityfs_if.c:226:59: warning: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Wnull-pointer-arithmetic]
securityfs_create_file(name, mode, parent, ((u8 *) NULL) + key,
Change the code to instead use a cast through uintptr_t to avoid the warning.
--- security/tomoyo/securityfs_if.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
security/tomoyo/securityfs_if.c +3 -3
@@ -135,8 +135,8 @@ static const struct file_operations tomoyo_self_operations = {*/ static int tomoyo_open (struct inode *inode,struct file *file) { -const int key = ((u8 *)file_inode (file)->i_private) - - ((u8 *)NULL ); +const u8 key = (uintptr_t )file_inode (file)->i_private; +return tomoyo_open_control (key, file); }
@@ -227,7 +227,7 @@ static const struct file_operations tomoyo_operations = {static void __init tomoyo_create_entry (const char *name,const umode_t mode,struct dentry *parent,const u8 key) { -securityfs_create_file (name, mode, parent, ((u8 *)NULL ) + key, +securityfs_create_file (name, mode, parent, (void *) (uintptr_t ) key, &tomoyo_operations); }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 3/38 staging: wimax: depends on NET
In reply to Sasha LevinFrom: Randy Dunlap <[email protected]>
[ Upstream commit 9364a2cf567187c0a075942c22d1f434c758de5d ]
Fix build errors when CONFIG_NET is not enabled. E.g. (trimmed):
ld: drivers/staging/wimax/op-msg.o: in function `wimax_msg_alloc':
op-msg.c:(.text+0xa9): undefined reference to `__alloc_skb'
ld: op-msg.c:(.text+0xcc): undefined reference to `genlmsg_put'
ld: op-msg.c:(.text+0xfc): undefined reference to `nla_put'
ld: op-msg.c:(.text+0x168): undefined reference to `kfree_skb'
ld: drivers/staging/wimax/op-msg.o: in function `wimax_msg_data_len':
op-msg.c:(.text+0x1ba): undefined reference to `nla_find'
ld: drivers/staging/wimax/op-msg.o: in function `wimax_msg_send':
op-msg.c:(.text+0x311): undefined reference to `init_net'
ld: op-msg.c:(.text+0x326): undefined reference to `netlink_broadcast'
ld: drivers/staging/wimax/stack.o: in function `__wimax_state_change':
stack.c:(.text+0x433): undefined reference to `netif_carrier_off'
ld: stack.c:(.text+0x46b): undefined reference to `netif_carrier_on'
ld: stack.c:(.text+0x478): undefined reference to `netif_tx_wake_queue'
ld: drivers/staging/wimax/stack.o: in function `wimax_subsys_exit':
stack.c:(.exit.text+0xe): undefined reference to `genl_unregister_family'
ld: drivers/staging/wimax/stack.o: in function `wimax_subsys_init':
stack.c:(.init.text+0x1a): undefined reference to `genl_register_family'
--- net/wimax/Kconfig | 1 + 1 file changed, 1 insertion(+)
net/wimax/Kconfig +1 -0
@@ -4,6 +4,7 @@ menuconfig WIMAX tristate "WiMAX Wireless Broadband support" + depends on NET depends on RFKILL || !RFKILL help
Signature · 1 line
2.27.0
Jakub Kicinski
maintainerRe: [PATCH AUTOSEL 4.4 03/38] staging: wimax: depends on NET
Quoted 5 lines · On Tue, 22 Dec 2020 21:24:41 -0500 Sasha Levin wrote:
From: Randy Dunlap <[email protected]>
[ Upstream commit
9364a2cf567187c0a075942c22d1f434c758de5d]Fix build errors when
CONFIG_NETis not enabled. E.g. (trimmed):
This one can be dropped, before wimax moved to staging the dependency was met thru the directory structure.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 4.4 03/38] staging: wimax: depends on NET
Quoted 9 lines · Jakub Kicinski
Quoted 5 lines · On Tue, 22 Dec 2020 21:24:41 -0500 Sasha Levin wrote:
From: Randy Dunlap <[email protected]>
[ Upstream commit
9364a2cf567187c0a075942c22d1f434c758de5d]Fix build errors when
CONFIG_NETis not enabled. E.g. (trimmed):This one can be dropped, before wimax moved to staging the dependency was met thru the directory structure.
I'll drop it, thanks.
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 4/38 scsi: pm80xx: Avoid busywait in FW ready check
In reply to Sasha LevinFrom: akshatzen <[email protected]>
[ Upstream commit 48cd6b38eb4f2874f091c4776ea1c26e7e4f967e ]
In function check_fw_ready() we busy wait using udelay. The CPU is not released and we see need_resched failures.
Busy waiting is not necessary since we are in process context and we can sleep instead. Replace udelay with msleep of 20 ms intervals while waiting for firmware to become ready.
It has been verified that check_fw_ready is not being used in interrupt context anywhere, hence it is safe to make this change.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 21 +++++++++++---------- drivers/scsi/pm8001/pm80xx_hwi.h | 6 ++++++ 2 files changed, 17 insertions(+), 10 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +11 -10
@@ -692,6 +692,7 @@ static int mpi_init_check(struct pm8001_hba_info *pm8001_ha)/** * check_fw_ready - The LLDD check if the FW is ready, if not, return error. +* This function sleeps hence it must not be used in atomic context. * @pm8001_ha: our hba card information */ static int check_fw_ready (struct pm8001_hba_info *pm8001_ha)
@@ -702,16 +703,16 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha)int ret =0 ;/* reset / PCIe ready */ - max_wait_time = max_wait_count =100 *1000 ;/* 100 milli sec */ + max_wait_time = max_wait_count =5 ;/* 100 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while ((value ==0xFFFFFFFF ) && (--max_wait_count));/* check ila status */ - max_wait_time = max_wait_count =1000 *1000 ;/* 1000 milli sec */ + max_wait_time = max_wait_count =50 ;/* 1000 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_ILA_READY ) !=SCRATCH_PAD_ILA_READY ) && (--max_wait_count));
@@ -724,9 +725,9 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha) }/* check RAAE status */ - max_wait_time = max_wait_count =1800 *1000 ;/* 1800 milli sec */ + max_wait_time = max_wait_count =90 ;/* 1800 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_RAAE_READY ) !=SCRATCH_PAD_RAAE_READY ) && (--max_wait_count));
@@ -739,9 +740,9 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha) }/* check iop0 status */ - max_wait_time = max_wait_count =600 *1000 ;/* 600 milli sec */ + max_wait_time = max_wait_count =30 ;/* 600 milli sec */ do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_IOP0_READY ) !=SCRATCH_PAD_IOP0_READY ) && (--max_wait_count));
@@ -757,9 +758,9 @@ static int check_fw_ready(struct pm8001_hba_info *pm8001_ha)if ((pm8001_ha->chip_id != chip_8008) && (pm8001_ha->chip_id != chip_8009)) {/* 200 milli sec */ - max_wait_time = max_wait_count =200 *1000 ; + max_wait_time = max_wait_count =10 ;do { -udelay (1 ); +msleep (FW_READY_INTERVAL ); value =pm8001_cr32 (pm8001_ha,0 ,MSGU_SCRATCH_PAD_1 ); }while (((value &SCRATCH_PAD_IOP1_READY ) !=SCRATCH_PAD_IOP1_READY ) && (--max_wait_count));
drivers/scsi/pm8001/pm80xx_hwi.h +6 -0
@@ -1534,3 +1534,9 @@ typedef struct SASProtocolTimerConfig SASProtocolTimerConfig_t;#define MEMBASE_II_SHIFT_REGISTER 0x1010#endif + +/** +* As we know sleep (1~20) ms may result in sleep longer than ~20 ms, hence we +* choose 20 ms interval. +*/ +#define FW_READY_INTERVAL 20
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 5/38 scsi: pm80xx: Fix pm8001_mpi_get_nvmd_resp() race condition
In reply to Sasha LevinFrom: yuuzheng <[email protected]>
[ Upstream commit 1f889b58716a5f5e3e4fe0e6742c1a4472f29ac1 ]
A use-after-free or null-pointer error occurs when the 251-byte response data is copied from IOMB buffer to response message buffer in function pm8001_mpi_get_nvmd_resp().
After sending the command get_nvmd_data(), the caller begins to sleep by calling wait_for_complete() and waits for the wake-up from calling complete() in pm8001_mpi_get_nvmd_resp(). Due to unexpected events (e.g., interrupt), if response buffer gets freed before memcpy(), a use-after-free error will occur. To fix this, the complete() should be called after memcpy().
--- drivers/scsi/pm8001/pm8001_hwi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_hwi.c +6 -1
@@ -3196,10 +3196,15 @@ pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) pm8001_ha->memoryMap.region[NVMD ].virt_ptr, fw_control_context->len);kfree (ccb->fw_control_context); +/* To avoid race condition, complete should be +* called after the message is copied to +* fw_control_context->usrAddr +*/ +complete (pm8001_ha->nvmd_completion); +PM8001_MSG_DBG (pm8001_ha,pm8001_printk ("Set nvm data complete!\n" )); ccb->task =NULL ; ccb->ccb_tag =0xFFFFFFFF ;pm8001_tag_free (pm8001_ha, tag); -complete (pm8001_ha->nvmd_completion); }int pm8001_mpi_local_phy_ctl (struct pm8001_hba_info *pm8001_ha,void *piomb)
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 6/38 staging: rtl8192u: fix wrong judgement in rtl8192_rx_isr
In reply to Sasha LevinFrom: Zhang Qilong <[email protected]>
[ Upstream commit 071dc1787a2f8bb636f864c1f306280deea3b1d5 ]
The 'EPERM' cannot appear in the previous path, we should use '-EPERM' to check it. For example:
Call trace:
->rtl8192_rx_isr
->usb_submit_urb
->usb_hcd_submit_urb
->rh_urb_enqueue
->rh_queue_status
->usb_hcd_link_urb_to_ep--- drivers/staging/rtl8192u/r8192U_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8192u/r8192U_core.c +1 -1
@@ -1003,7 +1003,7 @@ static void rtl8192_rx_isr(struct urb *urb) urb->context = skb;skb_queue_tail (&priv->rx_queue, skb); err =usb_submit_urb (urb,GFP_ATOMIC ); -if (err && err !=EPERM ) +if (err && err != -EPERM )netdev_err (dev,"can not submit rxurb, err is %x, URB status is %x\n" , err, urb->status);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 7/38 mips: ar7: add missing iounmap() on error in ar7_gpio_init
In reply to Sasha LevinFrom: Qinglang Miao <[email protected]>
[ Upstream commit 5a5aa912f687204d50455d0db36f94dd8de601c2 ]
Add the missing iounmap() of gpch->regs before return from ar7_gpio_init() in the error handling case.
--- arch/mips/ar7/gpio.c | 1 + 1 file changed, 1 insertion(+)
arch/mips/ar7/gpio.c +1 -0
@@ -339,6 +339,7 @@ int __init ar7_gpio_init(void)if (ret) {printk (KERN_ERR "%s: failed to add gpiochip\n" , gpch->chip.label); +iounmap (gpch->regs);return ret; } printk(KERN_INFO "%s: registered %d GPIOs\n",
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 8/38 locktorture: Prevent hangs for invalid arguments
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 6b74fa0a776e3715d385b23d29db469179c825b0 ]
If an locktorture torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a lock_torture_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error.
--- kernel/locking/locktorture.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/locking/locktorture.c +5 -0
@@ -38,6 +38,7 @@#include <linux/slab.h> #include <linux/percpu-rwsem.h> #include <linux/torture.h> +#include <linux/reboot.h> MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" );
@@ -966,6 +967,10 @@ static int __init lock_torture_init(void) unwind:torture_init_end ();lock_torture_cleanup (); +if (shutdown_secs) { +WARN_ON (!IS_MODULE (CONFIG_LOCK_TORTURE_TEST )); +kernel_power_off (); + }return firsterr; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 9/38 rcutorture: Prevent hangs for invalid arguments
In reply to Sasha LevinFrom: "Paul E. McKenney" <[email protected]>
[ Upstream commit 4994684ce10924a0302567c315c91b0a64eeef46 ]
If an rcutorture torture-test run is given a bad kvm.sh argument, the test will complain to the console, which is good. What is bad is that from the user's perspective, it will just hang for the time specified by the --duration argument. This commit therefore forces an immediate kernel shutdown if a rcu_torture_init()-time error occurs, thus avoiding the appearance of a hang. It also forces a console splat in this case to clearly indicate the presence of an error.
--- kernel/rcu/rcutorture.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/rcu/rcutorture.c +4 -0
@@ -1914,6 +1914,10 @@ rcu_torture_init(void) unwind:torture_init_end ();rcu_torture_cleanup (); +if (shutdown_secs) { +WARN_ON (!IS_MODULE (CONFIG_RCU_TORTURE_TEST )); +kernel_power_off (); + }return firsterr; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 10/38 drm: panel: simple: add missing platform_driver_unregister() in panel_simple_init
In reply to Sasha LevinFrom: Qinglang Miao <[email protected]>
[ Upstream commit f2e66f212a9de04afc2caa5ec79057c0ac75c728 ]
Add the missing platform_driver_unregister() before return from panel_simple_init in the error handling case when failed to register panel_simple_dsi_driver with CONFIG_DRM_MIPI_DSI enabled.
--- drivers/gpu/drm/panel/panel-simple.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-simple.c +3 -1
@@ -1435,8 +1435,10 @@ static int __init panel_simple_init(void)if (IS_ENABLED (CONFIG_DRM_MIPI_DSI )) { err =mipi_dsi_driver_register (&panel_simple_dsi_driver); -if (err <0 ) +if (err <0 ) { +platform_driver_unregister (&panel_simple_platform_driver);return err; + } }return 0 ;
Signature · 6 lines
2.27.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sasha Levin
maintainerPATCH 11/38 Bluetooth: hidp: use correct wait queue when removing ctrl_wait
In reply to Sasha LevinFrom: Ole Bjørn Midtbø <[email protected]>
[ Upstream commit cca342d98bef68151a80b024f7bf5f388d1fbdea ]
A different wait queue was used when removing ctrl_wait than when adding it. This effectively made the remove operation without locking compared to other operations on the wait queue ctrl_wait was part of. This caused issues like below where dead000000000100 is LIST_POISON1 and dead000000000200 is LIST_POISON2.
list_add corruption. next->prev should be prev (ffffffc1b0a33a08), \ but was dead000000000200. (next=ffffffc03ac77de0). ------------[ cut here ]------------ CPU: 3 PID: 2138 Comm: bluetoothd Tainted: G O 4.4.238+ #9 ... ---[ end trace 0adc2158f0646eac ]--- Call trace: [<ffffffc000443f78>] __list_add+0x38/0xb0 [<ffffffc0000f0d04>] add_wait_queue+0x4c/0x68 [<ffffffc00020eecc>] __pollwait+0xec/0x100 [<ffffffc000d1556c>] bt_sock_poll+0x74/0x200 [<ffffffc000bdb8a8>] sock_poll+0x110/0x128 [<ffffffc000210378>] do_sys_poll+0x220/0x480 [<ffffffc0002106f0>] SyS_poll+0x80/0x138 [<ffffffc00008510c>] __sys_trace_return+0x0/0x4 Unable to handle kernel paging request at virtual address dead000000000100 ... CPU: 4 PID: 5387 Comm: kworker/u15:3 Tainted: G W O 4.4.238+ #9 ... Call trace: [<ffffffc0000f079c>] __wake_up_common+0x7c/0xa8 [<ffffffc0000f0818>] __wake_up+0x50/0x70 [<ffffffc000be11b0>] sock_def_wakeup+0x58/0x60 [<ffffffc000de5e10>] l2cap_sock_teardown_cb+0x200/0x224 [<ffffffc000d3f2ac>] l2cap_chan_del+0xa4/0x298 [<ffffffc000d45ea0>] l2cap_conn_del+0x118/0x198 [<ffffffc000d45f8c>] l2cap_disconn_cfm+0x6c/0x78 [<ffffffc000d29934>] hci_event_packet+0x564/0x2e30 [<ffffffc000d19b0c>] hci_rx_work+0x10c/0x360 [<ffffffc0000c2218>] process_one_work+0x268/0x460 [<ffffffc0000c2678>] worker_thread+0x268/0x480 [<ffffffc0000c94e0>] kthread+0x118/0x128 [<ffffffc000085070>] ret_from_fork+0x10/0x20 ---[ end trace 0adc2158f0646ead ]---
--- net/bluetooth/hidp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hidp/core.c +1 -1
@@ -1282,7 +1282,7 @@ static int hidp_session_thread(void *arg)/* cleanup runtime environment */ remove_wait_queue (sk_sleep (session->intr_sock->sk), &intr_wait); -remove_wait_queue (sk_sleep (session->intr_sock->sk), &ctrl_wait); +remove_wait_queue (sk_sleep (session->ctrl_sock->sk), &ctrl_wait);wake_up_interruptible (&session->report_queue);hidp_del_timer (session);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 12/38 net: skb_vlan_untag(): don't reset transport offset if set by GRO layer
In reply to Sasha LevinFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 8be33ecfc1ffd2da20cc29e957e4cb6eb99310cb ]
Similar to commit fda55eca5a33f
("net: introduce skb_transport_header_was_set()"), avoid resetting transport offsets that were already set by GRO layer. This not only mirrors the behavior of __netif_receive_skb_core(), but also makes sense when it comes to UDP GSO fraglists forwarding: transport offset of such skbs is set only once by GRO receive callback and remains untouched and correct up to the xmitting driver in 1:1 case, but becomes junk after untagging in ingress VLAN case and breaks UDP GSO offload. This does not happen after this change, and all types of forwarding of UDP GSO fraglists work as expected.
Since v1 [1]:
- keep the code 1:1 with __netif_receive_skb_core() (Jakub).
[1] https://lore.kernel.org/netdev/[email protected]
--- net/core/skbuff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/skbuff.c +2 -1
@@ -4386,7 +4386,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb) goto err_free;skb_reset_network_header (skb); -skb_reset_transport_header (skb); +if (!skb_transport_header_was_set (skb)) +skb_reset_transport_header (skb);skb_reset_mac_len (skb);return skb;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 13/38 MIPS: BMC47xx: fix kconfig dependency bug for BCM47XX_SSB
In reply to Sasha LevinFrom: Necip Fazil Yildiran <[email protected]>
[ Upstream commit 09a48cbcd7af9203296938044f1100bb113ce01a ]
When BCM47XX_SSB is enabled and SSB_PCIHOST is disabled, it results in the following Kbuild warning:
WARNING: unmet direct dependencies detected for SSB_B43_PCI_BRIDGE
Depends on [n]: SSB [=y] && SSB_PCIHOST [=n]
Selected by [y]:
- BCM47XX_SSB [=y] && BCM47XX [=y] && PCI [=y]
The reason is that BCM47XX_SSB selects SSB_B43_PCI_BRIDGE without depending on or selecting SSB_PCIHOST while SSB_B43_PCI_BRIDGE depends on SSB_PCIHOST. This can also fail building the kernel as demonstrated in a bug report.
Honor the kconfig dependency to remove unmet direct dependency warnings and avoid any potential build failures.
--- arch/mips/bcm47xx/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/mips/bcm47xx/Kconfig +1 -0
@@ -8,6 +8,7 @@ config BCM47XX_SSB select SSB_DRIVER_MIPS select SSB_DRIVER_EXTIF select SSB_EMBEDDED + select SSB_PCIHOST if PCI select SSB_B43_PCI_BRIDGE if PCI select SSB_DRIVER_PCICORE if PCI select SSB_PCICORE_HOSTMODE if PCI
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 14/38 jfs: Fix memleak in dbAdjCtl
In reply to Sasha LevinFrom: Dinghao Liu <[email protected]>
[ Upstream commit 751341b4d7841e2b76e78eec382c2e119165497f ]
When dbBackSplit() fails, mp should be released to prevent memleak. It's the same when dbJoin() fails.
--- fs/jfs/jfs_dmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/jfs/jfs_dmap.c +6 -2
@@ -2562,15 +2562,19 @@ dbAdjCtl(struct bmap * bmp, s64 blkno, int newval, int alloc, int level)*/ if (oldval ==NOFREE ) { rc =dbBackSplit ((dmtree_t *) dcp, leafno); -if (rc) +if (rc) { +release_metapage (mp);return rc; + } oldval = dcp->stree[ti]; }dbSplit ((dmtree_t *) dcp, leafno, dcp->budmin, newval); }else { rc =dbJoin ((dmtree_t *) dcp, leafno, newval); -if (rc) +if (rc) { +release_metapage (mp);return rc; + } }/* check if the root of the current dmap control page changed due
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 15/38 media: zr364xx: propagate errors from zr364xx_start_readpipe()
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit af0321a5be3e5647441eb6b79355beaa592df97a ]
zr364xx_start_readpipe() can fail but callers do not care about that. This can result in various negative consequences. The patch adds missed error handling.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/usb/zr364xx/zr364xx.c | 31 ++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/media/usb/zr364xx/zr364xx.c +24 -7
@@ -1359,6 +1359,7 @@ static int zr364xx_board_init(struct zr364xx_camera *cam) {struct zr364xx_pipeinfo *pipe = cam->pipe;unsigned long i; +int err;DBG ("board init: %p\n" , cam);memset (pipe,0 ,sizeof (*pipe));
@@ -1392,9 +1393,8 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)if (i ==0 ) { printk(KERN_INFO KBUILD_MODNAME ": out of memory. Aborting\n"); -kfree (cam->pipe->transfer_buffer); - cam->pipe->transfer_buffer =NULL ; -return -ENOMEM ; + err = -ENOMEM ; + goto err_free; }else cam->buffer.dwFrames = i;
@@ -1409,9 +1409,17 @@ static int zr364xx_board_init(struct zr364xx_camera *cam)/*** end create system buffers ***/ /* start read pipe */ -zr364xx_start_readpipe (cam); + err =zr364xx_start_readpipe (cam); +if (err) + goto err_free; +DBG (": board initialized\n" );return 0 ; + +err_free: +kfree (cam->pipe->transfer_buffer); + cam->pipe->transfer_buffer =NULL ; +return err; } static int zr364xx_probe(struct usb_interface *intf,
@@ -1610,10 +1618,19 @@ static int zr364xx_resume(struct usb_interface *intf)if (!cam->was_streaming)return 0 ; -zr364xx_start_readpipe (cam); + res =zr364xx_start_readpipe (cam); +if (res) +return res; + res =zr364xx_prepare (cam); -if (!res) -zr364xx_start_acquire (cam); +if (res) + goto err_prepare; + +zr364xx_start_acquire (cam); +return 0 ; + +err_prepare: +zr364xx_stop_readpipe (cam); return res; }#endif
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 16/38 media: isif: reset global state
In reply to Sasha LevinFrom: Evgeny Novikov <[email protected]>
[ Upstream commit 6651dba2bd838f34cf5a1e84229aaa579b1a94fe ]
isif_probe() invokes iounmap() on error handling paths, but it does not reset the global state. So, later it can invoke iounmap() even when ioremap() fails. This is the case also for isif_remove(). The patch resets the global state after invoking iounmap() to avoid this.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/davinci/isif.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/media/platform/davinci/isif.c +9 -2
@@ -1090,10 +1090,14 @@ static int isif_probe(struct platform_device *pdev)release_mem_region (res->start,resource_size (res)); i--; fail_nobase_res: -if (isif_cfg.base_addr) +if (isif_cfg.base_addr) {iounmap (isif_cfg.base_addr); -if (isif_cfg.linear_tbl0_addr) + isif_cfg.base_addr =NULL ; + } +if (isif_cfg.linear_tbl0_addr) {iounmap (isif_cfg.linear_tbl0_addr); + isif_cfg.linear_tbl0_addr =NULL ; + }while (i >=0 ) { res =platform_get_resource (pdev,IORESOURCE_MEM , i);
@@ -1111,8 +1115,11 @@ static int isif_remove(struct platform_device *pdev)int i =0 ;iounmap (isif_cfg.base_addr); + isif_cfg.base_addr =NULL ;iounmap (isif_cfg.linear_tbl0_addr); + isif_cfg.linear_tbl0_addr =NULL ;iounmap (isif_cfg.linear_tbl1_addr); + isif_cfg.linear_tbl1_addr =NULL ;while (i <3 ) { res =platform_get_resource (pdev,IORESOURCE_MEM , i);if (res)
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 17/38 mmc: tmio: do not print real IOMEM pointer
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ade8e9d3fb9232ddfb87a4bc641b35b988d9757b ]
Printing kernel pointers is discouraged because they might leak kernel memory layout. This fixes smatch warning:
drivers/mmc/host/tmio_mmc.c:177 tmio_mmc_probe() warn: argument 3 to %08lx specifier is cast from pointer
--- drivers/mmc/host/tmio_mmc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc.c +1 -2
@@ -109,8 +109,7 @@ static int tmio_mmc_probe(struct platform_device *pdev)if (ret) goto host_remove; -pr_info ("%s at 0x%08lx irq %d\n" ,mmc_hostname (host->mmc), - (unsigned long )host->ctl, irq); +pr_info ("%s at 0x%p irq %d\n" ,mmc_hostname (host->mmc), host->ctl, irq);return 0 ;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 18/38 ARM: OMAP2+: Fix memleak in omap2xxx_clkt_vps_init
In reply to Sasha LevinFrom: Youling Tang <[email protected]>
[ Upstream commit 3c5902d270edb6ccc3049acfe5d3e96653c87dcd ]
If the clk_register fails, we should free hw before function returns to prevent memleak.
--- arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +6 -0
@@ -247,6 +247,12 @@ void omap2xxx_clkt_vps_init(void) hw->hw.init = &init; clk =clk_register (NULL , &hw->hw); +if (IS_ERR (clk)) { +printk (KERN_ERR "Failed to register clock\n" ); +kfree (hw); +return ; + } +clkdev_create (clk,"cpufreq_ck" ,NULL );return ; cleanup:
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 19/38 tick/broadcast: Serialize access to tick_next_period
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit f73f64d5687192bc8eb7f3d9521ca6256b79f224 ]
tick_broadcast_setup_oneshot() accesses tick_next_period twice without any serialization. This is wrong in two aspects:
- Reading it twice might make the broadcast data inconsistent if the variable is updated concurrently.
- On 32bit systems the access might see an partial update
Protect it with jiffies_lock. That's safe as none of the callchains leading up to this function can create a lock ordering violation:
timer interrupt
run_local_timers()
hrtimer_run_queues()
hrtimer_switch_to_hres()
tick_init_highres()
tick_switch_to_oneshot()
tick_broadcast_switch_to_oneshot()
or
tick_check_oneshot_change()
tick_nohz_switch_to_nohz()
tick_switch_to_oneshot()
tick_broadcast_switch_to_oneshot()
--- kernel/time/tick-broadcast.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
kernel/time/tick-broadcast.c +20 -3
@@ -872,6 +872,22 @@ static void tick_broadcast_init_next_event(struct cpumask *mask, } } +static inline ktime_t tick_get_next_period (void ) +{ +ktime_t next; + +/* +* Protect against concurrent updates (store /load tearing on +* 32bit). It does not matter if the time is already in the +* past. The broadcast device which is about to be programmed will +* fire in any case. +*/ +raw_spin_lock (&jiffies_lock); + next = tick_next_period; +raw_spin_unlock (&jiffies_lock); +return next; +} +/** * tick_broadcast_setup_oneshot - setup the broadcast device */
@@ -900,10 +916,11 @@ void tick_broadcast_setup_oneshot(struct clock_event_device *bc) tick_broadcast_oneshot_mask, tmpmask);if (was_periodic && !cpumask_empty (tmpmask)) { +ktime_t nextevt =tick_get_next_period (); +clockevents_switch_state (bc,CLOCK_EVT_STATE_ONESHOT ); -tick_broadcast_init_next_event (tmpmask, - tick_next_period); -tick_broadcast_set_event (bc, cpu, tick_next_period); +tick_broadcast_init_next_event (tmpmask, nextevt); +tick_broadcast_set_event (bc, cpu, nextevt); }else bc->next_event.tv64 =KTIME_MAX ; }else {
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 20/38 ALSA: usb-audio: Don't call usb_set_interface() at trigger callback
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 4974b7950929e4a28d4eaee48e4ad07f168ac132 ]
The PCM trigger callback is atomic, hence we must not call a function like usb_set_interface() there. Calling it from there would lead to a kernel Oops.
Fix it by moving the usb_set_interface() call to set_sync_endpoint().
Also, apply the snd_usb_set_interface_quirk() for consistency, too.
--- sound/usb/pcm.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
sound/usb/pcm.c +13 -15
@@ -242,21 +242,6 @@ static int start_endpoints(struct snd_usb_substream *subs) !test_and_set_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) {struct snd_usb_endpoint *ep = subs->sync_endpoint; -if (subs->data_endpoint->iface != subs->sync_endpoint->iface || - subs->data_endpoint->altsetting != subs->sync_endpoint->altsetting) { - err =usb_set_interface (subs->dev, - subs->sync_endpoint->iface, - subs->sync_endpoint->altsetting); -if (err <0 ) { -clear_bit (SUBSTREAM_FLAG_SYNC_EP_STARTED , &subs->flags); -dev_err (&subs->dev->dev, -"%d:%d: cannot set interface (%d)\n" , - subs->sync_endpoint->iface, - subs->sync_endpoint->altsetting, err); -return -EIO ; - } - } -dev_dbg (&subs->dev->dev,"Starting sync EP @%p\n" , ep); ep->sync_slave = subs->data_endpoint;
@@ -489,6 +474,19 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, subs->data_endpoint->sync_master = subs->sync_endpoint; +if (subs->data_endpoint->iface != subs->sync_endpoint->iface || + subs->data_endpoint->altsetting != subs->sync_endpoint->altsetting) { + err =usb_set_interface (subs->dev, + subs->sync_endpoint->iface, + subs->sync_endpoint->altsetting); +if (err <0 ) +return err; +dev_dbg (&dev->dev,"setting usb interface %d:%d\n" , + subs->sync_endpoint->iface, + subs->sync_endpoint->altsetting); +snd_usb_set_interface_quirk (dev); + } +return 0 ; }
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 21/38 rxrpc: Don't leak the service-side session key to userspace
In reply to Sasha LevinFrom: David Howells <[email protected]>
[ Upstream commit d2ae4e918218f543214fbd906db68a6c580efbbb ]
Don't let someone reading a service-side rxrpc-type key get access to the session key that was exchanged with the client. The server application will, at some point, need to be able to read the information in the ticket, but this probably shouldn't include the key material.
--- include/keys/rxrpc-type.h | 1 + net/rxrpc/ar-key.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
include/keys/rxrpc-type.h +1 -0
@@ -88,6 +88,7 @@ struct rxk5_key {*/ struct rxrpc_key_token {u16 security_index;/* RxRPC header security index */ +bool no_leak_key;/* Don't copy the key to userspace */ struct rxrpc_key_token *next;/* the next token in the list */ union {struct rxkad_key *kad;
net/rxrpc/ar-key.c +6 -2
@@ -1081,7 +1081,8 @@ static long rxrpc_read(const struct key *key,case RXRPC_SECURITY_RXKAD : toksize +=8 *4 ;/* viceid, kvno, key*2, begin, * end, primary, tktlen */ - toksize +=RND (token->kad->ticket_len); +if (!token->no_leak_key) + toksize +=RND (token->kad->ticket_len);break ;case RXRPC_SECURITY_RXK5 :
@@ -1190,7 +1191,10 @@ static long rxrpc_read(const struct key *key,ENCODE (token->kad->start);ENCODE (token->kad->expiry);ENCODE (token->kad->primary_flag); -ENCODE_DATA (token->kad->ticket_len, token->kad->ticket); +if (token->no_leak_key) +ENCODE (0 ); +else +ENCODE_DATA (token->kad->ticket_len, token->kad->ticket);break ;case RXRPC_SECURITY_RXK5 :
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 22/38 ARM: dts: hisilicon: fix errors detected by snps-dw-apb-uart.yaml
In reply to Sasha LevinFrom: Zhen Lei <[email protected]>
[ Upstream commit 30ea026e33c6dda48849d9fe0d15c1d280a92d53 ]
1. Change node name to match '^serial(@[0-9a-f,]+)*$'
2. Change clock-names to "baudclk", "apb_pclk". Both of them use the same clock.
--- arch/arm/boot/dts/hip01.dtsi | 24 ++++++++++++------------ arch/arm/boot/dts/hip04-d01.dts | 2 +- arch/arm/boot/dts/hip04.dtsi | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/boot/dts/hip01.dtsi +12 -12
@@ -46,41 +46,41 @@ amba { compatible = "arm,amba-bus"; ranges; - uart0: uart@10001000 { + uart0: serial@10001000 { compatible = "snps,dw-apb-uart"; reg = <0x10001000 0x1000>; - clocks = <&hisi_refclk144mhz>; - clock-names = "apb_pclk"; + clocks = <&hisi_refclk144mhz>, <&hisi_refclk144mhz>; + clock-names = "baudclk", "apb_pclk"; reg-shift = <2>; interrupts = <0 32 4>; status = "disabled"; }; - uart1: uart@10002000 { + uart1: serial@10002000 { compatible = "snps,dw-apb-uart"; reg = <0x10002000 0x1000>; - clocks = <&hisi_refclk144mhz>; - clock-names = "apb_pclk"; + clocks = <&hisi_refclk144mhz>, <&hisi_refclk144mhz>; + clock-names = "baudclk", "apb_pclk"; reg-shift = <2>; interrupts = <0 33 4>; status = "disabled"; }; - uart2: uart@10003000 { + uart2: serial@10003000 { compatible = "snps,dw-apb-uart"; reg = <0x10003000 0x1000>; - clocks = <&hisi_refclk144mhz>; - clock-names = "apb_pclk"; + clocks = <&hisi_refclk144mhz>, <&hisi_refclk144mhz>; + clock-names = "baudclk", "apb_pclk"; reg-shift = <2>; interrupts = <0 34 4>; status = "disabled"; }; - uart3: uart@10006000 { + uart3: serial@10006000 { compatible = "snps,dw-apb-uart"; reg = <0x10006000 0x1000>; - clocks = <&hisi_refclk144mhz>; - clock-names = "apb_pclk"; + clocks = <&hisi_refclk144mhz>, <&hisi_refclk144mhz>; + clock-names = "baudclk", "apb_pclk"; reg-shift = <2>; interrupts = <0 4 4>; status = "disabled";
arch/arm/boot/dts/hip04-d01.dts +1 -1
@@ -25,7 +25,7 @@ memory@00000000,10000000 { }; soc { - uart0: uart@4007000 { + uart0: serial@4007000 { status = "ok"; }; };
arch/arm/boot/dts/hip04.dtsi +3 -3
@@ -253,12 +253,12 @@ arm-pmu { <0 79 4>; }; - uart0: uart@4007000 { + uart0: serial@4007000 { compatible = "snps,dw-apb-uart"; reg = <0x4007000 0x1000>; interrupts = <0 381 4>; - clocks = <&clk_168m>; - clock-names = "uartclk"; + clocks = <&clk_168m>, <&clk_168m>; + clock-names = "baudclk", "apb_pclk"; reg-shift = <2>; status = "disabled"; };
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 23/38 ARM: dts: hisilicon: fix errors detected by usb yaml
In reply to Sasha LevinFrom: Zhen Lei <[email protected]>
[ Upstream commit 64f5b52554a1de47a53972a47b9b58d8d66ee5aa ]
1. Change node name to match '^usb(@.*)?'
These errors are detected by generic-ehci.yaml and generic-ohci.yaml.
--- arch/arm/boot/dts/hisi-x5hd2.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/hisi-x5hd2.dtsi +2 -2
@@ -451,14 +451,14 @@ gmac1: ethernet@1841000 { status = "disabled"; }; - usb0: ehci@1890000 { + usb0: usb@1890000 { compatible = "generic-ehci"; reg = <0x1890000 0x1000>; interrupts = <0 66 4>; clocks = <&clock HIX5HD2_USB_CLK>; }; - usb1: ohci@1880000 { + usb1: usb@1880000 { compatible = "generic-ohci"; reg = <0x1880000 0x1000>; interrupts = <0 67 4>;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 24/38 ARM: dts: hisilicon: fix errors detected by simple-bus.yaml
In reply to Sasha LevinFrom: Zhen Lei <[email protected]>
[ Upstream commit 8e9e8dd7ce093344a89792deaeb6caedde636dcf ]
Change bus node name from "amba" to "amba-bus" to match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
--- arch/arm/boot/dts/hi3620-hi4511.dts | 2 +- arch/arm/boot/dts/hi3620.dtsi | 2 +- arch/arm/boot/dts/hip01.dtsi | 2 +- arch/arm/boot/dts/hisi-x5hd2.dtsi | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
arch/arm/boot/dts/hi3620-hi4511.dts +1 -1
@@ -25,7 +25,7 @@ memory { reg = <0x40000000 0x20000000>; }; - amba { + amba-bus { dual_timer0: dual_timer@800000 { status = "ok"; };
arch/arm/boot/dts/hi3620.dtsi +1 -1
@@ -64,7 +64,7 @@ cpu@3 { }; }; - amba { + amba-bus { #address-cells = <1>; #size-cells = <1>;
arch/arm/boot/dts/hip01.dtsi +1 -1
@@ -40,7 +40,7 @@ soc { interrupt-parent = <&gic>; ranges = <0 0x10000000 0x20000000>; - amba { + amba-bus { #address-cells = <1>; #size-cells = <1>; compatible = "arm,amba-bus";
arch/arm/boot/dts/hisi-x5hd2.dtsi +1 -1
@@ -31,7 +31,7 @@ soc { interrupt-parent = <&gic>; ranges = <0 0xf8000000 0x8000000>; - amba { + amba-bus { #address-cells = <1>; #size-cells = <1>; compatible = "arm,amba-bus";
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 25/38 brcmsmac: ampdu: Check BA window size before checking block ack
In reply to Sasha LevinFrom: Dmitry Safonov <[email protected]>
[ Upstream commit 01c195de620bb6c3ecda0dbf295fe685d8232e10 ]
bindex can be out of BA window (64):
tid 0 seq 2983, start_seq 2915, bindex 68, index 39 tid 0 seq 2984, start_seq 2915, bindex 69, index 40 tid 0 seq 2985, start_seq 2915, bindex 70, index 41 tid 0 seq 2986, start_seq 2915, bindex 71, index 42 tid 0 seq 2879, start_seq 2915, bindex 4060, index 63 tid 0 seq 2854, start_seq 2915, bindex 4035, index 38 tid 0 seq 2795, start_seq 2915, bindex 3976, index 43 tid 0 seq 2989, start_seq 2924, bindex 65, index 45 tid 0 seq 2992, start_seq 2924, bindex 68, index 48 tid 0 seq 2993, start_seq 2924, bindex 69, index 49 tid 0 seq 2994, start_seq 2924, bindex 70, index 50 tid 0 seq 2997, start_seq 2924, bindex 73, index 53 tid 0 seq 2795, start_seq 2941, bindex 3950, index 43 tid 0 seq 2921, start_seq 2941, bindex 4076, index 41 tid 0 seq 2929, start_seq 2941, bindex 4084, index 49 tid 0 seq 3011, start_seq 2946, bindex 65, index 3 tid 0 seq 3012, start_seq 2946, bindex 66, index 4 tid 0 seq 3013, start_seq 2946, bindex 67, index 5
In result isset() will try to dereference something on the stack, causing panics:
BUG: unable to handle page fault for address: ffffa742800ed01f #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 6a4e9067 P4D 6a4e9067 PUD 6a4ec067 PMD 6a4ed067 PTE 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 1 PID: 0 Comm: swapper/1 Kdump: loaded Not tainted 5.8.5-arch1-1-kdump #1 Hardware name: Apple Inc. MacBookAir3,1/Mac-942452F5819B1C1B, BIOS MBA31.88Z.0061.B07.1201241641 01/24/12 RIP: 0010:brcms_c_ampdu_dotxstatus+0x343/0x9f0 [brcmsmac] Code: 54 24 20 66 81 e2 ff 0f 41 83 e4 07 89 d1 0f b7 d2 66 c1 e9 03 0f b7 c9 4c 8d 5c 0c 48 49 8b 4d 10 48 8b 79 68 41 57 44 89 e1 <41> 0f b6 33 41 d3 e0 48 c7 c1 38 e0 ea c0 48 83 c7 10 44 21 c6 4c RSP: 0018:ffffa742800ecdd0 EFLAGS: 00010207 RAX: 0000000000000019 RBX: 000000000000000b RCX: 0000000000000006 RDX: 0000000000000ffe RSI: 0000000000000004 RDI: ffff8fc6ad776800 RBP: ffff8fc6855acb00 R08: 0000000000000001 R09: 00000000000005d9 R10: 00000000fffffffe R11: ffffa742800ed01f R12: 0000000000000006 R13: ffff8fc68d75a000 R14: 00000000000005db R15: 0000000000000019 FS: 0000000000000000(0000) GS:ffff8fc6aad00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffa742800ed01f CR3: 000000002480a000 CR4: 00000000000406e0 Call Trace: <IRQ> brcms_c_dpc+0xb46/0x1020 [brcmsmac] ? wlc_intstatus+0xc8/0x180 [brcmsmac] ? __raise_softirq_irqoff+0x1a/0x80 brcms_dpc+0x37/0xd0 [brcmsmac] tasklet_action_common.constprop.0+0x51/0xb0 __do_softirq+0xff/0x340 ? handle_level_irq+0x1a0/0x1a0 asm_call_on_stack+0x12/0x20 </IRQ> do_softirq_own_stack+0x5f/0x80 irq_exit_rcu+0xcb/0x120 common_interrupt+0xd1/0x200 asm_common_interrupt+0x1e/0x40 RIP: 0010:cpuidle_enter_state+0xb3/0x420
Check if the block is within BA window and only then check block's status. Otherwise as Behan wrote: "When I came back to Dublin I was courtmartialed in my absence and sentenced to death in my absence, so I said they could shoot me in my absence."
Also reported:
https://bbs.archlinux.org/viewtopic.php?id=258428
https://lore.kernel.org/linux-wireless/[email protected]/
--- drivers/net/wireless/brcm80211/brcmsmac/ampdu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/ampdu.c +8 -3
@@ -953,14 +953,19 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb, index =TX_SEQ_TO_INDEX (seq); ack_recd = false;if (ba_recd) { +int block_acked; + bindex =MODSUB_POW2 (seq, start_seq,SEQNUM_MAX ); +if (bindex <AMPDU_TX_BA_MAX_WSIZE ) + block_acked =isset (bitmap, bindex); +else + block_acked =0 ;brcms_dbg_ht (wlc->hw->d11core,"tid %d seq %d, start_seq %d, bindex %d set %d, index %d\n" , tid, seq, start_seq, bindex, -isset (bitmap, bindex), index); + block_acked, index);/* if acked then clear bit and free packet */ -if ((bindex <AMPDU_TX_BA_MAX_WSIZE ) - &&isset (bitmap, bindex)) { +if (block_acked) { ini->txretry[index] =0 ;/*
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 26/38 iommu/tegra-smmu: Expand mutex protection range
In reply to Sasha LevinFrom: Nicolin Chen <[email protected]>
[ Upstream commit d5f583bf8654c231b781096bc1a186065cda72b3 ]
This is used to protect potential race condition at use_count. since probes of client drivers, calling attach_dev(), may run concurrently.
--- drivers/iommu/tegra-smmu.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/iommu/tegra-smmu.c +21 -13
@@ -241,26 +241,19 @@ static int tegra_smmu_alloc_asid(struct tegra_smmu *smmu, unsigned int *idp) {unsigned long id; -mutex_lock (&smmu->lock); - id =find_first_zero_bit (smmu->asids, smmu->soc->num_asids); -if (id >= smmu->soc->num_asids) { -mutex_unlock (&smmu->lock); +if (id >= smmu->soc->num_asids)return -ENOSPC ; - }set_bit (id, smmu->asids); *idp = id; -mutex_unlock (&smmu->lock);return 0 ; }static void tegra_smmu_free_asid (struct tegra_smmu *smmu,unsigned int id) { -mutex_lock (&smmu->lock);clear_bit (id, smmu->asids); -mutex_unlock (&smmu->lock); }static bool tegra_smmu_capable (enum iommu_cap cap)
@@ -395,17 +388,21 @@ static int tegra_smmu_as_prepare(struct tegra_smmu *smmu, struct tegra_smmu_as *as) {u32 value; -int err; +int err =0 ; + +mutex_lock (&smmu->lock);if (as->use_count >0 ) { as->use_count++; -return 0 ; + goto unlock; } as->pd_dma =dma_map_page (smmu->dev, as->pd,0 ,SMMU_SIZE_PD ,DMA_TO_DEVICE ); -if (dma_mapping_error (smmu->dev, as->pd_dma)) -return -ENOMEM ; +if (dma_mapping_error (smmu->dev, as->pd_dma)) { + err = -ENOMEM ; + goto unlock; + }/* We can't handle 64-bit DMA addresses */ if (!smmu_dma_addr_valid (smmu, as->pd_dma)) {
@@ -428,24 +425,35 @@ static int tegra_smmu_as_prepare(struct tegra_smmu *smmu, as->smmu = smmu; as->use_count++; +mutex_unlock (&smmu->lock); +return 0 ; err_unmap:dma_unmap_page (smmu->dev, as->pd_dma,SMMU_SIZE_PD ,DMA_TO_DEVICE ); +unlock: +mutex_unlock (&smmu->lock); +return err; }static void tegra_smmu_as_unprepare (struct tegra_smmu *smmu,struct tegra_smmu_as *as) { -if (--as->use_count >0 ) +mutex_lock (&smmu->lock); + +if (--as->use_count >0 ) { +mutex_unlock (&smmu->lock);return ; + }tegra_smmu_free_asid (smmu, as->id);dma_unmap_page (smmu->dev, as->pd_dma,SMMU_SIZE_PD ,DMA_TO_DEVICE ); as->smmu =NULL ; + +mutex_unlock (&smmu->lock); } static int tegra_smmu_attach_dev(struct iommu_domain *domain,
Signature · 6 lines
2.27.0 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Sasha Levin
maintainerPATCH 27/38 crypto: qce - Fix SHA result buffer corruption issues
In reply to Sasha LevinFrom: Thara Gopinath <[email protected]>
[ Upstream commit 1148a9654b5a69611d33e14719251c6ec20f5f2c ]
Partial hash was being copied into the final result buffer without the entire message block processed. Depending on how the end user processes this result buffer, errors vary from result buffer corruption to result buffer poisoing. Fix this issue by ensuring that only the final hash value is copied into the result buffer.
--- drivers/crypto/qce/sha.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/sha.c +1 -1
@@ -55,7 +55,7 @@ static void qce_ahash_done(void *data)dma_unmap_sg (qce->dev, &rctx->result_sg,1 ,DMA_FROM_DEVICE );memcpy (rctx->digest, result->auth_iv, digestsize); -if (req->result) +if (req->result && rctx->last_blk)memcpy (req->result, result->auth_iv, digestsize); rctx->byte_count[0 ] =cpu_to_be32 (result->auth_byte_count[0 ]);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 28/38 media: gp8psk: initialize stats at power control logic
In reply to Sasha LevinFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit d0ac1a26ed5943127cb0156148735f5f52a07075 ]
As reported on:
https://lore.kernel.org/linux-media/[email protected]/
if gp8psk_usb_in_op() returns an error, the status var is not initialized. Yet, this var is used later on, in order to identify:
- if the device was already started;
- if firmware has loaded;
- if the LNBf was powered on.
Using status = 0 seems to ensure that everything will be properly powered up.
So, instead of the proposed solution, let's just set status = 0.
--- drivers/media/usb/dvb-usb/gp8psk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/gp8psk.c +1 -1
@@ -163,7 +163,7 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d)static int gp8psk_power_ctrl (struct dvb_usb_device *d,int onoff) { -u8 status, buf; +u8 status =0 , buf;int gp_product_id =le16_to_cpu (d->udev->descriptor.idProduct);if (onoff) {
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 29/38 net/lapb: fix t1 timer handling for LAPB_STATE_0
In reply to Sasha LevinFrom: Martin Schiller <[email protected]>
[ Upstream commit 62480b992ba3fb1d7260b11293aed9d6557831c7 ]
1. DTE interface changes immediately to LAPB_STATE_1 and start sending SABM(E).
2. DCE interface sends N2-times DM and changes to LAPB_STATE_1 afterwards if there is no response in the meantime.
--- net/lapb/lapb_timer.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/lapb/lapb_timer.c +9 -2
@@ -92,11 +92,18 @@ static void lapb_t1timer_expiry(unsigned long param)switch (lapb->state) {/* -* If we are a DCE, keep going DM .. DM .. DM +* If we are a DCE, send DM up to N2 times, then switch to +* STATE_1 and send SABM(E). */ case LAPB_STATE_0 : -if (lapb->mode &LAPB_DCE ) +if (lapb->mode &LAPB_DCE && + lapb->n2count != lapb->n2) { + lapb->n2count++;lapb_send_control (lapb,LAPB_DM ,LAPB_POLLOFF ,LAPB_RESPONSE ); + }else { + lapb->state =LAPB_STATE_1 ; +lapb_establish_data_link (lapb); + }break ;/*
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 30/38 x86/mce: Panic for LMCE only if mca_cfg.tolerant < 3
In reply to Sasha LevinFrom: Gabriele Paoloni <[email protected]>
[ Upstream commit 3a866b16fd2360a9c4ebf71cfbf7ebfe968c1409 ]
Right now for LMCE, if no_way_out is set, mce_panic() is called regardless of mca_cfg.tolerant. This is not correct as, if mca_cfg.tolerant = 3, the code should never panic.
Add that check.
[ bp: use local ptr 'cfg'. ]
--- arch/x86/kernel/cpu/mcheck/mce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +1 -1
@@ -1062,7 +1062,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)* to see it will clear it. */ if (lmce) { -if (no_way_out) +if (no_way_out && cfg->tolerant <3 )mce_panic ("Fatal local machine check" , &m, msg); }else { order =mce_start (&no_way_out);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 31/38 mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start
In reply to Sasha LevinFrom: Zhang Xiaohui <[email protected]>
[ Upstream commit 5c455c5ab332773464d02ba17015acdca198f03d ]
mwifiex_cmd_802_11_ad_hoc_start() calls memcpy() without checking the destination size may trigger a buffer overflower, which a local user could use to cause denial of service or the execution of arbitrary code.
Fix it by putting the length check before calling memcpy().
--- drivers/net/wireless/mwifiex/join.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mwifiex/join.c +2 -0
@@ -856,6 +856,8 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,memset (adhoc_start->ssid,0 ,IEEE80211_MAX_SSID_LEN ); +if (req_ssid->ssid_len >IEEE80211_MAX_SSID_LEN ) + req_ssid->ssid_len =IEEE80211_MAX_SSID_LEN ;memcpy (adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len); mwifiex_dbg(adapter, INFO, "info: ADHOC_S_CMD: SSID = %s\n",
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 32/38 misc: vmw_vmci: fix kernel info-leak by initializing dbells in vmci_ctx_get_chkpt_doorbells()
In reply to Sasha LevinFrom: Anant Thazhemadam <[email protected]>
[ Upstream commit 31dcb6c30a26d32650ce134820f27de3c675a45a ]
A kernel-infoleak was reported by syzbot, which was caused because dbells was left uninitialized.
Using kzalloc() instead of kmalloc() fixes this issue.
--- drivers/misc/vmw_vmci/vmci_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_context.c +1 -1
@@ -750,7 +750,7 @@ static int vmci_ctx_get_chkpt_doorbells(struct vmci_ctx *context,return VMCI_ERROR_MORE_DATA ; } - dbells =kmalloc (data_size,GFP_ATOMIC ); + dbells =kzalloc (data_size,GFP_ATOMIC );if (!dbells)return VMCI_ERROR_NO_MEM ;
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 33/38 iwlwifi: trans: consider firmware dead after errors
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 152fdc0f698896708f9d7889a4ba4da6944b74f7 ]
If we get an error, no longer consider the firmware to be in IWL_TRANS_FW_ALIVE state.
--- drivers/net/wireless/iwlwifi/iwl-trans.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/iwl-trans.h +3 -1
@@ -1102,8 +1102,10 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans)return ;/* prevent double restarts due to the same erroneous FW */ -if (!test_and_set_bit (STATUS_FW_ERROR , &trans->status)) +if (!test_and_set_bit (STATUS_FW_ERROR , &trans->status)) {iwl_op_mode_nic_error (trans->op_mode); + trans->state =IWL_TRANS_NO_FW ; + } }/*****************************************************
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 34/38 iwlwifi: add an extra firmware state in the transport
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit b2ed841ed070ccbe908016537f429a3a8f0221bf ]
Start tracking not just if the firmware is dead or alive, but also if it's starting.
--- drivers/net/wireless/iwlwifi/iwl-trans.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans.h +13 -5
@@ -619,12 +619,14 @@ struct iwl_trans_ops {/** * enum iwl_trans_state - state of the transport layer * -* @IWL_TRANS_NO_FW: no fw has sent an alive response -* @IWL_TRANS_FW_ALIVE: a fw has sent an alive response +* @IWL_TRANS_NO_FW: firmware wasn't started yet, or crashed +* @IWL_TRANS_FW_STARTED: FW was started, but not alive yet +* @IWL_TRANS_FW_ALIVE: FW has sent an alive response */ enum iwl_trans_state { -IWL_TRANS_NO_FW =0 , -IWL_TRANS_FW_ALIVE =1 , +IWL_TRANS_NO_FW , +IWL_TRANS_FW_STARTED , +IWL_TRANS_FW_ALIVE , };/**
@@ -780,12 +782,18 @@ static inline int iwl_trans_start_fw(struct iwl_trans *trans,const struct fw_img *fw, bool run_in_rfkill) { + int ret; +might_sleep ();WARN_ON_ONCE (!trans->rx_mpdu_cmd);clear_bit (STATUS_FW_ERROR , &trans->status); -return trans->ops->start_fw (trans, fw, run_in_rfkill); + ret = trans->ops->start_fw (trans, fw, run_in_rfkill); +if (ret ==0 ) + trans->state =IWL_TRANS_FW_STARTED ; + +return ret; } static inline int iwl_trans_update_sf(struct iwl_trans *trans,
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 35/38 mac80211: disallow band-switch during CSA
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 3660944a37ce73890292571f44f04891834f9044 ]
If the AP advertises a band switch during CSA, we will not have the right information to continue working with it, since it will likely (have to) change its capabilities and we don't track any capability changes at all. Additionally, we store e.g. supported rates per band, and that information would become invalid.
Since this is a fringe scenario, just disconnect explicitly.
--- net/mac80211/mlme.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
net/mac80211/mlme.c +15 -3
@@ -1210,6 +1210,17 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,if (res)return ; +if (sdata->vif.bss_conf.chandef.chan->band != + csa_ie.chandef.chan->band) { +sdata_info (sdata, +"AP %pM switches to different band (%d MHz, width:%d, CF1/2: %d/%d MHz), disconnecting\n" , + ifmgd->associated->bssid, + csa_ie.chandef.chan->center_freq, + csa_ie.chandef.width, csa_ie.chandef.center_freq1, + csa_ie.chandef.center_freq2); + goto lock_and_drop_connection; + } +if (!cfg80211_chandef_usable (local->hw.wiphy, &csa_ie.chandef,IEEE80211_CHAN_DISABLED )) { sdata_info(sdata,
@@ -1218,9 +1229,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, csa_ie.chandef.chan->center_freq, csa_ie.chandef.width, csa_ie.chandef.center_freq1, csa_ie.chandef.center_freq2); -ieee80211_queue_work (&local->hw, - &ifmgd->csa_connection_drop_work); -return ; + goto lock_and_drop_connection; } if (cfg80211_chandef_identical(&csa_ie.chandef,
@@ -1310,6 +1319,9 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata,TU_TO_EXP_TIME ((csa_ie.count -1 ) * cbss->beacon_interval));return ; + lock_and_drop_connection: +mutex_lock (&local->mtx); +mutex_lock (&local->chanctx_mtx); drop_connection:ieee80211_queue_work (&local->hw, &ifmgd->csa_connection_drop_work);mutex_unlock (&local->chanctx_mtx);
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 36/38 mac80211: don't filter out beacons once we start CSA
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 189a164d0fc6c59a22c4486d641d0a0a0d33387a ]
I hit a bug in which we started a CSA with an action frame, but the AP changed its mind and didn't change the beacon. The CSA wasn't cancelled and we lost the connection.
The beacons were ignored because they never changed: they never contained any CSA IE. Because they never changed, the CRC of the beacon didn't change either which made us ignore the beacons instead of processing them.
Now what happens is:
1) beacon has CRC X and it is valid. No CSA IE in the beacon
2) as long as beacon's CRC X, don't process their IEs
3) rx action frame with CSA
4) invalidate the beacon's CRC
5) rx beacon, CRC is still X, but now it is invalid
6) process the beacon, detect there is no CSA IE
7) abort CSA
--- net/mac80211/mlme.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/mlme.c +1 -0
@@ -1296,6 +1296,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, sdata->csa_chandef = csa_ie.chandef; sdata->csa_block_tx = csa_ie.mode; ifmgd->csa_ignored_same_chan = false; + ifmgd->beacon_crc_valid = false;if (sdata->csa_block_tx) ieee80211_stop_vif_queues(local, sdata,
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 37/38 ALSA: hda/hdmi: packet buffer index must be set before reading value
In reply to Sasha LevinFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 46c3bbd9827952f92e250fa6ee30a797a4c4e17e ]
The check for infoframe transmit status in hdmi_infoframe_uptodate() makes the assumption that packet buffer index is set to zero.
Align code with specification and explicitly set the index before AC_VERB_GET_HDMI_DIP_XMIT. The packet index setting affects both DIP-Data and DIP-XmitCtrl verbs.
There are no known cases where the old implementation has caused driver to work incorrectly. This change is purely based on code review against the specification (HDA spec rev1.0a).
--- sound/pci/hda/patch_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_hdmi.c +1 -1
@@ -1055,11 +1055,11 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid,u8 val;int i; +hdmi_set_dip_index (codec, pin_nid,0x0 ,0x0 );if (snd_hda_codec_read (codec, pin_nid,0 ,AC_VERB_GET_HDMI_DIP_XMIT ,0 ) !=AC_DIPXMIT_BEST )return false; -hdmi_set_dip_index (codec, pin_nid,0x0 ,0x0 );for (i =0 ; i < size; i++) { val =snd_hda_codec_read (codec, pin_nid,0 ,AC_VERB_GET_HDMI_DIP_DATA ,0 );
Signature · 1 line
2.27.0
Sasha Levin
maintainerPATCH 38/38 PCI: Add function 1 DMA alias quirk for Marvell 9215 SATA controller
In reply to Sasha LevinFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 059983790a4c963d92943e55a61fca55be427d55 ]
Add function 1 DMA alias quirk for Marvell 88SS9215 PCIe SSD Controller.
--- drivers/pci/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/quirks.c +3 -0
@@ -3649,6 +3649,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x917a,/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x91a0 , quirk_dma_func1_alias); +/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c135 */ +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9215 , + quirk_dma_func1_alias);/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */ DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_MARVELL_EXT ,0x9220 , quirk_dma_func1_alias);
Signature · 1 line
2.27.0