4.14.240-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 182/315 selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
In reply to Greg Kroah-HartmanFrom: Minchan Kim <[email protected]>
[ Upstream commit 648f2c6100cfa18e7dfe43bc0b9c3b73560d623c ]
In the field, we have seen lots of allocation failure from the call path below.
06-03 13:29:12.999 1010315 31557 31557 W Binder : 31542_2: page allocation failure: order:0, mode:0x800(GFP_NOWAIT), nodemask=(null),cpuset=background,mems_allowed=0
...
...
06-03 13:29:12.999 1010315 31557 31557 W Call trace:
06-03 13:29:12.999 1010315 31557 31557 W : dump_backtrace.cfi_jt+0x0/0x8 06-03 13:29:12.999 1010315 31557 31557 W : dump_stack+0xc8/0x14c 06-03 13:29:12.999 1010315 31557 31557 W : warn_alloc+0x158/0x1c8 06-03 13:29:12.999 1010315 31557 31557 W : __alloc_pages_slowpath+0x9d8/0xb80 06-03 13:29:12.999 1010315 31557 31557 W : __alloc_pages_nodemask+0x1c4/0x430 06-03 13:29:12.999 1010315 31557 31557 W : allocate_slab+0xb4/0x390 06-03 13:29:12.999 1010315 31557 31557 W : ___slab_alloc+0x12c/0x3a4 06-03 13:29:12.999 1010315 31557 31557 W : kmem_cache_alloc+0x358/0x5e4 06-03 13:29:12.999 1010315 31557 31557 W : avc_alloc_node+0x30/0x184 06-03 13:29:12.999 1010315 31557 31557 W : avc_update_node+0x54/0x4f0 06-03 13:29:12.999 1010315 31557 31557 W : avc_has_extended_perms+0x1a4/0x460 06-03 13:29:12.999 1010315 31557 31557 W : selinux_file_ioctl+0x320/0x3d0 06-03 13:29:12.999 1010315 31557 31557 W : __arm64_sys_ioctl+0xec/0x1fc 06-03 13:29:12.999 1010315 31557 31557 W : el0_svc_common+0xc0/0x24c 06-03 13:29:12.999 1010315 31557 31557 W : el0_svc+0x28/0x88 06-03 13:29:12.999 1010315 31557 31557 W : el0_sync_handler+0x8c/0xf0 06-03 13:29:12.999 1010315 31557 31557 W : el0_sync+0x1a4/0x1c0 .. .. 06-03 13:29:12.999 1010315 31557 31557 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010315 31557 31557 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010315 31557 31557 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:12.999 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:12.999 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:12.999 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 10230 30892 30892 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 10230 30892 30892 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 10230 30892 30892 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 10230 30892 30892 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 10230 30892 30892 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0
Based on [1], selinux is tolerate for failure of memory allocation. Then, use __GFP_NOWARN together.
[1] 476accbe2f6e ("selinux: use GFP_NOWAIT in the AVC kmem_caches")
--- security/selinux/avc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
security/selinux/avc.c +7 -6
@@ -346,26 +346,27 @@ static struct avc_xperms_decision_nodestruct avc_xperms_decision_node *xpd_node;struct extended_perms_decision *xpd; - xpd_node =kmem_cache_zalloc (avc_xperms_decision_cachep,GFP_NOWAIT ); + xpd_node =kmem_cache_zalloc (avc_xperms_decision_cachep, +GFP_NOWAIT | __GFP_NOWARN);if (!xpd_node)return NULL ; xpd = &xpd_node->xpd;if (which &XPERMS_ALLOWED ) { xpd->allowed =kmem_cache_zalloc (avc_xperms_data_cachep, -GFP_NOWAIT ); +GFP_NOWAIT | __GFP_NOWARN);if (!xpd->allowed) goto error; }if (which &XPERMS_AUDITALLOW ) { xpd->auditallow =kmem_cache_zalloc (avc_xperms_data_cachep, -GFP_NOWAIT ); +GFP_NOWAIT | __GFP_NOWARN);if (!xpd->auditallow) goto error; }if (which &XPERMS_DONTAUDIT ) { xpd->dontaudit =kmem_cache_zalloc (avc_xperms_data_cachep, -GFP_NOWAIT ); +GFP_NOWAIT | __GFP_NOWARN);if (!xpd->dontaudit) goto error; }
@@ -393,7 +394,7 @@ static struct avc_xperms_node *avc_xperms_alloc(void) {struct avc_xperms_node *xp_node; - xp_node =kmem_cache_zalloc (avc_xperms_cachep,GFP_NOWAIT ); + xp_node =kmem_cache_zalloc (avc_xperms_cachep,GFP_NOWAIT | __GFP_NOWARN);if (!xp_node)return xp_node;INIT_LIST_HEAD (&xp_node->xpd_head);
@@ -546,7 +547,7 @@ static struct avc_node *avc_alloc_node(void) {struct avc_node *node; - node =kmem_cache_zalloc (avc_node_cachep,GFP_NOWAIT ); + node =kmem_cache_zalloc (avc_node_cachep,GFP_NOWAIT | __GFP_NOWARN);if (!node) goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 183/315 xfrm: Fix error reporting in xfrm_state_construct.
In reply to Greg Kroah-HartmanFrom: Steffen Klassert <[email protected]>
[ Upstream commit 6fd06963fa74197103cdbb4b494763127b3f2f34 ]
When memory allocation for XFRMA_ENCAP or XFRMA_COADDR fails, the error will not be reported because the -ENOMEM assignment to the err variable is overwritten before. Fix this by moving these two in front of the function so that memory allocation failures will be reported.
--- net/xfrm/xfrm_user.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
net/xfrm/xfrm_user.c +14 -14
@@ -566,6 +566,20 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,copy_from_user_state (x, p); +if (attrs[XFRMA_ENCAP ]) { + x->encap =kmemdup (nla_data (attrs[XFRMA_ENCAP ]), +sizeof (*x->encap),GFP_KERNEL ); +if (x->encap ==NULL ) + goto error; + } + +if (attrs[XFRMA_COADDR ]) { + x->coaddr =kmemdup (nla_data (attrs[XFRMA_COADDR ]), +sizeof (*x->coaddr),GFP_KERNEL ); +if (x->coaddr ==NULL ) + goto error; + } +if (attrs[XFRMA_SA_EXTRA_FLAGS ]) x->props.extra_flags =nla_get_u32 (attrs[XFRMA_SA_EXTRA_FLAGS ]);
@@ -586,23 +600,9 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, attrs[XFRMA_ALG_COMP]))) goto error; -if (attrs[XFRMA_ENCAP ]) { - x->encap =kmemdup (nla_data (attrs[XFRMA_ENCAP ]), -sizeof (*x->encap),GFP_KERNEL ); -if (x->encap ==NULL ) - goto error; - } -if (attrs[XFRMA_TFCPAD ]) x->tfcpad =nla_get_u32 (attrs[XFRMA_TFCPAD ]); -if (attrs[XFRMA_COADDR ]) { - x->coaddr =kmemdup (nla_data (attrs[XFRMA_COADDR ]), -sizeof (*x->coaddr),GFP_KERNEL ); -if (x->coaddr ==NULL ) - goto error; - } -xfrm_mark_get (attrs, &x->mark);if (attrs[XFRMA_OUTPUT_MARK ])
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 184/315 wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 11ef6bc846dcdce838f0b00c5f6a562c57e5d43b ]
At least on wl12xx, reading the MAC after boot can fail with a warning at drivers/net/wireless/ti/wlcore/sdio.c:78 wl12xx_sdio_raw_read. The failed call comes from wl12xx_get_mac() that wlcore_nvs_cb() calls after request_firmware_work_func().
After the error, no wireless interface is created. Reloading the wl12xx module makes the interface work.
Turns out the wlan controller can be in a low-power ELP state after the boot from the bootloader or kexec, and needs to be woken up first.
Let's wake the hardware and add a sleep after that similar to wl12xx_pre_boot() is already doing.
Note that a similar issue could exist for wl18xx, but I have not seen it so far. And a search for wl18xx_get_mac and wl12xx_sdio_raw_read did not produce similar errors.
--- drivers/net/wireless/ti/wl12xx/main.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/ti/wl12xx/main.c +7 -0
@@ -1516,6 +1516,13 @@ static int wl12xx_get_fuse_mac(struct wl1271 *wl)u32 mac1, mac2;int ret; +/* Device may be in ELP from the bootloader or kexec */ + ret =wlcore_write32 (wl,WL12XX_WELP_ARM_COMMAND ,WELP_ARM_COMMAND_VAL ); +if (ret <0 ) + goto out; + +usleep_range (500000 ,700000 ); + ret =wlcore_set_partition (wl, &wl->ptable[PART_DRPW ]);if (ret <0 ) goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 185/315 wl1251: Fix possible buffer overflow in wl1251_cmd_scan
In reply to Greg Kroah-HartmanFrom: Lee Gibson <[email protected]>
[ Upstream commit d10a87a3535cce2b890897914f5d0d83df669c63 ]
Function wl1251_cmd_scan calls memcpy without checking the length. Harden by checking the length is within the maximum allowed size.
--- drivers/net/wireless/ti/wl1251/cmd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ti/wl1251/cmd.c +6 -3
@@ -466,9 +466,12 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len, cmd->channels[i].channel = channels[i]->hw_value; } - cmd->params.ssid_len = ssid_len; -if (ssid) -memcpy (cmd->params.ssid, ssid, ssid_len); +if (ssid) { +int len =clamp_val (ssid_len,0 ,IEEE80211_MAX_SSID_LEN ); + + cmd->params.ssid_len = len; +memcpy (cmd->params.ssid, ssid, len); + } ret =wl1251_cmd_send (wl,CMD_SCAN , cmd,sizeof (*cmd));if (ret <0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 186/315 cw1200: add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit dd778f89225cd258e8f0fed2b7256124982c8bb5 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/net/wireless/st/cw1200/cw1200_sdio.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/st/cw1200/cw1200_sdio.c +1 -0
@@ -63,6 +63,7 @@ static const struct sdio_device_id cw1200_sdio_ids[] = { { SDIO_DEVICE(SDIO_VENDOR_ID_STE, SDIO_DEVICE_ID_STE_CW1200) }, { /* end: all zeroes */ }, }; +MODULE_DEVICE_TABLE (sdio, cw1200_sdio_ids);/* hwbus_ops implemetation */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 187/315 MIPS: add PMD table accounting into MIPSpmd_alloc_one
In reply to Greg Kroah-HartmanFrom: Huang Pei <[email protected]>
[ Upstream commit ed914d48b6a1040d1039d371b56273d422c0081e ]
This fixes Page Table accounting bug.
MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone. Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables), "pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one" in MIPS without PMD table accounting causes PageTable accounting number negative, which read by global_zone_page_state(), always returns 0.
--- arch/mips/include/asm/pgalloc.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/mips/include/asm/pgalloc.h +7 -3
@@ -93,11 +93,15 @@ do { \static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long address) { -pmd_t *pmd; +pmd_t *pmd =NULL ; +struct page *pg; - pmd = (pmd_t *)__get_free_pages (GFP_KERNEL ,PMD_ORDER ); -if (pmd) + pg =alloc_pages (GFP_KERNEL | __GFP_ACCOUNT,PMD_ORDER ); +if (pg) { +pgtable_pmd_page_ctor (pg); + pmd = (pmd_t *)page_address (pg);pmd_init ((unsigned long )pmd, (unsigned long )invalid_pte_table); + }return pmd; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 188/315 atm: nicstar: use dma_free_coherent instead of kfree
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 6a1e5a4af17e440dd82a58a2c5f40ff17a82b722 ]
When 'nicstar_init_one' fails, 'ns_init_card_error' will be executed for error handling, but the correct memory free function should be used, otherwise it will cause an error. Since 'card->rsq.org' and 'card->tsq.org' are allocated using 'dma_alloc_coherent' function, they should be freed using 'dma_free_coherent'.
Fix this by using 'dma_free_coherent' instead of 'kfree'
This log reveals it:
[ 3.440294] kernel BUG at mm/slub.c:4206! [ 3.441059] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 3.441430] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #141 [ 3.441986] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 3.442780] RIP: 0010:kfree+0x26a/0x300 [ 3.443065] Code: e8 3a c3 b9 ff e9 d6 fd ff ff 49 8b 45 00 31 db a9 00 00 01 00 75 4d 49 8b 45 00 a9 00 00 01 00 75 0a 49 8b 45 08 a8 01 75 02 <0f> 0b 89 d9 b8 00 10 00 00 be 06 00 00 00 48 d3 e0 f7 d8 48 63 d0 [ 3.443396] RSP: 0000:ffffc90000017b70 EFLAGS: 00010246 [ 3.443396] RAX: dead000000000100 RBX: 0000000000000000 RCX: 0000000000000000 [ 3.443396] RDX: 0000000000000000 RSI: ffffffff85d3df94 RDI: ffffffff85df38e6 [ 3.443396] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000001 [ 3.443396] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888107dc0000 [ 3.443396] R13: ffffea00001f0100 R14: ffff888101a8bf00 R15: ffff888107dc0160 [ 3.443396] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 3.443396] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.443396] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0 [ 3.443396] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3.443396] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3.443396] Call Trace: [ 3.443396] ns_init_card_error+0x12c/0x220 [ 3.443396] nicstar_init_one+0x10d2/0x1130 [ 3.443396] local_pci_probe+0x4a/0xb0 [ 3.443396] pci_device_probe+0x126/0x1d0 [ 3.443396] ? pci_device_remove+0x100/0x100 [ 3.443396] really_probe+0x27e/0x650 [ 3.443396] driver_probe_device+0x84/0x1d0 [ 3.443396] ? mutex_lock_nested+0x16/0x20 [ 3.443396] device_driver_attach+0x63/0x70 [ 3.443396] __driver_attach+0x117/0x1a0 [ 3.443396] ? device_driver_attach+0x70/0x70 [ 3.443396] bus_for_each_dev+0xb6/0x110 [ 3.443396] ? rdinit_setup+0x40/0x40 [ 3.443396] driver_attach+0x22/0x30 [ 3.443396] bus_add_driver+0x1e6/0x2a0 [ 3.443396] driver_register+0xa4/0x180 [ 3.443396] __pci_register_driver+0x77/0x80 [ 3.443396] ? uPD98402_module_init+0xd/0xd [ 3.443396] nicstar_init+0x1f/0x75 [ 3.443396] do_one_initcall+0x7a/0x3d0 [ 3.443396] ? rdinit_setup+0x40/0x40 [ 3.443396] ? rcu_read_lock_sched_held+0x4a/0x70 [ 3.443396] kernel_init_freeable+0x2a7/0x2f9 [ 3.443396] ? rest_init+0x2c0/0x2c0 [ 3.443396] kernel_init+0x13/0x180 [ 3.443396] ? rest_init+0x2c0/0x2c0 [ 3.443396] ? rest_init+0x2c0/0x2c0 [ 3.443396] ret_from_fork+0x1f/0x30 [ 3.443396] Modules linked in: [ 3.443396] Dumping ftrace buffer: [ 3.443396] (ftrace buffer empty) [ 3.458593] ---[ end trace 3c6f8f0d8ef59bcd ]--- [ 3.458922] RIP: 0010:kfree+0x26a/0x300 [ 3.459198] Code: e8 3a c3 b9 ff e9 d6 fd ff ff 49 8b 45 00 31 db a9 00 00 01 00 75 4d 49 8b 45 00 a9 00 00 01 00 75 0a 49 8b 45 08 a8 01 75 02 <0f> 0b 89 d9 b8 00 10 00 00 be 06 00 00 00 48 d3 e0 f7 d8 48 63 d0 [ 3.460499] RSP: 0000:ffffc90000017b70 EFLAGS: 00010246 [ 3.460870] RAX: dead000000000100 RBX: 0000000000000000 RCX: 0000000000000000 [ 3.461371] RDX: 0000000000000000 RSI: ffffffff85d3df94 RDI: ffffffff85df38e6 [ 3.461873] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000001 [ 3.462372] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888107dc0000 [ 3.462871] R13: ffffea00001f0100 R14: ffff888101a8bf00 R15: ffff888107dc0160 [ 3.463368] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 3.463949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.464356] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0 [ 3.464856] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3.465356] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3.465860] Kernel panic - not syncing: Fatal exception [ 3.466370] Dumping ftrace buffer: [ 3.466616] (ftrace buffer empty) [ 3.466871] Kernel Offset: disabled [ 3.467122] Rebooting in 1 seconds..
--- drivers/atm/nicstar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/atm/nicstar.c +4 -2
@@ -838,10 +838,12 @@ static void ns_init_card_error(ns_dev *card, int error)dev_kfree_skb_any (hb); }if (error >=12 ) { -kfree (card->rsq.org); +dma_free_coherent (&card->pcidev->dev,NS_RSQSIZE +NS_RSQ_ALIGNMENT , + card->rsq.org, card->rsq.dma); }if (error >=11 ) { -kfree (card->tsq.org); +dma_free_coherent (&card->pcidev->dev,NS_TSQSIZE +NS_TSQ_ALIGNMENT , + card->tsq.org, card->tsq.dma); }if (error >=10 ) {free_irq (card->pcidev->irq, card);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 189/315 atm: nicstar: register the interrupt handler in the right place
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 70b639dc41ad499384e41e106fce72e36805c9f2 ]
Because the error handling is sequential, the application of resources should be carried out in the order of error handling, so the operation of registering the interrupt handler should be put in front, so as not to free the unregistered interrupt handler during error handling.
This log reveals it:
[ 3.438724] Trying to free already-free IRQ 23 [ 3.439060] WARNING: CPU: 5 PID: 1 at kernel/irq/manage.c:1825 free_irq+0xfb/0x480 [ 3.440039] Modules linked in: [ 3.440257] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #142 [ 3.440793] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 3.441561] RIP: 0010:free_irq+0xfb/0x480 [ 3.441845] Code: 6e 08 74 6f 4d 89 f4 e8 c3 78 09 00 4d 8b 74 24 18 4d 85 f6 75 e3 e8 b4 78 09 00 8b 75 c8 48 c7 c7 a0 ac d5 85 e8 95 d7 f5 ff <0f> 0b 48 8b 75 c0 4c 89 ff e8 87 c5 90 03 48 8b 43 40 4c 8b a0 80 [ 3.443121] RSP: 0000:ffffc90000017b50 EFLAGS: 00010086 [ 3.443483] RAX: 0000000000000000 RBX: ffff888107c6f000 RCX: 0000000000000000 [ 3.443972] RDX: 0000000000000000 RSI: ffffffff8123f301 RDI: 00000000ffffffff [ 3.444462] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000003 [ 3.444950] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 [ 3.444994] R13: ffff888107dc0000 R14: ffff888104f6bf00 R15: ffff888107c6f0a8 [ 3.444994] FS: 0000000000000000(0000) GS:ffff88817bd40000(0000) knlGS:0000000000000000 [ 3.444994] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.444994] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0 [ 3.444994] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3.444994] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3.444994] Call Trace: [ 3.444994] ns_init_card_error+0x18e/0x250 [ 3.444994] nicstar_init_one+0x10d2/0x1130 [ 3.444994] local_pci_probe+0x4a/0xb0 [ 3.444994] pci_device_probe+0x126/0x1d0 [ 3.444994] ? pci_device_remove+0x100/0x100 [ 3.444994] really_probe+0x27e/0x650 [ 3.444994] driver_probe_device+0x84/0x1d0 [ 3.444994] ? mutex_lock_nested+0x16/0x20 [ 3.444994] device_driver_attach+0x63/0x70 [ 3.444994] __driver_attach+0x117/0x1a0 [ 3.444994] ? device_driver_attach+0x70/0x70 [ 3.444994] bus_for_each_dev+0xb6/0x110 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] driver_attach+0x22/0x30 [ 3.444994] bus_add_driver+0x1e6/0x2a0 [ 3.444994] driver_register+0xa4/0x180 [ 3.444994] __pci_register_driver+0x77/0x80 [ 3.444994] ? uPD98402_module_init+0xd/0xd [ 3.444994] nicstar_init+0x1f/0x75 [ 3.444994] do_one_initcall+0x7a/0x3d0 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] ? rcu_read_lock_sched_held+0x4a/0x70 [ 3.444994] kernel_init_freeable+0x2a7/0x2f9 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] kernel_init+0x13/0x180 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ret_from_fork+0x1f/0x30 [ 3.444994] Kernel panic - not syncing: panic_on_warn set ... [ 3.444994] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #142 [ 3.444994] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 3.444994] Call Trace: [ 3.444994] dump_stack+0xba/0xf5 [ 3.444994] ? free_irq+0xfb/0x480 [ 3.444994] panic+0x155/0x3ed [ 3.444994] ? __warn+0xed/0x150 [ 3.444994] ? free_irq+0xfb/0x480 [ 3.444994] __warn+0x103/0x150 [ 3.444994] ? free_irq+0xfb/0x480 [ 3.444994] report_bug+0x119/0x1c0 [ 3.444994] handle_bug+0x3b/0x80 [ 3.444994] exc_invalid_op+0x18/0x70 [ 3.444994] asm_exc_invalid_op+0x12/0x20 [ 3.444994] RIP: 0010:free_irq+0xfb/0x480 [ 3.444994] Code: 6e 08 74 6f 4d 89 f4 e8 c3 78 09 00 4d 8b 74 24 18 4d 85 f6 75 e3 e8 b4 78 09 00 8b 75 c8 48 c7 c7 a0 ac d5 85 e8 95 d7 f5 ff <0f> 0b 48 8b 75 c0 4c 89 ff e8 87 c5 90 03 48 8b 43 40 4c 8b a0 80 [ 3.444994] RSP: 0000:ffffc90000017b50 EFLAGS: 00010086 [ 3.444994] RAX: 0000000000000000 RBX: ffff888107c6f000 RCX: 0000000000000000 [ 3.444994] RDX: 0000000000000000 RSI: ffffffff8123f301 RDI: 00000000ffffffff [ 3.444994] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000003 [ 3.444994] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 [ 3.444994] R13: ffff888107dc0000 R14: ffff888104f6bf00 R15: ffff888107c6f0a8 [ 3.444994] ? vprintk_func+0x71/0x110 [ 3.444994] ns_init_card_error+0x18e/0x250 [ 3.444994] nicstar_init_one+0x10d2/0x1130 [ 3.444994] local_pci_probe+0x4a/0xb0 [ 3.444994] pci_device_probe+0x126/0x1d0 [ 3.444994] ? pci_device_remove+0x100/0x100 [ 3.444994] really_probe+0x27e/0x650 [ 3.444994] driver_probe_device+0x84/0x1d0 [ 3.444994] ? mutex_lock_nested+0x16/0x20 [ 3.444994] device_driver_attach+0x63/0x70 [ 3.444994] __driver_attach+0x117/0x1a0 [ 3.444994] ? device_driver_attach+0x70/0x70 [ 3.444994] bus_for_each_dev+0xb6/0x110 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] driver_attach+0x22/0x30 [ 3.444994] bus_add_driver+0x1e6/0x2a0 [ 3.444994] driver_register+0xa4/0x180 [ 3.444994] __pci_register_driver+0x77/0x80 [ 3.444994] ? uPD98402_module_init+0xd/0xd [ 3.444994] nicstar_init+0x1f/0x75 [ 3.444994] do_one_initcall+0x7a/0x3d0 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] ? rcu_read_lock_sched_held+0x4a/0x70 [ 3.444994] kernel_init_freeable+0x2a7/0x2f9 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] kernel_init+0x13/0x180 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ret_from_fork+0x1f/0x30 [ 3.444994] Dumping ftrace buffer: [ 3.444994] (ftrace buffer empty) [ 3.444994] Kernel Offset: disabled [ 3.444994] Rebooting in 1 seconds..
--- drivers/atm/nicstar.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/atm/nicstar.c +9 -9
@@ -526,6 +526,15 @@ static int ns_init_card(int i, struct pci_dev *pcidev)/* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */ writel (0x00000000 , card->membase +VPM ); + card->intcnt =0 ; +if (request_irq + (pcidev->irq, &ns_irq_handler,IRQF_SHARED ,"nicstar" , card) !=0 ) { +pr_err ("nicstar%d: can't allocate IRQ %d.\n" , i, pcidev->irq); + error =9 ; +ns_init_card_error (card, error); +return error; + } +/* Initialize TSQ */ card->tsq.org = dma_alloc_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
@@ -752,15 +761,6 @@ static int ns_init_card(int i, struct pci_dev *pcidev) card->efbie =1 ; - card->intcnt =0 ; -if (request_irq - (pcidev->irq, &ns_irq_handler,IRQF_SHARED ,"nicstar" , card) !=0 ) { -printk ("nicstar%d: can't allocate IRQ %d.\n" , i, pcidev->irq); - error =9 ; -ns_init_card_error (card, error); -return error; - } -/* Register device */ card->atmdev =atm_dev_register ("nicstar" , &card->pcidev->dev, &atm_ops,-1 ,NULL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 190/315 vsock: notify server to shutdown when client has pending signal
In reply to Greg Kroah-HartmanFrom: Longpeng(Mike) <[email protected]>
[ Upstream commit c7ff9cff70601ea19245d997bb977344663434c7 ]
The client's sk_state will be set to TCP_ESTABLISHED if the server replay the client's connect request.
However, if the client has pending signal, its sk_state will be set to TCP_CLOSE without notify the server, so the server will hold the corrupt connection.
client server
1. sk_state=TCP_SYN_SENT |
2. call ->connect() |
3. wait reply |
| 4. sk_state=TCP_ESTABLISHED
| 5. insert to connected list
| 6. reply to the client
7. sk_state=TCP_ESTABLISHED |
8. insert to connected list |
9. *signal pending* <--------------------- the user kill client
10. sk_state=TCP_CLOSE |
client is exiting... |
11. call ->release() |
virtio_transport_close
if (!(sk->sk_state == TCP_ESTABLISHED ||
sk->sk_state == TCP_CLOSING))
return true; *return at here, the server cannot notice the connection is corrupt*So the client should notify the peer in this case.
--- net/vmw_vsock/af_vsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/vmw_vsock/af_vsock.c +1 -1
@@ -1232,7 +1232,7 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr,if (signal_pending (current)) { err =sock_intr_errno (timeout); - sk->sk_state =TCP_CLOSE ; + sk->sk_state = sk->sk_state ==TCP_ESTABLISHED ?TCP_CLOSING :TCP_CLOSE ; sock->state =SS_UNCONNECTED ;vsock_transport_cancel_pkt (vsk); goto out_wait;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 191/315 RDMA/rxe: Dont overwrite errno from ib_umem_get()
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit 20ec0a6d6016aa28b9b3299be18baef1a0f91cd2 ]
rxe_mr_init_user() always returns the fixed -EINVAL when ib_umem_get() fails so it's hard for user to know which actual error happens in ib_umem_get(). For example, ib_umem_get() will return -EOPNOTSUPP when trying to pin pages on a DAX file.
Return actual error as mlx4/mlx5 does.
--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_mr.c +1 -1
@@ -175,7 +175,7 @@ int rxe_mem_init_user(struct rxe_dev *rxe, struct rxe_pd *pd, u64 start,if (IS_ERR (umem)) {pr_warn ("err %d from rxe_umem_get\n" , (int )PTR_ERR (umem)); - err = -EINVAL ; + err =PTR_ERR (umem); goto err1; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 192/315 iwlwifi: mvm: dont change band on bound PHY contexts
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 8835a64f74c46baebfc946cd5a2c861b866ebcee ]
When we have a P2P Device active, we attempt to only change the PHY context it uses when we get a new remain-on-channel, if the P2P Device is the only user of the PHY context.
This is fine if we're switching within a band, but if we're switching bands then the switch implies a removal and re-add of the PHY context, which isn't permitted by the firmware while it's bound to an interface.
Fix the code to skip the unbind/release/... cycle only if the band doesn't change (or we have old devices that can switch the band on the fly as well.)
--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +18 -6
@@ -3270,6 +3270,7 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw,struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif);struct cfg80211_chan_def chandef;struct iwl_mvm_phy_ctxt *phy_ctxt; +bool band_change_removal;int ret, i; IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value,
@@ -3335,19 +3336,30 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw,cfg80211_chandef_create (&chandef, channel,NL80211_CHAN_NO_HT );/* -* Change the PHY context configuration as it is currently referenced -* only by the P2P Device MAC +* Check if the remain-on-channel is on a different band and that +* requires context removal, see iwl_mvm_phy_ctxt_changed(). If +* so, we'll need to release and then re-configure here, since we +* must not remove a PHY context that's part of a binding. */ -if (mvmvif->phy_ctxt->ref ==1 ) { + band_change_removal = +fw_has_capa (&mvm->fw->ucode_capa, +IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT ) && + mvmvif->phy_ctxt->channel->band != chandef.chan->band; + +if (mvmvif->phy_ctxt->ref ==1 && !band_change_removal) { +/* +* Change the PHY context configuration as it is currently +* referenced only by the P2P Device MAC (and we can modify it) +*/ ret =iwl_mvm_phy_ctxt_changed (mvm, mvmvif->phy_ctxt, &chandef,1 ,1 );if (ret) goto out_unlock; }else {/* -* The PHY context is shared with other MACs. Need to remove the -* P2P Device from the binding, allocate an new PHY context and -* create a new binding +* The PHY context is shared with other MACs (or we're trying to +* switch bands), so remove the P2P Device from the binding, +* allocate an new PHY context and create a new binding. */ phy_ctxt =iwl_mvm_get_free_phy_ctxt (mvm);if (!phy_ctxt) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 193/315 sfc: avoid double pci_remove of VFs
In reply to Greg Kroah-HartmanFrom: Íñigo Huguet <[email protected]>
[ Upstream commit 45423cff1db66cf0993e8a9bd0ac93e740149e49 ]
If pci_remove was called for a PF with VFs, the removal of the VFs was called twice from efx_ef10_sriov_fini: one directly with pci_driver->remove and another implicit by calling pci_disable_sriov, which also perform the VFs remove. This was leading to crashing the kernel on the second attempt.
Given that pci_disable_sriov already calls to pci remove function, get rid of the direct call to pci_driver->remove from the driver.
2 different ways to trigger the bug:
- Create one or more VFs, then attach the PF to a virtual machine (at least with qemu/KVM)
- Create one or more VFs, then remove the PF with:
echo 1 > /sys/bus/pci/devices/PF_PCI_ID/remove
Removing sfc module does not trigger the error, at least for me, because it removes the VF first, and then the PF.
Example of a log with the error:
list_del corruption, ffff967fd20a8ad0->next is LIST_POISON1 (dead000000000100)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:47!
[...trimmed...]
RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4c
[...trimmed...]
Call Trace:
efx_dissociate+0x1f/0x140 [sfc]
efx_pci_remove+0x27/0x150 [sfc]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0x103/0x1f0
pci_stop_bus_device+0x69/0x90
pci_stop_and_remove_bus_device+0xe/0x20
pci_iov_remove_virtfn+0xba/0x120
sriov_disable+0x2f/0xe0
efx_ef10_pci_sriov_disable+0x52/0x80 [sfc]
? pcie_aer_is_native+0x12/0x40
efx_ef10_sriov_fini+0x72/0x110 [sfc]
efx_pci_remove+0x62/0x150 [sfc]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0x103/0x1f0
unbind_store+0xf6/0x130
kernfs_fop_write+0x116/0x190
vfs_write+0xa5/0x1a0
ksys_write+0x4f/0xb0
do_syscall_64+0x5b/0x1a0
entry_SYSCALL_64_after_hwframe+0x65/0xca--- drivers/net/ethernet/sfc/ef10_sriov.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/ethernet/sfc/ef10_sriov.c +1 -9
@@ -443,7 +443,6 @@ int efx_ef10_sriov_init(struct efx_nic *efx)void efx_ef10_sriov_fini (struct efx_nic *efx) {struct efx_ef10_nic_data *nic_data = efx->nic_data; -unsigned int i;int rc;if (!nic_data->vf) {
@@ -453,14 +452,7 @@ void efx_ef10_sriov_fini(struct efx_nic *efx)return ; } -/* Remove any VFs in the host */ -for (i =0 ; i < efx->vf_count; ++i) { -struct efx_nic *vf_efx = nic_data->vf[i].efx; - -if (vf_efx) - vf_efx->pci_dev->driver->remove (vf_efx->pci_dev); - } - +/* Disable SRIOV and remove any VFs in the host */ rc =efx_ef10_pci_sriov_disable (efx, true);if (rc) netif_dbg(efx, drv, efx->net_dev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 194/315 sfc: error code if SRIOV cannot be disabled
In reply to Greg Kroah-HartmanFrom: Íñigo Huguet <[email protected]>
[ Upstream commit 1ebe4feb8b442884f5a28d2437040096723dd1ea ]
If SRIOV cannot be disabled during device removal or module unloading, return error code so it can be logged properly in the calling function.
Note that this can only happen if any VF is currently attached to a guest using Xen, but not with vfio/KVM. Despite that in that case the VFs won't work properly with PF removed and/or the module unloaded, I have let it as is because I don't know what side effects may have changing it, and also it seems to be the same that other drivers are doing in this situation.
In the case of being called during SRIOV reconfiguration, the behavior hasn't changed because the function is called with force=false.
--- drivers/net/ethernet/sfc/ef10_sriov.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/ef10_sriov.c +11 -4
@@ -406,12 +406,17 @@ fail1:return rc; } +/* Disable SRIOV and remove VFs +* If some VFs are attached to a guest (using Xen, only) nothing is +* done if force=false, and vports are freed if force=true (for the non +* attachedc ones, only) but SRIOV is not disabled and VFs are not +* removed in either case. +*/ static int efx_ef10_pci_sriov_disable (struct efx_nic *efx,bool force) {struct pci_dev *dev = efx->pci_dev; -unsigned int vfs_assigned =0 ; - - vfs_assigned =pci_vfs_assigned (dev); +unsigned int vfs_assigned =pci_vfs_assigned (dev); +int rc =0 ;if (vfs_assigned && !force) { netif_info(efx, drv, efx->net_dev, "VFs are assigned to guests; "
@@ -421,10 +426,12 @@ static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force)if (!vfs_assigned)pci_disable_sriov (dev); +else + rc = -EBUSY ;efx_ef10_sriov_free_vf_vswitching (efx); efx->vf_count =0 ; -return 0 ; +return rc; }int efx_ef10_sriov_configure (struct efx_nic *efx,int num_vfs)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 195/315 wireless: wext-spy: Fix out-of-bounds warning
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit e93bdd78406da9ed01554c51e38b2a02c8ef8025 ]
Fix the following out-of-bounds warning:
net/wireless/wext-spy.c:178:2: warning: 'memcpy' offset [25, 28] from the object at 'threshold' is out of the bounds of referenced subobject 'low' with type 'struct iw_quality' at offset 20 [-Warray-bounds]
The problem is that the original code is trying to copy data into a couple of struct members adjacent to each other in a single call to memcpy(). This causes a legitimate compiler warning because memcpy() overruns the length of &threshold.low and &spydata->spy_thr_low. As these are just a couple of struct members, fix this by using direct assignments, instead of memcpy().
This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy().
--- net/wireless/wext-spy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/wireless/wext-spy.c +7 -7
@@ -120,8 +120,8 @@ int iw_handler_set_thrspy(struct net_device * dev,return -EOPNOTSUPP ;/* Just do it */ -memcpy (&(spydata->spy_thr_low), &(threshold->low), -2 *sizeof (struct iw_quality )); + spydata->spy_thr_low = threshold->low; + spydata->spy_thr_high = threshold->high;/* Clear flag */ memset (spydata->spy_thr_under,'\0' ,sizeof (spydata->spy_thr_under));
@@ -147,8 +147,8 @@ int iw_handler_get_thrspy(struct net_device * dev,return -EOPNOTSUPP ;/* Just do it */ -memcpy (&(threshold->low), &(spydata->spy_thr_low), -2 *sizeof (struct iw_quality )); + threshold->low = spydata->spy_thr_low; + threshold->high = spydata->spy_thr_high;return 0 ; }
@@ -173,10 +173,10 @@ static void iw_send_thrspy_event(struct net_device * dev,memcpy (threshold.addr.sa_data, address,ETH_ALEN ); threshold.addr.sa_family =ARPHRD_ETHER ;/* Copy stats */ -memcpy (&(threshold.qual), wstats,sizeof (struct iw_quality )); + threshold.qual = *wstats;/* Copy also thresholds */ -memcpy (&(threshold.low), &(spydata->spy_thr_low), -2 *sizeof (struct iw_quality )); + threshold.low = spydata->spy_thr_low; + threshold.high = spydata->spy_thr_high;/* Send event to user space */ wireless_send_event (dev,SIOCGIWTHRSPY , &wrqu, (char *) &threshold);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 196/315 RDMA/cma: Fix rdma_resolve_route() memory leak
In reply to Greg Kroah-HartmanFrom: Gerd Rausch <[email protected]>
[ Upstream commit 74f160ead74bfe5f2b38afb4fcf86189f9ff40c9 ]
Fix a memory leak when "mda_resolve_route() is called more than once on the same "rdma_cm_id".
This is possible if cma_query_handler() triggers the RDMA_CM_EVENT_ROUTE_ERROR flow which puts the state machine back and allows rdma_resolve_route() to be called again.
--- drivers/infiniband/core/cma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/cma.c +2 -1
@@ -2478,7 +2478,8 @@ static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms) work->new_state =RDMA_CM_ROUTE_RESOLVED ; work->event.event =RDMA_CM_EVENT_ROUTE_RESOLVED ; - route->path_rec =kmalloc (sizeof *route->path_rec,GFP_KERNEL ); +if (!route->path_rec) + route->path_rec =kmalloc (sizeof *route->path_rec,GFP_KERNEL );if (!route->path_rec) { ret = -ENOMEM ; goto err1;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 197/315 Bluetooth: Fix the HCI to MGMT status conversion table
In reply to Greg Kroah-HartmanFrom: Yu Liu <[email protected]>
[ Upstream commit 4ef36a52b0e47c80bbfd69c0cce61c7ae9f541ed ]
0x2B, 0x31 and 0x33 are reserved for future use but were not present in the HCI to MGMT conversion table, this caused the conversion to be incorrect for the HCI status code greater than 0x2A.
--- net/bluetooth/mgmt.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/mgmt.c +3 -0
@@ -219,12 +219,15 @@ static u8 mgmt_status_table[] = {MGMT_STATUS_TIMEOUT ,/* Instant Passed */ MGMT_STATUS_NOT_SUPPORTED ,/* Pairing Not Supported */ MGMT_STATUS_FAILED ,/* Transaction Collision */ +MGMT_STATUS_FAILED ,/* Reserved for future use */ MGMT_STATUS_INVALID_PARAMS ,/* Unacceptable Parameter */ MGMT_STATUS_REJECTED ,/* QoS Rejected */ MGMT_STATUS_NOT_SUPPORTED ,/* Classification Not Supported */ MGMT_STATUS_REJECTED ,/* Insufficient Security */ MGMT_STATUS_INVALID_PARAMS ,/* Parameter Out Of Range */ +MGMT_STATUS_FAILED ,/* Reserved for future use */ MGMT_STATUS_BUSY ,/* Role Switch Pending */ +MGMT_STATUS_FAILED ,/* Reserved for future use */ MGMT_STATUS_FAILED ,/* Slot Violation */ MGMT_STATUS_FAILED ,/* Role Switch Failed */ MGMT_STATUS_INVALID_PARAMS, /* EIR Too Large */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 198/315 Bluetooth: Shutdown controller after workqueues are flushed or cancelled
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 0ea9fd001a14ebc294f112b0361a4e601551d508 ]
Rfkill block and unblock Intel USB Bluetooth [8087:0026] may make it stops working:
[ 509.691509] Bluetooth: hci0: HCI reset during shutdown failed [ 514.897584] Bluetooth: hci0: MSFT filter_enable is already on [ 530.044751] usb 3-10: reset full-speed USB device number 5 using xhci_hcd [ 545.660350] usb 3-10: device descriptor read/64, error -110 [ 561.283530] usb 3-10: device descriptor read/64, error -110 [ 561.519682] usb 3-10: reset full-speed USB device number 5 using xhci_hcd [ 566.686650] Bluetooth: hci0: unexpected event for opcode 0x0500 [ 568.752452] Bluetooth: hci0: urb 0000000096cd309b failed to resubmit (113) [ 578.797955] Bluetooth: hci0: Failed to read MSFT supported features (-110) [ 586.286565] Bluetooth: hci0: urb 00000000c522f633 failed to resubmit (113) [ 596.215302] Bluetooth: hci0: Failed to read MSFT supported features (-110)
Or kernel panics because other workqueues already freed skb:
[ 2048.663763] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 2048.663775] #PF: supervisor read access in kernel mode [ 2048.663779] #PF: error_code(0x0000) - not-present page [ 2048.663782] PGD 0 P4D 0 [ 2048.663787] Oops: 0000 [#1] SMP NOPTI [ 2048.663793] CPU: 3 PID: 4491 Comm: rfkill Tainted: G W 5.13.0-rc1-next-20210510+ #20 [ 2048.663799] Hardware name: HP HP EliteBook 850 G8 Notebook PC/8846, BIOS T76 Ver. 01.01.04 12/02/2020 [ 2048.663801] RIP: 0010:__skb_ext_put+0x6/0x50 [ 2048.663814] Code: 8b 1b 48 85 db 75 db 5b 41 5c 5d c3 be 01 00 00 00 e8 de 13 c0 ff eb e7 be 02 00 00 00 e8 d2 13 c0 ff eb db 0f 1f 44 00 00 55 <8b> 07 48 89 e5 83 f8 01 74 14 b8 ff ff ff ff f0 0f c1 07 83 f8 01 [ 2048.663819] RSP: 0018:ffffc1d105b6fd80 EFLAGS: 00010286 [ 2048.663824] RAX: 0000000000000000 RBX: ffff9d9ac5649000 RCX: 0000000000000000 [ 2048.663827] RDX: ffffffffc0d1daf6 RSI: 0000000000000206 RDI: 0000000000000000 [ 2048.663830] RBP: ffffc1d105b6fd98 R08: 0000000000000001 R09: ffff9d9ace8ceac0 [ 2048.663834] R10: ffff9d9ace8ceac0 R11: 0000000000000001 R12: ffff9d9ac5649000 [ 2048.663838] R13: 0000000000000000 R14: 00007ffe0354d650 R15: 0000000000000000 [ 2048.663843] FS: 00007fe02ab19740(0000) GS:ffff9d9e5f8c0000(0000) knlGS:0000000000000000 [ 2048.663849] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2048.663853] CR2: 0000000000000000 CR3: 0000000111a52004 CR4: 0000000000770ee0 [ 2048.663856] PKRU: 55555554 [ 2048.663859] Call Trace: [ 2048.663865] ? skb_release_head_state+0x5e/0x80 [ 2048.663873] kfree_skb+0x2f/0xb0 [ 2048.663881] btusb_shutdown_intel_new+0x36/0x60 [btusb] [ 2048.663905] hci_dev_do_close+0x48c/0x5e0 [bluetooth] [ 2048.663954] ? __cond_resched+0x1a/0x50 [ 2048.663962] hci_rfkill_set_block+0x56/0xa0 [bluetooth] [ 2048.664007] rfkill_set_block+0x98/0x170 [ 2048.664016] rfkill_fop_write+0x136/0x1e0 [ 2048.664022] vfs_write+0xc7/0x260 [ 2048.664030] ksys_write+0xb1/0xe0 [ 2048.664035] ? exit_to_user_mode_prepare+0x37/0x1c0 [ 2048.664042] __x64_sys_write+0x1a/0x20 [ 2048.664048] do_syscall_64+0x40/0xb0 [ 2048.664055] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 2048.664060] RIP: 0033:0x7fe02ac23c27 [ 2048.664066] Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 [ 2048.664070] RSP: 002b:00007ffe0354d638 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 2048.664075] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fe02ac23c27 [ 2048.664078] RDX: 0000000000000008 RSI: 00007ffe0354d650 RDI: 0000000000000003 [ 2048.664081] RBP: 0000000000000000 R08: 0000559b05998440 R09: 0000559b05998440 [ 2048.664084] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003 [ 2048.664086] R13: 0000000000000000 R14: ffffffff00000000 R15: 00000000ffffffff
So move the shutdown callback to a place where workqueues are either flushed or cancelled to resolve the issue.
--- net/bluetooth/hci_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/bluetooth/hci_core.c +8 -8
@@ -1569,14 +1569,6 @@ int hci_dev_do_close(struct hci_dev *hdev)BT_DBG ("%s %p" , hdev->name, hdev); -if (!hci_dev_test_flag (hdev,HCI_UNREGISTER ) && - !hci_dev_test_flag (hdev,HCI_USER_CHANNEL ) && -test_bit (HCI_UP , &hdev->flags)) { -/* Execute vendor specific shutdown routine */ -if (hdev->shutdown) - hdev->shutdown (hdev); - } -cancel_delayed_work (&hdev->power_off);hci_request_cancel_all (hdev);
@@ -1644,6 +1636,14 @@ int hci_dev_do_close(struct hci_dev *hdev)clear_bit (HCI_INIT , &hdev->flags); } +if (!hci_dev_test_flag (hdev,HCI_UNREGISTER ) && + !hci_dev_test_flag (hdev,HCI_USER_CHANNEL ) && +test_bit (HCI_UP , &hdev->flags)) { +/* Execute vendor specific shutdown routine */ +if (hdev->shutdown) + hdev->shutdown (hdev); + } +/* flush cmd work */ flush_work (&hdev->cmd_work);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 199/315 Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
In reply to Greg Kroah-HartmanFrom: Tim Jiang <[email protected]>
[ Upstream commit 4f00bfb372674d586c4a261bfc595cbce101fbb6 ]
This is btsoc timing issue, after host start to downloading bt firmware, ep2 need time to switch from function acl to function dfu, so host add 20ms delay as workaround.
--- drivers/bluetooth/btusb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/bluetooth/btusb.c +5 -0
@@ -2614,6 +2614,11 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev, sent += size; count -= size; +/* ep2 need time to switch from function acl to function dfu, +* so we add 20ms delay here. +*/ +msleep (20 ); +while (count) { size =min_t (size_t, count,QCA_DFU_PACKET_LEN );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 200/315 sctp: validate from_addr_param return
In reply to Greg Kroah-HartmanFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 0c5dc070ff3d6246d22ddd931f23a6266249e3db ]
Ilja reported that, simply putting it, nothing was validating that from_addr_param functions were operating on initialized memory. That is, the parameter itself was being validated by sctp_walk_params, but it doesn't check for types and their specific sizes and it could be a 0-length one, causing from_addr_param to potentially work over the next parameter or even uninitialized memory.
The fix here is to, in all calls to from_addr_param, check if enough space is there for the wanted IP address type.
--- include/net/sctp/structs.h | 2 +- net/sctp/bind_addr.c | 19 +++++++++++-------- net/sctp/input.c | 6 ++++-- net/sctp/ipv6.c | 7 ++++++- net/sctp/protocol.c | 7 ++++++- net/sctp/sm_make_chunk.c | 29 ++++++++++++++++------------- 6 files changed, 44 insertions(+), 26 deletions(-)
include/net/sctp/structs.h +1 -1
@@ -441,7 +441,7 @@ struct sctp_af { int saddr);void (*from_sk) (union sctp_addr *,struct sock *sk); -void (*from_addr_param) (union sctp_addr *, +bool (*from_addr_param) (union sctp_addr *,union sctp_addr_param *,__be16 port,int iif); int (*to_addr_param) (const union sctp_addr *,
net/sctp/bind_addr.c +11 -8
@@ -285,22 +285,19 @@ int sctp_raw_to_bind_addrs(struct sctp_bind_addr *bp, __u8 *raw_addr_list, rawaddr = (union sctp_addr_param *)raw_addr_list; af =sctp_get_af_specific (param_type2af (param->type)); -if (unlikely (!af)) { +if (unlikely (!af) || + !af->from_addr_param (&addr, rawaddr,htons (port),0 )) { retval = -EINVAL ; -sctp_bind_addr_clean (bp); -break ; + goto out_err; } - af->from_addr_param (&addr, rawaddr,htons (port),0 );if (sctp_bind_addr_state (bp, &addr) !=-1 ) goto next; retval =sctp_add_bind_addr (bp, &addr,sizeof (addr),SCTP_ADDR_SRC , gfp); -if (retval) { +if (retval)/* Can't finish building the list, clean up. */ -sctp_bind_addr_clean (bp); -break ; - } + goto out_err; next: len =ntohs (param->length);
@@ -309,6 +306,12 @@ next: }return retval; + +out_err: +if (retval) +sctp_bind_addr_clean (bp); + +return retval; }/********************************************************************
net/sctp/input.c +4 -2
@@ -1081,7 +1081,8 @@ static struct sctp_association *__sctp_rcv_init_lookup(struct net *net,if (!af)continue ; - af->from_addr_param (paddr, params.addr, sh->source,0 ); +if (!af->from_addr_param (paddr, params.addr, sh->source,0 )) +continue ; asoc =__sctp_lookup_association (net, laddr, paddr, transportp);if (asoc)
@@ -1124,7 +1125,8 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(if (unlikely (!af))return NULL ; - af->from_addr_param (&paddr, param, peer_port,0 ); +if (af->from_addr_param (&paddr, param, peer_port,0 )) +return NULL ;return __sctp_lookup_association (net, laddr, &paddr, transportp); }
net/sctp/ipv6.c +6 -1
@@ -490,15 +490,20 @@ static void sctp_v6_to_sk_daddr(union sctp_addr *addr, struct sock *sk) }/* Initialize a sctp_addr from an address parameter. */ -static void sctp_v6_from_addr_param (union sctp_addr *addr, +static bool sctp_v6_from_addr_param (union sctp_addr *addr,union sctp_addr_param *param,__be16 port,int iif) { +if (ntohs (param->v6.param_hdr.length) <sizeof (struct sctp_ipv6addr_param )) +return false; + addr->v6.sin6_family =AF_INET6 ; addr->v6.sin6_port = port; addr->v6.sin6_flowinfo =0 ;/* BUG */ addr->v6.sin6_addr = param->v6.addr; addr->v6.sin6_scope_id = iif; + +return true; }/* Initialize an address parameter from a sctp_addr and return the length
net/sctp/protocol.c +6 -1
@@ -279,14 +279,19 @@ static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk) }/* Initialize a sctp_addr from an address parameter. */ -static void sctp_v4_from_addr_param (union sctp_addr *addr, +static bool sctp_v4_from_addr_param (union sctp_addr *addr,union sctp_addr_param *param,__be16 port,int iif) { +if (ntohs (param->v4.param_hdr.length) <sizeof (struct sctp_ipv4addr_param )) +return false; + addr->v4.sin_family =AF_INET ; addr->v4.sin_port = port; addr->v4.sin_addr.s_addr = param->v4.addr.s_addr;memset (addr->v4.sin_zero,0 ,sizeof (addr->v4.sin_zero)); + +return true; }/* Initialize an address parameter from a sctp_addr and return the length
net/sctp/sm_make_chunk.c +16 -13
@@ -2341,11 +2341,13 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,/* Process the initialization parameters. */ sctp_walk_params(param, peer_init, init_hdr.params) { -if (!src_match && (param.p->type ==SCTP_PARAM_IPV4_ADDRESS || - param.p->type ==SCTP_PARAM_IPV6_ADDRESS )) { +if (!src_match && + (param.p->type ==SCTP_PARAM_IPV4_ADDRESS || + param.p->type ==SCTP_PARAM_IPV6_ADDRESS )) { af =sctp_get_af_specific (param_type2af (param.p->type)); - af->from_addr_param (&addr, param.addr, - chunk->sctp_hdr->source,0 ); +if (!af->from_addr_param (&addr, param.addr, + chunk->sctp_hdr->source,0 )) +continue ;if (sctp_cmp_addr_exact (sctp_source (chunk), &addr)) src_match =1 ; }
@@ -2523,7 +2525,8 @@ static int sctp_process_param(struct sctp_association *asoc,break ; do_addr_param: af =sctp_get_af_specific (param_type2af (param.p->type)); - af->from_addr_param (&addr, param.addr,htons (asoc->peer.port),0 ); +if (!af->from_addr_param (&addr, param.addr,htons (asoc->peer.port),0 )) +break ; scope =sctp_scope (peer_addr);if (sctp_in_scope (net, &addr, scope))if (!sctp_assoc_add_peer (asoc, &addr, gfp,SCTP_UNCONFIRMED ))
@@ -2620,15 +2623,13 @@ do_addr_param: addr_param = param.v +sizeof (struct sctp_addip_param ); af =sctp_get_af_specific (param_type2af (addr_param->p.type)); -if (af ==NULL ) +if (!af)break ; - af->from_addr_param (&addr, addr_param, -htons (asoc->peer.port),0 ); +if (!af->from_addr_param (&addr, addr_param, +htons (asoc->peer.port),0 )) +break ; -/* if the address is invalid, we can't process it. -* XXX: see spec for what to do. -*/ if (!af->addr_valid (&addr,NULL ,NULL ))break ;
@@ -3045,7 +3046,8 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,if (unlikely (!af))return SCTP_ERROR_DNS_FAILED ; - af->from_addr_param (&addr, addr_param,htons (asoc->peer.port),0 ); +if (!af->from_addr_param (&addr, addr_param,htons (asoc->peer.port),0 )) +return SCTP_ERROR_DNS_FAILED ;/* ADDIP 4.2.1 This parameter MUST NOT contain a broadcast * or multicast address.
@@ -3310,7 +3312,8 @@ static void sctp_asconf_param_success(struct sctp_association *asoc,/* We have checked the packet before, so we do not check again. */ af =sctp_get_af_specific (param_type2af (addr_param->p.type)); - af->from_addr_param (&addr, addr_param,htons (bp->port),0 ); +if (!af->from_addr_param (&addr, addr_param,htons (bp->port),0 )) +return ;switch (asconf_param->param_hdr.type) {case SCTP_PARAM_ADD_IP :
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 201/315 sctp: add size validation when walking chunks
In reply to Greg Kroah-HartmanFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 50619dbf8db77e98d821d615af4f634d08e22698 ]
The first chunk in a packet is ensured to be present at the beginning of sctp_rcv(), as a packet needs to have at least 1 chunk. But the second one, may not be completely available and ch->length can be over uninitialized memory.
Fix here is by only trying to walk on the next chunk if there is enough to hold at least the header, and then proceed with the ch->length validation that is already there.
--- net/sctp/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/input.c +1 -1
@@ -1197,7 +1197,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ch = (struct sctp_chunkhdr *)ch_end; chunk_num++; - }while (ch_end <skb_tail_pointer (skb)); + }while (ch_end +sizeof (*ch) <skb_tail_pointer (skb));return asoc; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 202/315 fscrypt: dont ignore minor_hash when hash is 0
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 77f30bfcfcf484da7208affd6a9e63406420bf91 upstream.
When initializing a no-key name, fscrypt_fname_disk_to_usr() sets the minor_hash to 0 if the (major) hash is 0.
This doesn't make sense because 0 is a valid hash code, so we shouldn't ignore the filesystem-provided minor_hash in that case. Fix this by removing the special case for 'hash == 0'.
This is an old bug that appears to have originated when the encryption code in ext4 and f2fs was moved into fs/crypto/. The original ext4 and f2fs code passed the hash by pointer instead of by value. So 'if (hash)' actually made sense then, as it was checking whether a pointer was NULL. But now the hashes are passed by value, and filesystems just pass 0 for any hashes they don't have. There is no need to handle this any differently from the hashes actually being 0.
It is difficult to reproduce this bug, as it only made a difference in the case where a filename's 32-bit major hash happened to be 0. However, it probably had the largest chance of causing problems on ubifs, since ubifs uses minor_hash to do lookups of no-key names, in addition to using it as a readdir cookie. ext4 only uses minor_hash as a readdir cookie, and f2fs doesn't use minor_hash at all.
--- fs/crypto/fname.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
fs/crypto/fname.c +2 -7
@@ -304,13 +304,8 @@ int fscrypt_fname_disk_to_usr(struct ino oname->name);return 0 ; } -if (hash) { - digested_name.hash = hash; - digested_name.minor_hash = minor_hash; - }else { - digested_name.hash =0 ; - digested_name.minor_hash =0 ; - } + digested_name.hash = hash; + digested_name.minor_hash = minor_hash;memcpy (digested_name.digest,FSCRYPT_FNAME_DIGEST (iname->name, iname->len),FSCRYPT_FNAME_DIGEST_SIZE );
Greg Kroah-Hartman
maintainerPATCH 203/315 bdi: Do not use freezable workqueue
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
commit a2b90f11217790ec0964ba9c93a4abb369758c26 upstream.
A removable block device, such as NVMe or SSD connected over Thunderbolt can be hot-removed any time including when the system is suspended. When device is hot-removed during suspend and the system gets resumed, kernel first resumes devices and then thaws the userspace including freezable workqueues. What happens in that case is that the NVMe driver notices that the device is unplugged and removes it from the system. This ends up calling bdi_unregister() for the gendisk which then schedules wb_workfn() to be run one more time.
However, since the bdi_wq is still frozen flush_delayed_work() call in wb_shutdown() blocks forever halting system resume process. User sees this as hang as nothing is happening anymore.
Triggering sysrq-w reveals this:
Workqueue: nvme-wq nvme_remove_dead_ctrl_work [nvme] Call Trace: ? __schedule+0x2c5/0x630 ? wait_for_completion+0xa4/0x120 schedule+0x3e/0xc0 schedule_timeout+0x1c9/0x320 ? resched_curr+0x1f/0xd0 ? wait_for_completion+0xa4/0x120 wait_for_completion+0xc3/0x120 ? wake_up_q+0x60/0x60 __flush_work+0x131/0x1e0 ? flush_workqueue_prep_pwqs+0x130/0x130 bdi_unregister+0xb9/0x130 del_gendisk+0x2d2/0x2e0 nvme_ns_remove+0xed/0x110 [nvme_core] nvme_remove_namespaces+0x96/0xd0 [nvme_core] nvme_remove+0x5b/0x160 [nvme] pci_device_remove+0x36/0x90 device_release_driver_internal+0xdf/0x1c0 nvme_remove_dead_ctrl_work+0x14/0x30 [nvme] process_one_work+0x1c2/0x3f0 worker_thread+0x48/0x3e0 kthread+0x100/0x140 ? current_work+0x30/0x30 ? kthread_park+0x80/0x80 ret_from_fork+0x35/0x40
This is not limited to NVMes so exactly same issue can be reproduced by hot-removing SSD (over Thunderbolt) while the system is suspended.
Prevent this from happening by removing WQ_FREEZABLE from bdi_wq.
--- mm/backing-dev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/backing-dev.c +2 -2
@@ -247,8 +247,8 @@ static int __init default_bdi_init(void) {int err; - bdi_wq =alloc_workqueue ("writeback" ,WQ_MEM_RECLAIM |WQ_FREEZABLE | -WQ_UNBOUND |WQ_SYSFS ,0 ); + bdi_wq =alloc_workqueue ("writeback" ,WQ_MEM_RECLAIM |WQ_UNBOUND | +WQ_SYSFS ,0 );if (!bdi_wq)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 204/315 fuse: reject internal errno
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 49221cf86d18bb66fe95d3338cb33bd4b9880ca5 upstream.
Don't allow userspace to report errors that could be kernel-internal.
--- fs/fuse/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/dev.c +1 -1
@@ -1889,7 +1889,7 @@ static ssize_t fuse_dev_do_write(struct } err = -EINVAL ; -if (oh.error <=-1000 || oh.error >0 ) +if (oh.error <=-512 || oh.error >0 ) goto err_finish;spin_lock (&fpq->lock);
Greg Kroah-Hartman
maintainerPATCH 205/315 mac80211: fix memory corruption in EAPOL handling
In reply to Greg Kroah-HartmanFrom: Davis Mosenkovs <[email protected]>
Commit e3d4030498c3 ("mac80211: do not accept/forward invalid EAPOL frames") uses skb_mac_header() before eth_type_trans() is called leading to incorrect pointer, the pointer gets written to. This issue has appeared during backporting to 4.4, 4.9 and 4.14.
--- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rx.c +1 -1
@@ -2404,7 +2404,7 @@ ieee80211_deliver_skb(struct ieee80211_r#endif if (skb) { -struct ethhdr *ehdr = (void *)skb_mac_header (skb); +struct ethhdr *ehdr = (struct ethhdr *)skb->data;/* deliver to local stack */ skb->protocol =eth_type_trans (skb, dev);
Greg Kroah-Hartman
maintainerPATCH 206/315 powerpc/barrier: Avoid collision with clangs __lwsync macro
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 015d98149b326e0f1f02e44413112ca8b4330543 upstream.
A change in clang 13 results in the __lwsync macro being defined as __builtin_ppc_lwsync, which emits 'lwsync' or 'msync' depending on what the target supports. This breaks the build because of -Werror in arch/powerpc, along with thousands of warnings:
In file included from arch/powerpc/kernel/pmc.c:12:
In file included from include/linux/bug.h:5:
In file included from arch/powerpc/include/asm/bug.h:109:
In file included from include/asm-generic/bug.h:20:
In file included from include/linux/kernel.h:12:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: error: '__lwsync' macro redefined [-Werror,-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
^
<built-in>:308:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^1 error generated.
Undefine this macro so that the runtime patching introduced by commit 2d1b2027626d ("powerpc: Fixup lwsync at runtime") continues to work properly with clang and the build no longer breaks.
--- arch/powerpc/include/asm/barrier.h | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/include/asm/barrier.h +2 -0
@@ -42,6 +42,8 @@# define SMPWMB eieio#endif +/* clang defines this macro for a builtin, which will not work with runtime patching */ +#undef __lwsync#define __lwsync () __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")#define dma_rmb () __lwsync()#define dma_wmb () __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
Greg Kroah-Hartman
maintainerPATCH 207/315 usb: gadget: f_fs: Fix setting of device and driver data cross-references
In reply to Greg Kroah-HartmanFrom: Andrew Gabbasov <[email protected]>
commit ecfbd7b9054bddb12cea07fda41bb3a79a7b0149 upstream.
FunctionFS device structure 'struct ffs_dev' and driver data structure 'struct ffs_data' are bound to each other with cross-reference pointers 'ffs_data->private_data' and 'ffs_dev->ffs_data'. While the first one is supposed to be valid through the whole life of 'struct ffs_data' (and while 'struct ffs_dev' exists non-freed), the second one is cleared in 'ffs_closed()' (called from 'ffs_data_reset()' or the last 'ffs_data_put()'). This can be called several times, alternating in different order with 'ffs_free_inst()', that, if possible, clears the other cross-reference.
As a result, different cases of these calls order may leave stale cross-reference pointers, used when the pointed structure is already freed. Even if it occasionally doesn't cause kernel crash, this error is reported by KASAN-enabled kernel configuration.
For example, the case [last 'ffs_data_put()' - 'ffs_free_inst()'] was fixed by commit cdafb6d8b8da ("usb: gadget: f_fs: Fix use-after-free in ffs_free_inst").
The other case ['ffs_data_reset()' - 'ffs_free_inst()' - 'ffs_data_put()'] now causes KASAN reported error [1], when 'ffs_data_reset()' clears 'ffs_dev->ffs_data', then 'ffs_free_inst()' frees the 'struct ffs_dev', but can't clear 'ffs_data->private_data', which is then accessed in 'ffs_closed()' called from 'ffs_data_put()'. This happens since 'ffs_dev->ffs_data' reference is cleared too early.
Moreover, one more use case, when 'ffs_free_inst()' is called immediately after mounting FunctionFS device (that is before the descriptors are written and 'ffs_ready()' is called), and then 'ffs_data_reset()' or 'ffs_data_put()' is called from accessing "ep0" file or unmounting the device. This causes KASAN error report like [2], since 'ffs_dev->ffs_data' is not yet set when 'ffs_free_inst()' can't properly clear 'ffs_data->private_data', that is later accessed to freed structure.
Fix these (and may be other) cases of stale pointers access by moving setting and clearing of the mentioned cross-references to the single places, setting both of them when 'struct ffs_data' is created and bound to 'struct ffs_dev', and clearing both of them when one of the structures is destroyed. It seems convenient to make this pointer initialization and structures binding in 'ffs_acquire_dev()' and make pointers clearing in 'ffs_release_dev()'. This required some changes in these functions parameters and return types.
Also, 'ffs_release_dev()' calling requires some cleanup, fixing minor issues, like (1) 'ffs_release_dev()' is not called if 'ffs_free_inst()' is called without unmounting the device, and "release_dev" callback is not called at all, or (2) "release_dev" callback is called before "ffs_closed" callback on unmounting, which seems to be not correctly nested with "acquire_dev" and "ffs_ready" callbacks.
Make this cleanup togther with other mentioned 'ffs_release_dev()' changes.
[1]
==================================================================
root@rcar-gen3:~# mkdir /dev/cfs root@rcar-gen3:~# mkdir /dev/ffs root@rcar-gen3:~# modprobe libcomposite root@rcar-gen3:~# mount -t configfs none /dev/cfs root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1 root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 64.340664] file system registered root@rcar-gen3:~# mount -t functionfs ffs /dev/ffs root@rcar-gen3:~# cd /dev/ffs root@rcar-gen3:/dev/ffs# /home/root/ffs-test ffs-test: info: ep0: writing descriptors (in v2 format) [ 83.181442] read descriptors [ 83.186085] read strings ffs-test: info: ep0: writing strings ffs-test: dbg: ep1: starting ffs-test: dbg: ep2: starting ffs-test: info: ep1: starts ffs-test: info: ep2: starts ffs-test: info: ep0: starts
^C
root@rcar-gen3:/dev/ffs# cd /home/root/ root@rcar-gen3:~# rmdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 98.935061] unloading root@rcar-gen3:~# umount /dev/ffs [ 102.734301] ================================================================== [ 102.742059] BUG: KASAN: use-after-free in ffs_release_dev+0x64/0xa8 [usb_f_fs] [ 102.749683] Write of size 1 at addr ffff0004d46ff549 by task umount/2997 [ 102.756709] [ 102.758311] CPU: 0 PID: 2997 Comm: umount Not tainted 5.13.0-rc4+ #8 [ 102.764971] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 102.772179] Call trace: [ 102.774779] dump_backtrace+0x0/0x330 [ 102.778653] show_stack+0x20/0x2c [ 102.782152] dump_stack+0x11c/0x1ac [ 102.785833] print_address_description.constprop.0+0x30/0x274 [ 102.791862] kasan_report+0x14c/0x1c8 [ 102.795719] __asan_report_store1_noabort+0x34/0x58 [ 102.800840] ffs_release_dev+0x64/0xa8 [usb_f_fs] [ 102.805801] ffs_fs_kill_sb+0x50/0x84 [usb_f_fs] [ 102.810663] deactivate_locked_super+0xa0/0xf0 [ 102.815339] deactivate_super+0x98/0xac [ 102.819378] cleanup_mnt+0xd0/0x1b0 [ 102.823057] __cleanup_mnt+0x1c/0x28 [ 102.826823] task_work_run+0x104/0x180 [ 102.830774] do_notify_resume+0x458/0x14e0 [ 102.835083] work_pending+0xc/0x5f8 [ 102.838762] [ 102.840357] Allocated by task 2988: [ 102.844032] kasan_save_stack+0x28/0x58 [ 102.848071] kasan_set_track+0x28/0x3c [ 102.852016] ____kasan_kmalloc+0x84/0x9c [ 102.856142] __kasan_kmalloc+0x10/0x1c [ 102.860088] __kmalloc+0x214/0x2f8 [ 102.863678] kzalloc.constprop.0+0x14/0x20 [usb_f_fs] [ 102.868990] ffs_alloc_inst+0x8c/0x208 [usb_f_fs] [ 102.873942] try_get_usb_function_instance+0xf0/0x164 [libcomposite] [ 102.880629] usb_get_function_instance+0x64/0x68 [libcomposite] [ 102.886858] function_make+0x128/0x1ec [libcomposite] [ 102.892185] configfs_mkdir+0x330/0x590 [configfs] [ 102.897245] vfs_mkdir+0x12c/0x1bc [ 102.900835] do_mkdirat+0x180/0x1d0 [ 102.904513] __arm64_sys_mkdirat+0x80/0x94 [ 102.908822] invoke_syscall+0xf8/0x25c [ 102.912772] el0_svc_common.constprop.0+0x150/0x1a0 [ 102.917891] do_el0_svc+0xa0/0xd4 [ 102.921386] el0_svc+0x24/0x34 [ 102.924613] el0_sync_handler+0xcc/0x154 [ 102.928743] el0_sync+0x198/0x1c0 [ 102.932238] [ 102.933832] Freed by task 2996: [ 102.937144] kasan_save_stack+0x28/0x58 [ 102.941181] kasan_set_track+0x28/0x3c [ 102.945128] kasan_set_free_info+0x28/0x4c [ 102.949435] ____kasan_slab_free+0x104/0x118 [ 102.953921] __kasan_slab_free+0x18/0x24 [ 102.958047] slab_free_freelist_hook+0x148/0x1f0 [ 102.962897] kfree+0x318/0x440 [ 102.966123] ffs_free_inst+0x164/0x2d8 [usb_f_fs] [ 102.971075] usb_put_function_instance+0x84/0xa4 [libcomposite] [ 102.977302] ffs_attr_release+0x18/0x24 [usb_f_fs] [ 102.982344] config_item_put+0x140/0x1a4 [configfs] [ 102.987486] configfs_rmdir+0x3fc/0x518 [configfs] [ 102.992535] vfs_rmdir+0x114/0x234 [ 102.996122] do_rmdir+0x274/0x2b0 [ 102.999617] __arm64_sys_unlinkat+0x94/0xc8 [ 103.004015] invoke_syscall+0xf8/0x25c [ 103.007961] el0_svc_common.constprop.0+0x150/0x1a0 [ 103.013080] do_el0_svc+0xa0/0xd4 [ 103.016575] el0_svc+0x24/0x34 [ 103.019801] el0_sync_handler+0xcc/0x154 [ 103.023930] el0_sync+0x198/0x1c0 [ 103.027426] [ 103.029020] The buggy address belongs to the object at ffff0004d46ff500 [ 103.029020] which belongs to the cache kmalloc-128 of size 128 [ 103.042079] The buggy address is located 73 bytes inside of [ 103.042079] 128-byte region [ffff0004d46ff500, ffff0004d46ff580) [ 103.054236] The buggy address belongs to the page: [ 103.059262] page:0000000021aa849b refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0004d46fee00 pfn:0x5146fe [ 103.070437] head:0000000021aa849b order:1 compound_mapcount:0 [ 103.076456] flags: 0x8000000000010200(slab|head|zone=2) [ 103.081948] raw: 8000000000010200 fffffc0013521a80 0000000d0000000d ffff0004c0002300 [ 103.090052] raw: ffff0004d46fee00 000000008020001e 00000001ffffffff 0000000000000000 [ 103.098150] page dumped because: kasan: bad access detected [ 103.103985] [ 103.105578] Memory state around the buggy address: [ 103.110602] ffff0004d46ff400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 103.118161] ffff0004d46ff480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 103.125726] >ffff0004d46ff500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 103.133284] ^ [ 103.139120] ffff0004d46ff580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 103.146679] ffff0004d46ff600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 103.154238] ================================================================== [ 103.161792] Disabling lock debugging due to kernel taint [ 103.167319] Unable to handle kernel paging request at virtual address 0037801d6000018e [ 103.175406] Mem abort info: [ 103.178457] ESR = 0x96000004 [ 103.181609] EC = 0x25: DABT (current EL), IL = 32 bits [ 103.187020] SET = 0, FnV = 0 [ 103.190185] EA = 0, S1PTW = 0 [ 103.193417] Data abort info: [ 103.196385] ISV = 0, ISS = 0x00000004 [ 103.200315] CM = 0, WnR = 0 [ 103.203366] [0037801d6000018e] address between user and kernel address ranges [ 103.210611] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 103.216231] Modules linked in: usb_f_fs libcomposite configfs ath9k_htc led_class mac80211 libarc4 ath9k_common ath9k_hw ath cfg80211 aes_ce_blk sata_rc4 [ 103.259233] CPU: 0 PID: 2997 Comm: umount Tainted: G B 5.13.0-rc4+ #8 [ 103.267031] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 103.273951] pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--) [ 103.280001] pc : ffs_data_clear+0x138/0x370 [usb_f_fs] [ 103.285197] lr : ffs_data_clear+0x124/0x370 [usb_f_fs] [ 103.290385] sp : ffff800014777a80 [ 103.293725] x29: ffff800014777a80 x28: ffff0004d7649c80 x27: 0000000000000000 [ 103.300931] x26: ffff800014777fb0 x25: ffff60009aec9394 x24: ffff0004d7649ca4 [ 103.308136] x23: 1fffe0009a3d063a x22: dfff800000000000 x21: ffff0004d1e831d0 [ 103.315340] x20: e1c000eb00000bb4 x19: ffff0004d1e83000 x18: 0000000000000000 [ 103.322545] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 103.329748] x14: 0720072007200720 x13: 0720072007200720 x12: 1ffff000012ef658 [ 103.336952] x11: ffff7000012ef658 x10: 0720072007200720 x9 : ffff800011322648 [ 103.344157] x8 : ffff800014777818 x7 : ffff80000977b2c7 x6 : 0000000000000000 [ 103.351359] x5 : 0000000000000001 x4 : ffff7000012ef659 x3 : 0000000000000001 [ 103.358562] x2 : 0000000000000000 x1 : 1c38001d6000018e x0 : e1c000eb00000c70 [ 103.365766] Call trace: [ 103.368235] ffs_data_clear+0x138/0x370 [usb_f_fs] [ 103.373076] ffs_data_reset+0x20/0x304 [usb_f_fs] [ 103.377829] ffs_data_closed+0x1ec/0x244 [usb_f_fs] [ 103.382755] ffs_fs_kill_sb+0x70/0x84 [usb_f_fs] [ 103.387420] deactivate_locked_super+0xa0/0xf0 [ 103.391905] deactivate_super+0x98/0xac [ 103.395776] cleanup_mnt+0xd0/0x1b0 [ 103.399299] __cleanup_mnt+0x1c/0x28 [ 103.402906] task_work_run+0x104/0x180 [ 103.406691] do_notify_resume+0x458/0x14e0 [ 103.410823] work_pending+0xc/0x5f8 [ 103.414351] Code: b4000a54 9102f280 12000802 d343fc01 (38f66821) [ 103.420490] ---[ end trace 57b43a50e8244f57 ]--- Segmentation fault root@rcar-gen3:~# ==================================================================
[2]
==================================================================
root@rcar-gen3:~# mkdir /dev/ffs root@rcar-gen3:~# modprobe libcomposite root@rcar-gen3:~# root@rcar-gen3:~# mount -t configfs none /dev/cfs root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1 root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 54.766480] file system registered root@rcar-gen3:~# mount -t functionfs ffs /dev/ffs root@rcar-gen3:~# rmdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs [ 63.197597] unloading root@rcar-gen3:~# cat /dev/ffs/ep0 cat: read error:[ 67.213506] ================================================================== [ 67.222095] BUG: KASAN: use-after-free in ffs_data_clear+0x70/0x370 [usb_f_fs] [ 67.229699] Write of size 1 at addr ffff0004c26e974a by task cat/2994 [ 67.236446] [ 67.238045] CPU: 0 PID: 2994 Comm: cat Not tainted 5.13.0-rc4+ #8 [ 67.244431] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 67.251624] Call trace: [ 67.254212] dump_backtrace+0x0/0x330 [ 67.258081] show_stack+0x20/0x2c [ 67.261579] dump_stack+0x11c/0x1ac [ 67.265260] print_address_description.constprop.0+0x30/0x274 [ 67.271286] kasan_report+0x14c/0x1c8 [ 67.275143] __asan_report_store1_noabort+0x34/0x58 [ 67.280265] ffs_data_clear+0x70/0x370 [usb_f_fs] [ 67.285220] ffs_data_reset+0x20/0x304 [usb_f_fs] [ 67.290172] ffs_data_closed+0x240/0x244 [usb_f_fs] [ 67.295305] ffs_ep0_release+0x40/0x54 [usb_f_fs] [ 67.300256] __fput+0x304/0x580 [ 67.303576] ____fput+0x18/0x24 [ 67.306893] task_work_run+0x104/0x180 [ 67.310846] do_notify_resume+0x458/0x14e0 [ 67.315154] work_pending+0xc/0x5f8 [ 67.318834] [ 67.320429] Allocated by task 2988: [ 67.324105] kasan_save_stack+0x28/0x58 [ 67.328144] kasan_set_track+0x28/0x3c [ 67.332090] ____kasan_kmalloc+0x84/0x9c [ 67.336217] __kasan_kmalloc+0x10/0x1c [ 67.340163] __kmalloc+0x214/0x2f8 [ 67.343754] kzalloc.constprop.0+0x14/0x20 [usb_f_fs] [ 67.349066] ffs_alloc_inst+0x8c/0x208 [usb_f_fs] [ 67.354017] try_get_usb_function_instance+0xf0/0x164 [libcomposite] [ 67.360705] usb_get_function_instance+0x64/0x68 [libcomposite] [ 67.366934] function_make+0x128/0x1ec [libcomposite] [ 67.372260] configfs_mkdir+0x330/0x590 [configfs] [ 67.377320] vfs_mkdir+0x12c/0x1bc [ 67.380911] do_mkdirat+0x180/0x1d0 [ 67.384589] __arm64_sys_mkdirat+0x80/0x94 [ 67.388899] invoke_syscall+0xf8/0x25c [ 67.392850] el0_svc_common.constprop.0+0x150/0x1a0 [ 67.397969] do_el0_svc+0xa0/0xd4 [ 67.401464] el0_svc+0x24/0x34 [ 67.404691] el0_sync_handler+0xcc/0x154 [ 67.408819] el0_sync+0x198/0x1c0 [ 67.412315] [ 67.413909] Freed by task 2993: [ 67.417220] kasan_save_stack+0x28/0x58 [ 67.421257] kasan_set_track+0x28/0x3c [ 67.425204] kasan_set_free_info+0x28/0x4c [ 67.429513] ____kasan_slab_free+0x104/0x118 [ 67.434001] __kasan_slab_free+0x18/0x24 [ 67.438128] slab_free_freelist_hook+0x148/0x1f0 [ 67.442978] kfree+0x318/0x440 [ 67.446205] ffs_free_inst+0x164/0x2d8 [usb_f_fs] [ 67.451156] usb_put_function_instance+0x84/0xa4 [libcomposite] [ 67.457385] ffs_attr_release+0x18/0x24 [usb_f_fs] [ 67.462428] config_item_put+0x140/0x1a4 [configfs] [ 67.467570] configfs_rmdir+0x3fc/0x518 [configfs] [ 67.472626] vfs_rmdir+0x114/0x234 [ 67.476215] do_rmdir+0x274/0x2b0 [ 67.479710] __arm64_sys_unlinkat+0x94/0xc8 [ 67.484108] invoke_syscall+0xf8/0x25c [ 67.488055] el0_svc_common.constprop.0+0x150/0x1a0 [ 67.493175] do_el0_svc+0xa0/0xd4 [ 67.496671] el0_svc+0x24/0x34 [ 67.499896] el0_sync_handler+0xcc/0x154 [ 67.504024] el0_sync+0x198/0x1c0 [ 67.507520] [ 67.509114] The buggy address belongs to the object at ffff0004c26e9700 [ 67.509114] which belongs to the cache kmalloc-128 of size 128 [ 67.522171] The buggy address is located 74 bytes inside of [ 67.522171] 128-byte region [ffff0004c26e9700, ffff0004c26e9780) [ 67.534328] The buggy address belongs to the page: [ 67.539355] page:000000003177a217 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5026e8 [ 67.549175] head:000000003177a217 order:1 compound_mapcount:0 [ 67.555195] flags: 0x8000000000010200(slab|head|zone=2) [ 67.560687] raw: 8000000000010200 fffffc0013037100 0000000c00000002 ffff0004c0002300 [ 67.568791] raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 [ 67.576890] page dumped because: kasan: bad access detected [ 67.582725] [ 67.584318] Memory state around the buggy address: [ 67.589343] ffff0004c26e9600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 67.596903] ffff0004c26e9680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 67.604463] >ffff0004c26e9700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 67.612022] ^ [ 67.617860] ffff0004c26e9780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 67.625421] ffff0004c26e9800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 67.632981] ================================================================== [ 67.640535] Disabling lock debugging due to kernel taint File descriptor[ 67.646100] Unable to handle kernel paging request at virtual address fabb801d4000018d in bad state [ 67.655456] Mem abort info: [ 67.659619] ESR = 0x96000004 [ 67.662801] EC = 0x25: DABT (current EL), IL = 32 bits [ 67.668225] SET = 0, FnV = 0 [ 67.671375] EA = 0, S1PTW = 0 [ 67.674613] Data abort info: [ 67.677587] ISV = 0, ISS = 0x00000004 [ 67.681522] CM = 0, WnR = 0 [ 67.684588] [fabb801d4000018d] address between user and kernel address ranges [ 67.691849] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 67.697470] Modules linked in: usb_f_fs libcomposite configfs ath9k_htc led_class mac80211 libarc4 ath9k_common ath9k_hw ath cfg80211 aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce gf128mul sha2_ce sha1_ce evdev sata_rcar libata xhci_plat_hcd scsi_mod xhci_hcd rene4 [ 67.740467] CPU: 0 PID: 2994 Comm: cat Tainted: G B 5.13.0-rc4+ #8 [ 67.748005] Hardware name: Renesas Salvator-X board based on r8a77951 (DT) [ 67.754924] pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--) [ 67.760974] pc : ffs_data_clear+0x138/0x370 [usb_f_fs] [ 67.766178] lr : ffs_data_clear+0x124/0x370 [usb_f_fs] [ 67.771365] sp : ffff800014767ad0 [ 67.774706] x29: ffff800014767ad0 x28: ffff800009cf91c0 x27: ffff0004c54861a0 [ 67.781913] x26: ffff0004dc90b288 x25: 1fffe00099ec10f5 x24: 00000000000a801d [ 67.789118] x23: 1fffe00099f6953a x22: dfff800000000000 x21: ffff0004cfb4a9d0 [ 67.796322] x20: d5e000ea00000bb1 x19: ffff0004cfb4a800 x18: 0000000000000000 [ 67.803526] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000 [ 67.810730] x14: 0720072007200720 x13: 0720072007200720 x12: 1ffff000028ecefa [ 67.817934] x11: ffff7000028ecefa x10: 0720072007200720 x9 : ffff80001132c014 [ 67.825137] x8 : ffff8000147677d8 x7 : ffff8000147677d7 x6 : 0000000000000000 [ 67.832341] x5 : 0000000000000001 x4 : ffff7000028ecefb x3 : 0000000000000001 [ 67.839544] x2 : 0000000000000005 x1 : 1abc001d4000018d x0 : d5e000ea00000c6d [ 67.846748] Call trace: [ 67.849218] ffs_data_clear+0x138/0x370 [usb_f_fs] [ 67.854058] ffs_data_reset+0x20/0x304 [usb_f_fs] [ 67.858810] ffs_data_closed+0x240/0x244 [usb_f_fs] [ 67.863736] ffs_ep0_release+0x40/0x54 [usb_f_fs] [ 67.868488] __fput+0x304/0x580 [ 67.871665] ____fput+0x18/0x24 [ 67.874837] task_work_run+0x104/0x180 [ 67.878622] do_notify_resume+0x458/0x14e0 [ 67.882754] work_pending+0xc/0x5f8 [ 67.886282] Code: b4000a54 9102f280 12000802 d343fc01 (38f66821) [ 67.892422] ---[ end trace 6d7cedf53d7abbea ]--- Segmentation fault root@rcar-gen3:~# ==================================================================
--- drivers/usb/gadget/function/f_fs.c | 67 +++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 35 deletions(-)
drivers/usb/gadget/function/f_fs.c +32 -35
@@ -247,8 +247,8 @@ EXPORT_SYMBOL_GPL(ffs_lock);static struct ffs_dev *_ffs_find_dev (const char *name);static struct ffs_dev *_ffs_alloc_dev (void );static void _ffs_free_dev (struct ffs_dev *dev); -static void *ffs_acquire_dev (const char *dev_name); -static void ffs_release_dev (struct ffs_data *ffs_data); +static int ffs_acquire_dev (const char *dev_name,struct ffs_data *ffs_data); +static void ffs_release_dev (struct ffs_dev *ffs_dev);static int ffs_ready (struct ffs_data *ffs);static void ffs_closed (struct ffs_data *ffs);
@@ -1505,7 +1505,6 @@ ffs_fs_mount(struct file_system_type *t, };struct dentry *rv;int ret; -void *ffs_dev;struct ffs_data *ffs;ENTER ();
@@ -1526,19 +1525,16 @@ ffs_fs_mount(struct file_system_type *t,return ERR_PTR (-ENOMEM ); } - ffs_dev =ffs_acquire_dev (dev_name); -if (IS_ERR (ffs_dev)) { + ret =ffs_acquire_dev (dev_name, ffs); +if (ret) {ffs_data_put (ffs); -return ERR_CAST (ffs_dev); +return ERR_PTR (ret); } - ffs->private_data = ffs_dev; data.ffs_data = ffs; rv =mount_nodev (t, flags, &data, ffs_sb_fill); -if (IS_ERR (rv) && data.ffs_data) { -ffs_release_dev (data.ffs_data); +if (IS_ERR (rv) && data.ffs_data)ffs_data_put (data.ffs_data); - }return rv; }
@@ -1548,10 +1544,8 @@ ffs_fs_kill_sb(struct super_block *sb)ENTER ();kill_litter_super (sb); -if (sb->s_fs_info) { -ffs_release_dev (sb->s_fs_info); +if (sb->s_fs_info)ffs_data_closed (sb->s_fs_info); - } }static struct file_system_type ffs_fs_type = {
@@ -1620,6 +1614,7 @@ static void ffs_data_put(struct ffs_dataif (unlikely (refcount_dec_and_test (&ffs->ref))) {pr_info ("%s(): freeing\n" , __func__);ffs_data_clear (ffs); +ffs_release_dev (ffs->private_data);BUG_ON (waitqueue_active (&ffs->ev.waitq) ||waitqueue_active (&ffs->ep0req_completion.wait) ||waitqueue_active (&ffs->wait));
@@ -2924,6 +2919,7 @@ static inline struct f_fs_opts *ffs_do_fstruct ffs_function *func =ffs_func_from_usb (f);struct f_fs_opts *ffs_opts = container_of(f->fi, struct f_fs_opts, func_inst); +struct ffs_data *ffs_data;int ret;ENTER ();
@@ -2938,12 +2934,13 @@ static inline struct f_fs_opts *ffs_do_fif (!ffs_opts->no_configfs)ffs_dev_lock (); ret = ffs_opts->dev->desc_ready ?0 : -ENODEV ; - func->ffs = ffs_opts->dev->ffs_data; + ffs_data = ffs_opts->dev->ffs_data;if (!ffs_opts->no_configfs)ffs_dev_unlock ();if (ret)return ERR_PTR (ret); + func->ffs = ffs_data; func->conf = c; func->gadget = c->cdev->gadget;
@@ -3398,6 +3395,7 @@ static void ffs_free_inst(struct usb_funstruct f_fs_opts *opts; opts =to_f_fs_opts (f); +ffs_release_dev (opts->dev);ffs_dev_lock ();_ffs_free_dev (opts->dev);ffs_dev_unlock ();
@@ -3585,47 +3583,48 @@ static void _ffs_free_dev(struct ffs_dev {list_del (&dev->entry); -/* Clear the private_data pointer to stop incorrect dev access */ -if (dev->ffs_data) - dev->ffs_data->private_data =NULL ; -kfree (dev);if (list_empty (&ffs_devices))functionfs_cleanup (); } -static void *ffs_acquire_dev (const char *dev_name) +static int ffs_acquire_dev (const char *dev_name,struct ffs_data *ffs_data) { +int ret =0 ;struct ffs_dev *ffs_dev;ENTER ();ffs_dev_lock (); ffs_dev =_ffs_find_dev (dev_name); -if (!ffs_dev) - ffs_dev =ERR_PTR (-ENOENT ); -else if (ffs_dev->mounted) - ffs_dev =ERR_PTR (-EBUSY ); -else if (ffs_dev->ffs_acquire_dev_callback && - ffs_dev->ffs_acquire_dev_callback (ffs_dev)) - ffs_dev =ERR_PTR (-ENOENT ); -else +if (!ffs_dev) { + ret = -ENOENT ; + }else if (ffs_dev->mounted) { + ret = -EBUSY ; + }else if (ffs_dev->ffs_acquire_dev_callback && + ffs_dev->ffs_acquire_dev_callback (ffs_dev)) { + ret = -ENOENT ; + }else { ffs_dev->mounted = true; + ffs_dev->ffs_data = ffs_data; + ffs_data->private_data = ffs_dev; + }ffs_dev_unlock (); -return ffs_dev; +return ret; } -static void ffs_release_dev (struct ffs_data *ffs_data) +static void ffs_release_dev (struct ffs_dev *ffs_dev) { -struct ffs_dev *ffs_dev; -ENTER ();ffs_dev_lock (); - ffs_dev = ffs_data->private_data; -if (ffs_dev) { +if (ffs_dev && ffs_dev->mounted) { ffs_dev->mounted = false; +if (ffs_dev->ffs_data) { + ffs_dev->ffs_data->private_data =NULL ; + ffs_dev->ffs_data =NULL ; + }if (ffs_dev->ffs_release_dev_callback) ffs_dev->ffs_release_dev_callback (ffs_dev);
@@ -3653,7 +3652,6 @@ static int ffs_ready(struct ffs_data *ff } ffs_obj->desc_ready = true; - ffs_obj->ffs_data = ffs;if (ffs_obj->ffs_ready_callback) { ret = ffs_obj->ffs_ready_callback (ffs);
@@ -3681,7 +3679,6 @@ static void ffs_closed(struct ffs_data * goto done; ffs_obj->desc_ready = false; - ffs_obj->ffs_data =NULL ;if (test_and_clear_bit (FFS_FL_CALL_CLOSED_CALLBACK , &ffs->flags) && ffs_obj->ffs_closed_callback)
Greg Kroah-Hartman
maintainerPATCH 208/315 drm/radeon: Add the missed drm_gem_object_put() in radeon_user_framebuffer_create()
In reply to Greg Kroah-HartmanFrom: Jing Xiangfeng <[email protected]>
commit 9ba85914c36c8fed9bf3e8b69c0782908c1247b7 upstream.
radeon_user_framebuffer_create() misses to call drm_gem_object_put() in an error path. Add the missed function call to fix it.
--- drivers/gpu/drm/radeon/radeon_display.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_display.c +1 -0
@@ -1347,6 +1347,7 @@ radeon_user_framebuffer_create(struct dr/* Handle is imported dma-buf, so cannot be migrated to VRAM for scanout */ if (obj->import_attach) {DRM_DEBUG_KMS ("Cannot create framebuffer from imported dma_buf\n" ); +drm_gem_object_put (obj);return ERR_PTR (-EINVAL ); }
Greg Kroah-Hartman
maintainerPATCH 209/315 pinctrl/amd: Add device HID for new AMD GPIO controller
In reply to Greg Kroah-HartmanFrom: Maximilian Luz <[email protected]>
commit 1ca46d3e43569186bd1decfb02a6b4c4ddb4304b upstream.
Add device HID AMDI0031 to the AMD GPIO controller driver match table. This controller can be found on Microsoft Surface Laptop 4 devices and seems similar enough that we can just copy the existing AMDI0030 entry.
--- drivers/pinctrl/pinctrl-amd.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-amd.c +1 -0
@@ -920,6 +920,7 @@ static int amd_gpio_remove(struct platfostatic const struct acpi_device_id amd_gpio_acpi_match[] = { {"AMD0030" ,0 }, {"AMDI0030" ,0 }, + {"AMDI0031" ,0 }, { }, };MODULE_DEVICE_TABLE (acpi, amd_gpio_acpi_match);
Greg Kroah-Hartman
maintainerPATCH 210/315 mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
In reply to Greg Kroah-HartmanFrom: Al Cooper <[email protected]>
commit d0244847f9fc5e20df8b7483c8a4717fe0432d38 upstream.
When an eMMC device is being run in HS400 mode, any access to the RPMB device will cause the error message "mmc1: Invalid UHS-I mode selected". This happens as a result of tuning being disabled before RPMB access and then re-enabled after the RPMB access is complete. When tuning is re-enabled, the system has to switch from HS400 to HS200 to do the tuning and then back to HS400. As part of sequence to switch from HS400 to HS200 the system is temporarily put into HS mode. When switching to HS mode, sdhci_get_preset_value() is called and does not have support for HS mode and prints the warning message and returns the preset for SDR12. The fix is to add support for MMC and SD HS modes to sdhci_get_preset_value().
This can be reproduced on any system running eMMC in HS400 mode (not HS400ES) by using the "mmc" utility to run the following
command: "mmc rpmb read-counter /dev/mmcblk0rpmb".
--- drivers/mmc/host/sdhci.c | 4 ++++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 5 insertions(+)
drivers/mmc/host/sdhci.c +4 -0
@@ -1293,6 +1293,10 @@ static u16 sdhci_get_preset_value(structu16 preset =0 ;switch (host->timing) { +case MMC_TIMING_MMC_HS : +case MMC_TIMING_SD_HS : + preset =sdhci_readw (host,SDHCI_PRESET_FOR_HIGH_SPEED ); +break ;case MMC_TIMING_UHS_SDR12 : preset =sdhci_readw (host,SDHCI_PRESET_FOR_SDR12 );break ;
drivers/mmc/host/sdhci.h +1 -0
@@ -252,6 +252,7 @@/* 60-FB reserved */ +#define SDHCI_PRESET_FOR_HIGH_SPEED 0x64#define SDHCI_PRESET_FOR_SDR12 0x66#define SDHCI_PRESET_FOR_SDR25 0x68#define SDHCI_PRESET_FOR_SDR50 0x6A
Greg Kroah-Hartman
maintainerPATCH 211/315 mmc: core: clear flags before allowing to retune
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
commit 77347eda64ed5c9383961d1de9165f9d0b7d8df6 upstream.
It might be that something goes wrong during tuning so the MMC core will immediately trigger a retune. In our case it was:
- we sent a tuning block
- there was an error so we need to send an abort cmd to the eMMC
- the abort cmd had a CRC error
- retune was set by the MMC core
This lead to a vicious circle causing a performance regression of 75%. So, clear retuning flags before we enable retuning to start with a known cleared state.
Reported-by Yoshihiro Shimoda <[email protected]>
--- drivers/mmc/core/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +5 -2
@@ -992,11 +992,14 @@ int mmc_execute_tuning(struct mmc_card * err = host->ops->execute_tuning (host, opcode); -if (err) +if (err) {pr_err ("%s: tuning execution failed: %d\n" ,mmc_hostname (host), err); -else + }else { + host->retune_now =0 ; + host->need_retune =0 ;mmc_retune_enable (host); + }return err; }
Greg Kroah-Hartman
maintainerPATCH 212/315 mmc: core: Allow UHS-I voltage switch for SDSC cards if supported
In reply to Greg Kroah-HartmanFrom: Christian Löhle <[email protected]>
commit 09247e110b2efce3a104e57e887c373e0a57a412 upstream.
While initializing an UHS-I SD card, the mmc core first tries to switch to 1.8V I/O voltage, before it continues to change the settings for the bus speed mode.
However, the current behaviour in the mmc core is inconsistent and doesn't conform to the SD spec. More precisely, an SD card that supports UHS-I must set both the SD_OCR_CCS bit and the SD_OCR_S18R bit in the OCR register response. When switching to 1.8V I/O the mmc core correctly checks both of the bits, but only the SD_OCR_S18R bit when changing the settings for bus speed mode.
Rather than actually fixing the code to confirm to the SD spec, let's deliberately deviate from it by requiring only the SD_OCR_S18R bit for both parts. This enables us to support UHS-I for SDSC cards (outside spec), which is actually being supported by some existing SDSC cards. Moreover, this fixes the inconsistent behaviour.
--- drivers/mmc/core/sd.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/mmc/core/sd.c +6 -4
@@ -787,11 +787,13 @@ try_again:return err;/* -* In case CCS and S18A in the response is set, start Signal Voltage -* Switch procedure. SPI mode doesn't support CMD11. +* In case the S18A bit is set in the response, let's start the signal +* voltage switch procedure. SPI mode doesn't support CMD11. +* Note that, according to the spec, the S18A bit is not valid unless +* the CCS bit is set as well. We deliberately deviate from the spec in +* regards to this, which allows UHS-I to be supported for SDSC cards. */ -if (!mmc_host_is_spi (host) && rocr && - ((*rocr &0x41000000 ) ==0x41000000 )) { +if (!mmc_host_is_spi (host) && rocr && (*rocr &0x01000000 )) { err =mmc_set_uhs_voltage (host, pocr);if (err == -EAGAIN ) { retries--;
Greg Kroah-Hartman
maintainerPATCH 213/315 ata: ahci_sunxi: Disable DIPM
In reply to Greg Kroah-HartmanFrom: Timo Sigurdsson <[email protected]>
commit f6bca4d91b2ea052e917cca3f9d866b5cc1d500a upstream.
DIPM is unsupported or broken on sunxi. Trying to enable the power management policy med_power_with_dipm on an Allwinner A20 SoC based board leads to immediate I/O errors and the attached SATA disk disappears from the /dev filesystem. A reset (power cycle) is required to make the SATA controller or disk work again. The A10 and A20 SoC data sheets and manuals don't mention DIPM at all [1], so it's fair to assume that it's simply not supported. But even if it was, it should be considered broken and best be disabled in the ahci_sunxi driver.
[1] https://github.com/allwinner-zh/documents/tree/master/
--- drivers/ata/ahci_sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci_sunxi.c +1 -1
@@ -165,7 +165,7 @@ static void ahci_sunxi_start_engine(stru }static const struct ata_port_info ahci_sunxi_port_info = { - .flags =AHCI_FLAG_COMMON |ATA_FLAG_NCQ , + .flags =AHCI_FLAG_COMMON |ATA_FLAG_NCQ |ATA_FLAG_NO_DIPM , .pio_mask =ATA_PIO4 , .udma_mask =ATA_UDMA6 , .port_ops = &ahci_platform_ops,
Greg Kroah-Hartman
maintainerPATCH 214/315 cpu/hotplug: Cure the cpusets trainwreck
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
commit b22afcdf04c96ca58327784e280e10288cfd3303 upstream.
Alexey and Joshua tried to solve a cpusets related hotplug problem which is user space visible and results in unexpected behaviour for some time after a CPU has been plugged in and the corresponding uevent was delivered.
cpusets delegate the hotplug work (rebuilding cpumasks etc.) to a workqueue. This is done because the cpusets code has already a lock nesting of cgroups_mutex -> cpu_hotplug_lock. A synchronous callback or waiting for the work to finish with cpu_hotplug_lock held can and will deadlock because that results in the reverse lock order.
As a consequence the uevent can be delivered before cpusets have consistent state which means that a user space invocation of sched_setaffinity() to move a task to the plugged CPU fails up to the point where the scheduled work has been processed.
The same is true for CPU unplug, but that does not create user observable failure (yet).
It's still inconsistent to claim that an operation is finished before it actually is and that's the real issue at hand. uevents just make it reliably observable.
Obviously the problem should be fixed in cpusets/cgroups, but untangling that is pretty much impossible because according to the changelog of the commit which introduced this 8 years ago:
3a5a6d0c2b03("cpuset: don't nest cgroup_mutex inside get_online_cpus()")
the lock order cgroups_mutex -> cpu_hotplug_lock is a design decision and the whole code is built around that.
So bite the bullet and invoke the relevant cpuset function, which waits for the work to finish, in _cpu_up/down() after dropping cpu_hotplug_lock and only when tasks are not frozen by suspend/hibernate because that would obviously wait forever.
Waiting there with cpu_add_remove_lock, which is protecting the present and possible CPU maps, held is not a problem at all because neither work queues nor cpusets/cgroups have any lockchains related to that lock.
Waiting in the hotplug machinery is not problematic either because there are already state callbacks which wait for hardware queues to drain. It makes the operations slightly slower, but hotplug is slow anyway.
This ensures that state is consistent before returning from a hotplug up/down operation. It's still inconsistent during the operation, but that's a different story.
Add a large comment which explains why this is done and why this is not a dump ground for the hack of the day to work around half thought out locking schemes. Document also the implications vs. hotplug operations and serialization or the lack of it.
Thanks to Alexy and Joshua for analyzing why this temporary sched_setaffinity() failure happened.
--- kernel/cpu.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
kernel/cpu.c +49 -0
@@ -30,6 +30,7 @@#include <linux/relay.h> #include <linux/slab.h> #include <linux/percpu-rwsem.h> +#include <linux/cpuset.h> #include <trace/events/power.h> #define CREATE_TRACE_POINTS
@@ -771,6 +772,52 @@ void __init cpuhp_threads_init(void)kthread_unpark (this_cpu_read (cpuhp_state.thread)); } +/* +* +* Serialize hotplug trainwrecks outside of the cpu_hotplug_lock +* protected region. +* +* The operation is still serialized against concurrent CPU hotplug via +* cpu_add_remove_lock, i.e. CPU map protection. But it is _not_ +* serialized against other hotplug related activity like adding or +* removing of state callbacks and state instances, which invoke either the +* startup or the teardown callback of the affected state. +* +* This is required for subsystems which are unfixable vs. CPU hotplug and +* evade lock inversion problems by scheduling work which has to be +* completed _before_ cpu_up()/_cpu_down() returns. +* +* Don't even think about adding anything to this for any new code or even +* drivers. It's only purpose is to keep existing lock order trainwrecks +* working. +* +* For cpu_down() there might be valid reasons to finish cleanups which are +* not required to be done under cpu_hotplug_lock, but that's a different +* story and would be not invoked via this. +*/ +static void cpu_up_down_serialize_trainwrecks (bool tasks_frozen) +{ +/* +* cpusets delegate hotplug operations to a worker to "solve" the +* lock order problems. Wait for the worker, but only if tasks are +* _not_ frozen (suspend, hibernate) as that would wait forever. +* +* The wait is required because otherwise the hotplug operation +* returns with inconsistent state, which could even be observed in +* user space when a new CPU is brought up. The CPU plug uevent +* would be delivered and user space reacting on it would fail to +* move tasks to the newly plugged CPU up to the point where the +* work has finished because up to that point the newly plugged CPU +* is not assignable in cpusets/cgroups. On unplug that's not +* necessarily a visible issue, but it is still inconsistent state, +* which is the real problem which needs to be "fixed". This can't +* prevent the transient state between scheduling the work and +* returning from waiting for it. +*/ +if (!tasks_frozen) +cpuset_wait_for_hotplug (); +} +#ifdef CONFIG_HOTPLUG_CPU #ifndef arch_clear_mm_cpumask_cpu#define arch_clear_mm_cpumask_cpu (cpu, mm) cpumask_clear_cpu(cpu, mm_cpumask(mm))
@@ -1010,6 +1057,7 @@ out:*/ lockup_detector_cleanup ();arch_smt_update (); +cpu_up_down_serialize_trainwrecks (tasks_frozen);return ret; }
@@ -1145,6 +1193,7 @@ static int _cpu_up(unsigned int cpu, int out:cpus_write_unlock ();arch_smt_update (); +cpu_up_down_serialize_trainwrecks (tasks_frozen);return ret; }
Greg Kroah-Hartman
maintainerPATCH 215/315 ASoC: tegra: Set driver_name=tegra for all machine drivers
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit f6eb84fa596abf28959fc7e0b626f925eb1196c7 upstream.
The driver_name="tegra" is now required by the newer ALSA UCMs, otherwise Tegra UCMs don't match by the path/name.
All Tegra machine drivers are specifying the card's name, but it has no effect if model name is specified in the device-tree since it overrides the card's name. We need to set the driver_name to "tegra" in order to get a usable lookup path for the updated ALSA UCMs. The new UCM lookup path has a form of driver_name/card_name.
The old lookup paths that are based on driver module name continue to work as before. Note that UCM matching never worked for Tegra ASoC drivers if they were compiled as built-in, this is fixed by supporting the new naming scheme.
--- sound/soc/tegra/tegra_alc5632.c | 1 + sound/soc/tegra/tegra_max98090.c | 1 + sound/soc/tegra/tegra_rt5640.c | 1 + sound/soc/tegra/tegra_rt5677.c | 1 + sound/soc/tegra/tegra_sgtl5000.c | 1 + sound/soc/tegra/tegra_wm8753.c | 1 + sound/soc/tegra/tegra_wm8903.c | 1 + sound/soc/tegra/tegra_wm9712.c | 1 + sound/soc/tegra/trimslice.c | 1 + 9 files changed, 9 insertions(+)
sound/soc/tegra/tegra_alc5632.c +1 -0
@@ -137,6 +137,7 @@ static struct snd_soc_dai_link tegra_alcstatic struct snd_soc_card snd_soc_tegra_alc5632 = { .name ="tegra-alc5632" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_alc5632_dai, .num_links =1 ,
sound/soc/tegra/tegra_max98090.c +1 -0
@@ -188,6 +188,7 @@ static struct snd_soc_dai_link tegra_maxstatic struct snd_soc_card snd_soc_tegra_max98090 = { .name ="tegra-max98090" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_max98090_dai, .num_links =1 ,
sound/soc/tegra/tegra_rt5640.c +1 -0
@@ -138,6 +138,7 @@ static struct snd_soc_dai_link tegra_rt5static struct snd_soc_card snd_soc_tegra_rt5640 = { .name ="tegra-rt5640" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_rt5640_dai, .num_links =1 ,
sound/soc/tegra/tegra_rt5677.c +1 -0
@@ -181,6 +181,7 @@ static struct snd_soc_dai_link tegra_rt5static struct snd_soc_card snd_soc_tegra_rt5677 = { .name ="tegra-rt5677" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_rt5677_dai, .num_links =1 ,
sound/soc/tegra/tegra_sgtl5000.c +1 -0
@@ -103,6 +103,7 @@ static struct snd_soc_dai_link tegra_sgtstatic struct snd_soc_card snd_soc_tegra_sgtl5000 = { .name ="tegra-sgtl5000" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_sgtl5000_dai, .num_links =1 ,
sound/soc/tegra/tegra_wm8753.c +1 -0
@@ -110,6 +110,7 @@ static struct snd_soc_dai_link tegra_wm8static struct snd_soc_card snd_soc_tegra_wm8753 = { .name ="tegra-wm8753" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_wm8753_dai, .num_links =1 ,
sound/soc/tegra/tegra_wm8903.c +1 -0
@@ -222,6 +222,7 @@ static struct snd_soc_dai_link tegra_wm8static struct snd_soc_card snd_soc_tegra_wm8903 = { .name ="tegra-wm8903" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_wm8903_dai, .num_links =1 ,
sound/soc/tegra/tegra_wm9712.c +1 -0
@@ -59,6 +59,7 @@ static struct snd_soc_dai_link tegra_wm9static struct snd_soc_card snd_soc_tegra_wm9712 = { .name ="tegra-wm9712" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_wm9712_dai, .num_links =1 ,
sound/soc/tegra/trimslice.c +1 -0
@@ -103,6 +103,7 @@ static struct snd_soc_dai_link trimslicestatic struct snd_soc_card snd_soc_trimslice = { .name ="tegra-trimslice" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &trimslice_tlv320aic23_dai, .num_links =1 ,
Greg Kroah-Hartman
maintainerPATCH 216/315 qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit fca41af18e10318e4de090db47d9fa7169e1bf2f upstream.
fw_cfg_showrev() is called by an indirect call in kobj_attr_show(), which violates clang's CFI checking because fw_cfg_showrev()'s second parameter is 'struct attribute', whereas the ->show() member of 'struct kobj_structure' expects the second parameter to be of type 'struct kobj_attribute'.
$ cat /sys/firmware/qemu_fw_cfg/rev 3
$ dmesg | grep "CFI failure" [ 26.016832] CFI failure (target: fw_cfg_showrev+0x0/0x8):
Fix this by converting fw_cfg_rev_attr to 'struct kobj_attribute' where this would have been caught automatically by the incompatible pointer types compiler warning. Update fw_cfg_showrev() accordingly.
--- drivers/firmware/qemu_fw_cfg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/firmware/qemu_fw_cfg.c +3 -5
@@ -192,15 +192,13 @@ static int fw_cfg_do_platform_probe(stru/* fw_cfg revision attribute, in /sys/firmware/qemu_fw_cfg top-level dir. */ static u32 fw_cfg_rev; -static ssize_t fw_cfg_showrev (struct kobject *k,struct attribute *a,char *buf) +static ssize_t fw_cfg_showrev (struct kobject *k,struct kobj_attribute *a, +char *buf) {return sprintf (buf,"%u\n" , fw_cfg_rev); } -static const struct { -struct attribute attr; -ssize_t (*show)(struct kobject *k,struct attribute *a,char *buf); -} fw_cfg_rev_attr = { +static const struct kobj_attribute fw_cfg_rev_attr = { .attr = { .name ="rev" , .mode =S_IRUSR }, .show = fw_cfg_showrev, };
Greg Kroah-Hartman
maintainerPATCH 217/315 ipmi/watchdog: Stop watchdog timer when the current action is none
In reply to Greg Kroah-HartmanFrom: Petr Pavlu <[email protected]>
commit 2253042d86f57d90a621ac2513a7a7a13afcf809 upstream.
When an IPMI watchdog timer is being stopped in ipmi_close() or ipmi_ioctl(WDIOS_DISABLECARD), the current watchdog action is updated to WDOG_TIMEOUT_NONE and _ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB) is called to install this action. The latter function ends up invoking __ipmi_set_timeout() which makes the actual 'Set Watchdog Timer' IPMI request.
For IPMI 1.0, this operation results in fully stopping the watchdog timer. For IPMI >= 1.5, function __ipmi_set_timeout() always specifies the "don't stop" flag in the prepared 'Set Watchdog Timer' IPMI request. This causes that the watchdog timer has its action correctly updated to 'none' but the timer continues to run. A problem is that IPMI firmware can then still log an expiration event when the configured timeout is reached, which is unexpected because the watchdog timer was requested to be stopped.
The patch fixes this problem by not setting the "don't stop" flag in __ipmi_set_timeout() when the current action is WDOG_TIMEOUT_NONE which results in stopping the watchdog timer. This makes the behaviour for IPMI >= 1.5 consistent with IPMI 1.0. It also matches the logic in __ipmi_heartbeat() which does not allow to reset the watchdog if the current action is WDOG_TIMEOUT_NONE as that would start the timer.
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_watchdog.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/char/ipmi/ipmi_watchdog.c +12 -10
@@ -394,16 +394,18 @@ static int i_ipmi_set_timeout(struct ipm data[0 ] =0 ;WDOG_SET_TIMER_USE (data[0 ],WDOG_TIMER_USE_SMS_OS ); -if ((ipmi_version_major >1 ) - || ((ipmi_version_major ==1 ) && (ipmi_version_minor >=5 ))) { -/* This is an IPMI 1.5-only feature. */ - data[0 ] |=WDOG_DONT_STOP_ON_SET ; - }else if (ipmi_watchdog_state !=WDOG_TIMEOUT_NONE ) { -/* -* In ipmi 1.0, setting the timer stops the watchdog, we -* need to start it back up again. -*/ - hbnow =1 ; +if (ipmi_watchdog_state !=WDOG_TIMEOUT_NONE ) { +if ((ipmi_version_major >1 ) || + ((ipmi_version_major ==1 ) && (ipmi_version_minor >=5 ))) { +/* This is an IPMI 1.5-only feature. */ + data[0 ] |=WDOG_DONT_STOP_ON_SET ; + }else { +/* +* In ipmi 1.0, setting the timer stops the watchdog, we +* need to start it back up again. +*/ + hbnow =1 ; + } } data[1 ] =0 ;
Greg Kroah-Hartman
maintainerPATCH 218/315 power: supply: ab8500: Fix an old bug
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
commit f1c74a6c07e76fcb31a4bcc1f437c4361a2674ce upstream.
Trying to get the AB8500 charging driver working I ran into a bit of bitrot: we haven't used the driver for a while so errors in refactorings won't be noticed.
This one is pretty self evident: use argument to the macro or we end up with a random pointer to something else.
--- include/linux/mfd/abx500/ux500_chargalg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mfd/abx500/ux500_chargalg.h +1 -1
@@ -15,7 +15,7 @@* - POWER_SUPPLY_TYPE_USB, * because only them store as drv_data pointer to struct ux500_charger. */ -#define psy_to_ux500_charger (x) power_supply_get_drvdata(psy) +#define psy_to_ux500_charger (x) power_supply_get_drvdata(x)/* Forward declaration */ struct ux500_charger ;
Greg Kroah-Hartman
maintainerPATCH 219/315 seq_buf: Fix overflow in seq_buf_putmem_hex()
In reply to Greg Kroah-HartmanFrom: Yun Zhou <[email protected]>
commit d3b16034a24a112bb83aeb669ac5b9b01f744bb7 upstream.
There's two variables being increased in that loop (i and j), and i follows the raw data, and j follows what is being written into the buffer. We should compare 'i' to MAX_MEMHEX_BYTES or compare 'j' to HEX_CHARS. Otherwise, if 'j' goes bigger than HEX_CHARS, it will overflow the destination buffer.
--- lib/seq_buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/seq_buf.c +3 -1
@@ -228,8 +228,10 @@ int seq_buf_putmem_hex(struct seq_buf *sWARN_ON (s->size ==0 ); +BUILD_BUG_ON (MAX_MEMHEX_BYTES *2 >=HEX_CHARS ); +while (len) { - start_len =min (len,HEX_CHARS -1 ); + start_len =min (len,MAX_MEMHEX_BYTES );#ifdef __BIG_ENDIANfor (i =0 , j =0 ; i < start_len; i++) {#else
Greg Kroah-Hartman
maintainerPATCH 220/315 tracing: Simplify & fix saved_tgids logic
In reply to Greg Kroah-HartmanFrom: Paul Burton <[email protected]>
commit b81b3e959adb107cd5b36c7dc5ba1364bbd31eb2 upstream.
The tgid_map array records a mapping from pid to tgid, where the index of an entry within the array is the pid & the value stored at that index is the tgid.
The saved_tgids_next() function iterates over pointers into the tgid_map array & dereferences the pointers which results in the tgid, but then it passes that dereferenced value to trace_find_tgid() which treats it as a pid & does a further lookup within the tgid_map array. It seems likely that the intent here was to skip over entries in tgid_map for which the recorded tgid is zero, but instead we end up skipping over entries for which the thread group leader hasn't yet had its own tgid recorded in tgid_map.
A minimal fix would be to remove the call to trace_find_tgid, turning:
if (trace_find_tgid(*ptr))
into:
if (*ptr)
..but it seems like this logic can be much simpler if we simply let seq_read() iterate over the whole tgid_map array & filter out empty entries by returning SEQ_SKIP from saved_tgids_show(). Here we take that approach, removing the incorrect logic here entirely.
--- kernel/trace/trace.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-)
kernel/trace/trace.c +13 -25
@@ -4750,37 +4750,20 @@ static const struct file_operations tracstatic void *saved_tgids_next (struct seq_file *m,void *v,loff_t *pos) { -int *ptr = v; +int pid = ++(*pos); -if (*pos || m->count) - ptr++; - - (*pos)++; - -for (; ptr <= &tgid_map[PID_MAX_DEFAULT ]; ptr++) { -if (trace_find_tgid (*ptr)) -return ptr; - } +if (pid >PID_MAX_DEFAULT ) +return NULL ; -return NULL ; +return &tgid_map[pid]; }static void *saved_tgids_start (struct seq_file *m,loff_t *pos) { -void *v; -loff_t l =0 ; - -if (!tgid_map) +if (!tgid_map || *pos >PID_MAX_DEFAULT )return NULL ; - v = &tgid_map[0 ]; -while (l <= *pos) { - v =saved_tgids_next (m, v, &l); -if (!v) -return NULL ; - } - -return v; +return &tgid_map[*pos]; }static void saved_tgids_stop (struct seq_file *m,void *v)
@@ -4789,9 +4772,14 @@ static void saved_tgids_stop(struct seq_static int saved_tgids_show (struct seq_file *m,void *v) { -int pid = (int *)v - tgid_map; +int *entry = (int *)v; +int pid = entry - tgid_map; +int tgid = *entry; + +if (tgid ==0 ) +return SEQ_SKIP ; -seq_printf (m,"%d %d\n" , pid,trace_find_tgid (pid)); +seq_printf (m,"%d %d\n" , pid, tgid);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 221/315 ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
commit 9272e5d0028d45a3b45b58c9255e6e0df53f7ad9 upstream.
In the out_err_bus_register error branch of tpci200_pci_probe, tpci200->info->cfg_regs is freed by tpci200_uninstall()-> tpci200_unregister()->pci_iounmap(..,tpci200->info->cfg_regs) in the first time.
But later, iounmap() is called to free tpci200->info->cfg_regs again.
My patch sets tpci200->info->cfg_regs to NULL after tpci200_uninstall() to avoid the double free.
--- drivers/ipack/carriers/tpci200.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ipack/carriers/tpci200.c +4 -1
@@ -591,8 +591,11 @@ static int tpci200_pci_probe(struct pci_ out_err_bus_register:tpci200_uninstall (tpci200); +/* tpci200->info->cfg_regs is unmapped in tpci200_uninstall */ + tpci200->info->cfg_regs =NULL ; out_err_install: -iounmap (tpci200->info->cfg_regs); +if (tpci200->info->cfg_regs) +iounmap (tpci200->info->cfg_regs); out_err_ioremap:pci_release_region (pdev,TPCI200_CFG_MEM_BAR ); out_err_pci_request:
Greg Kroah-Hartman
maintainerPATCH 222/315 dm btree remove: assign new_root only when removal succeeds
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit b6e58b5466b2959f83034bead2e2e1395cca8aeb upstream.
remove_raw() in dm_btree_remove() may fail due to IO read error (e.g. read the content of origin block fails during shadowing), and the value of shadow_spine::root is uninitialized, but the uninitialized value is still assign to new_root in the end of dm_btree_remove().
For dm-thin, the value of pmd->details_root or pmd->root will become an uninitialized value, so if trying to read details_info tree again out-of-bound memory may occur as showed below:
general protection fault, probably for non-canonical address 0x3fdcb14c8d7520 CPU: 4 PID: 515 Comm: dmsetup Not tainted 5.13.0-rc6 Hardware name: QEMU Standard PC RIP: 0010:metadata_ll_load_ie+0x14/0x30 Call Trace: sm_metadata_count_is_more_than_one+0xb9/0xe0 dm_tm_shadow_block+0x52/0x1c0 shadow_step+0x59/0xf0 remove_raw+0xb2/0x170 dm_btree_remove+0xf4/0x1c0 dm_pool_delete_thin_device+0xc3/0x140 pool_message+0x218/0x2b0 target_message+0x251/0x290 ctl_ioctl+0x1c4/0x4d0 dm_ctl_ioctl+0xe/0x20 __x64_sys_ioctl+0x7b/0xb0 do_syscall_64+0x40/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae
Fixing it by only assign new_root when removal succeeds
--- drivers/md/persistent-data/dm-btree-remove.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/persistent-data/dm-btree-remove.c +2 -1
@@ -549,7 +549,8 @@ int dm_btree_remove(struct dm_btree_infodelete_at (n, index); } - *new_root =shadow_root (&spine); +if (!r) + *new_root =shadow_root (&spine);exit_shadow_spine (&spine);return r;
Greg Kroah-Hartman
maintainerPATCH 223/315 media: dtv5100: fix control-request directions
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 8c8b9a9be2afa8bd6a72ad1130532baab9fab89d upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the control requests which erroneously used usb_rcvctrlpipe().
--- drivers/media/usb/dvb-usb/dtv5100.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/dtv5100.c +5 -2
@@ -35,6 +35,7 @@ static int dtv5100_i2c_msg(struct dvb_us u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) { struct dtv5100_state *st = d->priv; +unsigned int pipe;u8 request;u8 type;u16 value;
@@ -43,6 +44,7 @@ static int dtv5100_i2c_msg(struct dvb_usswitch (wlen) {case 1 :/* write { reg }, read { value } */ + pipe =usb_rcvctrlpipe (d->udev,0 ); request = (addr ==DTV5100_DEMOD_ADDR ?DTV5100_DEMOD_READ :DTV5100_TUNER_READ ); type =USB_TYPE_VENDOR |USB_DIR_IN ;
@@ -50,6 +52,7 @@ static int dtv5100_i2c_msg(struct dvb_usbreak ;case 2 :/* write { reg, value } */ + pipe =usb_sndctrlpipe (d->udev,0 ); request = (addr ==DTV5100_DEMOD_ADDR ?DTV5100_DEMOD_WRITE :DTV5100_TUNER_WRITE ); type =USB_TYPE_VENDOR |USB_DIR_OUT ;
@@ -63,7 +66,7 @@ static int dtv5100_i2c_msg(struct dvb_usmemcpy (st->data, rbuf, rlen);msleep (1 );/* avoid I2C errors */ -return usb_control_msg (d->udev,usb_rcvctrlpipe (d->udev,0 ), request, +return usb_control_msg (d->udev, pipe, request, type, value, index, st->data, rlen,DTV5100_USB_TIMEOUT ); }
@@ -150,7 +153,7 @@ static int dtv5100_probe(struct usb_inte/* initialize non qt1010/zl10353 part? */ for (i =0 ; dtv5100_init[i].request; i++) { - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), dtv5100_init[i].request, USB_TYPE_VENDOR | USB_DIR_OUT, dtv5100_init[i].value,
Greg Kroah-Hartman
maintainerPATCH 224/315 media: zr364xx: fix memory leak in zr364xx_start_readpipe
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 0a045eac8d0427b64577a24d74bb8347c905ac65 upstream.
syzbot reported memory leak in zr364xx driver.
The problem was in non-freed urb in case ofusb_submit_urb() fail.
backtrace:
[<ffffffff82baedf6>] kmalloc include/linux/slab.h:561 [inline] [<ffffffff82baedf6>] usb_alloc_urb+0x66/0xe0 drivers/usb/core/urb.c:74 [<ffffffff82f7cce8>] zr364xx_start_readpipe+0x78/0x130 drivers/media/usb/zr364xx/zr364xx.c:1022 [<ffffffff84251dfc>] zr364xx_board_init drivers/media/usb/zr364xx/zr364xx.c:1383 [inline] [<ffffffff84251dfc>] zr364xx_probe+0x6a3/0x851 drivers/media/usb/zr364xx/zr364xx.c:1516 [<ffffffff82bb6507>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396 [<ffffffff826018a9>] really_probe+0x159/0x500 drivers/base/dd.c:576
--- drivers/media/usb/zr364xx/zr364xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/zr364xx/zr364xx.c +1 -0
@@ -1061,6 +1061,7 @@ static int zr364xx_start_readpipe(structDBG ("submitting URB %p\n" , pipe_info->stream_urb); retval =usb_submit_urb (pipe_info->stream_urb,GFP_KERNEL );if (retval) { +usb_free_urb (pipe_info->stream_urb); printk(KERN_ERR KBUILD_MODNAME ": start read pipe failed\n");return retval; }
Greg Kroah-Hartman
maintainerPATCH 225/315 media: gspca/sq905: fix control-request direction
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 53ae298fde7adcc4b1432bce2dbdf8dac54dfa72 upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the USB_REQ_SYNCH_FRAME request which erroneously used usb_sndctrlpipe().
--- drivers/media/usb/gspca/sq905.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/gspca/sq905.c +1 -1
@@ -125,7 +125,7 @@ static int sq905_command(struct gspca_de } ret = usb_control_msg(gspca_dev->dev, - usb_sndctrlpipe(gspca_dev->dev, 0), + usb_rcvctrlpipe(gspca_dev->dev, 0), USB_REQ_SYNCH_FRAME, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, SQ905_PING, 0, gspca_dev->usb_buf, 1,
Greg Kroah-Hartman
maintainerPATCH 226/315 media: gspca/sunplus: fix zero-length control requests
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit b4bb4d425b7b02424afea2dfdcd77b3b4794175e upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Control transfers without a data stage are treated as OUT requests by the USB stack and should be using usb_sndctrlpipe(). Failing to do so will now trigger a warning.
Fix the single zero-length control request which was using the read-register helper, and update the helper so that zero-length reads fail with an error message instead.
--- drivers/media/usb/gspca/sunplus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/usb/gspca/sunplus.c +6 -2
@@ -251,6 +251,10 @@ static void reg_r(struct gspca_dev *gspcPERR ("reg_r: buffer overflow\n" );return ; } +if (len ==0 ) { +PERR ("reg_r: zero-length read\n" ); +return ; + }if (gspca_dev->usb_err <0 )return ; ret = usb_control_msg(gspca_dev->dev,
@@ -259,7 +263,7 @@ static void reg_r(struct gspca_dev *gspcUSB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,0 ,/* value */ index, - len ? gspca_dev->usb_buf :NULL , len, + gspca_dev->usb_buf, len, 500);if (ret <0 ) {pr_err ("reg_r err %d\n" , ret);
@@ -734,7 +738,7 @@ static int sd_start(struct gspca_dev *gscase MegaImageVI:reg_w_riv (gspca_dev,0xf0 ,0 ,0 );spca504B_WaitCmdStatus (gspca_dev); -reg_r (gspca_dev,0xf0 ,4 ,0 ); +reg_w_riv (gspca_dev,0xf0 ,4 ,0 );spca504B_WaitCmdStatus (gspca_dev);break ;default :
Greg Kroah-Hartman
maintainerPATCH 227/315 media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
In reply to Greg Kroah-HartmanFrom: Benjamin Drung <[email protected]>
commit 4c6e0976295add7f0ed94d276c04a3d6f1ea8f83 upstream.
The Elgato Cam Link 4K HDMI video capture card reports to support three different pixel formats, where the first format depends on the connected HDMI device.
``` $ v4l2-ctl -d /dev/video0 --list-formats-ext ioctl: VIDIOC_ENUM_FMT Type: Video Capture [0]: 'NV12' (Y/CbCr 4:2:0) Size: Discrete 3840x2160 Interval: Discrete 0.033s (29.970 fps) [1]: 'NV12' (Y/CbCr 4:2:0) Size: Discrete 3840x2160 Interval: Discrete 0.033s (29.970 fps) [2]: 'YU12' (Planar YUV 4:2:0) Size: Discrete 3840x2160 Interval: Discrete 0.033s (29.970 fps) ```
Changing the pixel format to anything besides the first pixel format does not work:
``` $ v4l2-ctl -d /dev/video0 --try-fmt-video pixelformat=YU12 Format Video Capture: Width/Height : 3840/2160 Pixel Format : 'NV12' (Y/CbCr 4:2:0) Field : None Bytes per Line : 3840 Size Image : 12441600 Colorspace : sRGB Transfer Function : Rec. 709 YCbCr/HSV Encoding: Rec. 709 Quantization : Default (maps to Limited Range) Flags : ```
User space applications like VLC might show an error message on the terminal in that case:
``` libv4l2: error set_fmt gave us a different result than try_fmt! ```
Depending on the error handling of the user space applications, they might display a distorted video, because they use the wrong pixel format for decoding the stream.
The Elgato Cam Link 4K responds to the USB video probe VS_PROBE_CONTROL/VS_COMMIT_CONTROL with a malformed data structure: The second byte contains bFormatIndex (instead of being the second byte of bmHint). The first byte is always zero. The third byte is always 1.
The firmware bug was reported to Elgato on 2020-12-01 and it was forwarded by the support team to the developers as feature request. There is no firmware update available since then. The latest firmware for Elgato Cam Link 4K as of 2021-03-23 has MCU 20.02.19 and FPGA 67.
Therefore correct the malformed data structure for this device. The change was successfully tested with VLC, OBS, and Chromium using different pixel formats (YUYV, NV12, YU12), resolutions (3840x2160, 1920x1080), and frame rates (29.970 and 59.940 fps).
--- drivers/media/usb/uvc/uvc_video.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/media/usb/uvc/uvc_video.c +27 -0
@@ -89,10 +89,37 @@ int uvc_query_ctrl(struct uvc_device *destatic void uvc_fixup_video_ctrl (struct uvc_streaming *stream,struct uvc_streaming_control *ctrl) { +static const struct usb_device_id elgato_cam_link_4k = { +USB_DEVICE (0x0fd9 ,0x0066 ) + };struct uvc_format *format =NULL ;struct uvc_frame *frame =NULL ;unsigned int i; +/* +* The response of the Elgato Cam Link 4K is incorrect: The second byte +* contains bFormatIndex (instead of being the second byte of bmHint). +* The first byte is always zero. The third byte is always 1. +* +* The UVC 1.5 class specification defines the first five bits in the +* bmHint bitfield. The remaining bits are reserved and should be zero. +* Therefore a valid bmHint will be less than 32. +* +* Latest Elgato Cam Link 4K firmware as of 2021-03-23 needs this fix. +* MCU: 20.02.19, FPGA: 67 +*/ +if (usb_match_one_id (stream->dev->intf, &elgato_cam_link_4k) && + ctrl->bmHint >255 ) { +u8 corrected_format_index = ctrl->bmHint >>8 ; + +/* uvc_dbg(stream->dev, VIDEO, +"Correct USB video probe response from {bmHint: 0x%04x, bFormatIndex: %u} to {bmHint: 0x%04x, bFormatIndex: %u}\n", +ctrl->bmHint, ctrl->bFormatIndex, +1, corrected_format_index); */ + ctrl->bmHint =1 ; + ctrl->bFormatIndex = corrected_format_index; + } +for (i =0 ; i < stream->nformats; ++i) {if (stream->format[i].index == ctrl->bFormatIndex) { format = &stream->format[i];
Greg Kroah-Hartman
maintainerPATCH 228/315 jfs: fix GPF in diFree
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 9d574f985fe33efd6911f4d752de6f485a1ea732 upstream.
Avoid passing inode with
JFS_SBI(inode->i_sb)->ipimap == NULL to
diFree()[1]. GFP will appear:
struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap; struct inomap *imap = JFS_IP(ipimap)->i_imap;
JFS_IP() will return invalid pointer when ipimap == NULL
Call Trace: diFree+0x13d/0x2dc0 fs/jfs/jfs_imap.c:853 [1] jfs_evict_inode+0x2c9/0x370 fs/jfs/inode.c:154 evict+0x2ed/0x750 fs/inode.c:578 iput_final fs/inode.c:1654 [inline] iput.part.0+0x3fe/0x820 fs/inode.c:1680 iput+0x58/0x70 fs/inode.c:1670
--- fs/jfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/inode.c +2 -1
@@ -161,7 +161,8 @@ void jfs_evict_inode(struct inode *inodeif (test_cflag (COMMIT_Freewmap, inode))jfs_free_zero_link (inode); -diFree (inode); +if (JFS_SBI (inode->i_sb)->ipimap) +diFree (inode);/* * Free the inode from the quota allocation.
Greg Kroah-Hartman
maintainerPATCH 229/315 smackfs: restrict bytes count in smk_set_cipso()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit 49ec114a6e62d8d320037ce71c1aaf9650b3cafd upstream.
Oops, I failed to update subject line.
Quoted 1 line
From
07571157c91b98ce1a4aa70967531e64b78e8346Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Mon, 12 Apr 2021 22:25:06 +0900
Subject: [PATCH 4.14 229/315] smackfs: restrict bytes count in smk_set_cipso()
Commit 7ef4c19d245f3dc2 ("smackfs: restrict bytes count in smackfs write functions") missed that count > SMK_CIPSOMAX check applies to only format == SMK_FIXED24_FMT case.
--- security/smack/smackfs.c | 2 ++ 1 file changed, 2 insertions(+)
security/smack/smackfs.c +2 -0
@@ -883,6 +883,8 @@ static ssize_t smk_set_cipso(struct fileif (format ==SMK_FIXED24_FMT && (count <SMK_CIPSOMIN || count >SMK_CIPSOMAX ))return -EINVAL ; +if (count >PAGE_SIZE ) +return -EINVAL ; data =memdup_user_nul (buf, count);if (IS_ERR (data))
Greg Kroah-Hartman
maintainerPATCH 230/315 KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 4bf48e3c0aafd32b960d341c4925b48f416f14a5 upstream.
Ignore the guest MAXPHYADDR reported by CPUID.0x8000_0008 if TDP, i.e. NPT, is disabled, and instead use the host's MAXPHYADDR. Per AMD'S APM:
Maximum guest physical address size in bits. This number applies only to guests using nested paging. When this field is zero, refer to the PhysAddrSize field for the maximum guest physical address size.
Message-Id: <[email protected]>
--- arch/x86/kvm/cpuid.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +7 -1
@@ -649,8 +649,14 @@ static inline int __do_cpuid_ent(structunsigned virt_as =max ((entry->eax >>8 ) &0xff ,48U );unsigned phys_as = entry->eax &0xff ; -if (!g_phys_as) +/* +* Use bare metal's MAXPHADDR if the CPU doesn't report guest +* MAXPHYADDR separately, or if TDP (NPT) is disabled, as the +* guest version "applies only to guests using nested paging". +*/ +if (!g_phys_as || !tdp_enabled) g_phys_as = phys_as; + entry->eax = g_phys_as | (virt_as <<8 ); entry->edx =0 ;/*
Greg Kroah-Hartman
maintainerPATCH 231/315 KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
In reply to Greg Kroah-HartmanFrom: Lai Jiangshan <[email protected]>
commit f85d40160691881a17a397c448d799dfc90987ba upstream.
When the host is using debug registers but the guest is not using them nor is the guest in guest-debug state, the kvm code does not reset the host debug registers before kvm_x86->run(). Rather, it relies on the hardware vmentry instruction to automatically reset the dr7 registers which ensures that the host breakpoints do not affect the guest.
This however violates the non-instrumentable nature around VM entry and exit; for example, when a host breakpoint is set on vcpu->arch.cr2,
Another issue is consistency. When the guest debug registers are active, the host breakpoints are reset before kvm_x86->run(). But when the guest debug registers are inactive, the host breakpoints are delayed to be disabled. The host tracing tools may see different results depending on what the guest is doing.
To fix the problems, we clear %db7 unconditionally before kvm_x86->run() if the host has set any breakpoints, no matter if the guest is using them or not.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/x86.c +2 -0
@@ -7237,6 +7237,8 @@ static int vcpu_enter_guest(struct kvm_vset_debugreg (vcpu->arch.eff_db[3 ],3 );set_debugreg (vcpu->arch.dr6,6 ); vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD ; + }else if (unlikely (hw_breakpoint_active ())) { +set_debugreg (0 ,7 ); } kvm_x86_ops->run (vcpu);
Greg Kroah-Hartman
maintainerPATCH 232/315 scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
In reply to Greg Kroah-HartmanFrom: Tyrel Datwyler <[email protected]>
commit 93aa71ad7379900e61c8adff6a710a4c18c7c99b upstream.
Commit 66a834d09293 ("scsi: core: Fix error handling of scsi_host_alloc()") changed the allocation logic to call put_device() to perform host cleanup with the assumption that IDA removal and stopping the kthread would properly be performed in scsi_host_dev_release(). However, in the unlikely case that the error handler thread fails to spawn, shost->ehandler is set to ERR_PTR(-ENOMEM).
The error handler cleanup code in scsi_host_dev_release() will call kthread_stop() if shost->ehandler != NULL which will always be the case whether the kthread was successfully spawned or not. In the case that it failed to spawn this has the nasty side effect of trying to dereference an invalid pointer when kthread_stop() is called. The following splat provides an example of this behavior in the wild:
scsi host11: error handler thread failed to spawn, error = -4 Kernel attempted to read user page (10c) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x0000010c Faulting instruction address: 0xc00000000818e9a8 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: ibmvscsi(+) scsi_transport_srp dm_multipath dm_mirror dm_region hash dm_log dm_mod fuse overlay squashfs loop CPU: 12 PID: 274 Comm: systemd-udevd Not tainted 5.13.0-rc7 #1 NIP: c00000000818e9a8 LR: c0000000089846e8 CTR: 0000000000007ee8 REGS: c000000037d12ea0 TRAP: 0300 Not tainted (5.13.0-rc7) MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 28228228
XER: 20040001
CFAR: c0000000089846e4 DAR: 000000000000010c DSISR: 40000000 IRQMASK: 0
GPR00: c0000000089846e8 c000000037d13140 c000000009cc1100 fffffffffffffffc
GPR04: 0000000000000001 0000000000000000 0000000000000000 c000000037dc0000
GPR08: 0000000000000000 c000000037dc0000 0000000000000001 00000000fffff7ff
GPR12: 0000000000008000 c00000000a049000 c000000037d13d00 000000011134d5a0
GPR16: 0000000000001740 c0080000190d0000 c0080000190d1740 c000000009129288
GPR20: c000000037d13bc0 0000000000000001 c000000037d13bc0 c0080000190b7898
GPR24: c0080000190b7708 0000000000000000 c000000033bb2c48 0000000000000000
GPR28: c000000046b28280 0000000000000000 000000000000010c fffffffffffffffc NIP [c00000000818e9a8] kthread_stop+0x38/0x230
LR [c0000000089846e8] scsi_host_dev_release+0x98/0x160
Call Trace:
[c000000033bb2c48] 0xc000000033bb2c48 (unreliable) [c0000000089846e8] scsi_host_dev_release+0x98/0x160 [c00000000891e960] device_release+0x60/0x100 [c0000000087e55c4] kobject_release+0x84/0x210 [c00000000891ec78] put_device+0x28/0x40 [c000000008984ea4] scsi_host_alloc+0x314/0x430 [c0080000190b38bc] ibmvscsi_probe+0x54/0xad0 [ibmvscsi] [c000000008110104] vio_bus_probe+0xa4/0x4b0 [c00000000892a860] really_probe+0x140/0x680 [c00000000892aefc] driver_probe_device+0x15c/0x200 [c00000000892b63c] device_driver_attach+0xcc/0xe0 [c00000000892b740] __driver_attach+0xf0/0x200 [c000000008926f28] bus_for_each_dev+0xa8/0x130 [c000000008929ce4] driver_attach+0x34/0x50 [c000000008928fc0] bus_add_driver+0x1b0/0x300 [c00000000892c798] driver_register+0x98/0x1a0 [c00000000810eb60] __vio_register_driver+0x80/0xe0 [c0080000190b4a30] ibmvscsi_module_init+0x9c/0xdc [ibmvscsi] [c0000000080121d0] do_one_initcall+0x60/0x2d0 [c000000008261abc] do_init_module+0x7c/0x320 [c000000008265700] load_module+0x2350/0x25b0 [c000000008265cb4] __do_sys_finit_module+0xd4/0x160 [c000000008031110] system_call_exception+0x150/0x2d0 [c00000000800d35c] system_call_common+0xec/0x278
Fix this be nulling shost->ehandler when the kthread fails to spawn.
--- drivers/scsi/hosts.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/hosts.c +1 -0
@@ -499,6 +499,7 @@ struct Scsi_Host *scsi_host_alloc(structshost_printk (KERN_WARNING , shost,"error handler thread failed to spawn, error = %ld\n" ,PTR_ERR (shost->ehandler)); + shost->ehandler =NULL ; goto fail; }
Greg Kroah-Hartman
maintainerPATCH 233/315 tracing: Do not reference char * as a string in histograms
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
commit 704adfb5a9978462cd861f170201ae2b5e3d3a80 upstream.
The histogram logic was allowing events with char * pointers to be used as normal strings. But it was easy to crash the kernel with:
# echo 'hist:keys=filename' > events/syscalls/sys_enter_openat/trigger
And open some files, and boom!
BUG: unable to handle page fault for address: 00007f2ced0c3280 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 1173fa067 P4D 1173fa067 PUD 1171b6067 PMD 1171dd067 PTE 0 Oops: 0000 [#1] PREEMPT SMP CPU: 6 PID: 1810 Comm: cat Not tainted 5.13.0-rc5-test+ #61 Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016 RIP: 0010:strlen+0x0/0x20 Code: f6 82 80 2a 0b a9 20 74 11 0f b6 50 01 48 83 c0 01 f6 82 80 2a 0b
a9 20 75 ef c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 <80> 3f 00 74 10 48 89 f8 48 83 c0 01 80 38 00 75 f7 48 29 f8 c3
RSP: 0018:ffffbdbf81567b50 EFLAGS: 00010246
RAX: 0000000000000003 RBX: ffff93815cdb3800 RCX: ffff9382401a22d0
RDX: 0000000000000100 RSI: 0000000000000000 RDI: 00007f2ced0c3280
RBP: 0000000000000100 R08: ffff9382409ff074 R09: ffffbdbf81567c98
R10: ffff9382409ff074 R11: 0000000000000000 R12: ffff9382409ff074
R13: 0000000000000001 R14: ffff93815a744f00 R15: 00007f2ced0c3280
FS: 00007f2ced0f8580(0000) GS:ffff93825a800000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2ced0c3280 CR3: 0000000107069005 CR4: 00000000001706e0
Call Trace: event_hist_trigger+0x463/0x5f0 ? find_held_lock+0x32/0x90 ? sched_clock_cpu+0xe/0xd0 ? lock_release+0x155/0x440 ? kernel_init_free_pages+0x6d/0x90 ? preempt_count_sub+0x9b/0xd0 ? kernel_init_free_pages+0x6d/0x90 ? get_page_from_freelist+0x12c4/0x1680 ? __rb_reserve_next+0xe5/0x460 ? ring_buffer_lock_reserve+0x12a/0x3f0 event_triggers_call+0x52/0xe0 ftrace_syscall_enter+0x264/0x2c0 syscall_trace_enter.constprop.0+0x1ee/0x210 do_syscall_64+0x1c/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae
Where it triggered a fault on strlen(key) where key was the filename.
The reason is that filename is a char * to user space, and the histogram code just blindly dereferenced it, with obvious bad results.
I originally tried to use strncpy_from_user/kernel_nofault() but found that there's other places that its dereferenced and not worth the effort.
Just do not allow "char *" to act like strings.
--- kernel/trace/trace_events_hist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_events_hist.c +3 -3
@@ -375,7 +375,9 @@ static struct hist_field *create_hist_fiif (WARN_ON_ONCE (!field)) goto out; -if (is_string_field (field)) { +/* Pointers to strings are just pointers and dangerous to dereference */ +if (is_string_field (field) && + (field->filter_type !=FILTER_PTR_STRING )) { flags |=HIST_FIELD_FL_STRING ;if (field->filter_type ==FILTER_STATIC_STRING )
@@ -864,8 +866,6 @@ static inline void add_to_key(char *comp field = key_field->field;if (field->filter_type ==FILTER_DYN_STRING ) size = *(u32 *)(rec + field->offset) >>16 ; -else if (field->filter_type ==FILTER_PTR_STRING ) - size =strlen (key);else if (field->filter_type ==FILTER_STATIC_STRING ) size = field->size;
Greg Kroah-Hartman
maintainerPATCH 234/315 PCI: aardvark: Dont rely on jiffies while holding spinlock
In reply to Greg Kroah-HartmanFrom: Remi Pommarel <[email protected]>
commit 7fbcb5da811be7d47468417c7795405058abb3da upstream.
advk_pcie_wait_pio() can be called while holding a spinlock (from pci_bus_read_config_dword()), then depends on jiffies in order to timeout while polling on PIO state registers. In the case the PIO transaction failed, the timeout will never happen and will also cause the cpu to stall.
This decrements a variable and wait instead of using jiffies.
--- drivers/pci/host/pci-aardvark.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/host/pci-aardvark.c +5 -5
@@ -185,7 +185,8 @@ (PCIE_CONF_BUS (bus) |PCIE_CONF_DEV (PCI_SLOT (devfn)) | \ PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) -#define PIO_TIMEOUT_MS 1 +#define PIO_RETRY_CNT 500 +#define PIO_RETRY_DELAY 2/* 2 us*/ #define LINK_WAIT_MAX_RETRIES 10#define LINK_WAIT_USLEEP_MIN 90000
@@ -413,17 +414,16 @@ static void advk_pcie_check_pio_status(sstatic int advk_pcie_wait_pio (struct advk_pcie *pcie) {struct device *dev = &pcie->pdev->dev; -unsigned long timeout; - - timeout = jiffies +msecs_to_jiffies (PIO_TIMEOUT_MS ); +int i; -while (time_before (jiffies, timeout)) { +for (i =0 ; i <PIO_RETRY_CNT ; i++) {u32 start, isr; start =advk_readl (pcie,PIO_START ); isr =advk_readl (pcie,PIO_ISR );if (!start && isr)return 0 ; +udelay (PIO_RETRY_DELAY ); }dev_err (dev,"config read/write timed out\n" );
Greg Kroah-Hartman
maintainerPATCH 235/315 PCI: aardvark: Fix kernel panic during PIO transfer
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit f18139966d072dab8e4398c95ce955a9742e04f7 upstream.
Trying to start a new PIO transfer by writing value 0 in PIO_START register when previous transfer has not yet completed (which is indicated by value 1 in PIO_START) causes an External Abort on CPU, which results in kernel panic:
SError Interrupt on CPU0, code 0xbf000002 -- SError Kernel panic - not syncing: Asynchronous SError Interrupt
To prevent kernel panic, it is required to reject a new PIO transfer when previous one has not finished yet.
If previous PIO transfer is not finished yet, the kernel may issue a new PIO request only if the previous PIO transfer timed out.
In the past the root cause of this issue was incorrectly identified (as it often happens during link retraining or after link down event) and special hack was implemented in Trusted Firmware to catch all SError events in EL3, to ignore errors with code 0xbf000002 and not forwarding any other errors to kernel and instead throw panic from EL3 Trusted Firmware handler.
Links to discussion and patches about this issue:
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=3c7dcdac5c50
https://lore.kernel.org/linux-pci/[email protected]/
https://lore.kernel.org/linux-pci/[email protected]/
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/1541
But the real cause was the fact that during link retraining or after link down event the PIO transfer may take longer time, up to the 1.44s until it times out. This increased probability that a new PIO transfer would be issued by kernel while previous one has not finished yet.
After applying this change into the kernel, it is possible to revert the mentioned TF-A hack and SError events do not have to be caught in TF-A EL3.
--- drivers/pci/host/pci-aardvark.c | 49 ++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 9 deletions(-)
drivers/pci/host/pci-aardvark.c +40 -9
@@ -426,10 +426,39 @@ static int advk_pcie_wait_pio(struct advudelay (PIO_RETRY_DELAY ); } -dev_err (dev,"config read/write timed out\n" ); +dev_err (dev,"PIO read/write transfer time out\n" );return -ETIMEDOUT ; } +static bool advk_pcie_pio_is_running (struct advk_pcie *pcie) +{ +struct device *dev = &pcie->pdev->dev; + +/* +* Trying to start a new PIO transfer when previous has not completed +* cause External Abort on CPU which results in kernel panic: +* +* SError Interrupt on CPU0, code 0xbf000002 -- SError +* Kernel panic - not syncing: Asynchronous SError Interrupt +* +* Functions advk_pcie_rd_conf() and advk_pcie_wr_conf() are protected +* by raw_spin_lock_irqsave() at pci_lock_config() level to prevent +* concurrent calls at the same time. But because PIO transfer may take +* about 1.5s when link is down or card is disconnected, it means that +* advk_pcie_wait_pio() does not always have to wait for completion. +* +* Some versions of ARM Trusted Firmware handles this External Abort at +* EL3 level and mask it to prevent kernel panic. Relevant TF-A commit: +* https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=3c7dcdac5c50 +*/ +if (advk_readl (pcie,PIO_START )) { +dev_err (dev,"Previous PIO read/write transfer is still running\n" ); +return true; + } + +return false; +} +static int advk_pcie_rd_conf (struct pci_bus *bus,u32 devfn,int where,int size,u32 *val) {
@@ -442,9 +471,10 @@ static int advk_pcie_rd_conf(struct pci_return PCIBIOS_DEVICE_NOT_FOUND ; } -/* Start PIO */ -advk_writel (pcie,0 ,PIO_START ); -advk_writel (pcie,1 ,PIO_ISR ); +if (advk_pcie_pio_is_running (pcie)) { + *val =0xffffffff ; +return PCIBIOS_SET_FAILED ; + }/* Program the control register */ reg =advk_readl (pcie,PIO_CTRL );
@@ -463,7 +493,8 @@ static int advk_pcie_rd_conf(struct pci_/* Program the data strobe */ advk_writel (pcie,0xf ,PIO_WR_DATA_STRB ); -/* Start the transfer */ +/* Clear PIO DONE ISR and start the transfer */ +advk_writel (pcie,1 ,PIO_ISR );advk_writel (pcie,1 ,PIO_START ); ret =advk_pcie_wait_pio (pcie);
@@ -497,9 +528,8 @@ static int advk_pcie_wr_conf(struct pci_if (where % size)return PCIBIOS_SET_FAILED ; -/* Start PIO */ -advk_writel (pcie,0 ,PIO_START ); -advk_writel (pcie,1 ,PIO_ISR ); +if (advk_pcie_pio_is_running (pcie)) +return PCIBIOS_SET_FAILED ;/* Program the control register */ reg =advk_readl (pcie,PIO_CTRL );
@@ -526,7 +556,8 @@ static int advk_pcie_wr_conf(struct pci_/* Program the data strobe */ advk_writel (pcie, data_strobe,PIO_WR_DATA_STRB ); -/* Start the transfer */ +/* Clear PIO DONE ISR and start the transfer */ +advk_writel (pcie,1 ,PIO_ISR );advk_writel (pcie,1 ,PIO_START ); ret =advk_pcie_wait_pio (pcie);
Greg Kroah-Hartman
maintainerPATCH 236/315 tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
In reply to Greg Kroah-HartmanFrom: Sherry Sun <[email protected]>
[ Upstream commit fcb10ee27fb91b25b68d7745db9817ecea9f1038 ]
We should be very careful about the register values that will be used for division or modulo operations, althrough the possibility that the UARTBAUD register value is zero is very low, but we had better to deal with the "bad data" of hardware in advance to avoid division or modulo by zero leading to undefined kernel behavior.
--- drivers/tty/serial/fsl_lpuart.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/tty/serial/fsl_lpuart.c +3 -0
@@ -1998,6 +1998,9 @@ lpuart32_console_get_options(struct lpuart_port *sport, int *baud, bd =lpuart32_read (&sport->port,UARTBAUD ); bd &=UARTBAUD_SBR_MASK ; +if (!bd) +return ; + sbr = bd; uartclk =clk_get_rate (sport->clk);/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 237/315 misc/libmasm/module: Fix two use after free in ibmasm_init_one
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 7272b591c4cb9327c43443f67b8fbae7657dd9ae ]
In ibmasm_init_one, it calls ibmasm_init_remote_input_dev(). Inside ibmasm_init_remote_input_dev, mouse_dev and keybd_dev are allocated by input_allocate_device(), and assigned to sp->remote.mouse_dev and sp->remote.keybd_dev respectively.
In the err_free_devices error branch of ibmasm_init_one, mouse_dev and keybd_dev are freed by input_free_device(), and return error. Then the execution runs into error_send_message error branch of ibmasm_init_one, where ibmasm_free_remote_input_dev(sp) is called to unregister the freed sp->remote.mouse_dev and sp->remote.keybd_dev.
My patch add a "error_init_remote" label to handle the error of ibmasm_init_remote_input_dev(), to avoid the uaf bugs.
--- drivers/misc/ibmasm/module.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/misc/ibmasm/module.c +3 -2
@@ -123,7 +123,7 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id) result =ibmasm_init_remote_input_dev (sp);if (result) {dev_err (sp->dev,"Failed to initialize remote queue\n" ); - goto error_send_message; + goto error_init_remote; } result =ibmasm_send_driver_vpd (sp);
@@ -143,8 +143,9 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)return 0 ; error_send_message: -disable_sp_interrupts (sp->base_address);ibmasm_free_remote_input_dev (sp); +error_init_remote: +disable_sp_interrupts (sp->base_address);free_irq (sp->irq, (void *)sp); error_request_irq:iounmap (sp->base_address);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 238/315 Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 5d6fb80a142b5994355ce675c517baba6089d199 ]
This reverts commit 0edabdfe89581669609eaac5f6a8d0ae6fe95e7f.
I've explained that optional FireWire card for d.2 is also built-in to d.2 Pro, however it's wrong. The optional card uses DM1000 ASIC and has 'Mackie DJ Mixer' in its model name of configuration ROM. On the other hand, built-in FireWire card for d.2 Pro and d.4 Pro uses OXFW971 ASIC and has 'd.Pro' in its model name according to manuals and user experiences. The former card is not the card for d.2 Pro. They are similar in appearance but different internally.
--- sound/firewire/Kconfig | 4 ++-- sound/firewire/bebob/bebob.c | 2 +- sound/firewire/oxfw/oxfw.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
sound/firewire/Kconfig +2 -2
@@ -37,7 +37,7 @@ config SND_OXFW * Mackie(Loud) Onyx 1640i (former model) * Mackie(Loud) Onyx Satellite * Mackie(Loud) Tapco Link.Firewire - * Mackie(Loud) d.4 pro + * Mackie(Loud) d.2 pro/d.4 pro (built-in FireWire card with OXFW971 ASIC) * Mackie(Loud) U.420/U.420d * TASCAM FireOne * Stanton Controllers & Systems 1 Deck/Mixer
@@ -83,7 +83,7 @@ config SND_BEBOB * PreSonus FIREBOX/FIREPOD/FP10/Inspire1394 * BridgeCo RDAudio1/Audio5 * Mackie Onyx 1220/1620/1640 (FireWire I/O Card) - * Mackie d.2 (FireWire Option) and d.2 Pro + * Mackie d.2 (optional FireWire card with DM1000 ASIC) * Stanton FinalScratch 2 (ScratchAmp) * Tascam IF-FW/DM * Behringer XENIX UFX 1204/1604
sound/firewire/bebob/bebob.c +1 -1
@@ -414,7 +414,7 @@ static const struct ieee1394_device_id bebob_id_table[] = {SND_BEBOB_DEV_ENTRY (VEN_BRIDGECO ,0x00010049 , &spec_normal),/* Mackie, Onyx 1220/1620/1640 (Firewire I/O Card) */ SND_BEBOB_DEV_ENTRY (VEN_MACKIE2 ,0x00010065 , &spec_normal), -// Mackie, d.2 (Firewire option card) and d.2 Pro (the card is built-in). +// Mackie, d.2 (optional Firewire card with DM1000). SND_BEBOB_DEV_ENTRY (VEN_MACKIE1 ,0x00010067 , &spec_normal),/* Stanton, ScratchAmp */ SND_BEBOB_DEV_ENTRY(VEN_STANTON, 0x00000001, &spec_normal),
sound/firewire/oxfw/oxfw.c +1 -1
@@ -406,7 +406,7 @@ static const struct ieee1394_device_id oxfw_id_table[] = {* Onyx-i series (former models): 0x081216 * Mackie Onyx Satellite: 0x00200f * Tapco LINK.firewire 4x6: 0x000460 -* d.4 pro: Unknown +* d.2 pro/d.4 pro (built-in card): Unknown * U.420: Unknown * U.420d: Unknown */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 239/315 w1: ds2438: fixing bug that would always get page0
In reply to Greg Kroah-HartmanFrom: Luiz Sampaio <[email protected]>
[ Upstream commit 1f5e7518f063728aee0679c5086b92d8ea429e11 ]
The purpose of the w1_ds2438_get_page function is to get the register values at the page passed as the pageno parameter. However, the page0 was hardcoded, such that the function always returned the page0 contents. Fixed so that the function can retrieve any page.
--- drivers/w1/slaves/w1_ds2438.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/w1/slaves/w1_ds2438.c +2 -2
@@ -64,13 +64,13 @@ static int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf)if (w1_reset_select_slave (sl))continue ; w1_buf[0 ] =W1_DS2438_RECALL_MEMORY ; - w1_buf[1 ] =0x00 ; + w1_buf[1 ] = (u8 )pageno;w1_write_block (sl->master, w1_buf,2 );if (w1_reset_select_slave (sl))continue ; w1_buf[0 ] =W1_DS2438_READ_SCRATCH ; - w1_buf[1 ] =0x00 ; + w1_buf[1 ] = (u8 )pageno;w1_write_block (sl->master, w1_buf,2 ); count =w1_read_block (sl->master, buf,DS2438_PAGE_SIZE +1 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 240/315 scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit e30d55137edef47434c40d7570276a0846fe922c ]
An 'unexpected timeout' message may be seen in a point-2-point topology. The message occurs when a PLOGI is received before the driver is notified of FLOGI completion. The FLOGI completion failure causes discovery to be triggered for a second time. The discovery timer is restarted but no new discovery activity is initiated, thus the timeout message eventually appears.
In point-2-point, when discovery has progressed before the FLOGI completion is processed, it is not a failure. Add code to FLOGI completion to detect that discovery has progressed and exit the FLOGI handling (noop'ing it).
--- drivers/scsi/lpfc/lpfc_els.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/scsi/lpfc/lpfc_els.c +9 -0
@@ -1170,6 +1170,15 @@ stop_rr_fcf_flogi: phba->fcf.fcf_redisc_attempted =0 ;/* reset */ goto out; } + }else if (vport->port_state >LPFC_FLOGI && + vport->fc_flag &FC_PT2PT ) { +/* +* In a p2p topology, it is possible that discovery has +* already progressed, and this completion can be ignored. +* Recheck the indicated topology. +*/ +if (!sp->cmn.fPort) + goto out; } flogifail:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 241/315 scsi: lpfc: Fix crash when lpfc_sli4_hba_setup() fails to initialize the SGLs
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit 5aa615d195f1e142c662cb2253f057c9baec7531 ]
The driver is encountering a crash in lpfc_free_iocb_list() while performing initial attachment.
Code review found this to be an errant failure path that was taken, jumping to a tag that then referenced structures that were uninitialized.
Fix the failure path.
--- drivers/scsi/lpfc/lpfc_sli.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -2
@@ -7032,7 +7032,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)"0393 Error %d during rpi post operation\n" , rc); rc = -ENODEV ; - goto out_destroy_queue; + goto out_free_iocblist; }lpfc_sli4_node_prep (phba);
@@ -7157,8 +7157,9 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) out_unset_queue:/* Unset all the queues set up in this routine when error out */ lpfc_sli4_queue_unset (phba); -out_destroy_queue: +out_free_iocblist:lpfc_free_iocb_list (phba); +out_destroy_queue:lpfc_sli4_queue_destroy (phba); out_stop_timers:lpfc_stop_hba_timers (phba);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 242/315 scsi: core: Cap scsi_host cmd_per_lun at can_queue
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit ea2f0f77538c50739b9fb4de4700cee5535e1f77 ]
The sysfs handling function sdev_store_queue_depth() enforces that the sdev queue depth cannot exceed shost can_queue. The initial sdev queue depth comes from shost cmd_per_lun. However, the LLDD may manually set cmd_per_lun to be larger than can_queue, which leads to an initial sdev queue depth greater than can_queue.
Such an issue was reported in [0], which caused a hang. That has since been fixed in commit fc09acb7de31 ("scsi: scsi_debug: Fix cmd_per_lun, set to max_queue").
Stop this possibly happening for other drivers by capping shost cmd_per_lun at shost can_queue.
[0] https://lore.kernel.org/linux-scsi/YHaez6iN2HHYxYOh@T590/
--- drivers/scsi/hosts.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/hosts.c +3 -0
@@ -213,6 +213,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, goto fail; } + shost->cmd_per_lun =min_t (short, shost->cmd_per_lun, + shost->can_queue); + error =scsi_init_sense_cache (shost);if (error) goto fail;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 243/315 tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit fad92b11047a748c996ebd6cfb164a63814eeb2e ]
In the probe function, if the final 'serial_config()' fails, 'info' is leaking.
Add a resource handling path to free this memory.
--- drivers/tty/serial/8250/serial_cs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/serial_cs.c +10 -1
@@ -305,6 +305,7 @@ static int serial_resume(struct pcmcia_device *link)static int serial_probe (struct pcmcia_device *link) {struct serial_info *info; +int ret;dev_dbg (&link->dev,"serial_attach()\n" );
@@ -319,7 +320,15 @@ static int serial_probe(struct pcmcia_device *link)if (do_sound) link->config_flags |=CONF_ENABLE_SPKR ; -return serial_config (link); + ret =serial_config (link); +if (ret) + goto free_info; + +return 0 ; + +free_info: +kfree (info); +return ret; }static void serial_detach (struct pcmcia_device *link)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 244/315 fs/jfs: Fix missing error code in lmLogInit()
In reply to Greg Kroah-HartmanFrom: Jiapeng Chong <[email protected]>
[ Upstream commit 492109333c29e1bb16d8732e1d597b02e8e0bf2e ]
The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'rc.
Eliminate the follow smatch warning:
fs/jfs/jfs_logmgr.c:1327 lmLogInit() warn: missing error code 'rc'.
--- fs/jfs/jfs_logmgr.c | 1 + 1 file changed, 1 insertion(+)
fs/jfs/jfs_logmgr.c +1 -0
@@ -1338,6 +1338,7 @@ int lmLogInit(struct jfs_log * log) }else {if (memcmp (logsuper->uuid, log->uuid,16 )) {jfs_warn ("wrong uuid on JFS log device" ); + rc = -EINVAL ; goto errout20; } log->size =le32_to_cpu (logsuper->size);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 245/315 scsi: iscsi: Add iscsi_cls_conn refcount helpers
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit b1d19e8c92cfb0ded180ef3376c20e130414e067 ]
There are a couple places where we could free the iscsi_cls_conn while it's still in use. This adds some helpers to get/put a refcount on the struct and converts an exiting user. Subsequent commits will then use the helpers to fix 2 bugs in the eh code.
--- drivers/scsi/libiscsi.c | 7 ++----- drivers/scsi/scsi_transport_iscsi.c | 12 ++++++++++++ include/scsi/scsi_transport_iscsi.h | 2 ++ 3 files changed, 16 insertions(+), 5 deletions(-)
drivers/scsi/libiscsi.c +2 -5
@@ -1385,7 +1385,6 @@ void iscsi_session_failure(struct iscsi_session *session, enum iscsi_err err) {struct iscsi_conn *conn; -struct device *dev;spin_lock_bh (&session->frwd_lock); conn = session->leadconn;
@@ -1394,10 +1393,8 @@ void iscsi_session_failure(struct iscsi_session *session,return ; } - dev =get_device (&conn->cls_conn->dev); +iscsi_get_conn (conn->cls_conn);spin_unlock_bh (&session->frwd_lock); -if (!dev) -return ;/* * if the host is being removed bypass the connection * recovery initialization because we are going to kill
@@ -1407,7 +1404,7 @@ void iscsi_session_failure(struct iscsi_session *session,iscsi_conn_error_event (conn->cls_conn, err); elseiscsi_conn_failure (conn ,err ); -put_device (dev); +iscsi_put_conn (conn->cls_conn); }EXPORT_SYMBOL_GPL (iscsi_session_failure);
drivers/scsi/scsi_transport_iscsi.c +12 -0
@@ -2306,6 +2306,18 @@ int iscsi_destroy_conn(struct iscsi_cls_conn *conn) }EXPORT_SYMBOL_GPL (iscsi_destroy_conn); +void iscsi_put_conn (struct iscsi_cls_conn *conn) +{ +put_device (&conn->dev); +} +EXPORT_SYMBOL_GPL (iscsi_put_conn); + +void iscsi_get_conn (struct iscsi_cls_conn *conn) +{ +get_device (&conn->dev); +} +EXPORT_SYMBOL_GPL (iscsi_get_conn); +/* * iscsi interface functions */
include/scsi/scsi_transport_iscsi.h +2 -0
@@ -436,6 +436,8 @@ extern void iscsi_remove_session(struct iscsi_cls_session *session);extern void iscsi_free_session (struct iscsi_cls_session *session);extern struct iscsi_cls_conn *iscsi_create_conn (struct iscsi_cls_session *sess,int dd_size,uint32_t cid); +extern void iscsi_put_conn (struct iscsi_cls_conn *conn); +extern void iscsi_get_conn (struct iscsi_cls_conn *conn);extern int iscsi_destroy_conn (struct iscsi_cls_conn *conn);extern void iscsi_unblock_session (struct iscsi_cls_session *session);extern void iscsi_block_session (struct iscsi_cls_session *session);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 246/315 scsi: iscsi: Fix shost->max_id use
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit bdd4aad7ff92ae39c2e93c415bb6761cb8b584da ]
The iscsi offload drivers are setting the shost->max_id to the max number of sessions they support. The problem is that max_id is not the max number of targets but the highest identifier the targets can have. To use it to limit the number of targets we need to set it to max sessions - 1, or we can end up with a session we might not have preallocated resources for.
--- drivers/scsi/be2iscsi/be_main.c | 4 ++-- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 4 ++-- drivers/scsi/qedi/qedi_main.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/be2iscsi/be_main.c +2 -2
@@ -412,7 +412,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) "beiscsi_hba_alloc - iscsi_host_alloc failed\n");return NULL ; } - shost->max_id =BE2_MAX_SESSIONS ; + shost->max_id =BE2_MAX_SESSIONS -1 ; shost->max_channel =0 ; shost->max_cmd_len =BEISCSI_MAX_CMD_LEN ; shost->max_lun =BEISCSI_NUM_MAX_LUN ;
@@ -5303,7 +5303,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba)/* Re-enable UER. If different TPE occurs then it is recoverable. */ beiscsi_set_uer_feature (phba); - phba->shost->max_id = phba->params.cxns_per_ctrl; + phba->shost->max_id = phba->params.cxns_per_ctrl -1 ; phba->shost->can_queue = phba->params.ios_per_ctrl; ret =beiscsi_init_port (phba);if (ret <0 ) {
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -793,7 +793,7 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)return NULL ; shost->dma_boundary = cnic->pcidev->dma_mask; shost->transportt = bnx2i_scsi_xport_template; - shost->max_id =ISCSI_MAX_CONNS_PER_HBA ; + shost->max_id =ISCSI_MAX_CONNS_PER_HBA -1 ; shost->max_channel =0 ; shost->max_lun =512 ; shost->max_cmd_len =16 ;
drivers/scsi/cxgbi/libcxgbi.c +2 -2
@@ -339,7 +339,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev)EXPORT_SYMBOL_GPL (cxgbi_hbas_remove);int cxgbi_hbas_add (struct cxgbi_device *cdev,u64 max_lun, -unsigned int max_id,struct scsi_host_template *sht, +unsigned int max_conns,struct scsi_host_template *sht,struct scsi_transport_template *stt) {struct cxgbi_hba *chba;
@@ -359,7 +359,7 @@ int cxgbi_hbas_add(struct cxgbi_device *cdev, u64 max_lun, shost->transportt = stt; shost->max_lun = max_lun; - shost->max_id = max_id; + shost->max_id = max_conns -1 ; shost->max_channel =0 ; shost->max_cmd_len =16 ;
drivers/scsi/qedi/qedi_main.c +1 -1
@@ -628,7 +628,7 @@ static struct qedi_ctx *qedi_host_alloc(struct pci_dev *pdev) goto exit_setup_shost; } - shost->max_id =QEDI_MAX_ISCSI_CONNS_PER_HBA ; + shost->max_id =QEDI_MAX_ISCSI_CONNS_PER_HBA -1 ; shost->max_channel =0 ; shost->max_lun = ~0 ; shost->max_cmd_len =16 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 247/315 scsi: qedi: Fix null ref during abort handling
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
[ Upstream commit 5777b7f0f03ce49372203b6521631f62f2810c8f ]
If qedi_process_cmd_cleanup_resp finds the cmd it frees the work and sets list_tmf_work to NULL, so qedi_tmf_work should check if list_tmf_work is non-NULL when it wants to force cleanup.
--- drivers/scsi/qedi/qedi_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedi/qedi_fw.c +1 -1
@@ -1474,7 +1474,7 @@ abort_ret: ldel_exit:spin_lock_bh (&qedi_conn->tmf_work_lock); -if (!qedi_cmd->list_tmf_work) { +if (qedi_cmd->list_tmf_work) {list_del_init (&list_work->list); qedi_cmd->list_tmf_work =NULL ;kfree (list_work);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 248/315 mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit 4700ef326556ed74aba188f12396740a8c1c21dd ]
This patch adds/modifies MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/mfd/da9052-i2c.c | 1 + drivers/mfd/stmpe-i2c.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/mfd/da9052-i2c.c +1 -0
@@ -118,6 +118,7 @@ static const struct i2c_device_id da9052_i2c_id[] = { {"da9053-bc", DA9053_BC}, {} }; +MODULE_DEVICE_TABLE (i2c, da9052_i2c_id);#ifdef CONFIG_OF static const struct of_device_id dialog_dt_ids[] = {
drivers/mfd/stmpe-i2c.c +1 -1
@@ -109,7 +109,7 @@ static const struct i2c_device_id stmpe_i2c_id[] = { { "stmpe2403", STMPE2403 }, { } }; -MODULE_DEVICE_TABLE(i2c, stmpe_id); +MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); static struct i2c_driver stmpe_i2c_driver = { .driver = {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 249/315 s390/sclp_vt220: fix console name to match device
In reply to Greg Kroah-HartmanFrom: Valentin Vidic <[email protected]>
[ Upstream commit b7d91d230a119fdcc334d10c9889ce9c5e15118b ]
Console name reported in /proc/consoles:
ttyS1 -W- (EC p ) 4:65
does not match the char device name:
crw--w---- 1 root root 4, 65 May 17 12:18 /dev/ttysclp0
so debian-installer inside a QEMU s390x instance gets confused and fails to start with the following error:
steal-ctty: No such file or directory
--- arch/s390/kernel/setup.c | 2 +- drivers/s390/char/sclp_vt220.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/setup.c +1 -1
@@ -140,7 +140,7 @@ static void __init set_preferred_console(void)else if (CONSOLE_IS_3270 )add_preferred_console ("tty3270" ,0 ,NULL );else if (CONSOLE_IS_VT220 ) -add_preferred_console ("ttyS" ,1 ,NULL ); +add_preferred_console ("ttysclp" ,0 ,NULL );else if (CONSOLE_IS_HVC )add_preferred_console ("hvc" ,0 ,NULL ); }
drivers/s390/char/sclp_vt220.c +2 -2
@@ -35,8 +35,8 @@#define SCLP_VT220_MINOR 65#define SCLP_VT220_DRIVER_NAME "sclp_vt220"#define SCLP_VT220_DEVICE_NAME "ttysclp" -#define SCLP_VT220_CONSOLE_NAME "ttyS" -#define SCLP_VT220_CONSOLE_INDEX 1/* console=ttyS1 */ +#define SCLP_VT220_CONSOLE_NAME "ttysclp" +#define SCLP_VT220_CONSOLE_INDEX 0/* console=ttysclp0 */ /* Representation of a single write request */ struct sclp_vt220_request {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 250/315 ALSA: sb: Fix potential double-free of CSP mixer elements
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit c305366a37441c2ac90b08711cb6f032b43672f2 ]
snd_sb_qsound_destroy() contains the calls of removing the previously created mixer controls, but it doesn't clear the pointers. As snd_sb_qsound_destroy() itself may be repeatedly called via ioctl, this could lead to double-free potentially.
Fix it by clearing the struct fields properly afterwards.
--- sound/isa/sb/sb16_csp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/isa/sb/sb16_csp.c +6 -2
@@ -1086,10 +1086,14 @@ static void snd_sb_qsound_destroy(struct snd_sb_csp * p) card = p->chip->card;down_write (&card->controls_rwsem); -if (p->qsound_switch) +if (p->qsound_switch) {snd_ctl_remove (card, p->qsound_switch); -if (p->qsound_space) + p->qsound_switch =NULL ; + } +if (p->qsound_space) {snd_ctl_remove (card, p->qsound_space); + p->qsound_space =NULL ; + }up_write (&card->controls_rwsem);/* cancel pending transfer of QSound parameters */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 251/315 powerpc/ps3: Add dma_mask to ps3_dma_region
In reply to Greg Kroah-HartmanFrom: Geoff Levand <[email protected]>
[ Upstream commit 9733862e50fdba55e7f1554e4286fcc5302ff28e ]
Commit f959dcd6ddfd29235030e8026471ac1b022ad2b0 (dma-direct: Fix potential NULL pointer dereference) added a null check on the dma_mask pointer of the kernel's device structure.
Add a dma_mask variable to the ps3_dma_region structure and set the device structure's dma_mask pointer to point to this new variable.
Fixes runtime errors like these:
# WARNING: Fixes tag on line 10 doesn't match correct format # WARNING: Fixes tag on line 10 doesn't match correct format
ps3_system_bus_match:349: dev=8.0(sb_01), drv=8.0(ps3flash): match
WARNING: CPU: 0 PID: 1 at kernel/dma/mapping.c:151 .dma_map_page_attrs+0x34/0x1e0 ps3flash sb_01: ps3stor_setup:193: map DMA region failed
--- arch/powerpc/include/asm/ps3.h | 2 ++ arch/powerpc/platforms/ps3/mm.c | 12 ++++++++++++ 2 files changed, 14 insertions(+)
arch/powerpc/include/asm/ps3.h +2 -0
@@ -83,6 +83,7 @@ struct ps3_dma_region_ops;* @bus_addr: The 'translated' bus address of the region. * @len: The length in bytes of the region. * @offset: The offset from the start of memory of the region. +* @dma_mask: Device dma_mask. * @ioid: The IOID of the device who owns this region * @chunk_list: Opaque variable used by the ioc page manager. * @region_ops: struct ps3_dma_region_ops - dma region operations
@@ -97,6 +98,7 @@ struct ps3_dma_region {enum ps3_dma_region_type region_type;unsigned long len;unsigned long offset; +u64 dma_mask;/* driver variables (set by ps3_dma_region_create) */ unsigned long bus_addr;
arch/powerpc/platforms/ps3/mm.c +12 -0
@@ -18,6 +18,7 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <linux/dma-mapping.h> #include <linux/kernel.h> #include <linux/export.h> #include <linux/memblock.h>
@@ -1132,6 +1133,7 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, enum ps3_dma_region_type region_type, void *addr, unsigned long len) { unsigned long lpar_addr; +int result; lpar_addr = addr ?ps3_mm_phys_to_lpar (__pa (addr)) :0 ;
@@ -1143,6 +1145,16 @@ int ps3_dma_region_init(struct ps3_system_bus_device *dev, r->offset -= map.r1.offset; r->len = len ? len :_ALIGN_UP (map.total,1 << r->page_size); + dev->core.dma_mask = &r->dma_mask; + + result =dma_set_mask_and_coherent (&dev->core,DMA_BIT_MASK (32 )); + +if (result <0 ) { +dev_err (&dev->core,"%s:%d: dma_set_mask_and_coherent failed: %d\n" , + __func__, __LINE__, result); +return result; + } +switch (dev->dev_type) {case PS3_DEVICE_TYPE_SB : r->region_ops = (USE_DYNAMIC_DMA )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 252/315 gpio: zynq: Check return value of pm_runtime_get_sync
In reply to Greg Kroah-HartmanFrom: Srinivas Neeli <[email protected]>
[ Upstream commit a51b2fb94b04ab71e53a71b9fad03fa826941254 ]
Return value of "pm_runtime_get_sync" API was neither captured nor checked. Fixed it by capturing the return value and then checking for any warning.
Addresses-Coverity: "check_return"
--- drivers/gpio/gpio-zynq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpio/gpio-zynq.c +4 -1
@@ -900,8 +900,11 @@ err_pm_dis:static int zynq_gpio_remove (struct platform_device *pdev) {struct zynq_gpio *gpio =platform_get_drvdata (pdev); +int ret; -pm_runtime_get_sync (&pdev->dev); + ret =pm_runtime_get_sync (&pdev->dev); +if (ret <0 ) +dev_warn (&pdev->dev,"pm_runtime_get_sync() Failed\n" );gpiochip_remove (&gpio->chip);clk_disable_unprepare (gpio->clk);device_set_wakeup_capable (&pdev->dev,0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 253/315 ALSA: ppc: fix error return code in snd_pmac_probe()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 80b9c1be567c3c6bbe0d4b290af578e630485b5d ]
If snd_pmac_tumbler_init() or snd_pmac_tumbler_post_init() fails, snd_pmac_probe() need return error code.
--- sound/ppc/powermac.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/ppc/powermac.c +5 -1
@@ -90,7 +90,11 @@ static int snd_pmac_probe(struct platform_device *devptr)sprintf (card->shortname,"PowerMac %s" , name_ext);sprintf (card->longname,"%s (Dev %d) Sub-frame %d" , card->shortname, chip->device_id, chip->subframe); -if (snd_pmac_tumbler_init (chip) <0 ||snd_pmac_tumbler_post_init () <0 ) + err =snd_pmac_tumbler_init (chip); +if (err <0 ) + goto __error; + err =snd_pmac_tumbler_post_init (); +if (err <0 ) goto __error;break ;case PMAC_AWACS :
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 254/315 selftests/powerpc: Fix "no_handler" EBB selftest
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 45677c9aebe926192e59475b35a1ff35ff2d4217 ]
The "no_handler_test" in ebb selftests attempts to read the PMU registers twice via helper function "dump_ebb_state". First dump is just before closing of event and the second invocation is done after closing of the event. The original intention of second dump_ebb_state was to dump the state of registers at the end of the test when the counters are frozen. But this will be achieved with the first call itself since sample period is set to low value and PMU will be frozen by then. Hence patch removes the dump which was done before closing of the event.
--- tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c | 2 -- 1 file changed, 2 deletions(-)
tools/testing/selftests/powerpc/pmu/ebb/no_handler_test.c +0 -2
@@ -50,8 +50,6 @@ static int no_handler_test(void)event_close (&event); -dump_ebb_state (); -/* The real test is that we never took an EBB at 0x0 */ return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 255/315 ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 7d3865a10b9ff2669c531d5ddd60bf46b3d48f1e ]
When devm_kcalloc() fails, the error code -ENOMEM should be returned instead of -EINVAL.
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -4046,7 +4046,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,if (!routes) {dev_err (card->dev,"ASoC: Could not allocate DAPM route table\n" ); -return -EINVAL ; +return -ENOMEM ; }for (i =0 ; i < num_routes; i++) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 256/315 ALSA: bebob: add support for ToneWeal FW66
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 50ebe56222bfa0911a932930f9229ee5995508d9 ]
A user of FFADO project reported the issue of ToneWeal FW66. As a result, the device is identified as one of applications of BeBoB solution.
I note that in the report the device returns contradictory result in plug discovery process for audio subunit. Fortunately ALSA BeBoB driver doesn't perform it thus it's likely to handle the device without issues.
I receive no reaction to test request for this patch yet, however it would be worth to add support for it.
daniel@gibbonmoon:/sys/bus/firewire/devices/fw1$ grep -r . * Binary file config_rom matches dev:244:1 guid:0x0023270002000000 hardware_version:0x000002 is_local:0 model:0x020002 model_name:FW66 power/runtime_active_time:0 power/runtime_active_kids:0 power/runtime_usage:0 power/runtime_status:unsupported power/async:disabled power/runtime_suspended_time:0 power/runtime_enabled:disabled power/control:auto subsystem/drivers_autoprobe:1 uevent:MAJOR=244 uevent:MINOR=1 uevent:DEVNAME=fw1 units:0x00a02d:0x010001 vendor:0x002327 vendor_name:ToneWeal fw1.0/uevent:MODALIAS=ieee1394:ven00002327mo00020002sp0000A02Dver00010001 fw1.0/power/runtime_active_time:0 fw1.0/power/runtime_active_kids:0 fw1.0/power/runtime_usage:0 fw1.0/power/runtime_status:unsupported fw1.0/power/async:disabled fw1.0/power/runtime_suspended_time:0 fw1.0/power/runtime_enabled:disabled fw1.0/power/control:auto fw1.0/model:0x020002 fw1.0/rom_index:15 fw1.0/specifier_id:0x00a02d fw1.0/model_name:FW66 fw1.0/version:0x010001 fw1.0/modalias:ieee1394:ven00002327mo00020002sp0000A02Dver00010001
Cc: Daniel Jozsef <[email protected]>
Reference: https://lore.kernel.org/alsa-devel/20200119164335.GA11974@workstation/
--- sound/firewire/Kconfig | 1 + sound/firewire/bebob/bebob.c | 3 +++ 2 files changed, 4 insertions(+)
sound/firewire/Kconfig +1 -0
@@ -109,6 +109,7 @@ config SND_BEBOB * M-Audio Ozonic/NRV10/ProfireLightBridge * M-Audio FireWire 1814/ProjectMix IO * Digidesign Mbox 2 Pro + * ToneWeal FW66 To compile this driver as a module, choose M here: the module will be called snd-bebob.
sound/firewire/bebob/bebob.c +3 -0
@@ -60,6 +60,7 @@ static DECLARE_BITMAP(devices_used, SNDRV_CARDS);#define VEN_MAUDIO1 0x00000d6c#define VEN_MAUDIO2 0x000007f5#define VEN_DIGIDESIGN 0x00a07e +#define OUI_SHOUYO 0x002327#define MODEL_FOCUSRITE_SAFFIRE_BOTH 0x00000000#define MODEL_MAUDIO_AUDIOPHILE_BOTH 0x00010060
@@ -513,6 +514,8 @@ static const struct ieee1394_device_id bebob_id_table[] = { &maudio_special_spec),/* Digidesign Mbox 2 Pro */ SND_BEBOB_DEV_ENTRY (VEN_DIGIDESIGN ,0x0000a9 , &spec_normal), +// Toneweal FW66. + SND_BEBOB_DEV_ENTRY(OUI_SHOUYO, 0x020002, &spec_normal),/* IDs are unknown but able to be supported */ /* Apogee, Mini-ME Firewire */ /* Apogee, Mini-DAC Firewire */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 257/315 usb: gadget: f_hid: fix endianness issue with descriptors
In reply to Greg Kroah-HartmanFrom: Ruslan Bilovol <[email protected]>
[ Upstream commit 33cb46c4676d01956811b68a29157ea969a5df70 ]
Running sparse checker it shows warning message about incorrect endianness used for descriptor initialization:
| f_hid.c:91:43: warning: incorrect type in initializer (different base types) | f_hid.c:91:43: expected restricted __le16 [usertype] bcdHID | f_hid.c:91:43: got int
Fixing issue with cpu_to_le16() macro, however this is not a real issue as the value is the same both endians.
--- drivers/usb/gadget/function/f_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_hid.c +1 -1
@@ -92,7 +92,7 @@ static struct usb_interface_descriptor hidg_interface_desc = {static struct hid_descriptor hidg_desc = { .bLength =sizeof hidg_desc, .bDescriptorType =HID_DT_HID , - .bcdHID =0x0101 , + .bcdHID =cpu_to_le16 (0x0101 ), .bCountryCode =0x00 , .bNumDescriptors =0x1 ,/*.desc[0].bDescriptorType = DYNAMIC */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 258/315 usb: gadget: hid: fix error return code in hid_bind()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 88693f770bb09c196b1eb5f06a484a254ecb9924 ]
Fix to return a negative error code from the error handling case instead of 0.
--- drivers/usb/gadget/legacy/hid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/gadget/legacy/hid.c +3 -1
@@ -175,8 +175,10 @@ static int hid_bind(struct usb_composite_dev *cdev)struct usb_descriptor_header *usb_desc; usb_desc =usb_otg_descriptor_alloc (gadget); -if (!usb_desc) +if (!usb_desc) { + status = -ENOMEM ; goto put; + }usb_otg_descriptor_init (gadget, usb_desc); otg_desc[0 ] = usb_desc; otg_desc[1 ] =NULL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 259/315 powerpc/boot: Fixup device-tree on little endian
In reply to Greg Kroah-HartmanFrom: Benjamin Herrenschmidt <[email protected]>
[ Upstream commit c93f80849bdd9b45d834053ae1336e28f0026c84 ]
This fixes the core devtree.c functions and the ns16550 UART backend.
--- arch/powerpc/boot/devtree.c | 59 +++++++++++++++++++++---------------- arch/powerpc/boot/ns16550.c | 9 ++++-- 2 files changed, 41 insertions(+), 27 deletions(-)
arch/powerpc/boot/devtree.c +34 -25
@@ -17,6 +17,7 @@#include "string.h" #include "stdio.h" #include "ops.h" +#include "of.h" void dt_fixup_memory (u64 start,u64 size) {
@@ -27,21 +28,25 @@ void dt_fixup_memory(u64 start, u64 size) root =finddevice ("/" );if (getprop (root,"#address-cells" , &naddr,sizeof (naddr)) <0 ) naddr =2 ; +else + naddr =be32_to_cpu (naddr);if (naddr <1 || naddr >2 )fatal ("Can't cope with #address-cells == %d in /\n\r" , naddr);if (getprop (root,"#size-cells" , &nsize,sizeof (nsize)) <0 ) nsize =1 ; +else + nsize =be32_to_cpu (nsize);if (nsize <1 || nsize >2 )fatal ("Can't cope with #size-cells == %d in /\n\r" , nsize); i =0 ;if (naddr ==2 ) - memreg[i++] = start >>32 ; - memreg[i++] = start &0xffffffff ; + memreg[i++] =cpu_to_be32 (start >>32 ); + memreg[i++] =cpu_to_be32 (start &0xffffffff );if (nsize ==2 ) - memreg[i++] = size >>32 ; - memreg[i++] = size &0xffffffff ; + memreg[i++] =cpu_to_be32 (size >>32 ); + memreg[i++] =cpu_to_be32 (size &0xffffffff ); memory =finddevice ("/memory" );if (! memory) {
@@ -49,9 +54,9 @@ void dt_fixup_memory(u64 start, u64 size)setprop_str (memory,"device_type" ,"memory" ); } -printf ("Memory <- <0x%x" , memreg[0 ]); +printf ("Memory <- <0x%x" ,be32_to_cpu (memreg[0 ]));for (i =1 ; i < (naddr + nsize); i++) -printf (" 0x%x" , memreg[i]); +printf (" 0x%x" ,be32_to_cpu (memreg[i]));printf ("> (%ldMB)\n\r" , (unsigned long )(size >>20 ));setprop (memory,"reg" , memreg, (naddr + nsize)*sizeof (u32));
@@ -69,10 +74,10 @@ void dt_fixup_cpu_clocks(u32 cpu, u32 tb, u32 bus)printf ("CPU bus-frequency <- 0x%x (%dMHz)\n\r" , bus,MHZ (bus));while ((devp =find_node_by_devtype (devp,"cpu" ))) { -setprop_val (devp,"clock-frequency" , cpu); -setprop_val (devp,"timebase-frequency" , tb); +setprop_val (devp,"clock-frequency" ,cpu_to_be32 (cpu)); +setprop_val (devp,"timebase-frequency" ,cpu_to_be32 (tb));if (bus >0 ) -setprop_val (devp,"bus-frequency" , bus); +setprop_val (devp,"bus-frequency" ,cpu_to_be32 (bus)); } timebase_period_ns =1000000000 / tb;
@@ -84,7 +89,7 @@ void dt_fixup_clock(const char *path, u32 freq)if (devp) {printf ("%s: clock-frequency <- %x (%dMHz)\n\r" , path, freq,MHZ (freq)); -setprop_val (devp,"clock-frequency" , freq); +setprop_val (devp,"clock-frequency" ,cpu_to_be32 (freq)); } }
@@ -137,8 +142,12 @@ void dt_get_reg_format(void *node, u32 *naddr, u32 *nsize) {if (getprop (node,"#address-cells" , naddr,4 ) !=4 ) *naddr =2 ; +else + *naddr =be32_to_cpu (*naddr);if (getprop (node,"#size-cells" , nsize,4 ) !=4 ) *nsize =1 ; +else + *nsize =be32_to_cpu (*nsize); }static void copy_val (u32 *dest,u32 *src,int naddr)
@@ -167,9 +176,9 @@ static int add_reg(u32 *reg, u32 *add, int naddr)int i, carry =0 ;for (i =MAX_ADDR_CELLS -1 ; i >=MAX_ADDR_CELLS - naddr; i--) { -u64 tmp = (u64 )reg[i] + add[i] + carry; +u64 tmp = (u64 )be32_to_cpu (reg[i]) +be32_to_cpu (add[i]) + carry; carry = tmp >>32 ; - reg[i] = (u32 )tmp; + reg[i] =cpu_to_be32 ((u32 )tmp); }return !carry;
@@ -184,18 +193,18 @@ static int compare_reg(u32 *reg, u32 *range, u32 *rangesize)u32 end;for (i =0 ; i <MAX_ADDR_CELLS ; i++) { -if (reg[i] < range[i]) +if (be32_to_cpu (reg[i]) <be32_to_cpu (range[i]))return 0 ; -if (reg[i] > range[i]) +if (be32_to_cpu (reg[i]) >be32_to_cpu (range[i]))break ; }for (i =0 ; i <MAX_ADDR_CELLS ; i++) { - end = range[i] + rangesize[i]; + end =be32_to_cpu (range[i]) +be32_to_cpu (rangesize[i]); -if (reg[i] < end) +if (be32_to_cpu (reg[i]) < end)break ; -if (reg[i] > end) +if (be32_to_cpu (reg[i]) > end)return 0 ; }
@@ -244,7 +253,6 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,return 0 ;dt_get_reg_format (parent, &naddr, &nsize); -if (nsize >2 )return 0 ;
@@ -256,10 +264,10 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,copy_val (last_addr, prop_buf + offset, naddr); - ret_size = prop_buf[offset + naddr]; + ret_size =be32_to_cpu (prop_buf[offset + naddr]);if (nsize ==2 ) { ret_size <<=32 ; - ret_size |= prop_buf[offset + naddr +1 ]; + ret_size |=be32_to_cpu (prop_buf[offset + naddr +1 ]); }for (;;) {
@@ -282,7 +290,6 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr, offset =find_range (last_addr, prop_buf, prev_naddr, naddr, prev_nsize, buflen /4 ); -if (offset <0 )return 0 ;
@@ -300,8 +307,7 @@ static int dt_xlate(void *node, int res, int reglen, unsigned long *addr,if (naddr >2 )return 0 ; - ret_addr = ((u64 )last_addr[2 ] <<32 ) | last_addr[3 ]; - + ret_addr = ((u64 )be32_to_cpu (last_addr[2 ]) <<32 ) |be32_to_cpu (last_addr[3 ]);if (sizeof (void *) ==4 && (ret_addr >=0x100000000ULL || ret_size >0x100000000ULL || ret_addr + ret_size >0x100000000ULL ))
@@ -354,11 +360,14 @@ int dt_is_compatible(void *node, const char *compat)int dt_get_virtual_reg (void *node,void **addr,int nres) {unsigned long xaddr; -int n; +int n, i; n =getprop (node,"virtual-reg" , addr, nres *4 ); -if (n >0 ) +if (n >0 ) { +for (i =0 ; i < n/4 ; i ++) + ((u32 *)addr)[i] =be32_to_cpu (((u32 *)addr)[i]);return n /4 ; + }for (n =0 ; n < nres; n++) {if (!dt_xlate_reg (node, n, &xaddr,NULL ))
arch/powerpc/boot/ns16550.c +7 -2
@@ -15,6 +15,7 @@#include "stdio.h" #include "io.h" #include "ops.h" +#include "of.h" #define UART_DLL 0/* Out: Divisor Latch Low */ #define UART_DLM 1/* Out: Divisor Latch High */
@@ -58,16 +59,20 @@ int ns16550_console_init(void *devp, struct serial_console_data *scdp)int n;u32 reg_offset; -if (dt_get_virtual_reg (devp, (void **)®_base,1 ) <1 ) +if (dt_get_virtual_reg (devp, (void **)®_base,1 ) <1 ) { +printf ("virt reg parse fail...\r\n" );return -1 ; + } n =getprop (devp,"reg-offset" , ®_offset,sizeof (reg_offset));if (n ==sizeof (reg_offset)) - reg_base += reg_offset; + reg_base +=be32_to_cpu (reg_offset); n =getprop (devp,"reg-shift" , ®_shift,sizeof (reg_shift));if (n !=sizeof (reg_shift)) reg_shift =0 ; +else + reg_shift =be32_to_cpu (reg_shift); scdp->open = ns16550_open; scdp->putc = ns16550_putc;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 260/315 backlight: lm3630a: Fix return code of .update_status() callback
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit b9481a667a90ec739995e85f91f3672ca44d6ffa ]
According to <linux/backlight.h> .update_status() is supposed to return 0 on success and a negative error code otherwise. Adapt lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() to actually do it.
While touching that also add the error code to the failure message.
--- drivers/video/backlight/lm3630a_bl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/backlight/lm3630a_bl.c +6 -6
@@ -184,7 +184,7 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)if ((pwm_ctrl &LM3630A_PWM_BANK_A ) !=0 ) {lm3630a_pwm_ctrl (pchip, bl->props.brightness, bl->props.max_brightness); -return bl->props.brightness; +return 0 ; }/* disable sleep */
@@ -204,8 +204,8 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)return 0 ; out_i2c_err: -dev_err (pchip->dev,"i2c failed to access\n" ); -return bl->props.brightness; +dev_err (pchip->dev,"i2c failed to access (%pe)\n" ,ERR_PTR (ret)); +return ret; }static int lm3630a_bank_a_get_brightness (struct backlight_device *bl)
@@ -261,7 +261,7 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)if ((pwm_ctrl &LM3630A_PWM_BANK_B ) !=0 ) {lm3630a_pwm_ctrl (pchip, bl->props.brightness, bl->props.max_brightness); -return bl->props.brightness; +return 0 ; }/* disable sleep */
@@ -281,8 +281,8 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)return 0 ; out_i2c_err: -dev_err (pchip->dev,"i2c failed to access REG_CTRL\n" ); -return bl->props.brightness; +dev_err (pchip->dev,"i2c failed to access (%pe)\n" ,ERR_PTR (ret)); +return ret; }static int lm3630a_bank_b_get_brightness (struct backlight_device *bl)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 261/315 ALSA: hda: Add IRQ check for platform_get_irq()
In reply to Greg Kroah-HartmanFrom: Jiajun Cao <[email protected]>
[ Upstream commit 8c13212443230d03ff25014514ec0d53498c0912 ]
The function hda_tegra_first_init() neglects to check the return value after executing platform_get_irq().
hda_tegra_first_init() should check the return value (if negative error number) for errors so as to not pass a negative value to the devm_request_irq().
Fix it by adding a check for the return value irq_id.
--- sound/pci/hda/hda_tegra.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_tegra.c +3 -0
@@ -363,6 +363,9 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev)unsigned short gcap;int irq_id =platform_get_irq (pdev,0 ); +if (irq_id <0 ) +return irq_id; + err =hda_tegra_init_chip (chip, pdev);if (err)return err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 262/315 staging: rtl8723bs: fix macro value for 2.4Ghz only device
In reply to Greg Kroah-HartmanFrom: Fabio Aiuto <[email protected]>
[ Upstream commit 6d490a27e23c5fb79b766530016ab8665169498e ]
fix IQK_Matrix_Settings_NUM macro value to 14 which is the max channel number value allowed in a 2.4Ghz device.
--- drivers/staging/rtl8723bs/hal/odm.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/odm.h +1 -4
@@ -209,10 +209,7 @@ typedef struct _ODM_RATE_ADAPTIVE {#define AVG_THERMAL_NUM 8#define IQK_Matrix_REG_NUM 8 -#define IQK_Matrix_Settings_NUM (14 + 24 + 21)/* Channels_2_4G_NUM -* + Channels_5G_20M_NUM -* + Channels_5G -*/ +#define IQK_Matrix_Settings_NUM 14/* Channels_2_4G_NUM */ #define DM_Type_ByFW 0#define DM_Type_ByDriver 1
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 263/315 intel_th: Wait until port is in reset before programming it
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
[ Upstream commit ab1afed701d2db7eb35c1a2526a29067a38e93d1 ]
Some devices don't drain their pipelines if we don't make sure that the corresponding output port is in reset before programming it for a new trace capture, resulting in bits of old trace appearing in the new trace capture. Fix that by explicitly making sure the reset is asserted before programming new trace capture.
--- drivers/hwtracing/intel_th/core.c | 17 +++++++++++++++++ drivers/hwtracing/intel_th/gth.c | 16 ++++++++++++++++ drivers/hwtracing/intel_th/intel_th.h | 3 +++ 3 files changed, 36 insertions(+)
drivers/hwtracing/intel_th/core.c +17 -0
@@ -223,6 +223,22 @@ static ssize_t port_show(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RO (port); +static void intel_th_trace_prepare (struct intel_th_device *thdev) +{ +struct intel_th_device *hub =to_intel_th_hub (thdev); +struct intel_th_driver *hubdrv =to_intel_th_driver (hub->dev.driver); + +if (hub->type !=INTEL_TH_SWITCH ) +return ; + +if (thdev->type !=INTEL_TH_OUTPUT ) +return ; + +pm_runtime_get_sync (&thdev->dev); + hubdrv->prepare (hub, &thdev->output); +pm_runtime_put (&thdev->dev); +} +static int intel_th_output_activate (struct intel_th_device *thdev) { struct intel_th_driver *thdrv =
@@ -243,6 +259,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev)if (ret) goto fail_put; +intel_th_trace_prepare (thdev);if (thdrv->activate) ret = thdrv->activate (thdev);else
drivers/hwtracing/intel_th/gth.c +16 -0
@@ -521,6 +521,21 @@ static void gth_tscu_resync(struct gth_device *gth)iowrite32 (reg, gth->base +REG_TSCU_TSUCTRL ); } +static void intel_th_gth_prepare (struct intel_th_device *thdev, +struct intel_th_output *output) +{ +struct gth_device *gth =dev_get_drvdata (&thdev->dev); +int count; + +/* +* Wait until the output port is in reset before we start +* programming it. +*/ +for (count =GTH_PLE_WAITLOOP_DEPTH ; + count && !(gth_output_get (gth, output->port) &BIT (5 )); count--) +cpu_relax (); +} +/** * intel_th_gth_enable() - enable tracing to an output device * @thdev: GTH device
@@ -742,6 +757,7 @@ static struct intel_th_driver intel_th_gth_driver = { .assign = intel_th_gth_assign, .unassign = intel_th_gth_unassign, .set_output = intel_th_gth_set_output, + .prepare = intel_th_gth_prepare, .enable = intel_th_gth_enable, .disable = intel_th_gth_disable, .driver = {
drivers/hwtracing/intel_th/intel_th.h +3 -0
@@ -140,6 +140,7 @@ intel_th_output_assigned(struct intel_th_device *thdev)* @remove: remove method * @assign: match a given output type device against available outputs * @unassign: deassociate an output type device from an output port +* @prepare: prepare output port for tracing * @enable: enable tracing for a given output device * @disable: disable tracing for a given output device * @irq: interrupt callback
@@ -161,6 +162,8 @@ struct intel_th_driver { struct intel_th_device *othdev);void (*unassign)(struct intel_th_device *thdev,struct intel_th_device *othdev); +void (*prepare)(struct intel_th_device *thdev, +struct intel_th_output *output);void (*enable)(struct intel_th_device *thdev,struct intel_th_output *output); void (*disable)(struct intel_th_device *thdev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 264/315 i2c: core: Disable client irq on reboot/shutdown
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit b64210f2f7c11c757432ba3701d88241b2b98fb1 ]
If an i2c client receives an interrupt during reboot or shutdown it may be too late to service it by making an i2c transaction on the bus because the i2c controller has already been shutdown. This can lead to system hangs if the i2c controller tries to make a transfer that is doomed to fail because the access to the i2c pins is already shut down, or an iommu translation has been torn down so i2c controller register access doesn't work.
Let's simply disable the irq if there isn't a shutdown callback for an i2c client when there is an irq associated with the device. This will make sure that irqs don't come in later than the time that we can handle it. We don't do this if the i2c client device already has a shutdown callback because presumably they're doing the right thing and quieting the device so irqs don't come in after the shutdown callback returns.
[[email protected]: Dropped newline, added commit text, added interrupt.h for robot build error]
--- drivers/i2c/i2c-core-base.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i2c/i2c-core-base.c +3 -0
@@ -31,6 +31,7 @@#include <linux/i2c.h> #include <linux/idr.h> #include <linux/init.h> +#include <linux/interrupt.h> #include <linux/irqflags.h> #include <linux/jump_label.h> #include <linux/kernel.h>
@@ -452,6 +453,8 @@ static void i2c_device_shutdown(struct device *dev) driver =to_i2c_driver (dev->driver);if (driver->shutdown) driver->shutdown (client); +else if (client->irq >0 ) +disable_irq (client->irq); }static void i2c_client_dev_release (struct device *dev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 265/315 lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
In reply to Greg Kroah-HartmanFrom: Dimitri John Ledkov <[email protected]>
[ Upstream commit 2c484419efc09e7234c667aa72698cb79ba8d8ed ]
lz4 compatible decompressor is simple. The format is underspecified and relies on EOF notification to determine when to stop. Initramfs buffer format[1] explicitly states that it can have arbitrary number of zero padding. Thus when operating without a fill function, be extra careful to ensure that sizes less than 4, or apperantly empty chunksizes are treated as EOF.
To test this I have created two cpio initrds, first a normal one, main.cpio. And second one with just a single /test-file with content "second" second.cpio. Then i compressed both of them with gzip, and with lz4 -l. Then I created a padding of 4 bytes (dd if=/dev/zero of=pad4 bs=1 count=4). To create four testcase initrds:
1) main.cpio.gzip + extra.cpio.gzip = pad0.gzip
2) main.cpio.lz4 + extra.cpio.lz4 = pad0.lz4
3) main.cpio.gzip + pad4 + extra.cpio.gzip = pad4.gzip
4) main.cpio.lz4 + pad4 + extra.cpio.lz4 = pad4.lz4
The pad4 test-cases replicate the initrd load by grub, as it pads and aligns every initrd it loads.
All of the above boot, however /test-file was not accessible in the initrd for the testcase #4, as decoding in lz4 decompressor failed. Also an error message printed which usually is harmless.
Whith a patched kernel, all of the above testcases now pass, and /test-file is accessible.
This fixes lz4 initrd decompress warning on every boot with grub. And more importantly this fixes inability to load multiple lz4 compressed initrds with grub. This patch has been shipping in Ubuntu kernels since January 2021.
[1] ./Documentation/driver-api/early-userspace/buffer-format.rst
--- lib/decompress_unlz4.c | 8 ++++++++ 1 file changed, 8 insertions(+)
lib/decompress_unlz4.c +8 -0
@@ -115,6 +115,9 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,error ("data corrupted" ); goto exit_2; } + }else if (size <4 ) { +/* empty or end-of-file */ + goto exit_3; } chunksize =get_unaligned_le32 (inp);
@@ -128,6 +131,10 @@ STATIC inline int INIT unlz4(u8 *input, long in_len,continue ; } +if (!fill && chunksize ==0 ) { +/* empty or end-of-file */ + goto exit_3; + }if (posp) *posp +=4 ;
@@ -187,6 +194,7 @@ STATIC inline int INIT unlz4(u8 *input, long in_len, } } +exit_3: ret =0 ; exit_2:if (!input)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 266/315 pwm: spear: Dont modify HW state in .remove callback
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit b601a18f12383001e7a8da238de7ca1559ebc450 ]
A consumer is expected to disable a PWM before calling pwm_put(). And if they didn't there is hopefully a good reason (or the consumer needs fixing). Also if disabling an enabled PWM was the right thing to do, this should better be done in the framework instead of in each low level driver.
So drop the hardware modification from the .remove() callback.
--- drivers/pwm/pwm-spear.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/pwm/pwm-spear.c +0 -4
@@ -231,10 +231,6 @@ static int spear_pwm_probe(struct platform_device *pdev)static int spear_pwm_remove (struct platform_device *pdev) {struct spear_pwm_chip *pc =platform_get_drvdata (pdev); -int i; - -for (i =0 ; i <NUM_PWM ; i++) -pwm_disable (&pc->chip.pwms[i]);/* clk was prepared in probe, hence unprepare it here */ clk_unprepare (pc->clk);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 267/315 power: supply: ab8500: Avoid NULL pointers
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit 5bcb5087c9dd3dca1ff0ebd8002c5313c9332b56 ]
Sometimes the code will crash because we haven't enabled AC or USB charging and thus not created the corresponding psy device. Fix it by checking that it is there before notifying.
--- drivers/power/supply/ab8500_charger.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/power/supply/ab8500_charger.c +17 -1
@@ -409,6 +409,14 @@ disable_otp:static void ab8500_power_supply_changed (struct ab8500_charger *di,struct power_supply *psy) { +/* +* This happens if we get notifications or interrupts and +* the platform has been configured not to support one or +* other type of charging. +*/ +if (!psy) +return ; +if (di->autopower_cfg) { if (!di->usb.charger_connected && !di->ac.charger_connected &&
@@ -435,7 +443,15 @@ static void ab8500_charger_set_usb_connected(struct ab8500_charger *di,if (!connected) di->flags.vbus_drop_end = false; -sysfs_notify (&di->usb_chg.psy->dev.kobj,NULL ,"present" ); +/* +* Sometimes the platform is configured not to support +* USB charging and no psy has been created, but we still +* will get these notifications. +*/ +if (di->usb_chg.psy) { +sysfs_notify (&di->usb_chg.psy->dev.kobj,NULL , +"present" ); + }if (connected) {mutex_lock (&di->charger_attached_mutex);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 268/315 power: supply: max17042: Do not enforce (incorrect) interrupt trigger type
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 7fbf6b731bca347700e460d94b130f9d734b33e9 ]
Interrupt line can be configured on different hardware in different way, even inverted. Therefore driver should not enforce specific trigger type - edge falling - but instead rely on Devicetree to configure it.
The Maxim 17047/77693 datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU therefore the edge falling is not correct.
The interrupt line is shared between PMIC and RTC driver, so using level sensitive interrupt is here especially important to avoid races. With an edge configuration in case if first PMIC signals interrupt followed shortly after by the RTC, the interrupt might not be yet cleared/acked thus the second one would not be noticed.
--- drivers/power/supply/max17042_battery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +1 -1
@@ -1051,7 +1051,7 @@ static int max17042_probe(struct i2c_client *client, }if (client->irq) { -unsigned int flags =IRQF_TRIGGER_FALLING |IRQF_ONESHOT ; +unsigned int flags =IRQF_ONESHOT ;/* * On ACPI systems the IRQ may be handled by ACPI-event code,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 269/315 power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit ed3443fb4df4e140a22f65144546c8a8e1e27f4e ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/reset/gpio-poweroff.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/reset/gpio-poweroff.c +1 -0
@@ -84,6 +84,7 @@ static const struct of_device_id of_gpio_poweroff_match[] = { { .compatible = "gpio-poweroff", }, {}, }; +MODULE_DEVICE_TABLE (of, of_gpio_poweroff_match);static struct platform_driver gpio_poweroff_driver = { .probe = gpio_poweroff_probe,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 270/315 ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
[ Upstream commit 8b95a7d90ce8160ac5cffd5bace6e2eba01a871e ]
There's a few instructions that GAS infers operands but Clang doesn't; from what I can tell the Arm ARM doesn't say these are optional.
F5.1.257 TBB, TBH T1 Halfword variant
F5.1.238 STREXD T1 variant
F5.1.84 LDREXD T1 variant
--- arch/arm/probes/kprobes/test-thumb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm/probes/kprobes/test-thumb.c +5 -5
@@ -444,21 +444,21 @@ void kprobe_thumb32_test_cases(void) "3: mvn r0, r0 \n\t" "2: nop \n\t") - TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,"]", + TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,", lsl #1]", "9: \n\t" ".short (2f-1b-4)>>1 \n\t" ".short (3f-1b-4)>>1 \n\t" "3: mvn r0, r0 \n\t" "2: nop \n\t") - TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,"]", + TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,", lsl #1]", "9: \n\t" ".short (2f-1b-4)>>1 \n\t" ".short (3f-1b-4)>>1 \n\t" "3: mvn r0, r0 \n\t" "2: nop \n\t") -TEST_RRX ("tbh [r" ,1 ,9f ,", r" ,14 ,1 ,"]" , +TEST_RRX ("tbh [r" ,1 ,9f ,", r" ,14 ,1 ,", lsl #1]" ,"9: \n\t" ".short (2f-1b-4)>>1 \n\t" ".short (3f-1b-4)>>1 \n\t"
@@ -471,10 +471,10 @@ void kprobe_thumb32_test_cases(void) TEST_UNSUPPORTED("strexb r0, r1, [r2]") TEST_UNSUPPORTED("strexh r0, r1, [r2]") - TEST_UNSUPPORTED("strexd r0, r1, [r2]") + TEST_UNSUPPORTED("strexd r0, r1, r2, [r2]") TEST_UNSUPPORTED("ldrexb r0, [r1]") TEST_UNSUPPORTED("ldrexh r0, [r1]") - TEST_UNSUPPORTED("ldrexd r0, [r1]") + TEST_UNSUPPORTED("ldrexd r0, r1, [r1]")TEST_GROUP ("Data-processing (shifted register) and (modified immediate)" )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 271/315 watchdog: Fix possible use-after-free in wdt_startup()
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit c08a6b31e4917034f0ed0cb457c3bb209576f542 ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/watchdog/sbc60xxwdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sbc60xxwdt.c +1 -1
@@ -152,7 +152,7 @@ static void wdt_startup(void)static void wdt_turnoff (void ) {/* Stop the timer */ -del_timer (&timer); +del_timer_sync (&timer);inb_p (wdt_stop);pr_info ("Watchdog timer is now disabled...\n" ); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 272/315 watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit 90b7c141132244e8e49a34a4c1e445cce33e07f4 ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/watchdog/sc520_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/sc520_wdt.c +1 -1
@@ -190,7 +190,7 @@ static int wdt_startup(void)static int wdt_turnoff (void ) {/* Stop the timer */ -del_timer (&timer); +del_timer_sync (&timer);/* Stop the watchdog */ wdt_config (0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 273/315 watchdog: Fix possible use-after-free by calling del_timer_sync()
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit d0212f095ab56672f6f36aabc605bda205e1e0bf ]
This driver's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/watchdog/lpc18xx_wdt.c | 2 +- drivers/watchdog/w83877f_wdt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/watchdog/lpc18xx_wdt.c +1 -1
@@ -300,7 +300,7 @@ static int lpc18xx_wdt_remove(struct platform_device *pdev)struct lpc18xx_wdt_dev *lpc18xx_wdt =platform_get_drvdata (pdev);dev_warn (&pdev->dev,"I quit now, hardware will probably reboot!\n" ); -del_timer (&lpc18xx_wdt->timer); +del_timer_sync (&lpc18xx_wdt->timer);watchdog_unregister_device (&lpc18xx_wdt->wdt_dev);clk_disable_unprepare (lpc18xx_wdt->wdt_clk);
drivers/watchdog/w83877f_wdt.c +1 -1
@@ -170,7 +170,7 @@ static void wdt_startup(void)static void wdt_turnoff (void ) {/* Stop the timer */ -del_timer (&timer); +del_timer_sync (&timer);wdt_change (WDT_DISABLE );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 274/315 watchdog: iTCO_wdt: Account for rebooting on second timeout
In reply to Greg Kroah-HartmanFrom: Jan Kiszka <[email protected]>
[ Upstream commit cb011044e34c293e139570ce5c01aed66a34345c ]
This was already attempted to fix via 1fccb73011ea: If the BIOS did not enable TCO SMIs, the timer definitely needs to trigger twice in order to cause a reboot. If TCO SMIs are on, as well as SMIs in general, we can continue to assume that the BIOS will perform a reboot on the first timeout.
QEMU with its ICH9 and related BIOS falls into the former category, currently taking twice the configured timeout in order to reboot the machine. For iTCO version that fall under turn_SMI_watchdog_clear_off, this is also true and was currently only addressed for v1, irrespective of the turn_SMI_watchdog_clear_off value.
--- drivers/watchdog/iTCO_wdt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/watchdog/iTCO_wdt.c +9 -3
@@ -75,6 +75,8 @@#define TCOBASE (p) ((p)->tco_res->start)/* SMI Control and Enable Register */ #define SMI_EN (p) ((p)->smi_res->start) +#define TCO_EN (1 << 13) +#define GBL_SMI_EN (1 << 0)#define TCO_RLD (p) (TCOBASE(p) + 0x00)/* TCO Timer Reload/Curr. Value */ #define TCOv1_TMR (p) (TCOBASE(p) + 0x01)/* TCOv1 Timer Initial Value*/
@@ -330,8 +332,12 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t) tmrval =seconds_to_ticks (p, t); -/* For TCO v1 the timer counts down twice before rebooting */ -if (p->iTCO_version ==1 ) +/* +* If TCO SMIs are off, the timer counts down twice before rebooting. +* Otherwise, the BIOS generally reboots when the SMI triggers. +*/ +if (p->smi_res && + (SMI_EN (p) & (TCO_EN |GBL_SMI_EN )) != (TCO_EN |GBL_SMI_EN )) tmrval /=2 ;/* from the specs: */
@@ -493,7 +499,7 @@ static int iTCO_wdt_probe(struct platform_device *pdev)* Disables TCO logic generating an SMI# */ val32 =inl (SMI_EN (p)); - val32 &=0xffffdfff ;/* Turn off SMI clearing watchdog */ + val32 &= ~TCO_EN ;/* Turn off SMI clearing watchdog */ outl (val32,SMI_EN (p)); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 275/315 x86/fpu: Return proper error codes from user access functions
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit aee8c67a4faa40a8df4e79316dbfc92d123989c1 ]
When *RSTOR from user memory raises an exception, there is no way to differentiate them. That's bad because it forces the slow path even when the failure was not a fault. If the operation raised eg. #GP then going through the slow path is pointless.
Use _ASM_EXTABLE_FAULT() which stores the trap number and let the exception fixup return the negated trap number as error.
This allows to separate the fast path and let it handle faults directly and avoid the slow path for all other exceptions.
--- arch/x86/include/asm/fpu/internal.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
arch/x86/include/asm/fpu/internal.h +12 -7
@@ -103,6 +103,7 @@ static inline void fpstate_init_fxstate(struct fxregs_state *fx) }extern void fpstate_sanitize_xstate (struct fpu *fpu); +/* Returns 0 or the negated trap number, which results in -EFAULT for #PF */ #define user_insn(insn, output, input...) \ ({ \ int err; \
@@ -110,14 +111,14 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu);might_fault (); \ \ asm volatile(ASM_STAC "\n" \ - "1:" #insn "\n\t" \ + "1: " #insn "\n" \ "2: " ASM_CLAC "\n" \ ".section .fixup,\"ax\"\n" \ - "3: movl $-1,%[err]\n" \ + "3: negl %%eax\n" \ " jmp 2b\n" \ ".previous\n" \ - _ASM_EXTABLE(1b, 3b) \ - : [err] "=r" (err), output \ + _ASM_EXTABLE_FAULT(1b, 3b) \ + : [err] "=a" (err), output \ : "0"(0), input); \ err; \ })
@@ -221,16 +222,20 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu)#define XRSTOR ".byte " REX_PREFIX "0x0f,0xae,0x2f"#define XRSTORS ".byte " REX_PREFIX "0x0f,0xc7,0x1f" +/* +* After this @err contains 0 on success or the negated trap number when +* the operation raises an exception. For faults this results in -EFAULT. +*/ #define XSTATE_OP (op, st, lmask, hmask, err) \ asm volatile("1:" op "\n\t" \ "xor %[err], %[err]\n" \ "2:\n\t" \ ".pushsection .fixup,\"ax\"\n\t" \ - "3: movl $-2,%[err]\n\t" \ + "3: negl %%eax\n\t" \ "jmp 2b\n\t" \ ".popsection\n\t" \ - _ASM_EXTABLE(1b, 3b) \ - : [err] "=r" (err) \ + _ASM_EXTABLE_FAULT(1b, 3b) \ + : [err] "=a" (err) \ : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ : "memory")
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 276/315 orangefs: fix orangefs df output.
In reply to Greg Kroah-HartmanFrom: Mike Marshall <[email protected]>
[ Upstream commit 0fdec1b3c9fbb5e856a40db5993c9eaf91c74a83 ]
Orangefs df output is whacky. Walt Ligon suggested this might fix it. It seems way more in line with reality now...
--- fs/orangefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/orangefs/super.c +1 -1
@@ -197,7 +197,7 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_bavail = (sector_t ) new_op->downcall.resp.statfs.blocks_avail; buf->f_files = (sector_t ) new_op->downcall.resp.statfs.files_total; buf->f_ffree = (sector_t ) new_op->downcall.resp.statfs.files_avail; - buf->f_frsize = sb->s_blocksize; + buf->f_frsize =0 ; out_op_release:op_release (new_op);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 277/315 ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
In reply to Greg Kroah-HartmanFrom: Jeff Layton <[email protected]>
[ Upstream commit 22d41cdcd3cfd467a4af074165357fcbea1c37f5 ]
The checks for page->mapping are odd, as set_page_dirty is an address_space operation, and I don't see where it would be called on a non-pagecache page.
The warning about the page lock also seems bogus. The comment over set_page_dirty() says that it can be called without the page lock in some rare cases. I don't think we want to warn if that's the case.
--- fs/ceph/addr.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
fs/ceph/addr.c +1 -9
@@ -74,10 +74,6 @@ static int ceph_set_page_dirty(struct page *page)struct inode *inode;struct ceph_inode_info *ci;struct ceph_snap_context *snapc; -int ret; - -if (unlikely (!mapping)) -return !TestSetPageDirty (page);if (PageDirty (page)) { dout("%p set_page_dirty %p idx %lu -- already dirty\n",
@@ -123,11 +119,7 @@ static int ceph_set_page_dirty(struct page *page) page->private = (unsigned long )snapc;SetPagePrivate (page); - ret =__set_page_dirty_nobuffers (page); -WARN_ON (!PageLocked (page)); -WARN_ON (!page->mapping); - -return ret; +return __set_page_dirty_nobuffers (page); }/*
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 278/315 NFS: nfs_find_open_context() may only select open files
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit e97bc66377bca097e1f3349ca18ca17f202ff659 ]
If a file has already been closed, then it should not be selected to support further I/O.
--- fs/nfs/inode.c | 4 ++++ include/linux/nfs_fs.h | 1 + 2 files changed, 5 insertions(+)
fs/nfs/inode.c +4 -0
@@ -972,6 +972,7 @@ EXPORT_SYMBOL_GPL(nfs_inode_attach_open_context);void nfs_file_set_open_context (struct file *filp,struct nfs_open_context *ctx) { filp->private_data =get_nfs_open_context (ctx); +set_bit (NFS_CONTEXT_FILE_OPEN , &ctx->flags);if (list_empty (&ctx->list))nfs_inode_attach_open_context (ctx); }
@@ -991,6 +992,8 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_ccontinue ;if ((pos->mode & (FMODE_READ |FMODE_WRITE )) != mode)continue ; +if (!test_bit (NFS_CONTEXT_FILE_OPEN , &pos->flags)) +continue ; ctx =get_nfs_open_context (pos);break ; }
@@ -1005,6 +1008,7 @@ void nfs_file_clear_open_context(struct file *filp)if (ctx) {struct inode *inode =d_inode (ctx->dentry); +clear_bit (NFS_CONTEXT_FILE_OPEN , &ctx->flags);/* * We fatal error on write before. Try to writeback * every page again.
include/linux/nfs_fs.h +1 -0
@@ -77,6 +77,7 @@ struct nfs_open_context {#define NFS_CONTEXT_RESEND_WRITES (1)#define NFS_CONTEXT_BAD (2)#define NFS_CONTEXT_UNLOCK (3) +#define NFS_CONTEXT_FILE_OPEN (4)int error;struct list_head list;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 279/315 power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit 073b5d5b1f9cc94a3eea25279fbafee3f4f5f097 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/supply/charger-manager.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/charger-manager.c +1 -0
@@ -1484,6 +1484,7 @@ static const struct of_device_id charger_manager_match[] = { }, {}, }; +MODULE_DEVICE_TABLE (of, charger_manager_match);static struct charger_desc *of_cm_parse_desc (struct device *dev) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 280/315 power: supply: ab8500: add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit dfe52db13ab8d24857a9840ec7ca75eef800c26c ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/power/supply/ab8500_btemp.c | 1 + drivers/power/supply/ab8500_charger.c | 1 + drivers/power/supply/ab8500_fg.c | 1 + 3 files changed, 3 insertions(+)
drivers/power/supply/ab8500_btemp.c +1 -0
@@ -1177,6 +1177,7 @@ static const struct of_device_id ab8500_btemp_match[] = { { .compatible = "stericsson,ab8500-btemp", }, { }, }; +MODULE_DEVICE_TABLE (of, ab8500_btemp_match);static struct platform_driver ab8500_btemp_driver = { .probe = ab8500_btemp_probe,
drivers/power/supply/ab8500_charger.c +1 -0
@@ -3752,6 +3752,7 @@ static const struct of_device_id ab8500_charger_match[] = { { .compatible = "stericsson,ab8500-charger", }, { }, }; +MODULE_DEVICE_TABLE (of, ab8500_charger_match);static struct platform_driver ab8500_charger_driver = { .probe = ab8500_charger_probe,
drivers/power/supply/ab8500_fg.c +1 -0
@@ -3229,6 +3229,7 @@ static const struct of_device_id ab8500_fg_match[] = { { .compatible = "stericsson,ab8500-fg", }, { }, }; +MODULE_DEVICE_TABLE (of, ab8500_fg_match);static struct platform_driver ab8500_fg_driver = { .probe = ab8500_fg_probe,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 281/315 pwm: tegra: Dont modify HW state in .remove callback
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 86f7fa71cd830d18d7ebcaf719dffd5ddfe1acdd ]
A consumer is expected to disable a PWM before calling pwm_put(). And if they didn't there is hopefully a good reason (or the consumer needs fixing). Also if disabling an enabled PWM was the right thing to do, this should better be done in the framework instead of in each low level driver.
So drop the hardware modification from the .remove() callback.
--- drivers/pwm/pwm-tegra.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/pwm/pwm-tegra.c +0 -13
@@ -245,7 +245,6 @@ static int tegra_pwm_probe(struct platform_device *pdev)static int tegra_pwm_remove (struct platform_device *pdev) {struct tegra_pwm_chip *pc =platform_get_drvdata (pdev); -unsigned int i;int err;if (WARN_ON (!pc))
@@ -255,18 +254,6 @@ static int tegra_pwm_remove(struct platform_device *pdev)if (err <0 )return err; -for (i =0 ; i < pc->chip.npwm; i++) { -struct pwm_device *pwm = &pc->chip.pwms[i]; - -if (!pwm_is_enabled (pwm)) -if (clk_prepare_enable (pc->clk) <0 ) -continue ; - -pwm_writel (pc, i,0 ); - -clk_disable_unprepare (pc->clk); - } -reset_control_assert (pc->rst);clk_disable_unprepare (pc->clk);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 282/315 ACPI: AMBA: Fix resource name in /proc/iomem
In reply to Greg Kroah-HartmanFrom: Liguang Zhang <[email protected]>
[ Upstream commit 7718629432676b5ebd9a32940782fe297a0abf8d ]
In function amba_handler_attach(), dev->res.name is initialized by amba_device_alloc. But when address_found is false, dev->res.name is assigned to null value, which leads to wrong resource name display in /proc/iomem, "<BAD>" is seen for those resources.
--- drivers/acpi/acpi_amba.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/acpi_amba.c +1 -0
@@ -70,6 +70,7 @@ static int amba_handler_attach(struct acpi_device *adev,case IORESOURCE_MEM :if (!address_found) { dev->res = *rentry->res; + dev->res.name =dev_name (&dev->dev); address_found = true; }break ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 283/315 ACPI: video: Add quirk for the Dell Vostro 3350
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 9249c32ec9197e8d34fe5179c9e31668a205db04 ]
The Dell Vostro 3350 ACPI video-bus device reports spurious ACPI_VIDEO_NOTIFY_CYCLE events resulting in spurious KEY_SWITCHVIDEOMODE events being reported to userspace (and causing trouble there).
Add a quirk setting the report_key_events mask to REPORT_BRIGHTNESS_KEY_EVENTS so that the ACPI_VIDEO_NOTIFY_CYCLE events will be ignored, while still reporting brightness up/down hotkey-presses to userspace normally.
--- drivers/acpi/acpi_video.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/acpi_video.c +9 -0
@@ -556,6 +556,15 @@ static const struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), }, }, + { + .callback = video_set_report_key_events, + .driver_data = (void *)((uintptr_t)REPORT_BRIGHTNESS_KEY_EVENTS), + .ident = "Dell Vostro 3350", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3350"), + }, + },/* * Some machines change the brightness themselves when a brightness * hotkey gets pressed, despite us telling them not to. In this case
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 284/315 virtio-blk: Fix memory leak among suspend/resume procedure
In reply to Greg Kroah-HartmanFrom: Xie Yongji <[email protected]>
[ Upstream commit b71ba22e7c6c6b279c66f53ee7818709774efa1f ]
The vblk->vqs should be freed before we call init_vqs() in virtblk_restore().
--- drivers/block/virtio_blk.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/virtio_blk.c +2 -0
@@ -931,6 +931,8 @@ static int virtblk_freeze(struct virtio_device *vdev)blk_mq_quiesce_queue (vblk->disk->queue); vdev->config->del_vqs (vdev); +kfree (vblk->vqs); +return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 285/315 virtio_net: Fix error handling in virtnet_restore()
In reply to Greg Kroah-HartmanFrom: Xie Yongji <[email protected]>
[ Upstream commit 3f2869cace829fb4b80fc53b3ddaa7f4ba9acbf1 ]
Do some cleanups in virtnet_restore() when virtnet_cpu_notif_add() failed.
--- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +4 -1
@@ -2765,8 +2765,11 @@ static __maybe_unused int virtnet_restore(struct virtio_device *vdev)virtnet_set_queues (vi, vi->curr_queue_pairs); err =virtnet_cpu_notif_add (vi); -if (err) +if (err) { +virtnet_freeze_down (vdev); +remove_vq_common (vi);return err; + }return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 286/315 virtio_console: Assure used length from device is limited
In reply to Greg Kroah-HartmanFrom: Xie Yongji <[email protected]>
[ Upstream commit d00d8da5869a2608e97cfede094dfc5e11462a46 ]
The buf->len might come from an untrusted device. This ensures the value would not exceed the size of the buffer to avoid data corruption or loss.
--- drivers/char/virtio_console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/virtio_console.c +2 -2
@@ -489,7 +489,7 @@ static struct port_buffer *get_inbuf(struct port *port) buf =virtqueue_get_buf (port->in_vq, &len);if (buf) { - buf->len = len; + buf->len =min_t (size_t, len, buf->size); buf->offset =0 ; port->stats.bytes_received += len; }
@@ -1755,7 +1755,7 @@ static void control_work_handler(struct work_struct *work)while ((buf =virtqueue_get_buf (vq, &len))) {spin_unlock (&portdev->c_ivq_lock); - buf->len = len; + buf->len =min_t (size_t, len, buf->size); buf->offset =0 ;handle_control_message (vq->vdev, portdev, buf);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 287/315 f2fs: add MODULE_SOFTDEP to ensure crc32 is included in the initramfs
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 0dd571785d61528d62cdd8aa49d76bc6085152fe ]
As marcosfrm reported in bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=213089
Initramfs generators rely on "pre" softdeps (and "depends") to include additional required modules.
F2FS does not declare "pre: crc32" softdep. Then every generator (dracut, mkinitcpio...) has to maintain a hardcoded list for this purpose.
Hence let's use MODULE_SOFTDEP("pre: crc32") in f2fs code.
--- fs/f2fs/super.c | 1 + 1 file changed, 1 insertion(+)
fs/f2fs/super.c +1 -0
@@ -2896,4 +2896,5 @@ module_exit(exit_f2fs_fs)MODULE_AUTHOR ("Samsung Electronics's Praesto Team" );MODULE_DESCRIPTION ("Flash Friendly File System" );MODULE_LICENSE ("GPL" ); +MODULE_SOFTDEP ("pre: crc32" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 288/315 PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun
In reply to Greg Kroah-HartmanFrom: Krzysztof Wilczyński <[email protected]>
[ Upstream commit bdcdaa13ad96f1a530711c29e6d4b8311eff767c ]
"utf16s_to_utf8s(..., buf, PAGE_SIZE)" puts up to PAGE_SIZE bytes into "buf" and returns the number of bytes it actually put there. If it wrote PAGE_SIZE bytes, the newline added by dsm_label_utf16s_to_utf8s() would overrun "buf".
Reduce the size available for utf16s_to_utf8s() to use so there is always space for the newline.
--- drivers/pci/pci-label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-label.c +1 -1
@@ -161,7 +161,7 @@ static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) len =utf16s_to_utf8s ((const wchar_t *)obj->buffer.pointer, obj->buffer.length,UTF16_LITTLE_ENDIAN , - buf,PAGE_SIZE ); + buf,PAGE_SIZE -1 ); buf[len] ='\n' ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 289/315 power: supply: rt5033_battery: Fix device tree enumeration
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit f3076cd8d1d5fa64b5e1fa5affc045c2fc123baa ]
The fuel gauge in the RT5033 PMIC has its own I2C bus and interrupt line. Therefore, it is not actually part of the RT5033 MFD and needs its own of_match_table to probe properly.
Also, given that it's independent of the MFD, there is actually no need to make the Kconfig depend on MFD_RT5033. Although the driver uses the shared <linux/mfd/rt5033.h> header, there is no compile or runtime dependency on the RT5033 MFD driver.
--- drivers/power/supply/Kconfig | 3 ++- drivers/power/supply/rt5033_battery.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/power/supply/Kconfig +2 -1
@@ -596,7 +596,8 @@ config BATTERY_GOLDFISH config BATTERY_RT5033 tristate "RT5033 fuel gauge support" - depends on MFD_RT5033 + depends on I2C + select REGMAP_I2C help This adds support for battery fuel gauge in Richtek RT5033 PMIC. The fuelgauge calculates and determines the battery state of charge
drivers/power/supply/rt5033_battery.c +7 -0
@@ -167,9 +167,16 @@ static const struct i2c_device_id rt5033_battery_id[] = { };MODULE_DEVICE_TABLE (i2c, rt5033_battery_id); +static const struct of_device_id rt5033_battery_of_match[] = { + { .compatible ="richtek,rt5033-battery" , }, + { } +}; +MODULE_DEVICE_TABLE (of, rt5033_battery_of_match); +static struct i2c_driver rt5033_battery_driver = { .driver = { .name ="rt5033-battery" , + .of_match_table = rt5033_battery_of_match, }, .probe = rt5033_battery_probe, .remove = rt5033_battery_remove,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 290/315 um: fix error return code in slip_open()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit b77e81fbe5f5fb4ad9a61ec80f6d1e30b6da093a ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- arch/um/drivers/slip_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/slip_user.c +2 -1
@@ -145,7 +145,8 @@ static int slip_open(void *data) } sfd = err; -if (set_up_tty (sfd)) + err =set_up_tty (sfd); +if (err) goto out_close2; pri->slave = sfd;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 291/315 um: fix error return code in winch_tramp()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit ccf1236ecac476d9d2704866d9a476c86e387971 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- arch/um/drivers/chan_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/um/drivers/chan_user.c +2 -1
@@ -256,7 +256,8 @@ static int winch_tramp(int fd, struct tty_port *port, int *fd_out, goto out_close; } -if (os_set_fd_block (*fd_out,0 )) { + err =os_set_fd_block (*fd_out,0 ); +if (err) {printk (UM_KERN_ERR "winch_tramp: failed to set thread_fd " "non-blocking.\n" ); goto out_close;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 292/315 watchdog: aspeed: fix hardware timeout calculation
In reply to Greg Kroah-HartmanFrom: Tao Ren <[email protected]>
[ Upstream commit e7dc481c92060f9ce872878b0b7a08c24713a7e5 ]
Fix hardware timeout calculation in aspeed_wdt_set_timeout function to ensure the reload value does not exceed the hardware limit.
--- drivers/watchdog/aspeed_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/aspeed_wdt.c +1 -1
@@ -147,7 +147,7 @@ static int aspeed_wdt_set_timeout(struct watchdog_device *wdd, wdd->timeout = timeout; - actual =min (timeout, wdd->max_hw_heartbeat_ms *1000 ); + actual =min (timeout, wdd->max_hw_heartbeat_ms /1000 );writel (actual *WDT_RATE_1MHZ , wdt->base +WDT_RELOAD_VALUE );writel (WDT_RESTART_MAGIC , wdt->base +WDT_RESTART );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 293/315 nfs: fix acl memory leak of posix_acl_create()
In reply to Greg Kroah-HartmanFrom: Gao Xiang <[email protected]>
[ Upstream commit 1fcb6fcd74a222d9ead54d405842fc763bb86262 ]
When looking into another nfs xfstests report, I found acl and default_acl in nfs3_proc_create() and nfs3_proc_mknod() error paths are possibly leaked. Fix them in advance.
--- fs/nfs/nfs3proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/nfs3proc.c +2 -2
@@ -357,7 +357,7 @@ nfs3_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,break ;case NFS3_CREATE_UNCHECKED : - goto out; + goto out_release_acls; }nfs_fattr_init (data->res.dir_attr);nfs_fattr_init (data->res.fattr);
@@ -702,7 +702,7 @@ nfs3_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,break ;default : status = -EINVAL ; - goto out; + goto out_release_acls; } status =nfs3_do_create (dir, dentry, data);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 294/315 ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
[ Upstream commit a801fcfeef96702fa3f9b22ad56c5eb1989d9221 ]
xfstests-generic/476 reports a warning message as below:
WARNING: CPU: 2 PID: 30347 at fs/inode.c:361 inc_nlink+0x52/0x70 Call Trace: do_rename+0x502/0xd40 [ubifs] ubifs_rename+0x8b/0x180 [ubifs] vfs_rename+0x476/0x1080 do_renameat2+0x67c/0x7b0 __x64_sys_renameat2+0x6e/0x90 do_syscall_64+0x66/0xe0 entry_SYSCALL_64_after_hwframe+0x44/0xae
Following race case can cause this:
rename_whiteout(Thread 1) wb_workfn(Thread 2)ubifs_rename
do_rename
__writeback_single_inode
spin_lock(&inode->i_lock)
whiteout->i_state |= I_LINKABLE
inode->i_state &= ~dirty;
---- How race happens on i_state:
(tmp = whiteout->i_state | I_LINKABLE)
(tmp = inode->i_state & ~dirty)
(whiteout->i_state = tmp)
(inode->i_state = tmp)
----
spin_unlock(&inode->i_lock)
inc_nlink(whiteout)
WARN_ON(!(inode->i_state & I_LINKABLE)) !!!Fix to add i_lock to avoid i_state update race condition.
--- fs/ubifs/dir.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ubifs/dir.c +7 -0
@@ -1408,7 +1408,10 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, goto out_release; } +spin_lock (&whiteout->i_lock); whiteout->i_state |=I_LINKABLE ; +spin_unlock (&whiteout->i_lock); + whiteout_ui =ubifs_inode (whiteout); whiteout_ui->data = dev; whiteout_ui->data_len =ubifs_encode_dev (dev,MKDEV (0 ,0 ));
@@ -1501,7 +1504,11 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,inc_nlink (whiteout);mark_inode_dirty (whiteout); + +spin_lock (&whiteout->i_lock); whiteout->i_state &= ~I_LINKABLE ; +spin_unlock (&whiteout->i_lock); +iput (whiteout); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 295/315 x86/fpu: Limit xstate copy size in xstateregs_set()
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 07d6688b22e09be465652cf2da0da6bf86154df6 ]
If the count argument is larger than the xstate size, this will happily copy beyond the end of xstate.
--- arch/x86/kernel/fpu/regset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/fpu/regset.c +1 -1
@@ -128,7 +128,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset,/* * A whole standard-format XSAVE buffer is needed: */ -if ((pos !=0 ) || (count < fpu_user_xstate_size)) +if (pos !=0 || count != fpu_user_xstate_size)return -EFAULT ; xsave = &fpu->state.xsave;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 296/315 ALSA: isa: Fix error return code in snd_cmi8330_probe()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 31028cbed26a8afa25533a10425ffa2ab794c76c ]
When 'SB_HW_16' check fails, the error code -ENODEV instead of 0 should be returned, which is the same as that returned when 'WSS_HW_CMI8330' check fails.
--- sound/isa/cmi8330.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/isa/cmi8330.c +1 -1
@@ -564,7 +564,7 @@ static int snd_cmi8330_probe(struct snd_card *card, int dev) }if (acard->sb->hardware !=SB_HW_16 ) { snd_printk(KERN_ERR PFX "SB16 not found during probe\n"); -return err; +return -ENODEV ; }snd_wss_out (acard->wss,CS4231_MISC_INFO ,0x40 );/* switch on MODE2 */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 297/315 NFSv4/pNFS: Dont call _nfs4_pnfs_v3_ds_connect multiple times
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit f46f84931a0aa344678efe412d4b071d84d8a805 ]
After we grab the lock in nfs4_pnfs_ds_connect(), there is no check for whether or not ds->ds_clp has already been initialised, so we can end up adding the same transports multiple times.
--- fs/nfs/pnfs_nfs.c | 52 +++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-)
fs/nfs/pnfs_nfs.c +26 -26
@@ -555,19 +555,16 @@ out: }EXPORT_SYMBOL_GPL (nfs4_pnfs_ds_add); -static void nfs4_wait_ds_connect (struct nfs4_pnfs_ds *ds) +static int nfs4_wait_ds_connect (struct nfs4_pnfs_ds *ds) {might_sleep (); -wait_on_bit (&ds->ds_state,NFS4DS_CONNECTING , -TASK_KILLABLE ); +return wait_on_bit (&ds->ds_state,NFS4DS_CONNECTING ,TASK_KILLABLE ); }static void nfs4_clear_ds_conn_bit (struct nfs4_pnfs_ds *ds) {smp_mb__before_atomic (); -clear_bit (NFS4DS_CONNECTING , &ds->ds_state); -smp_mb__after_atomic (); -wake_up_bit (&ds->ds_state,NFS4DS_CONNECTING ); +clear_and_wake_up_bit (NFS4DS_CONNECTING , &ds->ds_state); } static struct nfs_client *(*get_v3_ds_connect)(
@@ -728,30 +725,33 @@ int nfs4_pnfs_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds, {int err; -again: - err =0 ; -if (test_and_set_bit (NFS4DS_CONNECTING , &ds->ds_state) ==0 ) { -if (version ==3 ) { - err =_nfs4_pnfs_v3_ds_connect (mds_srv, ds, timeo, - retrans); - }else if (version ==4 ) { - err =_nfs4_pnfs_v4_ds_connect (mds_srv, ds, timeo, - retrans, minor_version); - }else { -dprintk ("%s: unsupported DS version %d\n" , __func__, - version); - err = -EPROTONOSUPPORT ; - } +do { + err =nfs4_wait_ds_connect (ds); +if (err || ds->ds_clp) + goto out; +if (nfs4_test_deviceid_unavailable (devid)) +return -ENODEV ; + }while (test_and_set_bit (NFS4DS_CONNECTING , &ds->ds_state) !=0 ); -nfs4_clear_ds_conn_bit (ds); - }else { -nfs4_wait_ds_connect (ds); +if (ds->ds_clp) + goto connect_done; -/* what was waited on didn't connect AND didn't mark unavail */ -if (!ds->ds_clp && !nfs4_test_deviceid_unavailable (devid)) - goto again; +switch (version) { +case 3 : + err =_nfs4_pnfs_v3_ds_connect (mds_srv, ds, timeo, retrans); +break ; +case 4 : + err =_nfs4_pnfs_v4_ds_connect (mds_srv, ds, timeo, retrans, + minor_version); +break ; +default : +dprintk ("%s: unsupported DS version %d\n" , __func__, version); + err = -EPROTONOSUPPORT ; } +connect_done: +nfs4_clear_ds_conn_bit (ds); +out:/* * At this point the ds->ds_clp should be ready, but it might have * hit an error.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 298/315 hexagon: use common DISCARDS macro
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 681ba73c72302214686401e707e2087ed11a6556 ]
ld.lld warns that the '.modinfo' section is not currently handled:
ld.lld: warning: kernel/built-in.a(workqueue.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(printk/printk.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(irq/spurious.o):(.modinfo) is being placed in '.modinfo' ld.lld: warning: kernel/built-in.a(rcu/update.o):(.modinfo) is being placed in '.modinfo'
The '.modinfo' section was added in commit 898490c010b5 ("moduleparam:
Save information about built-in modules in separate file") to the DISCARDS macro but Hexagon has never used that macro. The unification of DISCARDS happened in commit 023bf6f1b8bf ("linker script: unify usage of discard definition") in 2009, prior to Hexagon being added in 2011.
Switch Hexagon over to the DISCARDS macro so that anything that is expected to be discarded gets discarded.
--- arch/hexagon/kernel/vmlinux.lds.S | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
arch/hexagon/kernel/vmlinux.lds.S +1 -6
@@ -71,13 +71,8 @@ SECTIONS _end = .; - /DISCARD/ : { - EXIT_TEXT - EXIT_DATA - EXIT_CALL - } - STABS_DEBUG DWARF_DEBUG + DISCARDS }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 299/315 reset: a10sr: add missing of_match_table reference
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 466ba3c8ff4fae39e455ff8d080b3d5503302765 ]
The driver defined of_device_id table but did not use it with of_match_table. This prevents usual matching via devicetree and causes a W=1 warning:
drivers/reset/reset-a10sr.c:111:34: warning:
‘a10sr_reset_of_match’ defined but not used [-Wunused-const-variable=]
--- drivers/reset/reset-a10sr.c | 1 + 1 file changed, 1 insertion(+)
drivers/reset/reset-a10sr.c +1 -0
@@ -129,6 +129,7 @@ static struct platform_driver a10sr_reset_driver = { .probe = a10sr_reset_probe, .driver = { .name = "altr_a10sr_reset", + .of_match_table = a10sr_reset_of_match, }, };module_platform_driver (a10sr_reset_driver);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 300/315 ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 75121e1dc9fe4def41e63d57f6a53749b88006ed ]
There is no "max_brightness" property. This brings the intentional brightness reduce of green LED and dtschema checks as well:
arch/arm/boot/dts/exynos5410-odroidxu.dt.yaml: led-controller-1: led-1: 'max-brightness' is a required property
--- arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi +2 -2
@@ -25,7 +25,7 @@ * Green LED is much brighter than the others * so limit its max brightness */ - max_brightness = <127>; + max-brightness = <127>; linux,default-trigger = "mmc0"; };
@@ -33,7 +33,7 @@ label = "blue:heartbeat"; pwms = <&pwm 2 2000000 0>; pwm-names = "pwm2"; - max_brightness = <255>; + max-brightness = <255>; linux,default-trigger = "heartbeat"; }; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 301/315 ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit fd2f1717966535b7d0b6fe45cf0d79e94330da5f ]
There is no "max_brightness" property as pointed out by dtschema:
arch/arm/boot/dts/exynos5422-odroidxu4.dt.yaml: led-controller: led-1: 'max-brightness' is a required property
--- arch/arm/boot/dts/exynos5422-odroidxu4.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5422-odroidxu4.dts +1 -1
@@ -26,7 +26,7 @@ label = "blue:heartbeat"; pwms = <&pwm 2 2000000 0>; pwm-names = "pwm2"; - max_brightness = <255>; + max-brightness = <255>; linux,default-trigger = "heartbeat"; }; };
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 302/315 memory: atmel-ebi: add missing of_node_put for loop iteration
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 907c5bbb514a4676160e79764522fff56ce3448e ]
Early exits from for_each_available_child_of_node() should decrement the node reference counter. Reported by Coccinelle:
drivers/memory/atmel-ebi.c:593:1-33: WARNING:
Function "for_each_available_child_of_node" should have of_node_put() before return around line 604.
--- drivers/memory/atmel-ebi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/memory/atmel-ebi.c +3 -1
@@ -579,8 +579,10 @@ static int atmel_ebi_probe(struct platform_device *pdev) child); ret =atmel_ebi_dev_disable (ebi, child); -if (ret) +if (ret) { +of_node_put (child);return ret; + } } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 303/315 rtc: fix snprintf() checking in is_rtc_hctosys()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 54b909436ede47e0ee07f1765da27ec2efa41e84 ]
The scnprintf() function silently truncates the printf() and returns the number bytes that it was able to copy (not counting the NUL terminator). Thus, the highest value it can return here is "NAME_SIZE - 1" and the overflow check is dead code. Fix this by using the snprintf() function which returns the number of bytes that would have been copied if there was enough space and changing the condition from "> NAME_SIZE" to ">= NAME_SIZE".
--- drivers/rtc/rtc-proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-proc.c +2 -2
@@ -26,8 +26,8 @@ static bool is_rtc_hctosys(struct rtc_device *rtc)int size;char name[NAME_SIZE ]; - size =scnprintf (name,NAME_SIZE ,"rtc%d" , rtc->id); -if (size >NAME_SIZE ) + size =snprintf (name,NAME_SIZE ,"rtc%d" , rtc->id); +if (size >=NAME_SIZE )return false;return !strncmp (name,CONFIG_RTC_HCTOSYS_DEVICE ,NAME_SIZE );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 304/315 ARM: dts: r8a7779, marzen: Fix DU clock names
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 6ab8c23096a29b69044209a5925758a6f88bd450 ]
"make dtbs_check" complains:
arch/arm/boot/dts/r8a7779-marzen.dt.yaml: display@fff80000: clock-names:0: 'du.0' was expected
Change the first clock name to match the DT bindings.
This has no effect on actual operation, as the Display Unit driver in Linux does not use the first clock name on R-Car H1, but just grabs the first clock.
--- arch/arm/boot/dts/r8a7779-marzen.dts | 2 +- arch/arm/boot/dts/r8a7779.dtsi | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a7779-marzen.dts +1 -1
@@ -136,7 +136,7 @@ status = "okay"; clocks = <&mstp1_clks R8A7779_CLK_DU>, <&x3_clk>; - clock-names = "du", "dclkin.0"; + clock-names = "du.0", "dclkin.0"; ports { port@0 {
arch/arm/boot/dts/r8a7779.dtsi +1 -0
@@ -432,6 +432,7 @@ reg = <0xfff80000 0x40000>; interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&mstp1_clks R8A7779_CLK_DU>; + clock-names = "du.0"; power-domains = <&sysc R8A7779_PD_ALWAYS_ON>; status = "disabled";
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 305/315 arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
In reply to Greg Kroah-HartmanFrom: Petr Vorel <[email protected]>
[ Upstream commit f890f89d9a80fffbfa7ca791b78927e5b8aba869 ]
Reserve GPIO pins 85-88 as these aren't meant to be accessible from the application CPUs (causes reboot). Yet another fix similar to 9134586715e3, 5f8d3ab136d0, which is needed to allow angler to boot after 3edfb7bd76bd ("gpiolib: Show correct direction from the beginning").
--- arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +4 -0
@@ -38,3 +38,7 @@ }; }; }; + +&tlmm { + gpio-reserved-ranges = <85 4>; +};
Signature · 1 line
2.30.2
Re: [PATCH 4.14 305/315] arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
Quoted 26 lines · Greg Kroah-Hartman
From: Petr Vorel <[email protected]>
[ Upstream commit
f890f89d9a80fffbfa7ca791b78927e5b8aba869]Reserve GPIO pins 85-88 as these aren't meant to be accessible from the application CPUs (causes reboot). Yet another fix similar to
9134586715e3,5f8d3ab136d0, which is needed to allow angler to boot after3edfb7bd76bd("gpiolib: Show correct direction from the beginning").Fixes feeaf56ac78d ("arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support")Signed-off-by Petr Vorel <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +0
-0
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts line 44
Quoted 7 lines
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +4
-0@@ -38,3 +38,7 @@ }; }; }; + +&tlmm { + gpio-reserved-ranges = <85 4>; +};
Following build errors noticed on arm64 architecture on on stable-rc linux-4.19.y
stable-rc linux-4.14.y
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/current ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc'
Error: /builds/linux/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts:42.1-6 Label or path tlmm not found
FATAL ERROR: Syntax error parsing input tree
make[3]: *** [scripts/Makefile.lib:294:arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dtb] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:544:arch/arm64/boot/dts/qcom] Error 2
reference build link,
build: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/
config: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/config
steps to reproduce:
---------------------
# TuxMake is a command line tool and Python library that provides
# portable and repeatable Linux kernel builds across a variety of # architectures, toolchains, kernel configurations, and make targets. # # TuxMake supports the concept of runtimes. # See https://docs.tuxmake.org/runtimes/, for that to work it requires # that you install podman or docker on your system. # # To install tuxmake on your system globally: # sudo pip3 install -U tuxmake # # See https://docs.tuxmake.org/ for complete documentation.
tuxmake --runtime podman --target-arch arm64 --toolchain gcc-11 --kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/config
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerRe: [PATCH 4.14 305/315] arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
Quoted 77 lines · Naresh Kamboju
Quoted 26 lines · Greg Kroah-Hartman
From: Petr Vorel <[email protected]>
[ Upstream commit
f890f89d9a80fffbfa7ca791b78927e5b8aba869]Reserve GPIO pins 85-88 as these aren't meant to be accessible from the application CPUs (causes reboot). Yet another fix similar to
9134586715e3,5f8d3ab136d0, which is needed to allow angler to boot after3edfb7bd76bd("gpiolib: Show correct direction from the beginning").Fixes feeaf56ac78d ("arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support")Signed-off-by Petr Vorel <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +0
-0arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts line 44
Quoted 7 lines
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +4
-0@@ -38,3 +38,7 @@ }; }; }; + +&tlmm { + gpio-reserved-ranges = <85 4>; +};Following build errors noticed on arm64 architecture on on stable-rc linux-4.19.y
stable-rc linux-4.14.ymake --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/current ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc'
Error: /builds/linux/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts:42.1-6 Label or path tlmm not found
FATAL ERROR: Syntax error parsing input tree
make[3]: *** [scripts/Makefile.lib:294:arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dtb] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:544:arch/arm64/boot/dts/qcom] Error 2reference build link,
build: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/
config: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/configsteps to reproduce:
---------------------
# TuxMake is a command line tool and Python library that provides# portable and repeatable Linux kernel builds across a variety of # architectures, toolchains, kernel configurations, and make targets. # # TuxMake supports the concept of runtimes. # See https://docs.tuxmake.org/runtimes/, for that to work it requires # that you install podman or docker on your system. # # To install tuxmake on your system globally: # sudo pip3 install -U tuxmake # # See https://docs.tuxmake.org/ for complete documentation.
Quoted 4 lines
tuxmake --runtime podman --target-arch arm64 --toolchain gcc-11 --kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/config
Now dropped from everywhere, thanks.
greg k-h
Re: [PATCH 4.14 305/315] arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
Quoted 78 lines · Naresh Kamboju
Quoted 75 lines
Quoted 25 lines · Greg Kroah-Hartman
From: Petr Vorel <[email protected]>
[ Upstream commit
f890f89d9a80fffbfa7ca791b78927e5b8aba869]Reserve GPIO pins 85-88 as these aren't meant to be accessible from the application CPUs (causes reboot). Yet another fix similar to
9134586715e3,5f8d3ab136d0, which is needed to allow angler to boot after3edfb7bd76bd("gpiolib: Show correct direction from the beginning").Fixes feeaf56ac78d ("arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support")Signed-off-by Petr Vorel <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +0
-0arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts line 44
Quoted 7 lines
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +4
-0@@ -38,3 +38,7 @@ }; }; }; + +&tlmm { + gpio-reserved-ranges = <85 4>; +};Following build errors noticed on arm64 architecture on on stable-rc linux-4.19.y
stable-rc linux-4.14.ymake --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/current ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc'
Error: /builds/linux/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts:42.1-6 Label or path tlmm not found
FATAL ERROR: Syntax error parsing input tree
make[3]: *** [scripts/Makefile.lib:294:arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dtb] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:544:arch/arm64/boot/dts/qcom] Error 2reference build link,
build: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/
config: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/configsteps to reproduce:
---------------------
# TuxMake is a command line tool and Python library that provides# portable and repeatable Linux kernel builds across a variety of # architectures, toolchains, kernel configurations, and make targets.# TuxMake supports the concept of runtimes.
# See https://docs.tuxmake.org/runtimes/, for that to work it requires# that you install podman or docker on your system.# To install tuxmake on your system globally:
# sudo pip3 install -U tuxmake# See https://docs.tuxmake.org/ for complete documentation.
Quoted 6 lines
Quoted 3 lines
tuxmake --runtime podman --target-arch arm64 --toolchain gcc-11 --kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/configNow dropped from everywhere, thanks.
It should be working since v5.9, thus applicable to linux-5.10.y (longterm) and the two newer stable branches. As I described it before, I'd drop it from linux-4.19.y and linux-4.14.y (unless 3edfb7bd76bd from 4.20 is planning to be backported to it, which I don't think so).
The only branch which needs to adapt this patch is linux-5.4.y (use msmgpio). I can send a patch for it during this week.
Kind regards,
Petr
Quoted 1 line
greg k-h
Re: [PATCH 4.14 305/315] arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
In reply to Naresh KambojuQuoted 54 lines
Quoted 25 lines · Greg Kroah-Hartman
From: Petr Vorel <[email protected]>
[ Upstream commit
f890f89d9a80fffbfa7ca791b78927e5b8aba869]Reserve GPIO pins 85-88 as these aren't meant to be accessible from the application CPUs (causes reboot). Yet another fix similar to
9134586715e3,5f8d3ab136d0, which is needed to allow angler to boot after3edfb7bd76bd("gpiolib: Show correct direction from the beginning").Fixes feeaf56ac78d ("arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support")Signed-off-by Petr Vorel <[email protected]>Reviewed-by Konrad Dybcio <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts | 4 ++++ 1 file changed, 4 insertions(+)arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +0
-0arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts line 44
Quoted 7 lines
arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts +4
-0@@ -38,3 +38,7 @@ }; }; }; + +&tlmm { + gpio-reserved-ranges = <85 4>; +};Following build errors noticed on arm64 architecture on on stable-rc linux-4.19.y
stable-rc linux-4.14.ymake --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/current ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc'
Error: /builds/linux/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts:42.1-6 Label or path tlmm not found
FATAL ERROR: Syntax error parsing input tree
make[3]: *** [scripts/Makefile.lib:294:arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dtb] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:544:arch/arm64/boot/dts/qcom] Error 2
Quoted 1 line
Yes, this patch needs modification, because tlmm was added in v5.9 in 7c865b09b0a1 ("arm64: dts: qcom: msm8994: Modernize the DTS style"). Before it was msmgpio, thus substitute to it should fix it. I can verify it and send correct patches, but this problem started since 3edfb7bd76bd (v4.20), thus I'd prefer just skip linux-4.19.y and linux-4.14.y (unless 3edfb7bd76bd is planning to be backported to it, which I don't think so).
Kind regards,
Petr
Quoted 24 lines
reference build link,
build: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/
config: https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/configsteps to reproduce:
---------------------
# TuxMake is a command line tool and Python library that provides# portable and repeatable Linux kernel builds across a variety of # architectures, toolchains, kernel configurations, and make targets.# TuxMake supports the concept of runtimes.
# See https://docs.tuxmake.org/runtimes/, for that to work it requires# that you install podman or docker on your system.# To install tuxmake on your system globally:
# sudo pip3 install -U tuxmake# See https://docs.tuxmake.org/ for complete documentation.
tuxmake --runtime podman --target-arch arm64 --toolchain gcc-11 --kconfig defconfig --kconfig-add
https://builds.tuxbuild.com/1vXT4jBYUbNdKdLS1wz6gmXPVLM/config
Greg Kroah-Hartman
maintainerPATCH 306/315 ARM: dts: BCM5301X: Fixup SPI binding
In reply to Greg Kroah-HartmanFrom: Rafał Miłecki <[email protected]>
[ Upstream commit d5aede3e6dd1b8ca574600a1ecafe1e580c53f2f ]
1. Reorder interrupts
2. Fix typo: s/spi_lr_overhead/spi_lr_overread/
3. Rename node: s/spi-nor@0/flash@0/
This fixes:arch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dt.yaml: spi@18029200: interrupt-names: 'oneOf' conditional failed, one must be fixed:
['spi_lr_fullness_reached', 'spi_lr_session_aborted', 'spi_lr_impatient', 'spi_lr_session_done', 'spi_lr_overhead', 'mspi_done', 'mspi_halted'] is too long Additional items are not allowed ('spi_lr_session_aborted', 'spi_lr_impatient', 'spi_lr_session_done', 'spi_lr_overhead', 'mspi_done', 'mspi_halted' were unexpected) 'mspi_done' was expected
'spi_l1_intr' was expected
'mspi_halted' was expected
'spi_lr_fullness_reached' was expected
'spi_lr_session_aborted' was expected
'spi_lr_impatient' was expected
'spi_lr_session_done' was expected
'spi_lr_overread' was expected
From schema: Documentation/devicetree/bindings/spi/brcm,spi-bcm-qspi.yamlarch/arm/boot/dts/bcm4709-buffalo-wxr-1900dhp.dt.yaml: spi-nor@0: $nodename:0: 'spi-nor@0' does not match '^flash(@.*)?$'
From schema: Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml
--- arch/arm/boot/dts/bcm5301x.dtsi | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm/boot/dts/bcm5301x.dtsi +9 -9
@@ -432,27 +432,27 @@ <0x1811b408 0x004>, <0x180293a0 0x01c>; reg-names = "mspi", "bspi", "intr_regs", "intr_status_reg"; - interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>, + interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>, - <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>; - interrupt-names = "spi_lr_fullness_reached", + <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "mspi_done", + "mspi_halted", + "spi_lr_fullness_reached", "spi_lr_session_aborted", "spi_lr_impatient", "spi_lr_session_done", - "spi_lr_overhead", - "mspi_done", - "mspi_halted"; + "spi_lr_overread"; clocks = <&iprocmed>; clock-names = "iprocmed"; num-cs = <2>; #address-cells = <1>; #size-cells = <0>; - spi_nor: spi-nor@0 { + spi_nor: flash@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <20000000>;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 307/315 reset: bail if try_module_get() fails
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 4fb26fb83f0def3d39c14e268bcd4003aae8fade ]
Abort instead of returning a new reset control for a reset controller device that is going to have its module unloaded.
--- drivers/reset/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/reset/core.c +4 -1
@@ -398,7 +398,10 @@ static struct reset_control *__reset_control_get_internal(if (!rstc)return ERR_PTR (-ENOMEM ); -try_module_get (rcdev->owner); +if (!try_module_get (rcdev->owner)) { +kfree (rstc); +return ERR_PTR (-ENODEV ); + } rstc->rcdev = rcdev;list_add (&rstc->list, &rcdev->reset_control_head);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 308/315 memory: fsl_ifc: fix leak of IO mapping on probe failure
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 3b132ab67fc7a358fff35e808fa65d4bea452521 ]
On probe error the driver should unmap the IO memory. Smatch reports:
drivers/memory/fsl_ifc.c:298 fsl_ifc_ctrl_probe() warn: 'fsl_ifc_ctrl_dev->gregs' not released on lines: 298.
--- drivers/memory/fsl_ifc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/fsl_ifc.c +2 -2
@@ -231,8 +231,7 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev) fsl_ifc_ctrl_dev->gregs =of_iomap (dev->dev.of_node,0 );if (!fsl_ifc_ctrl_dev->gregs) {dev_err (&dev->dev,"failed to get memory region\n" ); - ret = -ENODEV ; - goto err; +return -ENODEV ; }if (of_property_read_bool (dev->dev.of_node,"little-endian" )) {
@@ -308,6 +307,7 @@ err_irq:free_irq (fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);irq_dispose_mapping (fsl_ifc_ctrl_dev->irq); err: +iounmap (fsl_ifc_ctrl_dev->gregs);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 309/315 memory: fsl_ifc: fix leak of private memory on probe failure
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 8e0d09b1232d0538066c40ed4c13086faccbdff6 ]
On probe error the driver should free the memory allocated for private structure. Fix this by using resource-managed allocation.
--- drivers/memory/fsl_ifc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/memory/fsl_ifc.c +2 -2
@@ -109,7 +109,6 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev)iounmap (ctrl->gregs);dev_set_drvdata (&dev->dev,NULL ); -kfree (ctrl);return 0 ; }
@@ -221,7 +220,8 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)dev_info (&dev->dev,"Freescale Integrated Flash Controller\n" ); - fsl_ifc_ctrl_dev =kzalloc (sizeof (*fsl_ifc_ctrl_dev),GFP_KERNEL ); + fsl_ifc_ctrl_dev =devm_kzalloc (&dev->dev,sizeof (*fsl_ifc_ctrl_dev), +GFP_KERNEL );if (!fsl_ifc_ctrl_dev)return -ENOMEM ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 310/315 ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema
In reply to Greg Kroah-HartmanFrom: Aswath Govindraju <[email protected]>
[ Upstream commit 414bfe1d26b60ef20b58e36efd5363188a694bab ]
ti,pindir-d0-out-d1-in property is expected to be of type boolean. Therefore, fix the property accordingly.
--- arch/arm/boot/dts/am335x-cm-t335.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/am335x-cm-t335.dts +1 -1
@@ -552,7 +552,7 @@ status = "okay"; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi0_pins>; - ti,pindir-d0-out-d1-in = <1>; + ti,pindir-d0-out-d1-in; /* WLS1271 WiFi */ wlcore: wlcore@1 { compatible = "ti,wl1271";
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 311/315 scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 030e4138d11fced3b831c2761e4cecf347bae99c ]
If an error occurs after a pci_enable_pcie_error_reporting() call, it must be undone by a corresponding pci_disable_pcie_error_reporting() call, as already done in the remove function.
--- drivers/scsi/be2iscsi/be_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/be2iscsi/be_main.c +1 -0
@@ -5737,6 +5737,7 @@ hba_free:pci_disable_msix (phba->pcidev);pci_dev_put (phba->pcidev);iscsi_host_free (phba->shost); +pci_disable_pcie_error_reporting (pcidev);pci_set_drvdata (pcidev,NULL ); disable_pci:pci_release_regions (pcidev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 312/315 mips: always link byteswap helpers into decompressor
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit cddc40f5617e53f97ef019d5b29c1bd6cbb031ec ]
My series to clean up the unaligned access implementation across architectures caused some mips randconfig builds to fail with:
mips64-linux-ld: arch/mips/boot/compressed/decompress.o: in function `decompress_kernel':
decompress.c:(.text.decompress_kernel+0x54): undefined reference to `__bswapsi2'
It turns out that this problem has already been fixed for the XZ decompressor but now it also shows up in (at least) LZO and LZ4. From my analysis I concluded that the compiler could always have emitted those calls, but the different implementation allowed it to make otherwise better decisions about not inlining the byteswap, which results in the link error when the out-of-line code is missing.
While it could be addressed by adding it to the two decompressor implementations that are known to be affected, but as this only adds 112 bytes to the kernel, the safer choice is to always add them.
--- arch/mips/boot/compressed/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/boot/compressed/Makefile +2 -2
@@ -33,7 +33,7 @@ KBUILD_AFLAGS := $(KBUILD_AFLAGS) -D__ASSEMBLY__ \ KCOV_INSTRUMENT := n # decompressor objects (linked with vmlinuz) -vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o +vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/string.o $(obj)/bswapsi.o ifdef CONFIG_DEBUG_ZBOOT vmlinuzobjs-$(CONFIG_DEBUG_ZBOOT) += $(obj)/dbg.o
@@ -47,7 +47,7 @@ extra-y += uart-ath79.c $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c $(call cmd,shipped) -vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o +vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o extra-y += ashldi3.c bswapsi.c $(obj)/ashldi3.o $(obj)/bswapsi.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 313/315 mips: disable branch profiling in boot/decompress.o
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 97e488073cfca0eea84450169ca4cbfcc64e33e3 ]
Use DISABLE_BRANCH_PROFILING for arch/mips/boot/compressed/decompress.o to prevent linkage errors.
mips64-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_fast_extDict':
decompress.c:(.text+0x8c): undefined reference to `ftrace_likely_update'
mips64-linux-ld: decompress.c:(.text+0xf4): undefined reference to `ftrace_likely_update'
mips64-linux-ld: decompress.c:(.text+0x200): undefined reference to `ftrace_likely_update'
mips64-linux-ld: decompress.c:(.text+0x230): undefined reference to `ftrace_likely_update'
mips64-linux-ld: decompress.c:(.text+0x320): undefined reference to `ftrace_likely_update'
mips64-linux-ld: arch/mips/boot/compressed/decompress.o:decompress.c:(.text+0x3f4): more undefined references to `ftrace_likely_update' follow
--- arch/mips/boot/compressed/decompress.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/boot/compressed/decompress.c +2 -0
@@ -11,6 +11,8 @@* option) any later version. */ +#define DISABLE_BRANCH_PROFILING +#include <linux/types.h> #include <linux/kernel.h> #include <linux/string.h>
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 314/315 MIPS: vdso: Invalid GIC access through VDSO
In reply to Greg Kroah-HartmanFrom: Martin Fäcknitz <[email protected]>
[ Upstream commit 47ce8527fbba145a7723685bc9a27d9855e06491 ]
Accessing raw timers (currently only CLOCK_MONOTONIC_RAW) through VDSO doesn't return the correct time when using the GIC as clock source. The address of the GIC mapped page is in this case not calculated correctly. The GIC mapped page is calculated from the VDSO data by subtracting PAGE_SIZE:
void *get_gic(const struct vdso_data *data) {
return (void __iomem *)data - PAGE_SIZE;
}However, the data pointer is not page aligned for raw clock sources. This is because the VDSO data for raw clock sources (CS_RAW = 1) is stored after the VDSO data for coarse clock sources (CS_HRES_COARSE = 0). Therefore, only the VDSO data for CS_HRES_COARSE is page aligned:
+--------------------+ | | | vd[CS_RAW] | ---+ | vd[CS_HRES_COARSE] | | +--------------------+ | -PAGE_SIZE | | | | GIC mapped page | <--+ | | +--------------------+
When __arch_get_hw_counter() is called with &vd[CS_RAW], get_gic returns the wrong address (somewhere inside the GIC mapped page). The GIC counter values are not returned which results in an invalid time.
--- arch/mips/vdso/vdso.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/vdso/vdso.h +1 -1
@@ -81,7 +81,7 @@ static inline const union mips_vdso_data *get_vdso_data(void)static inline void __iomem *get_gic (const union mips_vdso_data *data) { -return (void __iomem *)data -PAGE_SIZE ; +return (void __iomem *)((unsigned long )data &PAGE_MASK ) -PAGE_SIZE ; }#endif /* CONFIG_CLKSRC_MIPS_GIC */
Signature · 1 line
2.30.2
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.240 release. There are 315 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 Wed, 21 Jul 2021 14:47:42 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.240-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Following patch caused arm64 build errors on 4.19 and 4.14.
Quoted 2 lines
Petr Vorel <[email protected]>
arm64: dts: qcom: msm8994-angler: Fix gpio-reserved-ranges 85-88
make --silent --keep-going --jobs=8 O=/home/tuxbuild/.cache/tuxmake/builds/current ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- 'CC=sccache aarch64-linux-gnu-gcc' 'HOSTCC=sccache gcc'
Error: /builds/linux/arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dts:42.1-6 Label or path tlmm not found
FATAL ERROR: Syntax error parsing input tree
make[3]: *** [scripts/Makefile.lib:294:arch/arm64/boot/dts/qcom/msm8994-angler-rev-101.dtb] Error 1 make[3]: Target '__build' not remade because of errors.
make[2]: *** [/builds/linux/scripts/Makefile.build:544:arch/arm64/boot/dts/qcom] Error 2
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerPATCH 315/315 net: bridge: multicast: fix PIM hello router port marking race
In reply to Greg Kroah-HartmanFrom: Nikolay Aleksandrov <[email protected]>
commit 04bef83a3358946bfc98a5ecebd1b0003d83d882 upstream.
When a PIM hello packet is received on a bridge port with multicast snooping enabled, we mark it as a router port automatically, that includes adding that port the router port list. The multicast lock protects that list, but it is not acquired in the PIM message case leading to a race condition, we need to take it to fix the race.
--- net/bridge/br_multicast.c | 2 ++ 1 file changed, 2 insertions(+)
net/bridge/br_multicast.c +2 -0
@@ -1763,7 +1763,9 @@ static void br_multicast_pim(struct net_ pim_hdr_type(pimhdr) != PIM_TYPE_HELLO)return ; +spin_lock (&br->multicast_lock);br_multicast_mark_router (br, port); +spin_unlock (&br->multicast_lock); } static int br_multicast_ipv4_rcv(struct net_bridge *br,