3.18.95-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 1/45 vhost_net: stop device during reset owner
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit 4cd879515d686849eec5f718aeac62a70b067d82 ]
We don't stop device before reset owner, this means we could try to serve any virtqueue kick before reset dev->worker. This will result a warn since the work was pending at llist during owner resetting. Fix this by stopping device during owner reset.
--- drivers/vhost/net.c | 1 + 1 file changed, 1 insertion(+)
drivers/vhost/net.c +1 -0
@@ -1009,6 +1009,7 @@ static long vhost_net_reset_owner(struct }vhost_net_stop (n, &tx_sock, &rx_sock);vhost_net_flush (n); +vhost_dev_stop (&n->dev);vhost_dev_reset_owner (&n->dev, memory);vhost_net_vq_reset (n); done:
Greg Kroah-Hartman
maintainerPATCH 3/45 net: igmp: add a missing rcu locking section
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e7aadb27a5415e8125834b84a74477bfbee4eff5 ]
Newly added igmpv3_get_srcaddr() needs to be called under rcu lock.
Timer callbacks do not ensure this locking.
=============================
WARNING: suspicious RCU usage
4.15.0+ #200 Not tainted
-----------------------------./include/linux/inetdevice.h:216 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
3 locks held by syzkaller616973/4074:
#0: (&mm->mmap_sem){++++}, at: [<00000000bfce669e>] __do_page_fault+0x32d/0xc90 arch/x86/mm/fault.c:1355
#1: ((&im->timer)){+.-.}, at: [<00000000619d2f71>] lockdep_copy_map include/linux/lockdep.h:178 [inline]
#1: ((&im->timer)){+.-.}, at: [<00000000619d2f71>] call_timer_fn+0x1c6/0x820 kernel/time/timer.c:1316
#2: (&(&im->lock)->rlock){+.-.}, at: [<000000005f833c5c>] spin_lock_bh include/linux/spinlock.h:315 [inline]
#2: (&(&im->lock)->rlock){+.-.}, at: [<000000005f833c5c>] igmpv3_send_report+0x98/0x5b0 net/ipv4/igmp.c:600stack backtrace: CPU: 0 PID: 4074 Comm: syzkaller616973 Not tainted 4.15.0+ #200 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 lockdep_rcu_suspicious+0x123/0x170 kernel/locking/lockdep.c:4592 __in_dev_get_rcu include/linux/inetdevice.h:216 [inline] igmpv3_get_srcaddr net/ipv4/igmp.c:329 [inline] igmpv3_newpack+0xeef/0x12e0 net/ipv4/igmp.c:389 add_grhead.isra.27+0x235/0x300 net/ipv4/igmp.c:432 add_grec+0xbd3/0x1170 net/ipv4/igmp.c:565 igmpv3_send_report+0xd5/0x5b0 net/ipv4/igmp.c:605 igmp_send_report+0xc43/0x1050 net/ipv4/igmp.c:722 igmp_timer_expire+0x322/0x5c0 net/ipv4/igmp.c:831 call_timer_fn+0x228/0x820 kernel/time/timer.c:1326 expire_timers kernel/time/timer.c:1363 [inline] __run_timers+0x7ee/0xb70 kernel/time/timer.c:1666 run_timer_softirq+0x4c/0x70 kernel/time/timer.c:1692 __do_softirq+0x2d7/0xb85 kernel/softirq.c:285 invoke_softirq kernel/softirq.c:365 [inline] irq_exit+0x1cc/0x200 kernel/softirq.c:405 exiting_irq arch/x86/include/asm/apic.h:541 [inline] smp_apic_timer_interrupt+0x16b/0x700 arch/x86/kernel/apic/apic.c:1052 apic_timer_interrupt+0xa9/0xb0 arch/x86/entry/entry_64.S:938
--- net/ipv4/igmp.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/igmp.c +4 -0
@@ -384,7 +384,11 @@ static struct sk_buff *igmpv3_newpack(st pip->frag_off =htons (IP_DF ); pip->ttl =1 ; pip->daddr = fl4.daddr; + +rcu_read_lock (); pip->saddr =igmpv3_get_srcaddr (dev, &fl4); +rcu_read_unlock (); + pip->protocol =IPPROTO_IGMP ; pip->tot_len =0 ;/* filled in later */ ip_select_ident (skb,NULL );
Greg Kroah-Hartman
maintainerPATCH 4/45 qlcnic: fix deadlock bug
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
[ Upstream commit 233ac3891607f501f08879134d623b303838f478 ]
The following soft lockup was caught. This is a deadlock caused by recusive locking.
Process kworker/u40:1:28016 was holding spin lock "mbx->queue_lock" in qlcnic_83xx_mailbox_worker(), while a softirq came in and ask the same spin lock in qlcnic_83xx_enqueue_mbx_cmd(). This lock should be hold by disable bh..
[161846.962125] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [kworker/u40:1:28016] [161846.962367] Modules linked in: tun ocfs2 xen_netback xen_blkback xen_gntalloc xen_gntdev xen_evtchn xenfs xen_privcmd autofs4 ocfs2_dlmfs ocfs2_stack_o2cb ocfs2_dlm ocfs2_nodemanager ocfs2_stackglue configfs bnx2fc fcoe libfcoe libfc sunrpc 8021q mrp garp bridge stp llc bonding dm_round_robin dm_multipath iTCO_wdt iTCO_vendor_support pcspkr sb_edac edac_core i2c_i801 shpchp lpc_ich mfd_core ioatdma ipmi_devintf ipmi_si ipmi_msghandler sg ext4 jbd2 mbcache2 sr_mod cdrom sd_mod igb i2c_algo_bit i2c_core ahci libahci megaraid_sas ixgbe dca ptp pps_core vxlan udp_tunnel ip6_udp_tunnel qla2xxx scsi_transport_fc qlcnic crc32c_intel be2iscsi bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi ipv6 cxgb3 mdio libiscsi_tcp qla4xxx iscsi_boot_sysfs libiscsi scsi_transport_iscsi dm_mirror dm_region_hash dm_log dm_mod [161846.962454] [161846.962460] CPU: 1 PID: 28016 Comm: kworker/u40:1 Not tainted 4.1.12-94.5.9.el6uek.x86_64 #2 [161846.962463] Hardware name: Oracle Corporation SUN SERVER X4-2L /ASSY,MB,X4-2L , BIOS 26050100 09/19/2017 [161846.962489] Workqueue: qlcnic_mailbox qlcnic_83xx_mailbox_worker [qlcnic] [161846.962493] task: ffff8801f2e34600 ti: ffff88004ca5c000 task.ti: ffff88004ca5c000 [161846.962496] RIP: e030:[<ffffffff810013aa>] [<ffffffff810013aa>] xen_hypercall_sched_op+0xa/0x20 [161846.962506] RSP: e02b:ffff880202e43388 EFLAGS: 00000206 [161846.962509] RAX: 0000000000000000 RBX: ffff8801f6996b70 RCX: ffffffff810013aa [161846.962511] RDX: ffff880202e433cc RSI: ffff880202e433b0 RDI: 0000000000000003 [161846.962513] RBP: ffff880202e433d0 R08: 0000000000000000 R09: ffff8801fe893200 [161846.962516] R10: ffff8801fe400538 R11: 0000000000000206 R12: ffff880202e4b000 [161846.962518] R13: 0000000000000050 R14: 0000000000000001 R15: 000000000000020d [161846.962528] FS: 0000000000000000(0000) GS:ffff880202e40000(0000) knlGS:ffff880202e40000 [161846.962531] CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 [161846.962533] CR2: 0000000002612640 CR3: 00000001bb796000 CR4: 0000000000042660 [161846.962536] Stack: [161846.962538] ffff880202e43608 0000000000000000 ffffffff813f0442 ffff880202e433b0 [161846.962543] 0000000000000000 ffff880202e433cc ffffffff00000001 0000000000000000 [161846.962547] 00000009813f03d6 ffff880202e433e0 ffffffff813f0460 ffff880202e43440 [161846.962552] Call Trace: [161846.962555] <IRQ> [161846.962565] [<ffffffff813f0442>] ? xen_poll_irq_timeout+0x42/0x50 [161846.962570] [<ffffffff813f0460>] xen_poll_irq+0x10/0x20 [161846.962578] [<ffffffff81014222>] xen_lock_spinning+0xe2/0x110 [161846.962583] [<ffffffff81013f01>] __raw_callee_save_xen_lock_spinning+0x11/0x20 [161846.962592] [<ffffffff816e5c57>] ? _raw_spin_lock+0x57/0x80 [161846.962609] [<ffffffffa028acfc>] qlcnic_83xx_enqueue_mbx_cmd+0x7c/0xe0 [qlcnic] [161846.962623] [<ffffffffa028e008>] qlcnic_83xx_issue_cmd+0x58/0x210 [qlcnic] [161846.962636] [<ffffffffa028caf2>] qlcnic_83xx_sre_macaddr_change+0x162/0x1d0 [qlcnic] [161846.962649] [<ffffffffa028cb8b>] qlcnic_83xx_change_l2_filter+0x2b/0x30 [qlcnic] [161846.962657] [<ffffffff8160248b>] ? __skb_flow_dissect+0x18b/0x650 [161846.962670] [<ffffffffa02856e5>] qlcnic_send_filter+0x205/0x250 [qlcnic] [161846.962682] [<ffffffffa0285c77>] qlcnic_xmit_frame+0x547/0x7b0 [qlcnic] [161846.962691] [<ffffffff8160ac22>] xmit_one+0x82/0x1a0 [161846.962696] [<ffffffff8160ad90>] dev_hard_start_xmit+0x50/0xa0 [161846.962701] [<ffffffff81630112>] sch_direct_xmit+0x112/0x220 [161846.962706] [<ffffffff8160b80f>] __dev_queue_xmit+0x1df/0x5e0 [161846.962710] [<ffffffff8160bc33>] dev_queue_xmit_sk+0x13/0x20 [161846.962721] [<ffffffffa0575bd5>] bond_dev_queue_xmit+0x35/0x80 [bonding] [161846.962729] [<ffffffffa05769fb>] __bond_start_xmit+0x1cb/0x210 [bonding] [161846.962736] [<ffffffffa0576a71>] bond_start_xmit+0x31/0x60 [bonding] [161846.962740] [<ffffffff8160ac22>] xmit_one+0x82/0x1a0 [161846.962745] [<ffffffff8160ad90>] dev_hard_start_xmit+0x50/0xa0 [161846.962749] [<ffffffff8160bb1e>] __dev_queue_xmit+0x4ee/0x5e0 [161846.962754] [<ffffffff8160bc33>] dev_queue_xmit_sk+0x13/0x20 [161846.962760] [<ffffffffa05cfa72>] vlan_dev_hard_start_xmit+0xb2/0x150 [8021q] [161846.962764] [<ffffffff8160ac22>] xmit_one+0x82/0x1a0 [161846.962769] [<ffffffff8160ad90>] dev_hard_start_xmit+0x50/0xa0 [161846.962773] [<ffffffff8160bb1e>] __dev_queue_xmit+0x4ee/0x5e0 [161846.962777] [<ffffffff8160bc33>] dev_queue_xmit_sk+0x13/0x20 [161846.962789] [<ffffffffa05adf74>] br_dev_queue_push_xmit+0x54/0xa0 [bridge] [161846.962797] [<ffffffffa05ae4ff>] br_forward_finish+0x2f/0x90 [bridge] [161846.962807] [<ffffffff810b0dad>] ? ttwu_do_wakeup+0x1d/0x100 [161846.962811] [<ffffffff815f929b>] ? __alloc_skb+0x8b/0x1f0 [161846.962818] [<ffffffffa05ae04d>] __br_forward+0x8d/0x120 [bridge] [161846.962822] [<ffffffff815f613b>] ? __kmalloc_reserve+0x3b/0xa0 [161846.962829] [<ffffffff810be55e>] ? update_rq_runnable_avg+0xee/0x230 [161846.962836] [<ffffffffa05ae176>] br_forward+0x96/0xb0 [bridge] [161846.962845] [<ffffffffa05af85e>] br_handle_frame_finish+0x1ae/0x420 [bridge] [161846.962853] [<ffffffffa05afc4f>] br_handle_frame+0x17f/0x260 [bridge] [161846.962862] [<ffffffffa05afad0>] ? br_handle_frame_finish+0x420/0x420 [bridge] [161846.962867] [<ffffffff8160d057>] __netif_receive_skb_core+0x1f7/0x870 [161846.962872] [<ffffffff8160d6f2>] __netif_receive_skb+0x22/0x70 [161846.962877] [<ffffffff8160d913>] netif_receive_skb_internal+0x23/0x90 [161846.962884] [<ffffffffa07512ea>] ? xenvif_idx_release+0xea/0x100 [xen_netback] [161846.962889] [<ffffffff816e5a10>] ? _raw_spin_unlock_irqrestore+0x20/0x50 [161846.962893] [<ffffffff8160e624>] netif_receive_skb_sk+0x24/0x90 [161846.962899] [<ffffffffa075269a>] xenvif_tx_submit+0x2ca/0x3f0 [xen_netback] [161846.962906] [<ffffffffa0753f0c>] xenvif_tx_action+0x9c/0xd0 [xen_netback] [161846.962915] [<ffffffffa07567f5>] xenvif_poll+0x35/0x70 [xen_netback] [161846.962920] [<ffffffff8160e01b>] napi_poll+0xcb/0x1e0 [161846.962925] [<ffffffff8160e1c0>] net_rx_action+0x90/0x1c0 [161846.962931] [<ffffffff8108aaba>] __do_softirq+0x10a/0x350 [161846.962938] [<ffffffff8108ae75>] irq_exit+0x125/0x130 [161846.962943] [<ffffffff813f03a9>] xen_evtchn_do_upcall+0x39/0x50 [161846.962950] [<ffffffff816e7ffe>] xen_do_hypervisor_callback+0x1e/0x40 [161846.962952] <EOI> [161846.962959] [<ffffffff816e5c4a>] ? _raw_spin_lock+0x4a/0x80 [161846.962964] [<ffffffff816e5b1e>] ? _raw_spin_lock_irqsave+0x1e/0xa0 [161846.962978] [<ffffffffa028e279>] ? qlcnic_83xx_mailbox_worker+0xb9/0x2a0 [qlcnic] [161846.962991] [<ffffffff810a14e1>] ? process_one_work+0x151/0x4b0 [161846.962995] [<ffffffff8100c3f2>] ? check_events+0x12/0x20 [161846.963001] [<ffffffff810a1960>] ? worker_thread+0x120/0x480 [161846.963005] [<ffffffff816e187b>] ? __schedule+0x30b/0x890 [161846.963010] [<ffffffff810a1840>] ? process_one_work+0x4b0/0x4b0 [161846.963015] [<ffffffff810a1840>] ? process_one_work+0x4b0/0x4b0 [161846.963021] [<ffffffff810a6b3e>] ? kthread+0xce/0xf0 [161846.963025] [<ffffffff810a6a70>] ? kthread_freezable_should_stop+0x70/0x70 [161846.963031] [<ffffffff816e6522>] ? ret_from_fork+0x42/0x70 [161846.963035] [<ffffffff810a6a70>] ? kthread_freezable_should_stop+0x70/0x70 [161846.963037] Code: cc 51 41 53 b8 1c 00 00 00 0f 05 41 5b 59 c3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc 51 41 53 b8 1d 00 00 00 0f 05 <41> 5b 59 c3 cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc
--- drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +9 -9
@@ -3825,7 +3825,7 @@ static void qlcnic_83xx_flush_mbx_queue(struct list_head *head = &mbx->cmd_q;struct qlcnic_cmd_args *cmd =NULL ; -spin_lock (&mbx->queue_lock); +spin_lock_bh (&mbx->queue_lock);while (!list_empty (head)) { cmd = list_entry(head->next, struct qlcnic_cmd_args, list);
@@ -3836,7 +3836,7 @@ static void qlcnic_83xx_flush_mbx_queue(qlcnic_83xx_notify_cmd_completion (adapter, cmd); } -spin_unlock (&mbx->queue_lock); +spin_unlock_bh (&mbx->queue_lock); }static int qlcnic_83xx_check_mbx_status (struct qlcnic_adapter *adapter)
@@ -3872,12 +3872,12 @@ static void qlcnic_83xx_dequeue_mbx_cmd( {struct qlcnic_mailbox *mbx = adapter->ahw->mailbox; -spin_lock (&mbx->queue_lock); +spin_lock_bh (&mbx->queue_lock);list_del (&cmd->list); mbx->num_cmds--; -spin_unlock (&mbx->queue_lock); +spin_unlock_bh (&mbx->queue_lock);qlcnic_83xx_notify_cmd_completion (adapter, cmd); }
@@ -3942,7 +3942,7 @@ static int qlcnic_83xx_enqueue_mbx_cmd(sinit_completion (&cmd->completion); cmd->rsp_opcode =QLC_83XX_MBX_RESPONSE_UNKNOWN ; -spin_lock (&mbx->queue_lock); +spin_lock_bh (&mbx->queue_lock);list_add_tail (&cmd->list, &mbx->cmd_q); mbx->num_cmds++;
@@ -3950,7 +3950,7 @@ static int qlcnic_83xx_enqueue_mbx_cmd(s *timeout = cmd->total_cmds *QLC_83XX_MBX_TIMEOUT ;queue_work (mbx->work_q, &mbx->work); -spin_unlock (&mbx->queue_lock); +spin_unlock_bh (&mbx->queue_lock);return 0 ; }
@@ -4046,15 +4046,15 @@ static void qlcnic_83xx_mailbox_worker(s mbx->rsp_status =QLC_83XX_MBX_RESPONSE_WAIT ;spin_unlock_irqrestore (&mbx->aen_lock, flags); -spin_lock (&mbx->queue_lock); +spin_lock_bh (&mbx->queue_lock);if (list_empty (head)) { -spin_unlock (&mbx->queue_lock); +spin_unlock_bh (&mbx->queue_lock);return ; } cmd = list_entry(head->next, struct qlcnic_cmd_args, list); -spin_unlock (&mbx->queue_lock); +spin_unlock_bh (&mbx->queue_lock); mbx_ops->encode_cmd (adapter, cmd); mbx_ops->nofity_fw (adapter,QLC_83XX_MBX_REQUEST );
Greg Kroah-Hartman
maintainerPATCH 5/45 r8169: fix RTL8168EP take too long to complete driver initialization.
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chunhao Lin <[email protected]>
[ Upstream commit 086ca23d03c0d2f4088f472386778d293e15c5f6 ]
Driver check the wrong register bit in rtl_ocp_tx_cond() that keep driver waiting until timeout.
Fix this by waiting for the right register bit.
--- drivers/net/ethernet/realtek/r8169.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169.c +2 -2
@@ -1375,7 +1375,7 @@ DECLARE_RTL_COND(rtl_ocp_tx_cond) {void __iomem *ioaddr = tp->mmio_addr; -return RTL_R8 (IBISR0 ) &0x02 ; +return RTL_R8 (IBISR0 ) &0x20 ; }static void rtl8168dp_driver_start (struct rtl8169_private *tp)
@@ -1421,7 +1421,7 @@ static void rtl8168ep_driver_stop(structvoid __iomem *ioaddr = tp->mmio_addr;RTL_W8 (IBCR2 ,RTL_R8 (IBCR2 ) & ~0x01 ); -rtl_msleep_loop_wait_low (tp, &rtl_ocp_tx_cond,50 ,2000 ); +rtl_msleep_loop_wait_high (tp, &rtl_ocp_tx_cond,50 ,2000 );RTL_W8 (IBISR0 ,RTL_R8 (IBISR0 ) |0x20 );RTL_W8 (IBCR0 ,RTL_R8 (IBCR0 ) & ~0x01 );ocp_write (tp,0x01 ,0x180 ,OOB_CMD_DRIVER_STOP );
Greg Kroah-Hartman
maintainerPATCH 6/45 tcp: release sk_frag.page in tcp_disconnect
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit 9b42d55a66d388e4dd5550107df051a9637564fc ]
socket can be disconnected and gets transformed back to a listening socket, if sk_frag.page is not released, which will be cloned into a new socket by sk_clone_lock, but the reference count of this page is increased, lead to a use after free or double free issue
--- net/ipv4/tcp.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ipv4/tcp.c +6 -0
@@ -2280,6 +2280,12 @@ int tcp_disconnect(struct sock *sk, intWARN_ON (inet->inet_num && !icsk->icsk_bind_hash); +if (sk->sk_frag.page) { +put_page (sk->sk_frag.page); + sk->sk_frag.page =NULL ; + sk->sk_frag.offset =0 ; + } + sk->sk_error_report (sk);return err; }
Greg Kroah-Hartman
maintainerPATCH 7/45 ARM: exynos_defconfig: Enable options to mount a rootfs via NFS
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Martinez Canillas <[email protected]>
commit 19f79ccf6d77409cd138bce8db206cdac7fd5ea7 upstream.
This patch enables the options to mount a rootfs over NFS and also support for automatic configuration of IP addresses during boot as needed by NFS.
--- arch/arm/configs/exynos_defconfig | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/configs/exynos_defconfig +6 -0
@@ -33,6 +33,10 @@ CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_NET_KEY=y CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y CONFIG_RFKILL_REGULATOR=y CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_DEVTMPFS=y
@@ -170,6 +174,8 @@ CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_CRAMFS=y CONFIG_ROMFS_FS=y +CONFIG_NFS_FS=y +CONFIG_ROOT_NFS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y
Greg Kroah-Hartman
maintainerPATCH 8/45 ARM: exynos_defconfig: Enable NFSv4 client
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 1c1fb9b0c89a2506e556114c813a606bc1508d49 upstream.
NFS client is already enabled (NFS_FS) and by default it enables clients for version 2 and 3. Enable explicitly the version 4 client to utilize the newer protocol.
The NFS client is especially useful for testing kernel in automated environments (network boot with network file system).
--- arch/arm/configs/exynos_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/exynos_defconfig +1 -0
@@ -175,6 +175,7 @@ CONFIG_TMPFS_POSIX_ACL=y CONFIG_CRAMFS=y CONFIG_ROMFS_FS=y CONFIG_NFS_FS=y +CONFIG_NFS_V4=y CONFIG_ROOT_NFS=y CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_ASCII=y
Greg Kroah-Hartman
maintainerPATCH 10/45 ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Han <[email protected]>
Commit 6c16fa957e84 is an incorrect backport as we map the keys in struct __ipv4_neigh_lookup(), but the correct place to add the code is struct __ipv4_neigh_lookup_noref(), compared to upstream.
Fix it by moving the code, or fewer cases will be covered as __ipv4_neigh_lookup_noref() will be called unconditionally from __ipv4_neigh_lookup(), and it can be called from other places such as ip_output.c.
--- include/net/arp.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/net/arp.h +3 -3
@@ -22,6 +22,9 @@ static inline struct neighbour *__ipv4_nstruct neighbour *n;u32 hash_val; +if (dev->flags & (IFF_LOOPBACK |IFF_POINTOPOINT )) + key =INADDR_ANY ; + hash_val =arp_hashfn (key, dev, nht->hash_rnd[0 ]) >> (32 - nht->hash_shift); for (n = rcu_dereference_bh(nht->hash_buckets[hash_val]); n != NULL;
@@ -37,9 +40,6 @@ static inline struct neighbour *__ipv4_n {struct neighbour *n; -if (dev->flags & (IFF_LOOPBACK |IFF_POINTOPOINT )) - key =INADDR_ANY ; -rcu_read_lock_bh (); n =__ipv4_neigh_lookup_noref (dev, key);if (n && !atomic_inc_not_zero (&n->refcnt))
Greg Kroah-Hartman
maintainerPATCH 11/45 cifs: Fix missing put_xid in cifs_file_strict_mmap
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox <[email protected]>
commit f04a703c3d613845ae3141bfaf223489de8ab3eb upstream.
If cifs_zap_mapping() returned an error, we would return without putting the xid that we got earlier. Restructure cifs_file_strict_mmap() and cifs_file_mmap() to be more similar to each other and have a single point of return that always puts the xid.
--- fs/cifs/file.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
fs/cifs/file.c +12 -14
@@ -3261,20 +3261,18 @@ static struct vm_operations_struct cifs_int cifs_file_strict_mmap (struct file *file,struct vm_area_struct *vma) { -int rc, xid; +int xid, rc =0 ;struct inode *inode =file_inode (file); xid =get_xid (); -if (!CIFS_CACHE_READ (CIFS_I (inode))) { +if (!CIFS_CACHE_READ (CIFS_I (inode))) rc =cifs_zap_mapping (inode); -if (rc) -return rc; - } - - rc =generic_file_mmap (file, vma); -if (rc ==0 ) +if (!rc) + rc =generic_file_mmap (file, vma); +if (!rc) vma->vm_ops = &cifs_file_vm_ops; +free_xid (xid);return rc; }
@@ -3284,16 +3282,16 @@ int cifs_file_mmap(struct file *file, stint rc, xid; xid =get_xid (); + rc =cifs_revalidate_file (file); -if (rc) { +if (rc)cifs_dbg (FYI ,"Validation prior to mmap failed, error=%d\n" , rc); -free_xid (xid); -return rc; - } - rc =generic_file_mmap (file, vma); -if (rc ==0 ) +if (!rc) + rc =generic_file_mmap (file, vma); +if (!rc) vma->vm_ops = &cifs_file_vm_ops; +free_xid (xid);return rc; }
Greg Kroah-Hartman
maintainerPATCH 12/45 cifs: Fix autonegotiate security settings mismatch
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel N Pettersson <[email protected]>
commit 9aca7e454415f7878b28524e76bebe1170911a88 upstream.
Autonegotiation gives a security settings mismatch error if the SMB server selects an SMBv3 dialect that isn't SMB3.02. The exact error is "protocol revalidation - security settings mismatch".
This can be tested using Samba v4.2 or by setting the global Samba setting max protocol = SMB3_00.
The check that fails in smb3_validate_negotiate is the dialect verification of the negotiate info response. This is because it tries to verify against the protocol_id in the global smbdefault_values. The protocol_id in smbdefault_values is SMB3.02.
In SMB2_negotiate the protocol_id in smbdefault_values isn't updated, it is global so it probably shouldn't be, but server->dialect is.
This patch changes the check in smb3_validate_negotiate to use server->dialect instead of server->vals->protocol_id. The patch works with autonegotiate and when using a specific version in the vers mount option.
--- fs/cifs/smb2pdu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/cifs/smb2pdu.c +1 -2
@@ -507,8 +507,7 @@ int smb3_validate_negotiate(const unsign }/* check validate negotiate info response matches what we got earlier */ -if (pneg_rsp->Dialect != -cpu_to_le16 (tcon->ses->server->vals->protocol_id)) +if (pneg_rsp->Dialect !=cpu_to_le16 (tcon->ses->server->dialect)) goto vneg_out;if (pneg_rsp->SecurityMode !=cpu_to_le16 (tcon->ses->server->sec_mode))
Greg Kroah-Hartman
maintainerPATCH 13/45 CIFS: zero sensitive data when freeing
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurelien Aptel <[email protected]>
commit 97f4b7276b829a8927ac903a119bef2f963ccc58 upstream.
also replaces memset()+kfree() by kzfree().
--- fs/cifs/cifsencrypt.c | 3 +-- fs/cifs/connect.c | 6 +++--- fs/cifs/misc.c | 14 ++++---------- 3 files changed, 8 insertions(+), 15 deletions(-)
fs/cifs/cifsencrypt.c +1 -2
@@ -303,9 +303,8 @@ int calc_lanman_hash(const char *passwor {int i;int rc; -char password_with_pad[CIFS_ENCPWD_SIZE ]; +char password_with_pad[CIFS_ENCPWD_SIZE ] = {0 }; -memset (password_with_pad,0 ,CIFS_ENCPWD_SIZE );if (password)strncpy (password_with_pad, password,CIFS_ENCPWD_SIZE );
fs/cifs/connect.c +3 -3
@@ -1650,7 +1650,7 @@ cifs_parse_mount_options(const char *mou tmp_end++;if (!(tmp_end < end && tmp_end[1 ] == delim)) {/* No it is not. Set the password to NULL */ -kfree (vol->password); +kzfree (vol->password); vol->password =NULL ;break ; }
@@ -1688,7 +1688,7 @@ cifs_parse_mount_options(const char *mou options = end; } -kfree (vol->password); +kzfree (vol->password);/* Now build new password string */ temp_len =strlen (value); vol->password =kzalloc (temp_len+1 ,GFP_KERNEL );
@@ -4046,7 +4046,7 @@ cifs_construct_tcon(struct cifs_sb_inforeset_cifs_unix_caps (0 , tcon,NULL , vol_info); out:kfree (vol_info->username); -kfree (vol_info->password); +kzfree (vol_info->password);kfree (vol_info);return tcon;
fs/cifs/misc.c +4 -10
@@ -99,14 +99,11 @@ sesInfoFree(struct cifs_ses *buf_to_freekfree (buf_to_free->serverOS);kfree (buf_to_free->serverDomain);kfree (buf_to_free->serverNOS); -if (buf_to_free->password) { -memset (buf_to_free->password,0 ,strlen (buf_to_free->password)); -kfree (buf_to_free->password); - } +kzfree (buf_to_free->password);kfree (buf_to_free->user_name);kfree (buf_to_free->domainName); -kfree (buf_to_free->auth_key.response); -kfree (buf_to_free); +kzfree (buf_to_free->auth_key.response); +kzfree (buf_to_free); } struct cifs_tcon *
@@ -136,10 +133,7 @@ tconInfoFree(struct cifs_tcon *buf_to_fr }atomic_dec (&tconInfoAllocCount);kfree (buf_to_free->nativeFileSystem); -if (buf_to_free->password) { -memset (buf_to_free->password,0 ,strlen (buf_to_free->password)); -kfree (buf_to_free->password); - } +kzfree (buf_to_free->password);kfree (buf_to_free); }
Greg Kroah-Hartman
maintainerPATCH 14/45 posix-timer: Properly check sigevent->sigev_notify
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit cef31d9af908243421258f1df35a4a644604efbe upstream.
timer_create() specifies via sigevent->sigev_notify the signal delivery for the new timer. The valid modes are SIGEV_NONE, SIGEV_SIGNAL, SIGEV_THREAD and (SIGEV_SIGNAL | SIGEV_THREAD_ID).
The sanity check in good_sigevent() is only checking the valid combination for the SIGEV_THREAD_ID bit, i.e. SIGEV_SIGNAL, but if SIGEV_THREAD_ID is not set it accepts any random value.
This has no real effects on the posix timer and signal delivery code, but it affects show_timer() which handles the output of /proc/$PID/timers. That function uses a string array to pretty print sigev_notify. The access to that array has no bound checks, so random sigev_notify cause access beyond the array bounds.
Add proper checks for the valid notify modes and remove the SIGEV_THREAD_ID masking from various code pathes as SIGEV_NONE can never be set in combination with SIGEV_THREAD_ID.
--- kernel/time/posix-timers.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-)
kernel/time/posix-timers.c +19 -15
@@ -500,17 +500,22 @@ static struct pid *good_sigevent(sigeven {struct task_struct *rtn = current->group_leader; -if ((event->sigev_notify &SIGEV_THREAD_ID ) && - (!(rtn =find_task_by_vpid (event->sigev_notify_thread_id)) || - !same_thread_group (rtn, current) || - (event->sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_SIGNAL )) +switch (event->sigev_notify) { +case SIGEV_SIGNAL |SIGEV_THREAD_ID : + rtn =find_task_by_vpid (event->sigev_notify_thread_id); +if (!rtn || !same_thread_group (rtn, current)) +return NULL ; +/* FALLTHRU */ +case SIGEV_SIGNAL : +case SIGEV_THREAD : +if (event->sigev_signo <=0 || event->sigev_signo >SIGRTMAX ) +return NULL ; +/* FALLTHRU */ +case SIGEV_NONE : +return task_pid (rtn); +default :return NULL ; - -if (((event->sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_NONE ) && - ((event->sigev_signo <=0 ) || (event->sigev_signo >SIGRTMAX ))) -return NULL ; - -return task_pid (rtn); + } } void posix_timers_register_clock(const clockid_t clock_id,
@@ -738,8 +743,7 @@ common_timer_get(struct k_itimer *timr,/* interval timer ? */ if (iv.tv64) cur_setting->it_interval =ktime_to_timespec (iv); -else if (!hrtimer_active (timer) && - (timr->it_sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_NONE ) +else if (!hrtimer_active (timer) && timr->it_sigev_notify !=SIGEV_NONE )return ; now = timer->base->get_time ();
@@ -750,7 +754,7 @@ common_timer_get(struct k_itimer *timr,* expiry is > now. */ if (iv.tv64 && (timr->it_requeue_pending &REQUEUE_PENDING || - (timr->it_sigev_notify & ~SIGEV_THREAD_ID ) ==SIGEV_NONE )) + timr->it_sigev_notify ==SIGEV_NONE )) timr->it_overrun += (unsigned int )hrtimer_forward (timer, now, iv); remaining =ktime_sub (hrtimer_get_expires (timer), now);
@@ -760,7 +764,7 @@ common_timer_get(struct k_itimer *timr,* A single shot SIGEV_NONE timer must return 0, when * it is expired ! */ -if ((timr->it_sigev_notify & ~SIGEV_THREAD_ID ) !=SIGEV_NONE ) +if (timr->it_sigev_notify !=SIGEV_NONE ) cur_setting->it_value.tv_nsec =1 ; }else cur_setting->it_value =ktime_to_timespec (remaining);
@@ -858,7 +862,7 @@ common_timer_set(struct k_itimer *timr, timr->it.real.interval =timespec_to_ktime (new_setting->it_interval);/* SIGEV_NONE timers are not queued ! See common_timer_get */ -if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID ) ==SIGEV_NONE )) { +if (timr->it_sigev_notify ==SIGEV_NONE ) {/* Setup correct expiry time for relative timers */ if (mode ==HRTIMER_MODE_REL ) {hrtimer_add_expires (timer, timer->base->get_time ());
Greg Kroah-Hartman
maintainerPATCH 15/45 usbip: fix stub_rx: get_pipe() to validate endpoint number
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit 635f545a7e8be7596b9b2b6a43cab6bbd5a88e43 upstream.
get_pipe() routine doesn't validate the input endpoint number and uses to reference ep_in and ep_out arrays. Invalid endpoint number can trigger BUG(). Range check the epnum and returning error instead of calling BUG().
Change caller stub_recv_cmd_submit() to handle the get_pipe() error return.
--- drivers/usb/usbip/stub_rx.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/usb/usbip/stub_rx.c +10 -6
@@ -347,15 +347,15 @@ static int get_pipe(struct stub_device *struct usb_host_endpoint *ep;struct usb_endpoint_descriptor *epd =NULL ; +if (epnum <0 || epnum >15 ) + goto err_ret; +if (dir ==USBIP_DIR_IN ) ep = udev->ep_in[epnum &0x7f ];else ep = udev->ep_out[epnum &0x7f ]; -if (!ep) { -dev_err (&sdev->interface->dev,"no such endpoint?, %d\n" , - epnum); -BUG (); - } +if (!ep) + goto err_ret; epd = &ep->desc;if (usb_endpoint_xfer_control (epd)) {
@@ -386,9 +386,10 @@ static int get_pipe(struct stub_device *return usb_rcvisocpipe (udev, epnum); } +err_ret:/* NOT REACHED */ dev_err (&sdev->interface->dev,"get pipe, epnum %d\n" , epnum); -return 0 ; +return -1 ; }static void masking_bogus_flags (struct urb *urb)
@@ -454,6 +455,9 @@ static void stub_recv_cmd_submit(structstruct usb_device *udev = sdev->udev;int pipe =get_pipe (sdev, pdu->base.ep, pdu->base.direction); +if (pipe ==-1 ) +return ; + priv =stub_priv_alloc (sdev, pdu);if (!priv)return ;
Greg Kroah-Hartman
maintainerPATCH 16/45 usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit c6688ef9f29762e65bce325ef4acd6c675806366 upstream.
Harden CMD_SUBMIT path to handle malicious input that could trigger large memory allocations. Add checks to validate transfer_buffer_length and number_of_packets to protect against bad input requesting for unbounded memory allocations. Validate early in get_pipe() and return failure.
--- drivers/usb/usbip/stub_rx.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
drivers/usb/usbip/stub_rx.c +27 -3
@@ -341,11 +341,13 @@ static struct stub_priv *stub_priv_allocreturn priv; } -static int get_pipe (struct stub_device *sdev,int epnum,int dir) +static int get_pipe (struct stub_device *sdev,struct usbip_header *pdu) {struct usb_device *udev = sdev->udev;struct usb_host_endpoint *ep;struct usb_endpoint_descriptor *epd =NULL ; +int epnum = pdu->base.ep; +int dir = pdu->base.direction;if (epnum <0 || epnum >15 ) goto err_ret;
@@ -358,6 +360,7 @@ static int get_pipe(struct stub_device * goto err_ret; epd = &ep->desc; +if (usb_endpoint_xfer_control (epd)) {if (dir ==USBIP_DIR_OUT )return usb_sndctrlpipe (udev, epnum);
@@ -380,6 +383,27 @@ static int get_pipe(struct stub_device * }if (usb_endpoint_xfer_isoc (epd)) { +/* validate packet size and number of packets */ +unsigned int maxp, packets, bytes; + +#define USB_EP_MAXP_MULT_SHIFT 11 +#define USB_EP_MAXP_MULT_MASK (3 << USB_EP_MAXP_MULT_SHIFT) +#define USB_EP_MAXP_MULT (m) \ + (((m) & USB_EP_MAXP_MULT_MASK) >> USB_EP_MAXP_MULT_SHIFT) + + maxp =usb_endpoint_maxp (epd); + maxp *= (USB_EP_MAXP_MULT ( +__le16_to_cpu (epd->wMaxPacketSize)) +1 ); + bytes = pdu->u.cmd_submit.transfer_buffer_length; + packets =DIV_ROUND_UP (bytes, maxp); + +if (pdu->u.cmd_submit.number_of_packets <0 || + pdu->u.cmd_submit.number_of_packets > packets) { +dev_err (&sdev->udev->dev, +"CMD_SUBMIT: isoc invalid num packets %d\n" , + pdu->u.cmd_submit.number_of_packets); +return -1 ; + }if (dir ==USBIP_DIR_OUT )return usb_sndisocpipe (udev, epnum);else
@@ -388,7 +412,7 @@ static int get_pipe(struct stub_device * err_ret:/* NOT REACHED */ -dev_err (&sdev->interface->dev,"get pipe, epnum %d\n" , epnum); +dev_err (&sdev->udev->dev,"CMD_SUBMIT: invalid epnum %d\n" , epnum);return -1 ; }
@@ -453,7 +477,7 @@ static void stub_recv_cmd_submit(structstruct stub_priv *priv;struct usbip_device *ud = &sdev->ud;struct usb_device *udev = sdev->udev; -int pipe =get_pipe (sdev, pdu->base.ep, pdu->base.direction); +int pipe =get_pipe (sdev, pdu);if (pipe ==-1 )return ;
Greg Kroah-Hartman
maintainerPATCH 17/45 usbip: prevent vhci_hcd driver from leaking a socket pointer address
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit 2f2d0088eb93db5c649d2a5e34a3800a8a935fc5 upstream.
When a client has a USB device attached over IP, the vhci_hcd driver is locally leaking a socket pointer address via the
/sys/devices/platform/vhci_hcd/status file (world-readable) and in debug output when "usbip --debug port" is run.
Fix it to not leak. The socket pointer address is not used at the moment and it was made visible as a convenient way to find IP address from socket pointer address by looking up /proc/net/{tcp,tcp6}.
As this opens a security hole, the fix replaces socket pointer address with sockfd.
--- drivers/usb/usbip/usbip_common.h | 1 + drivers/usb/usbip/vhci_sysfs.c | 26 +++++++++++++++----------- tools/usb/usbip/libsrc/vhci_driver.c | 8 ++++---- 3 files changed, 20 insertions(+), 15 deletions(-)
drivers/usb/usbip/usbip_common.h +1 -0
@@ -261,6 +261,7 @@ struct usbip_device {/* lock for status */ spinlock_t lock; +int sockfd;struct socket *tcp_socket;struct task_struct *tcp_rx;
drivers/usb/usbip/vhci_sysfs.c +15 -11
@@ -39,16 +39,20 @@ static ssize_t status_show(struct device/* * output example: -* prt sta spd dev socket local_busid -* 000 004 000 000 c5a7bb80 1-2.3 -* 001 004 000 000 d8cee980 2-3.4 +* prt sta spd dev sockfd local_busid +* 0000 004 000 00000000 000003 1-2.3 +* 0001 004 000 00000000 000004 2-3.4 * -* IP address can be retrieved from a socket pointer address by looking -* up /proc/net/{tcp,tcp6}. Also, a userland program may remember a -* port number and its peer IP address. +* Output includes socket fd instead of socket pointer address to +* avoid leaking kernel memory address in: +* /sys/devices/platform/vhci_hcd.0/status and in debug output. +* The socket pointer address is not used at the moment and it was +* made visible as a convenient way to find IP address from socket +* pointer address by looking up /proc/net/{tcp,tcp6}. As this opens +* a security hole, the change is made to use sockfd instead. */ out +=sprintf (out, -"prt sta spd bus dev socket local_busid\n" ); +"prt sta spd dev sockfd local_busid\n" );for (i =0 ; i <VHCI_NPORTS ; i++) {struct vhci_device *vdev =port_to_vdev (i);
@@ -59,12 +63,11 @@ static ssize_t status_show(struct deviceif (vdev->ud.status ==VDEV_ST_USED ) { out +=sprintf (out,"%03u %08x " , vdev->speed, vdev->devid); - out +=sprintf (out,"%16p " , vdev->ud.tcp_socket); + out +=sprintf (out,"%06u " , vdev->ud.sockfd); out +=sprintf (out,"%s" ,dev_name (&vdev->udev->dev)); - }else { - out +=sprintf (out,"000 000 000 0000000000000000 0-0" ); - } + }else + out +=sprintf (out,"000 00000000 000000 0-0" ); out +=sprintf (out,"\n" );spin_unlock (&vdev->ud.lock);
@@ -223,6 +226,7 @@ static ssize_t store_attach(struct devic vdev->devid = devid; vdev->speed = speed; + vdev->ud.sockfd = sockfd; vdev->ud.tcp_socket = socket; vdev->ud.status =VDEV_ST_NOTASSIGNED ;
tools/usb/usbip/libsrc/vhci_driver.c +4 -4
@@ -55,12 +55,12 @@ static int parse_status(const char *valuwhile (*c !='\0' ) {int port, status, speed, devid; -unsigned long socket; +int sockfd;char lbusid[SYSFS_BUS_ID_SIZE ]; - ret =sscanf (c,"%d %d %d %x %lx %31s\n" , + ret =sscanf (c,"%d %d %d %x %u %31s\n" , &port, &status, &speed, - &devid, &socket, lbusid); + &devid, &sockfd, lbusid);if (ret <5 ) {dbg ("sscanf failed: %d" , ret);
@@ -69,7 +69,7 @@ static int parse_status(const char *valudbg ("port %d status %d speed %d devid %x" , port, status, speed, devid); -dbg ("socket %lx lbusid %s" , socket, lbusid); +dbg ("sockfd %u lbusid %s" , sockfd, lbusid);/* if a device is connected, look at it */
Greg Kroah-Hartman
maintainerPATCH 19/45 usb: usbip: Fix possible deadlocks reported by lockdep
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Goodbody <[email protected]>
commit 21619792d1eca7e772ca190ba68588e57f29595b upstream.
Change spin_lock calls to spin_lock_irqsave to prevent attmpted recursive lock taking in interrupt context.
This patch fixes Bug 109351
https://bugzilla.kernel.org/show_bug.cgi?id=109351
--- drivers/usb/usbip/usbip_event.c | 5 +- drivers/usb/usbip/vhci_hcd.c | 88 +++++++++++++++++++++++----------------- drivers/usb/usbip/vhci_rx.c | 30 +++++++------ drivers/usb/usbip/vhci_sysfs.c | 19 +++++--- drivers/usb/usbip/vhci_tx.c | 14 +++--- 5 files changed, 91 insertions(+), 65 deletions(-)
drivers/usb/usbip/usbip_event.c +3 -2
@@ -117,11 +117,12 @@ EXPORT_SYMBOL_GPL(usbip_event_add);int usbip_event_happened (struct usbip_device *ud) {int happened =0 ; +unsigned long flags; -spin_lock (&ud->lock); +spin_lock_irqsave (&ud->lock, flags);if (ud->event !=0 ) happened =1 ; -spin_unlock (&ud->lock); +spin_unlock_irqrestore (&ud->lock, flags);return happened; }
drivers/usb/usbip/vhci_hcd.c +52 -36
321 lines not on this page · raw message
drivers/usb/usbip/vhci_rx.c +17 -13
@@ -72,10 +72,11 @@ static void vhci_recv_ret_submit(struct {struct usbip_device *ud = &vdev->ud;struct urb *urb; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags); urb =pickup_urb_and_free_priv (vdev, pdu->base.seqnum); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);if (!urb) {pr_err ("cannot find a urb of seqnum %u\n" , pdu->base.seqnum);
@@ -104,9 +105,9 @@ static void vhci_recv_ret_submit(structusbip_dbg_vhci_rx ("now giveback urb %p\n" , urb); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
@@ -117,8 +118,9 @@ static struct vhci_unlink *dequeue_pendi struct usbip_header *pdu) {struct vhci_unlink *unlink, *tmp; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags);list_for_each_entry_safe (unlink, tmp, &vdev->unlink_rx, list) {pr_info ("unlink->seqnum %lu\n" , unlink->seqnum);
@@ -127,12 +129,12 @@ static struct vhci_unlink *dequeue_pendi unlink->seqnum);list_del (&unlink->list); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return unlink; } } -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return NULL ; }
@@ -142,6 +144,7 @@ static void vhci_recv_ret_unlink(struct {struct vhci_unlink *unlink;struct urb *urb; +unsigned long flags;usbip_dump_header (pdu);
@@ -152,9 +155,9 @@ static void vhci_recv_ret_unlink(structreturn ; } -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags); urb =pickup_urb_and_free_priv (vdev, unlink->unlink_seqnum); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);if (!urb) {/*
@@ -171,9 +174,9 @@ static void vhci_recv_ret_unlink(struct urb->status = pdu->u.ret_unlink.status;pr_info ("urb->status %d\n" , urb->status); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
@@ -185,10 +188,11 @@ static void vhci_recv_ret_unlink(structstatic int vhci_priv_tx_empty (struct vhci_device *vdev) {int empty =0 ; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags); empty =list_empty (&vdev->priv_rx); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return empty; }
drivers/usb/usbip/vhci_sysfs.c +11 -8
@@ -32,10 +32,11 @@ static ssize_t status_show(struct device {char *s = out;int i =0 ; +unsigned long flags;BUG_ON (!the_controller || !out); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);/* * output example:
@@ -73,7 +74,7 @@ static ssize_t status_show(struct devicespin_unlock (&vdev->ud.lock); } -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);return out - s; }
@@ -83,11 +84,12 @@ static DEVICE_ATTR_RO(status);static int vhci_port_disconnect (__u32 rhport) {struct vhci_device *vdev; +unsigned long flags;usbip_dbg_vhci_sysfs ("enter\n" );/* lock */ -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags); vdev =port_to_vdev (rhport);
@@ -97,14 +99,14 @@ static int vhci_port_disconnect(__u32 rh/* unlock */ spin_unlock (&vdev->ud.lock); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);return -EINVAL ; }/* unlock */ spin_unlock (&vdev->ud.lock); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usbip_event_add (&vdev->ud,VDEV_EVENT_DOWN );
@@ -180,6 +182,7 @@ static ssize_t store_attach(struct devicint sockfd =0 ;__u32 rhport =0 , devid =0 , speed =0 ;int err; +unsigned long flags;/* * @rhport: port number of vhci_hcd
@@ -205,14 +208,14 @@ static ssize_t store_attach(struct devic/* now need lock until setting vdev status as used */ /* begin a lock */ -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags); vdev =port_to_vdev (rhport);spin_lock (&vdev->ud.lock);if (vdev->ud.status !=VDEV_ST_NULL ) {/* end of the lock */ spin_unlock (&vdev->ud.lock); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);sockfd_put (socket);
@@ -231,7 +234,7 @@ static ssize_t store_attach(struct devic vdev->ud.status =VDEV_ST_NOTASSIGNED ;spin_unlock (&vdev->ud.lock); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);/* end the lock */ vdev->ud.tcp_rx =kthread_get_run (vhci_rx_loop, &vdev->ud,"vhci_rx" );
drivers/usb/usbip/vhci_tx.c +8 -6
@@ -47,16 +47,17 @@ static void setup_cmd_submit_pdu(structstatic struct vhci_priv *dequeue_from_priv_tx (struct vhci_device *vdev) {struct vhci_priv *priv, *tmp; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags);list_for_each_entry_safe (priv, tmp, &vdev->priv_tx, list) {list_move_tail (&priv->list, &vdev->priv_rx); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return priv; } -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return NULL ; }
@@ -136,16 +137,17 @@ static int vhci_send_cmd_submit(struct vstatic struct vhci_unlink *dequeue_from_unlink_tx (struct vhci_device *vdev) {struct vhci_unlink *unlink, *tmp; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags);list_for_each_entry_safe (unlink, tmp, &vdev->unlink_tx, list) {list_move_tail (&unlink->list, &vdev->unlink_rx); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return unlink; } -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 21/45 usbip: prevent leaking socket pointer address in messages
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit 90120d15f4c397272aaf41077960a157fc4212bf upstream.
usbip driver is leaking socket pointer address in messages. Remove the messages that aren't useful and print sockfd in the ones that are useful for debugging.
--- drivers/usb/usbip/stub_dev.c | 3 +-- drivers/usb/usbip/usbip_common.c | 15 ++++----------- drivers/usb/usbip/vhci_hcd.c | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-)
drivers/usb/usbip/stub_dev.c +1 -2
@@ -163,8 +163,7 @@ static void stub_shutdown_connection(str* step 1? */ if (ud->tcp_socket) { -dev_dbg (&sdev->udev->dev,"shutdown tcp_socket %p\n" , - ud->tcp_socket); +dev_dbg (&sdev->udev->dev,"shutdown sockfd %d\n" , ud->sockfd);kernel_sock_shutdown (ud->tcp_socket,SHUT_RDWR ); }
drivers/usb/usbip/usbip_common.c +4 -11
@@ -317,18 +317,14 @@ int usbip_recv(struct socket *sock, voidstruct msghdr msg;struct kvec iov;int total =0 ; -/* for blocks of if (usbip_dbg_flag_xmit) */ char *bp = buf;int osize = size; -usbip_dbg_xmit ("enter\n" ); - -if (!sock || !buf || !size) { -pr_err ("invalid arg, sock %p buff %p size %d\n" , sock, buf, - size); +if (!sock || !buf || !size)return -EINVAL ; - } + +usbip_dbg_xmit ("enter\n" ); do { sock->sk->sk_allocation = GFP_NOIO;
@@ -341,11 +337,8 @@ int usbip_recv(struct socket *sock, void msg.msg_flags =MSG_NOSIGNAL ; result =kernel_recvmsg (sock, &msg, &iov,1 , size,MSG_WAITALL ); -if (result <=0 ) { -pr_debug ("receive sock %p buf %p size %u ret %d total %d\n" , - sock, buf, size, result, total); +if (result <=0 ) goto err; - } size -= result; buf += result;
drivers/usb/usbip/vhci_hcd.c +1 -1
@@ -782,7 +782,7 @@ static void vhci_shutdown_connection(str/* need this? see stub_dev.c */ if (ud->tcp_socket) { -pr_debug ("shutdown tcp_socket %p\n" , ud->tcp_socket); +pr_debug ("shutdown sockfd %d\n" , ud->sockfd);kernel_sock_shutdown (ud->tcp_socket,SHUT_RDWR ); }
Greg Kroah-Hartman
maintainerPATCH 22/45 usbip: stub: stop printing kernel pointer addresses in messages
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit 248a22044366f588d46754c54dfe29ffe4f8b4df upstream.
Remove and/or change debug, info. and error messages to not print kernel pointer addresses.
--- drivers/usb/usbip/stub_main.c | 5 +++-- drivers/usb/usbip/stub_rx.c | 7 ++----- drivers/usb/usbip/stub_tx.c | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-)
drivers/usb/usbip/stub_main.c +3 -2
@@ -252,11 +252,12 @@ void stub_device_cleanup_urbs(struct stustruct stub_priv *priv;struct urb *urb; -dev_dbg (&sdev->udev->dev,"free sdev %p\n" , sdev); +dev_dbg (&sdev->udev->dev,"Stub device cleaning up urbs\n" );while ((priv =stub_priv_pop (sdev))) { urb = priv->urb; -dev_dbg (&sdev->udev->dev,"free urb %p\n" , urb); +dev_dbg (&sdev->udev->dev,"free urb seqnum %lu\n" , + priv->seqnum);usb_kill_urb (urb);kmem_cache_free (stub_priv_cache, priv);
drivers/usb/usbip/stub_rx.c +2 -5
@@ -230,9 +230,6 @@ static int stub_recv_cmd_unlink(struct sif (priv->seqnum != pdu->u.cmd_unlink.seqnum)continue ; -dev_info (&priv->urb->dev->dev,"unlink urb %p\n" , - priv->urb); -/* * This matched urb is not completed yet (i.e., be in * flight in usb hcd hardware/driver). Now we are
@@ -271,8 +268,8 @@ static int stub_recv_cmd_unlink(struct s ret =usb_unlink_urb (priv->urb);if (ret != -EINPROGRESS )dev_err (&priv->urb->dev->dev, -"failed to unlink a urb %p, ret %d\n" , - priv->urb, ret); +"failed to unlink a urb # %lu, ret %d\n" , + priv->seqnum, ret);return 0 ; }
drivers/usb/usbip/stub_tx.c +2 -2
@@ -201,8 +201,8 @@ static int stub_send_ret_submit(struct s/* 1. setup usbip_header */ setup_ret_submit_pdu (&pdu_header, urb); -usbip_dbg_stub_tx ("setup txdata seqnum: %d urb: %p\n" , - pdu_header.base.seqnum, urb); +usbip_dbg_stub_tx ("setup txdata seqnum: %d\n" , + pdu_header.base.seqnum);usbip_header_correct_endian (&pdu_header,1 ); iov[iovnum].iov_base = &pdu_header;
Greg Kroah-Hartman
maintainerPATCH 23/45 usbip: vhci: stop printing kernel pointer addresses in messages
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit 8272d099d05f7ab2776cf56a2ab9f9443be18907 upstream.
Remove and/or change debug, info. and error messages to not print kernel pointer addresses.
--- drivers/usb/usbip/vhci_hcd.c | 10 ---------- drivers/usb/usbip/vhci_rx.c | 23 +++++++++++------------ drivers/usb/usbip/vhci_tx.c | 3 ++- 3 files changed, 13 insertions(+), 23 deletions(-)
drivers/usb/usbip/vhci_hcd.c +0 -10
@@ -469,9 +469,6 @@ static int vhci_urb_enqueue(struct usb_hstruct vhci_device *vdev;unsigned long flags; -usbip_dbg_vhci_hc ("enter, usb_hcd %p urb %p mem_flags %d\n" , - hcd, urb, mem_flags); -/* patch to usb_sg_init() is in 2.5.60 */ BUG_ON (!urb->transfer_buffer && urb->transfer_buffer_length);
@@ -630,8 +627,6 @@ static int vhci_urb_dequeue(struct usb_hstruct vhci_device *vdev;unsigned long flags; -pr_info ("dequeue a urb %p\n" , urb); -spin_lock_irqsave (&the_controller->lock, flags); priv = urb->hcpriv;
@@ -659,7 +654,6 @@ static int vhci_urb_dequeue(struct usb_h/* tcp connection is closed */ spin_lock (&vdev->priv_lock); -pr_info ("device %p seems to be disconnected\n" , vdev);list_del (&priv->list);kfree (priv); urb->hcpriv =NULL ;
@@ -671,8 +665,6 @@ static int vhci_urb_dequeue(struct usb_h* vhci_rx will receive RET_UNLINK and give back the URB. * Otherwise, we give back it here. */ -pr_info ("gives back urb %p\n" , urb); -usb_hcd_unlink_urb_from_ep (hcd, urb);spin_unlock_irqrestore (&the_controller->lock, flags);
@@ -701,8 +693,6 @@ static int vhci_urb_dequeue(struct usb_h unlink->unlink_seqnum = priv->seqnum; -pr_info ("device %p seems to be still connected\n" , vdev); -/* send cmd_unlink and try to cancel the pending URB in the * peer */ list_add_tail (&unlink->list, &vdev->unlink_tx);
drivers/usb/usbip/vhci_rx.c +11 -12
@@ -37,24 +37,23 @@ struct urb *pickup_urb_and_free_priv(str urb = priv->urb; status = urb->status; -usbip_dbg_vhci_rx ("find urb %p vurb %p seqnum %u\n" , - urb, priv, seqnum); +usbip_dbg_vhci_rx ("find urb seqnum %u\n" , seqnum);switch (status) {case -ENOENT :/* fall through */ case -ECONNRESET : -dev_info (&urb->dev->dev, -"urb %p was unlinked %ssynchronuously.\n" , urb, - status == -ENOENT ?"" :"a" ); +dev_dbg (&urb->dev->dev, +"urb seq# %u was unlinked %ssynchronuously\n" , + seqnum, status == -ENOENT ?"" :"a" );break ;case -EINPROGRESS :/* no info output */ break ;default : -dev_info (&urb->dev->dev, -"urb %p may be in a error, status %d\n" , urb, - status); +dev_dbg (&urb->dev->dev, +"urb seq# %u may be in a error, status %d\n" , + seqnum, status); }list_del (&priv->list);
@@ -79,8 +78,8 @@ static void vhci_recv_ret_submit(structspin_unlock_irqrestore (&vdev->priv_lock, flags);if (!urb) { -pr_err ("cannot find a urb of seqnum %u\n" , pdu->base.seqnum); -pr_info ("max seqnum %d\n" , +pr_err ("cannot find a urb of seqnum %u max seqnum %d\n" , + pdu->base.seqnum,atomic_read (&the_controller->seqnum));usbip_event_add (ud,VDEV_EVENT_ERROR_TCP );return ;
@@ -103,7 +102,7 @@ static void vhci_recv_ret_submit(structif (usbip_dbg_flag_vhci_rx)usbip_dump_urb (urb); -usbip_dbg_vhci_rx ("now giveback urb %p\n" , urb); +usbip_dbg_vhci_rx ("now giveback urb %u\n" , pdu->base.seqnum);spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb);
@@ -168,7 +167,7 @@ static void vhci_recv_ret_unlink(structpr_info ("the urb (seqnum %d) was already given back\n" , pdu->base.seqnum); }else { -usbip_dbg_vhci_rx ("now giveback urb %p\n" , urb); +usbip_dbg_vhci_rx ("now giveback urb %d\n" , pdu->base.seqnum);/* If unlink is successful, status is -ECONNRESET */ urb->status = pdu->u.ret_unlink.status;
drivers/usb/usbip/vhci_tx.c +2 -1
@@ -83,7 +83,8 @@ static int vhci_send_cmd_submit(struct vmemset (&msg,0 ,sizeof (msg));memset (&iov,0 ,sizeof (iov)); -usbip_dbg_vhci_tx ("setup txdata urb %p\n" , urb); +usbip_dbg_vhci_tx ("setup txdata urb seqnum %lu\n" , + priv->seqnum);/* 1. setup usbip_header */ setup_cmd_submit_pdu (&pdu_header, urb);
Greg Kroah-Hartman
maintainerPATCH 24/45 dccp: CVE-2017-8824: use-after-free in DCCP code
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mohamed Ghannam <[email protected]>
commit 69c64866ce072dea1d1e59a0d61e0f66c0dffb76 upstream.
Whenever the sock object is in DCCP_CLOSED state, dccp_disconnect() must free dccps_hc_tx_ccid and dccps_hc_rx_ccid and set to NULL.
--- net/dccp/proto.c | 5 +++++ 1 file changed, 5 insertions(+)
net/dccp/proto.c +5 -0
@@ -259,6 +259,7 @@ int dccp_disconnect(struct sock *sk, int {struct inet_connection_sock *icsk =inet_csk (sk);struct inet_sock *inet =inet_sk (sk); +struct dccp_sock *dp =dccp_sk (sk);int err =0 ;const int old_state = sk->sk_state;
@@ -278,6 +279,10 @@ int dccp_disconnect(struct sock *sk, int sk->sk_err =ECONNRESET ;dccp_clear_xmit_timers (sk); +ccid_hc_rx_delete (dp->dccps_hc_rx_ccid, sk); +ccid_hc_tx_delete (dp->dccps_hc_tx_ccid, sk); + dp->dccps_hc_rx_ccid =NULL ; + dp->dccps_hc_tx_ccid =NULL ;__skb_queue_purge (&sk->sk_receive_queue);__skb_queue_purge (&sk->sk_write_queue);
Greg Kroah-Hartman
maintainerPATCH 25/45 media: dvb-usb-v2: lmedm04: Improve logic checking of warm start
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 3d932ee27e852e4904647f15b64dedca51187ad7 upstream.
Warm start has no check as whether a genuine device has connected and proceeds to next execution path.
Check device should read 0x47 at offset of 2 on USB descriptor read and it is the amount requested of 6 bytes.
Fix for
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access as
--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/media/usb/dvb-usb-v2/lmedm04.c +18 -8
@@ -438,18 +438,23 @@ static int lme2510_pid_filter(struct dvbstatic int lme2510_return_status (struct dvb_usb_device *d) { -int ret =0 ; +int ret;u8 *data; - data =kzalloc (10 ,GFP_KERNEL ); + data =kzalloc (6 ,GFP_KERNEL );if (!data)return -ENOMEM ; - ret |=usb_control_msg (d->udev,usb_rcvctrlpipe (d->udev,0 ), -0x06 ,0x80 ,0x0302 ,0x00 , data,0x0006 ,200 ); -info ("Firmware Status: %x (%x)" , ret , data[2 ]); + ret =usb_control_msg (d->udev,usb_rcvctrlpipe (d->udev,0 ), +0x06 ,0x80 ,0x0302 ,0x00 , + data,0x6 ,200 ); +if (ret !=6 ) + ret = -EINVAL ; +else + ret = data[2 ]; + +info ("Firmware Status: %6ph" , data); - ret = (ret <0 ) ? -ENODEV : data[2 ];kfree (data);return ret; }
@@ -1231,6 +1236,7 @@ static int lme2510_get_adapter_count(strstatic int lme2510_identify_state (struct dvb_usb_device *d,const char **name) {struct lme2510_state *st = d->priv; +int status;usb_reset_configuration (d->udev);
@@ -1239,12 +1245,16 @@ static int lme2510_identify_state(struct st->dvb_usb_lme2510_firmware = dvb_usb_lme2510_firmware; -if (lme2510_return_status (d) ==0x44 ) { + status =lme2510_return_status (d); +if (status ==0x44 ) { *name =lme_firmware_switch (d,0 );return COLD ; } -return 0 ; +if (status !=0x47 ) +return -EINVAL ; + +return WARM ; } static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
Greg Kroah-Hartman
maintainerPATCH 26/45 media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 7bf7a7116ed313c601307f7e585419369926ab05 upstream.
When the tuner was split from m88rs2000 the attach function is in wrong place.
Move to dm04_lme2510_tuner to trap errors on failure and removing a call to lme_coldreset.
Prevents driver starting up without any tuner connected.
Fixes to trap for ts2020 fail.
LME2510(C): FE Found M88RS2000
ts2020: probe of 0-0060 failed with error -11
...
LME2510(C): TUN Found RS2000 tuner
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/media/usb/dvb-usb-v2/lmedm04.c +6 -7
@@ -1118,8 +1118,6 @@ static int dm04_lme2510_frontend_attach(if (adap->fe[0 ]) {info ("FE Found M88RS2000" ); -dvb_attach (ts2020_attach, adap->fe[0 ], &ts2020_config, - &d->i2c_adap); st->i2c_tuner_gate_w =5 ; st->i2c_tuner_gate_r =5 ; st->i2c_tuner_addr =0x60 ;
@@ -1182,17 +1180,18 @@ static int dm04_lme2510_tuner(struct dvb ret = st->tuner_config;break ;case TUNER_RS2000 : - ret = st->tuner_config; +if (dvb_attach (ts2020_attach, adap->fe[0 ], + &ts2020_config, &d->i2c_adap)) + ret = st->tuner_config;break ;default :break ; } -if (ret) +if (ret) {info ("TUN Found %s tuner" , tun_msg[ret]); -else { -info ("TUN No tuner found --- resetting device" ); -lme_coldreset (d); + }else { +info ("TUN No tuner found" );return -ENODEV ; }
Greg Kroah-Hartman
maintainerPATCH 27/45 mtd: nand: Fix nand_do_read_oob() return value
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
commit 87e89ce8d0d14f573c068c61bec2117751fb5103 upstream.
Starting from commit 041e4575f034 ("mtd: nand: handle ECC errors in OOB"), nand_do_read_oob() (from the NAND core) did return 0 or a negative error, and the MTD layer expected it.
However, the trend for the NAND layer is now to return an error or a positive number of bitflips. Deciding which status to return to the user belongs to the MTD layer.
Commit e47f68587b82 ("mtd: check for max_bitflips in mtd_read_oob()") brought this logic to the mtd_read_oob() function while the return value coming from nand_do_read_oob() (called by the ->_read_oob() hook) was left unchanged.
--- drivers/mtd/nand/nand_base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/nand/nand_base.c +4 -1
@@ -1872,6 +1872,7 @@ static int nand_write_oob_syndrome(strucstatic int nand_do_read_oob (struct mtd_info *mtd,loff_t from,struct mtd_oob_ops *ops) { +unsigned int max_bitflips =0 ;int page, realpage, chipnr;struct nand_chip *chip = mtd->priv;struct mtd_ecc_stats stats;
@@ -1932,6 +1933,8 @@ static int nand_do_read_oob(struct mtd_inand_wait_ready (mtd); } + max_bitflips = max_t(unsigned int, max_bitflips, ret); + readlen -= len;if (!readlen)break ;
@@ -1957,7 +1960,7 @@ static int nand_do_read_oob(struct mtd_iif (mtd->ecc_stats.failed - stats.failed)return -EBADMSG ; -return mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN :0 ; +return max_bitflips; }/**
Greg Kroah-Hartman
maintainerPATCH 28/45 NFS: Add a cond_resched() to nfs_commit_release_pages()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 7f1bda447c9bd48b415acedba6b830f61591601f upstream.
The commit list can get very large, and so we need a cond_resched() in nfs_commit_release_pages() in order to ensure we don't hog the CPU for excessive periods of time.
--- fs/nfs/write.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/write.c +2 -0
@@ -1646,6 +1646,8 @@ static void nfs_commit_release_pages(strset_bit (NFS_CONTEXT_RESEND_WRITES , &req->wb_context->flags); next:nfs_unlock_and_release_request (req); +/* Latency breaker */ +cond_resched (); } nfss =NFS_SERVER (data->inode);if (atomic_long_read (&nfss->writeback) <NFS_CONGESTION_OFF_THRESH )
Greg Kroah-Hartman
maintainerPATCH 29/45 NFS: commit direct writes even if they fail partially
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: J. Bruce Fields <[email protected]>
commit 1b8d97b0a837beaf48a8449955b52c650a7114b4 upstream.
If some of the WRITE calls making up an O_DIRECT write syscall fail, we neglect to commit, even if some of the WRITEs succeed.
We also depend on the commit code to free the reference count on the nfs_page taken in the "if (request_commit)" case at the end of nfs_direct_write_completion(). The problem was originally noticed because ENOSPC's encountered partway through a write would result in a closed file being sillyrenamed when it should have been unlinked.
--- fs/nfs/direct.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/nfs/direct.c +1 -3
@@ -716,10 +716,8 @@ static void nfs_direct_write_completion(spin_lock (&dreq->lock); -if (test_bit (NFS_IOHDR_ERROR , &hdr->flags)) { - dreq->flags =0 ; +if (test_bit (NFS_IOHDR_ERROR , &hdr->flags)) dreq->error = hdr->error; - }if (dreq->error ==0 ) { dreq->count += hdr->good_bytes;if (nfs_write_need_commit (hdr)) {
Greg Kroah-Hartman
maintainerPATCH 30/45 kernfs: fix regression in kernfs_fop_write caused by wrong type
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
commit ba87977a49913129962af8ac35b0e13e0fa4382d upstream.
Commit b7ce40cff0b9 ("kernfs: cache atomic_write_len in kernfs_open_file") changes type of local variable 'len' from ssize_t to size_t. This change caused that the *ppos value is updated also when the previous write callback failed.
Mentioned snippet:
...
len = ops->write(...); <- return value can be negative
...
if (len > 0) <- true here in this case
*ppos += len;
...
--- fs/kernfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/kernfs/file.c +1 -1
@@ -267,7 +267,7 @@ static ssize_t kernfs_fop_write(struct f {struct kernfs_open_file *of =kernfs_of (file);const struct kernfs_ops *ops; -size_t len; +ssize_t len;char *buf;if (of->atomic_write_len) {
Greg Kroah-Hartman
maintainerPATCH 31/45 crypto: hash - introduce crypto_hash_alg_has_setkey()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit cd6ed77ad5d223dc6299fb58f62e0f5267f7e2ba upstream.
Templates that use an shash spawn can use crypto_shash_alg_has_setkey() to determine whether the underlying algorithm requires a key or not. But there was no corresponding function for ahash spawns. Add it.
Note that the new function actually has to support both shash and ahash algorithms, since the ahash API can be used with either.
--- crypto/ahash.c | 11 +++++++++++ include/crypto/internal/hash.h | 2 ++ 2 files changed, 13 insertions(+)
crypto/ahash.c +11 -0
@@ -636,5 +636,16 @@ struct hash_alg_common *ahash_attr_alg(s }EXPORT_SYMBOL_GPL (ahash_attr_alg); +bool crypto_hash_alg_has_setkey (struct hash_alg_common *halg) +{ +struct crypto_alg *alg = &halg->base; + +if (alg->cra_type != &crypto_ahash_type) +return crypto_shash_alg_has_setkey (__crypto_shash_alg (alg)); + +return __crypto_ahash_alg (alg)->setkey !=NULL ; +} +EXPORT_SYMBOL_GPL (crypto_hash_alg_has_setkey); +MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Asynchronous cryptographic hash type" );
include/crypto/internal/hash.h +2 -0
@@ -91,6 +91,8 @@ static inline bool crypto_shash_alg_has_return alg->setkey != shash_no_setkey; } +bool crypto_hash_alg_has_setkey (struct hash_alg_common *halg); +int crypto_init_ahash_spawn (struct crypto_ahash_spawn *spawn,struct hash_alg_common *alg,struct crypto_instance *inst);
Greg Kroah-Hartman
maintainerPATCH 32/45 crypto: cryptd - pass through absence of ->setkey()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 841a3ff329713f796a63356fef6e2f72e4a3f6a3 upstream.
When the cryptd template is used to wrap an unkeyed hash algorithm, don't install a ->setkey() method to the cryptd instance. This change is necessary for cryptd to keep working with unkeyed hash algorithms once we start enforcing that ->setkey() is called when present.
--- crypto/cryptd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/cryptd.c +2 -1
@@ -618,7 +618,8 @@ static int cryptd_create_hash(struct cry inst->alg.finup = cryptd_hash_finup_enqueue; inst->alg.export = cryptd_hash_export; inst->alg.import = cryptd_hash_import; - inst->alg.setkey = cryptd_hash_setkey; +if (crypto_shash_alg_has_setkey (salg)) + inst->alg.setkey = cryptd_hash_setkey; inst->alg.digest = cryptd_hash_digest_enqueue; err =ahash_register_instance (tmpl, inst);
Greg Kroah-Hartman
maintainerPATCH 33/45 crypto: caam - fix endless loop when DECO acquire fails
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horia Geantă <[email protected]>
commit 225ece3e7dad4cfc44cca38ce7a3a80f255ea8f1 upstream.
In case DECO0 cannot be acquired - i.e. run_descriptor_deco0() fails with -ENODEV, caam_probe() enters an endless loop:
run_descriptor_deco0
ret -ENODEV -> instantiate_rng -ENODEV, overwritten by -EAGAIN ret -EAGAIN -> caam_probe -EAGAIN results in endless loop
It turns out the error path in instantiate_rng() is incorrect, the checks are done in the wrong order.
--- drivers/crypto/caam/ctrl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/crypto/caam/ctrl.c +6 -2
@@ -209,12 +209,16 @@ static int instantiate_rng(struct device* without any error (HW optimizations for later * CAAM eras), then try again. */ +if (ret) +break ; + rdsta_val =rd_reg32 (&ctrl->r4tst[0 ].rdsta) &RDSTA_IFMASK ; -if (status || !(rdsta_val & (1 << sh_idx))) +if (status || !(rdsta_val & (1 << sh_idx))) { ret = -EAGAIN ; -if (ret)break ; + } +dev_info (ctrldev,"Instantiated RNG4 SH%d\n" , sh_idx);/* Clear the contents before recreating the descriptor */ memset (desc,0x00 ,CAAM_CMD_SZ *7 );
Greg Kroah-Hartman
maintainerPATCH 34/45 arm: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 20e8175d246e9f9deb377f2784b3e7dfb2ad3e86 upstream.
KVM doesn't follow the SMCCC when it comes to unimplemented calls, and inject an UNDEF instead of returning an error. Since firmware calls are now used for security mitigation, they are becoming more common, and the undef is counter productive.
Instead, let's follow the SMCCC which states that -1 must be returned to the caller when getting an unknown function number.
--- arch/arm/kvm/handle_exit.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/kvm/handle_exit.c +11 -2
@@ -45,7 +45,7 @@ static int handle_hvc(struct kvm_vcpu *v ret =kvm_psci_call (vcpu);if (ret <0 ) { -kvm_inject_undefined (vcpu); +vcpu_set_reg (vcpu,0 , ~0UL );return 1 ; }
@@ -54,7 +54,16 @@ static int handle_hvc(struct kvm_vcpu *vstatic int handle_smc (struct kvm_vcpu *vcpu,struct kvm_run *run) { -kvm_inject_undefined (vcpu); +/* +* "If an SMC instruction executed at Non-secure EL1 is +* trapped to EL2 because HCR_EL2.TSC is 1, the exception is a +* Trap exception, not a Secure Monitor Call exception [...]" +* +* We need to advance the PC after the trap, as it would +* otherwise return to the same address... +*/ +vcpu_set_reg (vcpu,0 , ~0UL ); +kvm_skip_instr (vcpu,kvm_vcpu_trap_il_is32bit (vcpu));return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 35/45 media: cxusb, dib0700: ignore XC2028_I2C_FLUSH
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 9893b905e743ded332575ca04486bd586c0772f7 upstream.
The XC2028_I2C_FLUSH only needs to be implemented on a few devices. Others can safely ignore it.
That prevents filling the dmesg with lots of messages like:
dib0700: stk7700ph_xc3028_callback: unknown command 2, arg 0
--- drivers/media/usb/dvb-usb/cxusb.c | 2 ++ drivers/media/usb/dvb-usb/dib0700_devices.c | 1 + 2 files changed, 3 insertions(+)
drivers/media/usb/dvb-usb/cxusb.c +2 -0
@@ -923,6 +923,8 @@ static int dvico_bluebird_xc2028_callbaccase XC2028_RESET_CLK :deb_info ("%s: XC2028_RESET_CLK %d\n" , __func__, arg);break ; +case XC2028_I2C_FLUSH : +break ;default :deb_info ("%s: unknown command %d, arg %d\n" , __func__, command, arg);
drivers/media/usb/dvb-usb/dib0700_devices.c +1 -0
@@ -431,6 +431,7 @@ static int stk7700ph_xc3028_callback(voi state->dib7000p_ops.set_gpio (adap->fe_adap[0 ].fe,8 ,0 ,1 );break ;case XC2028_RESET_CLK : +case XC2028_I2C_FLUSH :break ;default : err("%s: unknown command %d, arg %d\n", __func__,
Greg Kroah-Hartman
maintainerPATCH 36/45 kernel/async.c: revert "async: simplify lowest_in_progress()"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rasmus Villemoes <[email protected]>
commit 4f7e988e63e336827f4150de48163bed05d653bd upstream.
This reverts commit 92266d6ef60c ("async: simplify lowest_in_progress()") which was simply wrong: In the case where domain is NULL, we now use the wrong offsetof() in the list_first_entry macro, so we don't actually fetch the ->cookie value, but rather the eight bytes located sizeof(struct list_head) further into the struct async_entry.
On 64 bit, that's the data member, while on 32 bit, that's a u64 built from func and data in some order.
I think the bug happens to be harmless in practice: It obviously only affects callers which pass a NULL domain, and AFAICT the only such caller is
async_synchronize_full() -> async_synchronize_full_domain(NULL) -> async_synchronize_cookie_domain(ASYNC_COOKIE_MAX, NULL)
and the ASYNC_COOKIE_MAX means that in practice we end up waiting for the async_global_pending list to be empty - but it would break if somebody happened to pass (void*)-1 as the data element to async_schedule, and of course also if somebody ever does a async_synchronize_cookie_domain(, NULL) with a "finite" cookie value.
Maybe the "harmless in practice" means this isn't -stable material. But I'm not completely confident my quick git grep'ing is enough, and there might be affected code in one of the earlier kernels that has since been removed, so I'll leave the decision to the stable guys.
--- kernel/async.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
kernel/async.c +12 -8
@@ -84,20 +84,24 @@ static atomic_t entry_count;static async_cookie_t lowest_in_progress (struct async_domain *domain) { -struct list_head *pending; +struct async_entry *first =NULL ;async_cookie_t ret =ASYNC_COOKIE_MAX ;unsigned long flags;spin_lock_irqsave (&async_lock, flags); -if (domain) - pending = &domain->pending; -else - pending = &async_global_pending; +if (domain) { +if (!list_empty (&domain->pending)) + first =list_first_entry (&domain->pending, + struct async_entry, domain_list); + }else { +if (!list_empty (&async_global_pending)) + first =list_first_entry (&async_global_pending, + struct async_entry, global_list); + } -if (!list_empty (pending)) - ret = list_first_entry(pending, struct async_entry, - domain_list)->cookie; +if (first) + ret = first->cookie;spin_unlock_irqrestore (&async_lock, flags);return ret;
Greg Kroah-Hartman
maintainerPATCH 37/45 signal/openrisc: Fix do_unaligned_access to send the proper signal
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric W. Biederman <[email protected]>
commit 500d58300571b6602341b041f97c082a461ef994 upstream.
While reviewing the signal sending on openrisc the do_unaligned_access function stood out because it is obviously wrong. A comment about an si_code set above when actually si_code is never set. Leading to a random si_code being sent to userspace in the event of an unaligned access.
Looking further SIGBUS BUS_ADRALN is the proper pair of signal and si_code to send for an unaligned access. That is what other architectures do and what is required by posix.
Given that do_unaligned_access is broken in a way that no one can be relying on it on openrisc fix the code to just do the right thing.
--- arch/openrisc/kernel/traps.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/openrisc/kernel/traps.c +5 -5
@@ -302,12 +302,12 @@ asmlinkage void do_unaligned_access(strusiginfo_t info;if (user_mode (regs)) { -/* Send a SIGSEGV */ - info.si_signo =SIGSEGV ; +/* Send a SIGBUS */ + info.si_signo =SIGBUS ; info.si_errno =0 ; -/* info.si_code has been set above */ - info.si_addr = (void *)address; -force_sig_info (SIGSEGV , &info, current); + info.si_code =BUS_ADRALN ; + info.si_addr = (void __user *)address; +force_sig_info (SIGBUS , &info, current); }else {printk ("KERNEL: Unaligned Access 0x%.8lx\n" , address);show_registers (regs);
Greg Kroah-Hartman
maintainerPATCH 38/45 signal/sh: Ensure si_signo is initialized in do_divide_error
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric W. Biederman <[email protected]>
commit 0e88bb002a9b2ee8cc3cc9478ce2dc126f849696 upstream.
Set si_signo.
--- arch/sh/kernel/traps_32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/sh/kernel/traps_32.c +2 -1
@@ -607,7 +607,8 @@ asmlinkage void do_divide_error(unsigned break; } -force_sig_info (SIGFPE , &info, current); + info.si_signo =SIGFPE ; +force_sig_info (info.si_signo, &info, current); }#endif
Greg Kroah-Hartman
maintainerPATCH 39/45 alpha: fix crash if pthread_create races with signal delivery
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 21ffceda1c8b3807615c40d440d7815e0c85d366 upstream.
On alpha, a process will crash if it attempts to start a thread and a signal is delivered at the same time. The crash can be reproduced with this program: https://cygwin.com/ml/cygwin/2014-11/msg00473.html
The reason for the crash is this:
* we call the clone syscall
* we go to the function copy_process
* copy process calls copy_thread_tls, it is a wrapper around copy_thread
* copy_thread sets the tls pointer: childti->pcb.unique = regs->r20
* copy_thread sets regs->r20 to zero
* we go back to copy_process
* copy process checks "if (signal_pending(current))" and returns -ERESTARTNOINTR
* the clone syscall is restarted, but this time, regs->r20 is zero, so the new thread is created with zero tls pointer
* the new thread crashes in start_thread when attempting to access tls
The comment in the code says that setting the register r20 is some compatibility with OSF/1. But OSF/1 doesn't use the CLONE_SETTLS flag, so we don't have to zero r20 if CLONE_SETTLS is set. This patch fixes the bug by zeroing regs->r20 only if CLONE_SETTLS is not set.
--- arch/alpha/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/alpha/kernel/process.c +2 -1
@@ -274,12 +274,13 @@ copy_thread(unsigned long clone_flags, uapplication calling fork. */ if (clone_flags &CLONE_SETTLS ) childti->pcb.unique = regs->r20; +else + regs->r20 =0 ;/* OSF/1 has some strange fork() semantics. */ childti->pcb.usp = usp ?:rdusp (); *childregs = *regs; childregs->r0 =0 ; childregs->r19 =0 ; childregs->r20 =1 ;/* OSF/1 has some strange fork() semantics. */ - regs->r20 =0 ; stack = ((struct switch_stack *) regs) -1 ; *childstack = *stack; childstack->r26 = (unsigned long ) ret_from_fork;
Greg Kroah-Hartman
maintainerPATCH 40/45 alpha: fix reboot on Avanti platform
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 55fc633c41a08ce9244ff5f528f420b16b1e04d6 upstream.
We need to define NEED_SRM_SAVE_RESTORE on the Avanti, otherwise we get machine check exception when attempting to reboot the machine.
--- arch/alpha/kernel/pci_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/alpha/kernel/pci_impl.h +2 -1
@@ -143,7 +143,8 @@ struct pci_iommu_arena };#if defined(CONFIG_ALPHA_SRM ) && \ - (defined(CONFIG_ALPHA_CIA ) || defined(CONFIG_ALPHA_LCA )) + (defined(CONFIG_ALPHA_CIA ) || defined(CONFIG_ALPHA_LCA ) || \ + defined(CONFIG_ALPHA_AVANTI ))# define NEED_SRM_SAVE_RESTORE #else # undef NEED_SRM_SAVE_RESTORE
Greg Kroah-Hartman
maintainerPATCH 41/45 xtensa: fix futex_atomic_cmpxchg_inatomic
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
commit ca47480921587ae30417dd234a9f79af188e3666 upstream.
Return 0 if the operation was successful, not the userspace memory value. Check that userspace value equals passed oldval, not itself. Don't update *uval if the value wasn't read from userspace memory.
This fixes process hang due to infinite loop in futex_lock_pi. It also fixes a bunch of glibc tests nptl/tst-mutexpi*.
--- arch/xtensa/include/asm/futex.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
arch/xtensa/include/asm/futex.h +10 -13
@@ -109,7 +109,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 oldval, u32 newval) { int ret = 0; -u32 prev;if (!access_ok (VERIFY_WRITE , uaddr,sizeof (u32)))return -EFAULT ;
@@ -120,26 +119,24 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, __asm__ __volatile__ (" # futex_atomic_cmpxchg_inatomic\n" -"1: l32i %1, %3, 0\n" -" mov %0, %5\n" -" wsr %1, scompare1\n" -"2: s32c1i %0, %3, 0\n" -"3:\n" +" wsr %5, scompare1\n" +"1: s32c1i %1, %4, 0\n" +" s32i %1, %6, 0\n" +"2:\n" " .section .fixup,\"ax\"\n" " .align 4\n" -"4: .long 3b\n" -"5: l32r %1, 4b\n" -" movi %0, %6\n" +"3: .long 2b\n" +"4: l32r %1, 3b\n" +" movi %0, %7\n" " jx %1\n" " .previous\n" " .section __ex_table,\"a\"\n" -" .long 1b,5b,2b,5b\n" +" .long 1b,4b\n" " .previous\n" - :"+r" (ret),"=&r" (prev),"+m" (*uaddr) - :"r" (uaddr),"r" (oldval),"r" (newval),"I" (-EFAULT ) + :"+r" (ret),"+r" (newval),"+m" (*uaddr),"+m" (*uval) + :"r" (uaddr),"r" (oldval),"r" (uval),"I" (-EFAULT ) :"memory" ); - *uval = prev;return ret; }
Greg Kroah-Hartman
maintainerPATCH 42/45 EDAC, octeon: Fix an uninitialized variable warning
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit 544e92581a2ac44607d7cc602c6b54d18656f56d upstream.
Fix an uninitialized variable warning in the Octeon EDAC driver, as seen in MIPS cavium_octeon_defconfig builds since v4.14 with Codescape GNU Tools 2016.05-03:
drivers/edac/octeon_edac-lmc.c In function ‘octeon_lmc_edac_poll_o2’:
drivers/edac/octeon_edac-lmc.c:87:24: warning: ‘((long unsigned int*)&int_reg)[1]’ may \
be used uninitialized in this function [-Wmaybe-uninitialized]
if (int_reg.s.sec_err || int_reg.s.ded_err) {
^Iinitialise the whole int_reg variable to zero before the conditional assignments in the error injection case.
--- drivers/edac/octeon_edac-lmc.c | 1 + 1 file changed, 1 insertion(+)
drivers/edac/octeon_edac-lmc.c +1 -0
@@ -79,6 +79,7 @@ static void octeon_lmc_edac_poll_o2(struif (!pvt->inject) int_reg.u64 =cvmx_read_csr (CVMX_LMCX_INT (mci->mc_idx));else { + int_reg.u64 =0 ;if (pvt->error_type ==1 ) int_reg.s.sec_err =1 ;if (pvt->error_type ==2 )
Greg Kroah-Hartman
maintainerPATCH 44/45 ACPI: sbshc: remove raw pointer from printk() message
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 43cdd1b716b26f6af16da4e145b6578f98798bf6 upstream.
There's no need to be printing a raw kernel pointer to the kernel log at every boot. So just remove it, and change the whole message to use the correct dev_info() call at the same time.
--- drivers/acpi/sbshc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/sbshc.c +2 -2
@@ -309,8 +309,8 @@ static int acpi_smbus_hc_add(struct acpi device->driver_data = hc;acpi_ec_add_query_handler (hc->ec, hc->query_bit,NULL , smbus_alarm, hc); - printk(KERN_INFO PREFIX "SBS HC: EC = 0x%p, offset = 0x%0x, query_bit = 0x%0x\n", - hc->ec, hc->offset, hc->query_bit); +dev_info (&device->dev,"SBS HC: offset = 0x%0x, query_bit = 0x%0x\n" , + hc->offset, hc->query_bit);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 45/45 mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric W. Biederman <[email protected]>
commit 6ac1dc736b323011a55ecd1fc5897c24c4f77cbd upstream.
Setting si_code to 0 is the same a setting si_code to SI_USER which is definitely not correct. With si_code set to SI_USER si_pid and si_uid will be copied to userspace instead of si_addr. Which is very wrong.
So fix this by using a sensible si_code (SEGV_MAPERR) for this failure.
--- arch/mn10300/mm/misalignment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mn10300/mm/misalignment.c +1 -1
@@ -437,7 +437,7 @@ transfer_failed: info.si_signo =SIGSEGV ; info.si_errno =0 ; - info.si_code =0 ; + info.si_code =SEGV_MAPERR ; info.si_addr = (void *) regs->pc;force_sig_info (SIGSEGV , &info, current);return ;
Greg Kroah-Hartman
maintainerPATCH 2/45 ip6mr: fix stale iterator
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
[ Upstream commit 4adfa79fc254efb7b0eb3cd58f62c2c3f805f1ba ]
When we dump the ip6mr mfc entries via proc, we initialize an iterator with the table to dump but we don't clear the cache pointer which might be initialized from a prior read on the same descriptor that ended. This can result in lock imbalance (an unnecessary unlock) leading to other crashes and hangs. Clear the cache pointer like ipmr does to fix the issue. Thanks for the reliable reproducer.
Here's syzbot's trace:
WARNING: bad unlock balance detected!
4.15.0-rc3+ #128 Not tainted
syzkaller971460/3195 is trying to release lock (mrt_lock) at:
[<000000006898068d>] ipmr_mfc_seq_stop+0xe1/0x130 net/ipv6/ip6mr.c:553 but there are no more locks to release!
other info that might help us debug this:
1 lock held by syzkaller971460/3195:
#0: (&p->lock){+.+.}, at: [<00000000744a6565>] seq_read+0xd5/0x13d0
fs/seq_file.c:165
stack backtrace: CPU: 1 PID: 3195 Comm: syzkaller971460 Not tainted 4.15.0-rc3+ #128 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 print_unlock_imbalance_bug+0x12f/0x140 kernel/locking/lockdep.c:3561 __lock_release kernel/locking/lockdep.c:3775 [inline] lock_release+0x5f9/0xda0 kernel/locking/lockdep.c:4023 __raw_read_unlock include/linux/rwlock_api_smp.h:225 [inline] _raw_read_unlock+0x1a/0x30 kernel/locking/spinlock.c:255 ipmr_mfc_seq_stop+0xe1/0x130 net/ipv6/ip6mr.c:553 traverse+0x3bc/0xa00 fs/seq_file.c:135 seq_read+0x96a/0x13d0 fs/seq_file.c:189 proc_reg_read+0xef/0x170 fs/proc/inode.c:217 do_loop_readv_writev fs/read_write.c:673 [inline] do_iter_read+0x3db/0x5b0 fs/read_write.c:897 compat_readv+0x1bf/0x270 fs/read_write.c:1140 do_compat_preadv64+0xdc/0x100 fs/read_write.c:1189 C_SYSC_preadv fs/read_write.c:1209 [inline] compat_SyS_preadv+0x3b/0x50 fs/read_write.c:1203 do_syscall_32_irqs_on arch/x86/entry/common.c:327 [inline] do_fast_syscall_32+0x3ee/0xf9d arch/x86/entry/common.c:389 entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:125 RIP: 0023:0xf7f73c79 RSP: 002b:00000000e574a15c EFLAGS: 00000292 ORIG_RAX: 000000000000014d RAX: ffffffffffffffda RBX: 000000000000000f RCX: 0000000020a3afb0 RDX: 0000000000000001 RSI: 0000000000000067 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 BUG: sleeping function called from invalid context at lib/usercopy.c:25 in_atomic(): 1, irqs_disabled(): 0, pid: 3195, name: syzkaller971460 INFO: lockdep is turned off. CPU: 1 PID: 3195 Comm: syzkaller971460 Not tainted 4.15.0-rc3+ #128 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:53 ___might_sleep+0x2b2/0x470 kernel/sched/core.c:6060 __might_sleep+0x95/0x190 kernel/sched/core.c:6013 __might_fault+0xab/0x1d0 mm/memory.c:4525 _copy_to_user+0x2c/0xc0 lib/usercopy.c:25 copy_to_user include/linux/uaccess.h:155 [inline] seq_read+0xcb4/0x13d0 fs/seq_file.c:279 proc_reg_read+0xef/0x170 fs/proc/inode.c:217 do_loop_readv_writev fs/read_write.c:673 [inline] do_iter_read+0x3db/0x5b0 fs/read_write.c:897 compat_readv+0x1bf/0x270 fs/read_write.c:1140 do_compat_preadv64+0xdc/0x100 fs/read_write.c:1189 C_SYSC_preadv fs/read_write.c:1209 [inline] compat_SyS_preadv+0x3b/0x50 fs/read_write.c:1203 do_syscall_32_irqs_on arch/x86/entry/common.c:327 [inline] do_fast_syscall_32+0x3ee/0xf9d arch/x86/entry/common.c:389 entry_SYSENTER_compat+0x51/0x60 arch/x86/entry/entry_64_compat.S:125 RIP: 0023:0xf7f73c79 RSP: 002b:00000000e574a15c EFLAGS: 00000292 ORIG_RAX: 000000000000014d RAX: ffffffffffffffda RBX: 000000000000000f RCX: 0000000020a3afb0 RDX: 0000000000000001 RSI: 0000000000000067 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 WARNING: CPU: 1 PID: 3195 at lib/usercopy.c:26 _copy_to_user+0xb5/0xc0 lib/usercopy.c:26
--- net/ipv6/ip6mr.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/ip6mr.c +1 -0
@@ -498,6 +498,7 @@ static void *ipmr_mfc_seq_start(struct sreturn ERR_PTR (-ENOENT ); it->mrt = mrt; + it->cache =NULL ;return *pos ?ipmr_mfc_seq_idx (net, seq->private, *pos -1 ) :SEQ_START_TOKEN ; }
Greg Kroah-Hartman
maintainerPATCH 9/45 KEYS: encrypted: fix buffer overread in valid_master_desc()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 794b4bc292f5d31739d89c0202c54e7dc9bc3add upstream.
With the 'encrypted' key type it was possible for userspace to provide a data blob ending with a master key description shorter than expected, e.g. 'keyctl add encrypted desc "new x" @s'. When validating such a master key description, validate_master_desc() could read beyond the end of the buffer. Fix this by using strncmp() instead of memcmp(). [Also clean up the code to deduplicate some logic.]
--- security/keys/encrypted-keys/encrypted.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
security/keys/encrypted-keys/encrypted.c +15 -16
@@ -141,23 +141,22 @@ static int valid_ecryptfs_desc(const cha*/ static int valid_master_desc (const char *new_desc,const char *orig_desc) { -if (!memcmp (new_desc,KEY_TRUSTED_PREFIX ,KEY_TRUSTED_PREFIX_LEN )) { -if (strlen (new_desc) ==KEY_TRUSTED_PREFIX_LEN ) - goto out; -if (orig_desc) -if (memcmp (new_desc, orig_desc,KEY_TRUSTED_PREFIX_LEN )) - goto out; - }else if (!memcmp (new_desc,KEY_USER_PREFIX ,KEY_USER_PREFIX_LEN )) { -if (strlen (new_desc) ==KEY_USER_PREFIX_LEN ) - goto out; -if (orig_desc) -if (memcmp (new_desc, orig_desc,KEY_USER_PREFIX_LEN )) - goto out; - }else - goto out; +int prefix_len; + +if (!strncmp (new_desc,KEY_TRUSTED_PREFIX ,KEY_TRUSTED_PREFIX_LEN )) + prefix_len =KEY_TRUSTED_PREFIX_LEN ; +else if (!strncmp (new_desc,KEY_USER_PREFIX ,KEY_USER_PREFIX_LEN )) + prefix_len =KEY_USER_PREFIX_LEN ; +else +return -EINVAL ; + +if (!new_desc[prefix_len]) +return -EINVAL ; + +if (orig_desc &&strncmp (new_desc, orig_desc, prefix_len)) +return -EINVAL ; +return 0 ; -out: -return -EINVAL ; }/*
Greg Kroah-Hartman
maintainercover 3.18.95-stable review
This is the start of the stable review cycle for the 3.18.95 release. There are 45 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 Sat Feb 17 14:40:54 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.18.95-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-3.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.18.95-rc1
Eric W. Biederman <[email protected]>
mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy
Greg Kroah-Hartman <[email protected]>
ACPI: sbshc: remove raw pointer from printk() message
Bart Van Assche <[email protected]>
pktcdvd: Fix pkt_setup_dev() error path
James Hogan <[email protected]>
EDAC, octeon: Fix an uninitialized variable warning
Max Filippov <[email protected]>
xtensa: fix futex_atomic_cmpxchg_inatomic
Mikulas Patocka <[email protected]>
alpha: fix reboot on Avanti platform
Mikulas Patocka <[email protected]>
alpha: fix crash if pthread_create races with signal delivery
Eric W. Biederman <[email protected]>
signal/sh: Ensure si_signo is initialized in do_divide_error
Eric W. Biederman <[email protected]>
signal/openrisc: Fix do_unaligned_access to send the proper signal
Rasmus Villemoes <[email protected]>
kernel/async.c: revert "async: simplify lowest_in_progress()"
Mauro Carvalho Chehab <[email protected]>
media: cxusb, dib0700: ignore XC2028_I2C_FLUSH
Marc Zyngier <[email protected]>
arm: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls
Horia Geantă <[email protected]>
crypto: caam - fix endless loop when DECO acquire fails
Eric Biggers <[email protected]>
crypto: cryptd - pass through absence of ->setkey()
Eric Biggers <[email protected]>
crypto: hash - introduce crypto_hash_alg_has_setkey()
Ivan Vecera <[email protected]>
kernfs: fix regression in kernfs_fop_write caused by wrong type
J. Bruce Fields <[email protected]>
NFS: commit direct writes even if they fail partially
Trond Myklebust <[email protected]>
NFS: Add a cond_resched() to nfs_commit_release_pages()
Miquel Raynal <[email protected]>
mtd: nand: Fix nand_do_read_oob() return value
Malcolm Priestley <[email protected]>
media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner
Malcolm Priestley <[email protected]>
media: dvb-usb-v2: lmedm04: Improve logic checking of warm start
Mohamed Ghannam <[email protected]>
dccp: CVE-2017-8824: use-after-free in DCCP code
Shuah Khan <[email protected]>
usbip: vhci: stop printing kernel pointer addresses in messages
Shuah Khan <[email protected]>
usbip: stub: stop printing kernel pointer addresses in messages
Shuah Khan <[email protected]>
usbip: prevent leaking socket pointer address in messages
Yuyang Du <[email protected]>
usbip: vhci-hcd: Add USB3 SuperSpeed support
Andrew Goodbody <[email protected]>
usb: usbip: Fix possible deadlocks reported by lockdep
Jonathan Dieter <[email protected]>
usbip: Fix potential format overflow in userspace tools
Shuah Khan <[email protected]>
usbip: prevent vhci_hcd driver from leaking a socket pointer address
Shuah Khan <[email protected]>
usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input
Shuah Khan <[email protected]>
usbip: fix stub_rx: get_pipe() to validate endpoint number
Thomas Gleixner <[email protected]>
posix-timer: Properly check sigevent->sigev_notify
Aurelien Aptel <[email protected]>
CIFS: zero sensitive data when freeing
Daniel N Pettersson <[email protected]>
cifs: Fix autonegotiate security settings mismatch
Matthew Wilcox <[email protected]>
cifs: Fix missing put_xid in cifs_file_strict_mmap
Wang Han <[email protected]>
ipv4: Map neigh lookup keys in __ipv4_neigh_lookup_noref()
Eric Biggers <[email protected]>
KEYS: encrypted: fix buffer overread in valid_master_desc()
Krzysztof Kozlowski <[email protected]>
ARM: exynos_defconfig: Enable NFSv4 client
Javier Martinez Canillas <[email protected]>
ARM: exynos_defconfig: Enable options to mount a rootfs via NFS
Li RongQing <[email protected]>
tcp: release sk_frag.page in tcp_disconnect
Chunhao Lin <[email protected]>
r8169: fix RTL8168EP take too long to complete driver initialization.
Junxiao Bi <[email protected]>
qlcnic: fix deadlock bug
Eric Dumazet <[email protected]>
net: igmp: add a missing rcu locking section
Nikolay Aleksandrov <[email protected]>
ip6mr: fix stale iterator
Jason Wang <[email protected]>
vhost_net: stop device during reset owner
-------------
Diffstat:
Makefile | 4 +- arch/alpha/kernel/pci_impl.h | 3 +- arch/alpha/kernel/process.c | 3 +- arch/arm/configs/exynos_defconfig | 7 ++ arch/arm/kvm/handle_exit.c | 13 ++- arch/mn10300/mm/misalignment.c | 2 +- arch/openrisc/kernel/traps.c | 10 +- arch/sh/kernel/traps_32.c | 3 +- arch/xtensa/include/asm/futex.h | 23 ++--- crypto/ahash.c | 11 +++ crypto/cryptd.c | 3 +- drivers/acpi/sbshc.c | 4 +- drivers/block/pktcdvd.c | 4 +- drivers/crypto/caam/ctrl.c | 8 +- drivers/edac/octeon_edac-lmc.c | 1 + drivers/media/usb/dvb-usb-v2/lmedm04.c | 39 +++++--- drivers/media/usb/dvb-usb/cxusb.c | 2 + drivers/media/usb/dvb-usb/dib0700_devices.c | 1 + drivers/mtd/nand/nand_base.c | 5 +- .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | 18 ++-- drivers/net/ethernet/realtek/r8169.c | 4 +- drivers/usb/usbip/stub_dev.c | 3 +- drivers/usb/usbip/stub_main.c | 5 +- drivers/usb/usbip/stub_rx.c | 53 ++++++++--- drivers/usb/usbip/stub_tx.c | 4 +- drivers/usb/usbip/usbip_common.c | 15 +-- drivers/usb/usbip/usbip_common.h | 1 + drivers/usb/usbip/usbip_event.c | 5 +- drivers/usb/usbip/vhci_hcd.c | 102 +++++++++++---------- drivers/usb/usbip/vhci_rx.c | 53 ++++++----- drivers/usb/usbip/vhci_sysfs.c | 45 +++++---- drivers/usb/usbip/vhci_tx.c | 17 ++-- drivers/vhost/net.c | 1 + fs/cifs/cifsencrypt.c | 3 +- fs/cifs/connect.c | 6 +- fs/cifs/file.c | 26 +++--- fs/cifs/misc.c | 14 +-- fs/cifs/smb2pdu.c | 3 +- fs/kernfs/file.c | 2 +- fs/nfs/direct.c | 4 +- fs/nfs/write.c | 2 + include/crypto/internal/hash.h | 2 + include/net/arp.h | 6 +- kernel/async.c | 20 ++-- kernel/time/posix-timers.c | 34 ++++--- net/dccp/proto.c | 5 + net/ipv4/igmp.c | 4 + net/ipv4/tcp.c | 6 ++ net/ipv6/ip6mr.c | 1 + security/keys/encrypted-keys/encrypted.c | 31 +++---- tools/usb/usbip/libsrc/usbip_common.c | 9 +- tools/usb/usbip/libsrc/usbip_host_driver.c | 27 +++++- tools/usb/usbip/libsrc/vhci_driver.c | 8 +- 53 files changed, 405 insertions(+), 280 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 43/45 pktcdvd: Fix pkt_setup_dev() error path
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 5a0ec388ef0f6e33841aeb810d7fa23f049ec4cd upstream.
Commit 523e1d399ce0 ("block: make gendisk hold a reference to its queue") modified add_disk() and disk_release() but did not update any of the error paths that trigger a put_disk() call after disk->queue has been assigned. That introduced the following behavior in the pktcdvd driver if pkt_new_dev() fails:
Kernel BUG at 00000000e98fd882 [verbose debug info unavailable]
Since disk_release() calls blk_put_queue() anyway if disk->queue != NULL, fix this by removing the blk_cleanup_queue() call from the pkt_setup_dev() error path.
--- drivers/block/pktcdvd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/block/pktcdvd.c +1 -3
@@ -2798,7 +2798,7 @@ static int pkt_setup_dev(dev_t dev, dev_ pd->pkt_dev =MKDEV (pktdev_major, idx); ret =pkt_new_dev (pd, dev);if (ret) - goto out_new_dev; + goto out_mem2;/* inherit events of the host device */ disk->events = pd->bdev->bd_disk->events;
@@ -2816,8 +2816,6 @@ static int pkt_setup_dev(dev_t dev, dev_mutex_unlock (&ctl_mutex);return 0 ; -out_new_dev: -blk_cleanup_queue (disk->queue); out_mem2:put_disk (disk); out_mem:
Greg Kroah-Hartman
maintainerPATCH 18/45 usbip: Fix potential format overflow in userspace tools
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Dieter <[email protected]>
commit e5dfa3f902b9a642ae8c6997d57d7c41e384a90b upstream.
The usbip userspace tools call sprintf()/snprintf() and don't check for the return value which can lead the paths to overflow, truncating the final file in the path.
More urgently, GCC 7 now warns that these aren't checked with -Wformat-overflow, and with -Werror enabled in configure.ac, that makes these tools unbuildable.
This patch fixes these problems by replacing sprintf() with snprintf() in one place and adding checks for the return value of snprintf().
--- tools/usb/usbip/libsrc/usbip_common.c | 9 ++++++++- tools/usb/usbip/libsrc/usbip_host_driver.c | 27 ++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-)
tools/usb/usbip/libsrc/usbip_common.c +8 -1
@@ -215,9 +215,16 @@ int read_usb_interface(struct usbip_usb_ struct usbip_usb_interface *uinf) {char busid[SYSFS_BUS_ID_SIZE ]; +int size;struct udev_device *sif; -sprintf (busid,"%s:%d.%d" , udev->busid, udev->bConfigurationValue, i); + size =snprintf (busid,sizeof (busid),"%s:%d.%d" , + udev->busid, udev->bConfigurationValue, i); +if (size <0 || (unsigned int )size >=sizeof (busid)) { +err ("busid length %i >= %lu or < 0" , size, + (unsigned long )sizeof (busid)); +return -1 ; + } sif =udev_device_new_from_subsystem_sysname (udev_context,"usb" , busid);if (!sif) {
tools/usb/usbip/libsrc/usbip_host_driver.c +22 -5
@@ -39,13 +39,19 @@ struct udev *udev_context;static int32_t read_attr_usbip_status (struct usbip_usb_device *udev) {char status_attr_path[SYSFS_PATH_MAX ]; +int size;int fd;int length;char status;int value =0 ; -snprintf (status_attr_path,SYSFS_PATH_MAX ,"%s/usbip_status" , - udev->path); + size =snprintf (status_attr_path,SYSFS_PATH_MAX ,"%s/usbip_status" , + udev->path); +if (size <0 || (unsigned int )size >=sizeof (status_attr_path)) { +err ("usbip_status path length %i >= %lu or < 0" , size, + (unsigned long )sizeof (status_attr_path)); +return -1 ; + } fd =open (status_attr_path,O_RDONLY );if (fd <0 ) {
@@ -225,6 +231,7 @@ int usbip_host_export_device(struct usbi {char attr_name[] ="usbip_sockfd" ;char sockfd_attr_path[SYSFS_PATH_MAX ]; +int size;char sockfd_buff[30 ];int ret;
@@ -244,10 +251,20 @@ int usbip_host_export_device(struct usbi }/* only the first interface is true */ -snprintf (sockfd_attr_path,sizeof (sockfd_attr_path),"%s/%s" , - edev->udev.path, attr_name); + size =snprintf (sockfd_attr_path,sizeof (sockfd_attr_path),"%s/%s" , + edev->udev.path, attr_name); +if (size <0 || (unsigned int )size >=sizeof (sockfd_attr_path)) { +err ("exported device path length %i >= %lu or < 0" , size, + (unsigned long )sizeof (sockfd_attr_path)); +return -1 ; + } -snprintf (sockfd_buff,sizeof (sockfd_buff),"%d\n" , sockfd); + size =snprintf (sockfd_buff,sizeof (sockfd_buff),"%d\n" , sockfd); +if (size <0 || (unsigned int )size >=sizeof (sockfd_buff)) { +err ("socket length %i >= %lu or < 0" , size, + (unsigned long )sizeof (sockfd_buff)); +return -1 ; + } ret =write_sysfs_attribute (sockfd_attr_path, sockfd_buff,strlen (sockfd_buff));
Greg Kroah-Hartman
maintainerPATCH 20/45 usbip: vhci-hcd: Add USB3 SuperSpeed support
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuyang Du <[email protected]>
commit 1c9de5bf428612458427943b724bea51abde520a upstream.
This patch adds a USB3 HCD to an existing USB2 HCD and provides the support of SuperSpeed, in case the device can only be enumerated with SuperSpeed.
The bulk of the added code in usb3_bos_desc and hub_control to support SuperSpeed is borrowed from the commit 1cd8fd2887e162ad ("usb: gadget:dummy_hcd: add SuperSpeed support").
With this patch, each vhci will have VHCI_HC_PORTS HighSpeed ports and VHCI_HC_PORTS SuperSpeed ports.
--- drivers/usb/usbip/vhci_hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/usbip/vhci_hcd.c +1 -1
@@ -279,7 +279,7 @@ static int vhci_hub_control(struct usb_hcase USB_PORT_FEAT_POWER :usbip_dbg_vhci_rh (" ClearPortFeature: USB_PORT_FEAT_POWER\n" ); - dum->port_status[rhport] =0 ; + dum->port_status[rhport] &= ~USB_PORT_STAT_POWER ; dum->resuming =0 ;break ;case USB_PORT_FEAT_C_RESET :
Quoted 16 lines · Greg Kroah-Hartman,
This is the start of the stable review cycle for the 3.18.95 release. There are 45 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 Sat Feb 17 14:40:54 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.18.95-rc1.gz or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
linux-3.18.y
and the diffstat can be found below.
Quoted 4 lines
thanks,
greg k-h
Builds and boots on the OnePlus 3T, no regressions in general usage or dmesg. Another peaceful and boring update :P
Thanks,
Harsh Shandilya
Quoted 1 line
Greg Kroah-Hartman
maintainerQuoted 19 lines · Harsh Shandilya
Quoted 16 lines · Greg Kroah-Hartman,
This is the start of the stable review cycle for the 3.18.95 release. There are 45 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 Sat Feb 17 14:40:54 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.18.95-rc1.gz or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
linux-3.18.y
and the diffstat can be found below.
Quoted 7 lines
Quoted 4 lines
thanks,
greg k-h
Builds and boots on the OnePlus 3T, no regressions in general usage or dmesg. Another peaceful and boring update :P
Boring is good, it's what you want with a stable kernel update :)
thanks for testing and letting me know.
greg k-h
stable-rc/linux-3.18.y boot: 63 boots: 2 failed, 51 passed with 5 offline, 5 conflicts (v3.18.94-46-g72255f521206)
stable-rc/linux-3.18.y boot: 63 boots: 2 failed, 51 passed with 5 offline, 5 conflicts (v3.18.94-46-g72255f521206)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-3.18.y/kernel/v3.18.94-46-g72255f521206/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-3.18.y/kernel/v3.18.94-46-g72255f521206/
Tree: stable-rc
Branch: linux-3.18.y
Git Describe: v3.18.94-46-g72255f521206
Git Commit: 72255f5212068a6f4936e55b7089aa8e76d3b4ce
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 29 unique boards, 12 SoC families, 13 builds out of 183
Boot Regressions Detected:
arm:
multi_v7_defconfig:
am335x-boneblack:
lab-collabora: new failure (last pass: v3.18.91-37-gd5790feb0d8a)
dra7-evm:
lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)
qemu:
lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)
omap2plus_defconfig:
dra7-evm:
lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)
vexpress_defconfig:
qemu:
lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)arm64:
defconfig:
qemu:
lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)x86:
x86_64_defconfig:
qemu:
lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)Boot Failures Detected:
arm:
omap2plus_defconfig
dra7-evm: 1 failed lab
multi_v7_defconfig
dra7-evm: 1 failed lab
Offline Platforms:
arm:
multi_v7_defconfig:
exynos5410-odroidxu: 1 offline lab
sun4i-a10-cubieboard: 1 offline lab
sunxi_defconfig:
sun4i-a10-cubieboard: 1 offline lab
exynos_defconfig:
exynos5410-odroidxu: 1 offline lab
exynos5420-arndale-octa: 1 offline lab
Conflicting Boot Failures Detected: (These likely are not failures as other labs are reporting PASS. Needs review.)
arm64:
defconfig:
qemu:
lab-baylibre: FAIL
lab-collabora: PASS
x86:
x86_64_defconfig:
qemu:
lab-baylibre: FAIL
lab-collabora: PASSarm:
multi_v7_defconfig:
qemu:
lab-baylibre: FAIL
lab-collabora: PASS
am335x-boneblack:
lab-baylibre-seattle: PASS
lab-collabora: FAIL
vexpress_defconfig:
qemu:
lab-baylibre: FAIL
lab-collabora: PASS---
For more info write to <[email protected]>
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.95 release. There are 45 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 Sat Feb 17 14:40:54 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.18.95-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-3.18.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.95 release. There are 45 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 Sat Feb 17 14:40:54 UTC 2018. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:axm55xx_defconfig Qemu test results: total: 112 pass: 112 fail: 0
Build failure:
Building arm:axm55xx_defconfig ... failed
--------------
Error log:arch/arm/kvm/handle_exit.c: In function 'handle_hvc':arch/arm/kvm/handle_exit.c:48:3: error: implicit declaration of function 'vcpu_set_reg'
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.95 release. There are 45 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 Sat Feb 17 14:40:54 UTC 2018. Anything received after that time might be too late.
Build results:
total: 136 pass: 135 fail: 1 Failed builds: arm:axm55xx_defconfig Qemu test results: total: 112 pass: 112 fail: 0
Quoted 7 lines
Build failure:
Building arm:axm55xx_defconfig ... failed
--------------
Error log:arch/arm/kvm/handle_exit.c: In function 'handle_hvc':arch/arm/kvm/handle_exit.c:48:3: error: implicit declaration of function 'vcpu_set_reg'
Oops, I backported an arm kvm patch too far back, sorry about that. I'll go drop that patch now.
greg k-h
Quoted 11 lines · kernelci.org bot
stable-rc/linux-3.18.y boot: 63 boots: 2 failed, 51 passed with 5 offline, 5 conflicts (v3.18.94-46-g72255f521206)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-3.18.y/kernel/v3.18.94-46-g72255f521206/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-3.18.y/kernel/v3.18.94-46-g72255f521206/Tree: stable-rc
Branch: linux-3.18.y
Git Describe: v3.18.94-46-g72255f521206
Git Commit:72255f5212068a6f4936e55b7089aa8e76d3b4ce
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 29 unique boards, 12 SoC families, 13 builds out of 183
TL;DR; All is well.
Quoted 26 lines
Boot Regressions Detected:
arm:
multi_v7_defconfig: am335x-boneblack: lab-collabora: new failure (last pass: v3.18.91-37-gd5790feb0d8a) dra7-evm: lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2) qemu: lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2) omap2plus_defconfig: dra7-evm: lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2) vexpress_defconfig: qemu: lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)arm64:
defconfig: qemu: lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)
Quoted 5 lines
x86:
x86_64_defconfig: qemu: lab-baylibre: new failure (last pass: v3.18.94-27-gc19bd79392f2)
These are all lab infrastructure issues. Most of them from the BayLibre lab which was (mistakenly) upgraded in the middle of a batch of jobs. Oops.
Kevin
Greg Kroah-Hartman
maintainerQuoted 7 lines · Kevin Hilman
Quoted 5 lines · kernelci.org bot
stable-rc/linux-3.18.y boot: 63 boots: 2 failed, 51 passed with 5 offline, 5 conflicts (v3.18.94-46-g72255f521206)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-3.18.y/kernel/v3.18.94-46-g72255f521206/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-3.18.y/kernel/v3.18.94-46-g72255f521206/
Quoted 8 lines
Quoted 6 lines
Tree: stable-rc
Branch: linux-3.18.y
Git Describe: v3.18.94-46-g72255f521206
Git Commit:72255f5212068a6f4936e55b7089aa8e76d3b4ce
Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 29 unique boards, 12 SoC families, 13 builds out of 183TL;DR; All is well.
Ah good, thanks for the update.
greg k-h