4.4.69-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.4.69-stable review
This is the start of the stable review cycle for the 4.4.69 release. There are 56 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 May 20 10:48:24 UTC 2017. 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/v4.x/stable-review/patch-4.4.69-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-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.69-rc1
Joeseph Chang <[email protected]>
ipmi: Fix kernel panic at ipmi_ssif_thread()
Maxim Altshul <[email protected]>
wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event
Maxim Altshul <[email protected]>
wlcore: Pass win_size taken from ieee80211_sta to FW
Maxim Altshul <[email protected]>
mac80211: RX BA support for sta max_rx_aggregation_subframes
Sara Sharon <[email protected]>
mac80211: pass block ack session timeout to to driver
Sara Sharon <[email protected]>
mac80211: pass RX aggregation window size to driver
Johan Hovold <[email protected]>
Bluetooth: hci_intel: add missing tty-device sanity check
Johan Hovold <[email protected]>
Bluetooth: hci_bcm: add missing tty-device sanity check
Szymon Janc <[email protected]>
Bluetooth: Fix user channel for 32bit userspace on 64bit kernel
Wang YanQing <[email protected]>
tty: pty: Fix ldisc flush after userspace become aware of the data already
Johan Hovold <[email protected]>
serial: omap: suspend device on probe errors
Johan Hovold <[email protected]>
serial: omap: fix runtime-pm handling on unbind
Marek Szyprowski <[email protected]>
serial: samsung: Use right device for DMA-mapping calls
Marc Zyngier <[email protected]>
arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
Jason A. Donenfeld <[email protected]>
padata: free correct variable
Björn Jacke <[email protected]>
CIFS: add misssing SFM mapping for doublequote
David Disseldorp <[email protected]>
cifs: fix CIFS_IOC_GET_MNT_INFO oops
Björn Jacke <[email protected]>
CIFS: fix mapping of SFM_SPACE and SFM_PERIOD
Steve French <[email protected]>
SMB3: Work around mount failure when using SMB3 dialect to Macs
Steve French <[email protected]>
Set unicode flag on cifs echo request to avoid Mac error
Andrey Ryabinin <[email protected]>
fs/block_dev: always invalidate cleancache in invalidate_bdev()
Luis Henriques <[email protected]>
ceph: fix memory leak in __ceph_setxattr()
Michal Hocko <[email protected]>
fs/xattr.c: zero out memory copied to userspace in getxattr
Eric Biggers <[email protected]>
ext4: evict inline data when writing to memory map
Jack Morgenstein <[email protected]>
IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level
Jack Morgenstein <[email protected]>
IB/mlx4: Fix ib device initialization error flow
Shamir Rabinovitch <[email protected]>
IB/IPoIB: ibX: failed to create mcg debug file
Jack Morgenstein <[email protected]>
IB/core: Fix sysfs registration error flow
Alex Williamson <[email protected]>
vfio/type1: Remove locked page accounting workqueue
Somasundaram Krishnasamy <[email protected]>
dm era: save spacemap metadata root after the pre-commit
Stephan Mueller <[email protected]>
crypto: algif_aead - Require setkey before accept(2)
Mike Snitzer <[email protected]>
block: fix blk_integrity_register to use template's interval_exp if not 0
Andrew Jones <[email protected]>
KVM: arm/arm64: fix races in kvm_psci_vcpu_on
David Hildenbrand <[email protected]>
KVM: x86: fix user triggerable warning in kvm_apic_accept_events()
Richard Weinberger <[email protected]>
um: Fix PTRACE_POKEUSER on x86_64
Ben Hutchings <[email protected]>
x86, pmem: Fix cache flushing for iovec write < 8 bytes
Andy Lutomirski <[email protected]>
selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug
Ashish Kalra <[email protected]>
x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup
Maksim Salau <[email protected]>
usb: misc: legousbtower: Fix buffers on stack
Guenter Roeck <[email protected]>
usb: hub: Do not attempt to autosuspend disconnected devices
Guenter Roeck <[email protected]>
usb: hub: Fix error loop seen after hub communication errors
Alexey Brodkin <[email protected]>
usb: Make sure usb/phy/of gets built-in
Gustavo A. R. Silva <[email protected]>
usb: misc: add missing continue in switch
Ian Abbott <[email protected]>
staging: comedi: jr3_pci: cope with jiffies wraparound
Ian Abbott <[email protected]>
staging: comedi: jr3_pci: fix possible null pointer dereference
Johan Hovold <[email protected]>
staging: gdm724x: gdm_mux: fix use-after-free on module unload
Malcolm Priestley <[email protected]>
staging: vt6656: use off stack for out buffer USB transfers.
Malcolm Priestley <[email protected]>
staging: vt6656: use off stack for in buffer USB transfers.
Ajay Kaher <[email protected]>
USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously
Marek Vasut <[email protected]>
USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
Peter Chen <[email protected]>
usb: host: xhci: print correct command ring address
Nicholas Bellinger <[email protected]>
iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement
Nicholas Bellinger <[email protected]>
target: Convert ACL change queue_depth se_session reference usage
Bart Van Assche <[email protected]>
target/fileio: Fix zero-length READ and WRITE handling
Nicholas Bellinger <[email protected]>
target: Fix compare_and_write_callback handling for non GOOD status
Juergen Gross <[email protected]>
xen: adjust early dom0 p2m handling to xen hypervisor behavior
-------------
Diffstat:
Makefile | 4 +- arch/arm/kvm/psci.c | 8 +- arch/arm64/kvm/sys_regs.c | 6 +- arch/x86/boot/boot.h | 2 +- arch/x86/include/asm/pmem.h | 2 +- arch/x86/kvm/x86.c | 12 ++ arch/x86/um/ptrace_64.c | 2 +- arch/x86/xen/mmu.c | 7 +- block/blk-integrity.c | 3 +- crypto/algif_aead.c | 157 +++++++++++++++++++-- drivers/Makefile | 1 + drivers/bluetooth/hci_bcm.c | 5 +- drivers/bluetooth/hci_intel.c | 13 +- drivers/char/ipmi/ipmi_ssif.c | 4 +- drivers/infiniband/core/sysfs.c | 2 +- drivers/infiniband/hw/mlx4/main.c | 1 + drivers/infiniband/hw/mlx4/mcg.c | 3 +- drivers/infiniband/ulp/ipoib/ipoib_fs.c | 3 + drivers/infiniband/ulp/ipoib/ipoib_main.c | 44 +++++- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 3 - drivers/md/dm-era-target.c | 8 +- drivers/net/wireless/ath/ath10k/mac.c | 7 +- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 +- drivers/net/wireless/ath/ath9k/main.c | 8 +- drivers/net/wireless/ath/carl9170/main.c | 8 +- drivers/net/wireless/ath/wcn36xx/main.c | 8 +- .../net/wireless/brcm80211/brcmsmac/mac80211_if.c | 8 +- drivers/net/wireless/cw1200/sta.c | 4 +- drivers/net/wireless/cw1200/sta.h | 4 +- drivers/net/wireless/iwlegacy/4965-mac.c | 8 +- drivers/net/wireless/iwlegacy/4965.h | 4 +- drivers/net/wireless/iwlwifi/dvm/mac80211.c | 9 +- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 9 +- drivers/net/wireless/mac80211_hwsim.c | 8 +- drivers/net/wireless/mediatek/mt7601u/main.c | 8 +- drivers/net/wireless/mwl8k.c | 10 +- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 6 +- drivers/net/wireless/realtek/rtlwifi/core.c | 8 +- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 19 +-- drivers/net/wireless/rt2x00/rt2800lib.c | 7 +- drivers/net/wireless/rt2x00/rt2800lib.h | 4 +- drivers/net/wireless/ti/wl18xx/event.c | 28 ++++ drivers/net/wireless/ti/wl18xx/event.h | 1 + drivers/net/wireless/ti/wl18xx/main.c | 3 +- drivers/net/wireless/ti/wlcore/acx.c | 5 +- drivers/net/wireless/ti/wlcore/acx.h | 3 +- drivers/net/wireless/ti/wlcore/main.c | 14 +- drivers/staging/comedi/drivers/jr3_pci.c | 13 +- drivers/staging/gdm724x/gdm_mux.c | 4 +- drivers/staging/vt6656/usbpipe.c | 31 +++- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_configfs.c | 30 ++-- drivers/target/iscsi/iscsi_target_login.c | 1 + drivers/target/iscsi/iscsi_target_tpg.c | 10 -- drivers/target/iscsi/iscsi_target_tpg.h | 2 - drivers/target/target_core_file.c | 3 +- drivers/target/target_core_sbc.c | 5 +- drivers/target/target_core_tpg.c | 152 ++++++-------------- drivers/target/target_core_transport.c | 4 +- drivers/tty/pty.c | 7 +- drivers/tty/serial/omap-serial.c | 9 +- drivers/tty/serial/samsung.c | 9 +- drivers/usb/core/driver.c | 21 +++ drivers/usb/core/file.c | 9 +- drivers/usb/core/hub.c | 11 +- drivers/usb/host/xhci-mem.c | 2 +- drivers/usb/misc/legousbtower.c | 37 +++-- drivers/usb/misc/usbtest.c | 1 + drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 + drivers/vfio/vfio_iommu_type1.c | 102 ++++++------- fs/block_dev.c | 11 +- fs/ceph/xattr.c | 3 + fs/cifs/cifs_unicode.c | 6 + fs/cifs/cifs_unicode.h | 5 +- fs/cifs/cifssmb.c | 3 + fs/cifs/ioctl.c | 2 + fs/cifs/smb2pdu.c | 14 +- fs/ext4/inode.c | 5 + fs/xattr.c | 2 +- include/net/mac80211.h | 48 +++++-- include/target/target_core_fabric.h | 5 +- kernel/padata.c | 2 +- net/bluetooth/hci_sock.c | 3 +- net/mac80211/agg-rx.c | 32 ++++- net/mac80211/agg-tx.c | 53 ++++--- net/mac80211/driver-ops.c | 10 +- net/mac80211/driver-ops.h | 4 +- net/mac80211/sta_info.c | 3 + net/mac80211/trace.h | 43 +++--- tools/testing/selftests/x86/ldt_gdt.c | 46 ++++++ 91 files changed, 824 insertions(+), 445 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/56 xen: adjust early dom0 p2m handling to xen hypervisor behavior
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit 69861e0a52f8733355ce246f0db15e1b240ad667 upstream.
When booted as pv-guest the p2m list presented by the Xen is already mapped to virtual addresses. In dom0 case the hypervisor might make use of 2M- or 1G-pages for this mapping. Unfortunately while being properly aligned in virtual and machine address space, those pages might not be aligned properly in guest physical address space.
So when trying to obtain the guest physical address of such a page pud_pfn() and pmd_pfn() must be avoided as those will mask away guest physical address bits not being zero in this special case.
--- arch/x86/xen/mmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/xen/mmu.c +4 -3
@@ -2038,7 +2038,8 @@ static unsigned long __init xen_read_phy/* * Translate a virtual address to a physical one without relying on mapped -* page tables. +* page tables. Don't rely on big pages being aligned in (guest) physical +* space! */ static phys_addr_t __init xen_early_virt_to_phys (unsigned long vaddr) {
@@ -2059,7 +2060,7 @@ static phys_addr_t __init xen_early_virt sizeof(pud)));if (!pud_present (pud))return 0 ; - pa =pud_pfn (pud) <<PAGE_SHIFT ; + pa =pud_val (pud) &PTE_PFN_MASK ;if (pud_large (pud))return pa + (vaddr & ~PUD_MASK );
@@ -2067,7 +2068,7 @@ static phys_addr_t __init xen_early_virt sizeof(pmd)));if (!pmd_present (pmd))return 0 ; - pa =pmd_pfn (pmd) <<PAGE_SHIFT ; + pa =pmd_val (pmd) &PTE_PFN_MASK ;if (pmd_large (pmd))return pa + (vaddr & ~PMD_MASK );
Greg Kroah-Hartman
maintainerPATCH 3/56 target/fileio: Fix zero-length READ and WRITE handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 59ac9c078141b8fd0186c0b18660a1b2c24e724e upstream.
This patch fixes zero-length READ and WRITE handling in target/FILEIO, which was broken a long time back by:
Since:
commit d81cb44726f050d7cf1be4afd9cb45d153b52066
Author: Paolo Bonzini <[email protected]>
Date: Mon Sep 17 16:36:11 2012 -0700
target: go through normal processing for all zero-length commands
which moved zero-length READ and WRITE completion out of target-core, to doing submission into backend driver code.
To address this, go ahead and invoke target_complete_cmd() for any non negative return value in fd_do_rw().
--- drivers/target/target_core_file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/target/target_core_file.c +1 -2
@@ -594,8 +594,7 @@ fd_execute_rw(struct se_cmd *cmd, structif (ret <0 )return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; -if (ret) -target_complete_cmd (cmd,SAM_STAT_GOOD ); +target_complete_cmd (cmd,SAM_STAT_GOOD );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 4/56 target: Convert ACL change queue_depth se_session reference usage
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit d36ad77f702356afb1009d2987b0ab55da4c7d57 upstream.
This patch converts core_tpg_set_initiator_node_queue_depth() to use struct se_node_acl->acl_sess_list when performing explicit se_tpg_tfo->shutdown_session() for active sessions, in order for new se_node_acl->queue_depth to take effect.
This follows how core_tpg_del_initiator_node_acl() currently works when invoking se_tpg_tfo->shutdown-session(), and ahead of the next patch to take se_node_acl->acl_kref during lookup, the extra get_initiator_node_acl() can go away. In order to achieve this, go ahead and change target_get_session() to use kref_get_unless_zero() and propigate up the return value to know when a session is already being released.
This is because se_node_acl->acl_group is already protecting se_node_acl->acl_group reference via configfs, and shutdown within core_tpg_del_initiator_node_acl() won't occur until sys_write() to core_tpg_set_initiator_node_queue_depth() attribute returns back to user-space.
Also, drop the left-over iscsi-target hack, and obtain se_portal_group->session_lock in lio_tpg_shutdown_session() internally. Remove iscsi-target wrapper and unused se_tpg + force parameters and associated code.
--- drivers/target/iscsi/iscsi_target_configfs.c | 29 +---- drivers/target/iscsi/iscsi_target_tpg.c | 10 - drivers/target/iscsi/iscsi_target_tpg.h | 2 drivers/target/target_core_tpg.c | 152 +++++++-------------------- drivers/target/target_core_transport.c | 4 include/target/target_core_fabric.h | 5 6 files changed, 56 insertions(+), 146 deletions(-)
drivers/target/iscsi/iscsi_target_configfs.c +7 -22
@@ -725,11 +725,8 @@ static ssize_t lio_target_nacl_cmdsn_depif (iscsit_get_tpg (tpg) <0 )return -EINVAL ; -/* -* iscsit_tpg_set_initiator_node_queue_depth() assumes force=1 -*/ - ret =iscsit_tpg_set_initiator_node_queue_depth (tpg, -config_item_name (acl_ci), cmdsn_depth,1 ); + + ret =core_tpg_set_initiator_node_queue_depth (se_nacl, cmdsn_depth); pr_debug("LIO_Target_ConfigFS: %s/%s Set CmdSN Window: %u for" "InitiatorName: %s\n", config_item_name(wwn_ci),
@@ -1593,42 +1590,30 @@ static int lio_tpg_check_prot_fabric_onl }/* -* Called with spin_lock_irq(struct se_portal_group->session_lock) held -* or not held. -* -* Also, this function calls iscsit_inc_session_usage_count() on the +* This function calls iscsit_inc_session_usage_count() on the * struct iscsi_session in question. */ static int lio_tpg_shutdown_session (struct se_session *se_sess) {struct iscsi_session *sess = se_sess->fabric_sess_ptr; -struct se_portal_group *se_tpg = se_sess->se_tpg; -bool local_lock = false; - -if (!spin_is_locked (&se_tpg->session_lock)) { -spin_lock_irq (&se_tpg->session_lock); - local_lock = true; - } +struct se_portal_group *se_tpg = &sess->tpg->tpg_se_tpg; +spin_lock_bh (&se_tpg->session_lock);spin_lock (&sess->conn_lock);if (atomic_read (&sess->session_fall_back_to_erl0) ||atomic_read (&sess->session_logout) || (sess->time2retain_timer_flags &ISCSI_TF_EXPIRED )) {spin_unlock (&sess->conn_lock); -if (local_lock) -spin_unlock_irq (&sess->conn_lock); +spin_unlock_bh (&se_tpg->session_lock);return 0 ; }atomic_set (&sess->session_reinstatement,1 );spin_unlock (&sess->conn_lock);iscsit_stop_time2retain_timer (sess); -spin_unlock_irq (&se_tpg->session_lock); +spin_unlock_bh (&se_tpg->session_lock);iscsit_stop_session (sess,1 ,1 ); -if (!local_lock) -spin_lock_irq (&se_tpg->session_lock); -return 1 ; }
drivers/target/iscsi/iscsi_target_tpg.c +0 -10
@@ -589,16 +589,6 @@ int iscsit_tpg_del_network_portal(return iscsit_tpg_release_np (tpg_np, tpg, np); } -int iscsit_tpg_set_initiator_node_queue_depth ( -struct iscsi_portal_group *tpg, -unsigned char *initiatorname, -u32 queue_depth, -int force) -{ -return core_tpg_set_initiator_node_queue_depth (&tpg->tpg_se_tpg, - initiatorname, queue_depth, force); -} -int iscsit_ta_authentication (struct iscsi_portal_group *tpg,u32 authentication) {unsigned char buf1[256 ], buf2[256 ], *none =NULL ;
drivers/target/iscsi/iscsi_target_tpg.h +0 -2
@@ -26,8 +26,6 @@ extern struct iscsi_tpg_np *iscsit_tpg_a int);extern int iscsit_tpg_del_network_portal (struct iscsi_portal_group *,struct iscsi_tpg_np *); -extern int iscsit_tpg_set_initiator_node_queue_depth (struct iscsi_portal_group *, -unsigned char *,u32 ,int );extern int iscsit_ta_authentication (struct iscsi_portal_group *,u32 );extern int iscsit_ta_login_timeout (struct iscsi_portal_group *,u32 );extern int iscsit_ta_netif_timeout (struct iscsi_portal_group *,u32 );
drivers/target/target_core_tpg.c +45 -107
212 lines not on this page · raw message
drivers/target/target_core_transport.c +2 -2
@@ -383,9 +383,9 @@ static void target_release_session(struc se_tpg->se_tpg_tfo->close_session (se_sess); } -void target_get_session (struct se_session *se_sess) +int target_get_session (struct se_session *se_sess) { -kref_get (&se_sess->sess_kref); +return kref_get_unless_zero (&se_sess->sess_kref); }EXPORT_SYMBOL (target_get_session);
include/target/target_core_fabric.h +2 -3
@@ -117,7 +117,7 @@ void __transport_register_session(struct struct se_node_acl *, struct se_session *, void *);void transport_register_session (struct se_portal_group *,struct se_node_acl *,struct se_session *,void *); -void target_get_session (struct se_session *); +int target_get_session (struct se_session *);void target_put_session (struct se_session *);ssize_t target_show_dynamic_sessions (struct se_portal_group *,char *);void transport_free_session (struct se_session *);
@@ -172,8 +172,7 @@ bool target_tpg_has_node_acl(struct se_p const char *);struct se_node_acl *core_tpg_check_initiator_node_acl (struct se_portal_group *,unsigned char *); -int core_tpg_set_initiator_node_queue_depth (struct se_portal_group *, -unsigned char *,u32 ,int ); +int core_tpg_set_initiator_node_queue_depth (struct se_node_acl *,u32 );int core_tpg_set_initiator_node_tag (struct se_portal_group *,struct se_node_acl *,const char *);int core_tpg_register (struct se_wwn *,struct se_portal_group *,int );
Greg Kroah-Hartman
maintainerPATCH 8/56 USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ajay Kaher <[email protected]>
commit 2f86a96be0ccb1302b7eee7855dbee5ce4dc5dfb upstream.
There is race condition when two USB class drivers try to call init_usb_class at the same time and leads to crash. code path: probe->usb_register_dev->init_usb_class
To solve this, mutex locking has been added in init_usb_class() and destroy_usb_class().
As pointed by Alan, removed "if (usb_class)" test from destroy_usb_class() because usb_class can never be NULL there.
--- drivers/usb/core/file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/core/file.c +7 -2
@@ -26,6 +26,7 @@#define MAX_USB_MINORS 256static const struct file_operations *usb_minors[MAX_USB_MINORS ];static DECLARE_RWSEM (minor_rwsem); +static DEFINE_MUTEX (init_usb_class_mutex);static int usb_open (struct inode *inode,struct file *file) {
@@ -108,8 +109,9 @@ static void release_usb_class(struct krestatic void destroy_usb_class (void ) { -if (usb_class) -kref_put (&usb_class->kref, release_usb_class); +mutex_lock (&init_usb_class_mutex); +kref_put (&usb_class->kref, release_usb_class); +mutex_unlock (&init_usb_class_mutex); }int usb_major_init (void )
@@ -171,7 +173,10 @@ int usb_register_dev(struct usb_interfacif (intf->minor >=0 )return -EADDRINUSE ; +mutex_lock (&init_usb_class_mutex); retval =init_usb_class (); +mutex_unlock (&init_usb_class_mutex); +if (retval)return retval;
Greg Kroah-Hartman
maintainerPATCH 11/56 staging: gdm724x: gdm_mux: fix use-after-free on module unload
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit b58f45c8fc301fe83ee28cad3e64686c19e78f1c upstream.
Make sure to deregister the USB driver before releasing the tty driver to avoid use-after-free in the USB disconnect callback where the tty devices are deregistered.
--- drivers/staging/gdm724x/gdm_mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/gdm724x/gdm_mux.c +2 -2
@@ -670,14 +670,14 @@ static int __init gdm_usb_mux_init(void) static void __exit gdm_usb_mux_exit(void) { -unregister_lte_tty_driver (); -if (mux_rx_wq) {flush_workqueue (mux_rx_wq);destroy_workqueue (mux_rx_wq); }usb_deregister (&gdm_mux_driver); +unregister_lte_tty_driver (); + }module_init (gdm_usb_mux_init);
Greg Kroah-Hartman
maintainerPATCH 13/56 staging: comedi: jr3_pci: cope with jiffies wraparound
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 8ec04a491825e08068e92bed0bba7821893b6433 upstream.
The timer expiry routine jr3_pci_poll_dev() checks for expiry by checking whether the absolute value of jiffies (stored in local variable now) is greater than the expected expiry time in jiffy units. This will fail when jiffies wraps around. Also, it seems to make sense to handle the expiry one jiffy earlier than the current test. Use time_after_eq() to check for expiry.
--- drivers/staging/comedi/drivers/jr3_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/jr3_pci.c +1 -1
@@ -610,7 +610,7 @@ static void jr3_pci_poll_dev(unsigned lo s = &dev->subdevices[i]; spriv = s->private; -if (now > spriv->next_time_min) { +if (time_after_eq (now, spriv->next_time_min)) {struct jr3_pci_poll_delay sub_delay; sub_delay =jr3_pci_poll_subdevice (s);
Greg Kroah-Hartman
maintainerPATCH 14/56 usb: misc: add missing continue in switch
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
commit 2c930e3d0aed1505e86e0928d323df5027817740 upstream.
Add missing continue in switch.
Addresses-Coverity-ID: 1248733
--- drivers/usb/misc/usbtest.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/usbtest.c +1 -0
@@ -135,6 +135,7 @@ get_endpoints(struct usbtest_dev *dev, scase USB_ENDPOINT_XFER_INT :if (dev->info->intr) goto try_intr; +continue ;case USB_ENDPOINT_XFER_ISOC :if (dev->info->iso) goto try_iso;
Greg Kroah-Hartman
maintainerPATCH 15/56 usb: Make sure usb/phy/of gets built-in
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Brodkin <[email protected]>
commit 3d6159640da9c9175d1ca42f151fc1a14caded59 upstream.
DWC3 driver uses of_usb_get_phy_mode() which is implemented in drivers/usb/phy/of.c and in bare minimal configuration it might not be pulled in kernel binary.
In case of ARC or ARM this could be easily reproduced with "allnodefconfig" +CONFIG_USB=m +CONFIG_USB_DWC3=m.
On building all ends-up with:
---------------------->8------------------
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 5 modules
ERROR: "of_usb_get_phy_mode" [drivers/usb/dwc3/dwc3.ko] undefined! make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2 ---------------------->8------------------
--- drivers/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/Makefile +1 -0
@@ -98,6 +98,7 @@ obj-$(CONFIG_USB_PHY) += usb/ obj-$(CONFIG_USB) += usb/ obj-$(CONFIG_PCI) += usb/ obj-$(CONFIG_USB_GADGET) += usb/ +obj-$(CONFIG_OF) += usb/ obj-$(CONFIG_SERIO) += input/serio/ obj-$(CONFIG_GAMEPORT) += input/gameport/ obj-$(CONFIG_INPUT) += input/
Greg Kroah-Hartman
maintainerPATCH 16/56 usb: hub: Fix error loop seen after hub communication errors
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 245b2eecee2aac6fdc77dcafaa73c33f9644c3c7 upstream.
While stress testing a usb controller using a bind/unbind looop, the following error loop was observed.
usb 7-1.2: new low-speed USB device number 3 using xhci-hcd
usb 7-1.2: hub failed to enable device, error -108
usb 7-1-port2: cannot disable (err = -22)
usb 7-1-port2: couldn't allocate usb_device
usb 7-1-port2: cannot disable (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: activate --> -22
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
hub 7-1:1.0: hub_ext_port_status failed (err = -22)
** 57 printk messages dropped ** hub 7-1:1.0: activate --> -22
** 82 printk messages dropped ** hub 7-1:1.0: hub_ext_port_status failed (err = -22)
This continues forever. After adding tracebacks into the code, the call sequence leading to this is found to be as follows.
[<ffffffc0007fc8e0>] hub_activate+0x368/0x7b8 [<ffffffc0007fceb4>] hub_resume+0x2c/0x3c [<ffffffc00080b3b8>] usb_resume_interface.isra.6+0x128/0x158 [<ffffffc00080b5d0>] usb_suspend_both+0x1e8/0x288 [<ffffffc00080c9c4>] usb_runtime_suspend+0x3c/0x98 [<ffffffc0007820a0>] __rpm_callback+0x48/0x7c [<ffffffc00078217c>] rpm_callback+0xa8/0xd4 [<ffffffc000786234>] rpm_suspend+0x84/0x758 [<ffffffc000786ca4>] rpm_idle+0x2c8/0x498 [<ffffffc000786ed4>] __pm_runtime_idle+0x60/0xac [<ffffffc00080eba8>] usb_autopm_put_interface+0x6c/0x7c [<ffffffc000803798>] hub_event+0x10ac/0x12ac [<ffffffc000249bb8>] process_one_work+0x390/0x6b8 [<ffffffc00024abcc>] worker_thread+0x480/0x610 [<ffffffc000251a80>] kthread+0x164/0x178 [<ffffffc0002045d0>] ret_from_fork+0x10/0x40
kick_hub_wq() is called from hub_activate() even after failures to communicate with the hub. This results in an endless sequence of hub event -> hub activate -> wq trigger -> hub event -> ...
Provide two solutions for the problem.
- Only trigger the hub event queue if communication with the hub is successful.
- After a suspend failure, only resume already suspended interfaces if the communication with the device is still possible.
Each of the changes fixes the observed problem. Use both to improve robustness.
--- drivers/usb/core/driver.c | 18 ++++++++++++++++++ drivers/usb/core/hub.c | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/usb/core/driver.c +18 -0
@@ -1328,6 +1328,24 @@ static int usb_suspend_both(struct usb_d*/ if (udev->parent && !PMSG_IS_AUTO (msg)) status =0 ; + +/* +* If the device is inaccessible, don't try to resume +* suspended interfaces and just return the error. +*/ +if (status && status != -EBUSY ) { +int err; +u16 devstat; + + err =usb_get_status (udev,USB_RECIP_DEVICE ,0 , + &devstat); +if (err) { +dev_err (&udev->dev, +"Failed to suspend device, error %d\n" , + status); + goto done; + } + } }/* If the suspend failed, resume interfaces that did get suspended */
drivers/usb/core/hub.c +4 -1
@@ -1048,6 +1048,9 @@ static void hub_activate(struct usb_hub portstatus = portchange =0 ; status =hub_port_status (hub, port1, &portstatus, &portchange); +if (status) + goto abort; +if (udev || (portstatus &USB_PORT_STAT_CONNECTION ))dev_dbg (&port_dev->dev,"status %04x change %04x\n" , portstatus, portchange);
@@ -1180,7 +1183,7 @@ static void hub_activate(struct usb_hub/* Scan all ports that need attention */ kick_hub_wq (hub); - + abort:if (type ==HUB_INIT2 || type ==HUB_INIT3 ) {/* Allow autosuspend if it was suppressed */ disconnected:
Greg Kroah-Hartman
maintainerPATCH 17/56 usb: hub: Do not attempt to autosuspend disconnected devices
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit f5cccf49428447dfbc9edb7a04bb8fc316269781 upstream.
While running a bind/unbind stress test with the dwc3 usb driver on rk3399, the following crash was observed.
Unable to handle kernel NULL pointer dereference at virtual address 00000218 pgd = ffffffc00165f000 [00000218] *pgd=000000000174f003, *pud=000000000174f003, *pmd=0000000001750003, *pte=00e8000001751713 Internal error: Oops: 96000005 [#1] PREEMPT SMP Modules linked in: uinput uvcvideo videobuf2_vmalloc cmac
ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat rfcomm xt_mark fuse bridge stp llc zram btusb btrtl btbcm btintel bluetooth ip6table_filter mwifiex_pcie mwifiex cfg80211 cdc_ether usbnet r8152 mii joydev snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq snd_seq_device ppp_async ppp_generic slhc tun
CPU: 1 PID: 29814 Comm: kworker/1:1 Not tainted 4.4.52 #507 Hardware name: Google Kevin (DT) Workqueue: pm pm_runtime_work task: ffffffc0ac540000 ti: ffffffc0af4d4000 task.ti: ffffffc0af4d4000 PC is at autosuspend_check+0x74/0x174 LR is at autosuspend_check+0x70/0x174 ... Call trace: [<ffffffc00080dcc0>] autosuspend_check+0x74/0x174 [<ffffffc000810500>] usb_runtime_idle+0x20/0x40 [<ffffffc000785ae0>] __rpm_callback+0x48/0x7c [<ffffffc000786af0>] rpm_idle+0x1e8/0x498 [<ffffffc000787cdc>] pm_runtime_work+0x88/0xcc [<ffffffc000249bb8>] process_one_work+0x390/0x6b8 [<ffffffc00024abcc>] worker_thread+0x480/0x610 [<ffffffc000251a80>] kthread+0x164/0x178 [<ffffffc0002045d0>] ret_from_fork+0x10/0x40
Source:
(gdb) l *0xffffffc00080dcc00xffffffc00080dcc0 is in autosuspend_check
(drivers/usb/core/driver.c:1778).
1773 /* We don't need to check interfaces that are
1774 * disabled for runtime PM. Either they are unbound
1775 * or else their drivers don't support autosuspend
1776 * and so they are permanently active.
1777 */
1778 if (intf->dev.power.disable_depth)
1779 continue;
1780 if (atomic_read(&intf->dev.power.usage_count) > 0)
1781 return -EBUSY;
1782 w |= intf->needs_remote_wakeup;
Code analysis shows that intf is set to NULL in usb_disable_device() prior to setting actconfig to NULL. At the same time, usb_runtime_idle() does not lock the usb device, and neither does any of the functions in the traceback. This means that there is no protection against a race condition where usb_disable_device() is removing dev->actconfig->interface[] pointers while those are being accessed from autosuspend_check().
To solve the problem, synchronize and validate device state between autosuspend_check() and usb_disconnect().
--- drivers/usb/core/driver.c | 3 +++ drivers/usb/core/hub.c | 6 ++++++ 2 files changed, 9 insertions(+)
drivers/usb/core/driver.c +3 -0
@@ -1778,6 +1778,9 @@ static int autosuspend_check(struct usb_int w, i;struct usb_interface *intf; +if (udev->state ==USB_STATE_NOTATTACHED ) +return -ENODEV ; +/* Fail if autosuspend is disabled, or any interfaces are in use, or * any interface drivers require remote wakeup but it isn't available. */
drivers/usb/core/hub.c +6 -0
@@ -2071,6 +2071,12 @@ void usb_disconnect(struct usb_device **dev_info (&udev->dev,"USB disconnect, device number %d\n" , udev->devnum); +/* +* Ensure that the pm runtime code knows that the USB device +* is in the process of being disconnected. +*/ +pm_runtime_barrier (&udev->dev); +usb_lock_device (udev);hub_disconnect_children (udev);
Greg Kroah-Hartman
maintainerPATCH 18/56 usb: misc: legousbtower: Fix buffers on stack
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maksim Salau <[email protected]>
commit 942a48730faf149ccbf3e12ac718aee120bb3529 upstream.
Allocate buffers on HEAP instead of STACK for local structures that are to be received using usb_control_msg().
--- drivers/usb/misc/legousbtower.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/usb/misc/legousbtower.c +27 -10
@@ -317,9 +317,16 @@ static int tower_open (struct inode *inoint subminor;int retval =0 ;struct usb_interface *interface; -struct tower_reset_reply reset_reply; +struct tower_reset_reply *reset_reply;int result; + reset_reply =kmalloc (sizeof (*reset_reply),GFP_KERNEL ); + +if (!reset_reply) { + retval = -ENOMEM ; + goto exit; + } +nonseekable_open (inode, file); subminor =iminor (inode);
@@ -364,8 +371,8 @@ static int tower_open (struct inode *inoUSB_TYPE_VENDOR |USB_DIR_IN |USB_RECIP_DEVICE ,0 ,0 , - &reset_reply, -sizeof (reset_reply), + reset_reply, +sizeof (*reset_reply), 1000);if (result <0 ) { dev_err(&dev->udev->dev,
@@ -406,6 +413,7 @@ unlock_exit:mutex_unlock (&dev->lock); exit: +kfree (reset_reply);return retval; }
@@ -808,7 +816,7 @@ static int tower_probe (struct usb_interstruct lego_usb_tower *dev =NULL ;struct usb_host_interface *iface_desc;struct usb_endpoint_descriptor * endpoint; -struct tower_get_version_reply get_version_reply; +struct tower_get_version_reply *get_version_reply =NULL ;int i;int retval = -ENOMEM ;int result;
@@ -898,6 +906,13 @@ static int tower_probe (struct usb_inter dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval; dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval; + get_version_reply =kmalloc (sizeof (*get_version_reply),GFP_KERNEL ); + +if (!get_version_reply) { + retval = -ENOMEM ; + goto error; + } +/* get the firmware version and log it */ result = usb_control_msg (udev, usb_rcvctrlpipe(udev, 0),
@@ -905,18 +920,19 @@ static int tower_probe (struct usb_interUSB_TYPE_VENDOR |USB_DIR_IN |USB_RECIP_DEVICE ,0 ,0 , - &get_version_reply, -sizeof (get_version_reply), + get_version_reply, +sizeof (*get_version_reply), 1000);if (result <0 ) {dev_err (idev,"LEGO USB Tower get version control request failed\n" ); retval = result; goto error; } -dev_info (&interface->dev,"LEGO USB Tower firmware version is %d.%d " -"build %d\n" , get_version_reply.major, - get_version_reply.minor, -le16_to_cpu (get_version_reply.build_no)); +dev_info (&interface->dev, +"LEGO USB Tower firmware version is %d.%d build %d\n" , + get_version_reply->major, + get_version_reply->minor, +le16_to_cpu (get_version_reply->build_no));/* we can register the device now, as it is ready */ usb_set_intfdata (interface, dev);
@@ -940,6 +956,7 @@ exit:return retval; error: +kfree (get_version_reply);tower_delete (dev);return retval; }
Greg Kroah-Hartman
maintainerPATCH 19/56 x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashish Kalra <[email protected]>
commit d594aa0277e541bb997aef0bc0a55172d8138340 upstream.
The minimum size for a new stack (512 bytes) setup for arch/x86/boot components when the bootloader does not setup/provide a stack for the early boot components is not "enough".
The setup code executing as part of early kernel startup code, uses the stack beyond 512 bytes and accidentally overwrites and corrupts part of the BSS section. This is exposed mostly in the early video setup code, where it was corrupting BSS variables like force_x, force_y, which in-turn affected kernel parameters such as screen_info (screen_info.orig_video_cols) and later caused an exception/panic in console_init().
Most recent boot loaders setup the stack for early boot components, so this stack overwriting into BSS section issue has not been exposed.
--- arch/x86/boot/boot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/boot.h +1 -1
@@ -16,7 +16,7 @@#ifndef BOOT_BOOT_H #define BOOT_BOOT_H -#define STACK_SIZE 512/* Minimum number of bytes for stack */ +#define STACK_SIZE 1024/* Minimum number of bytes for stack */ #ifndef __ASSEMBLY__
Greg Kroah-Hartman
maintainerPATCH 22/56 um: Fix PTRACE_POKEUSER on x86_64
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 9abc74a22d85ab29cef9896a2582a530da7e79bf upstream.
This is broken since ever but sadly nobody noticed. Recent versions of GDB set DR_CONTROL unconditionally and UML dies due to a heap corruption. It turns out that the PTRACE_POKEUSER was copy&pasted from i386 and assumes that addresses are 4 bytes long.
Fix that by using 8 as address size in the calculation.
--- arch/x86/um/ptrace_64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/um/ptrace_64.c +1 -1
@@ -121,7 +121,7 @@ int poke_user(struct task_struct *child, else if ((addr >= offsetof(struct user, u_debugreg[0])) && (addr <= offsetof(struct user, u_debugreg[7]))) { addr -= offsetof(struct user, u_debugreg[0]); - addr = addr >>2 ; + addr = addr >>3 ;if ((addr ==4 ) || (addr ==5 ))return -EIO ; child->thread.arch.debugregs[addr] = data;
Greg Kroah-Hartman
maintainerPATCH 24/56 KVM: arm/arm64: fix races in kvm_psci_vcpu_on
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Jones <[email protected]>
commit 6c7a5dce22b3f3cc44be098e2837fa6797edb8b8 upstream.
Fix potential races in kvm_psci_vcpu_on() by taking the kvm->lock mutex. In general, it's a bad idea to allow more than one PSCI_CPU_ON to process the same target VCPU at the same time. One such problem that may arise is that one PSCI_CPU_ON could be resetting the target vcpu, which fills the entire sys_regs array with a temporary value including the MPIDR register, while another looks up the VCPU based on the MPIDR value, resulting in no target VCPU found. Resolves both races found with the kvm-unit-tests/arm/psci unit test.
--- arch/arm/kvm/psci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/kvm/psci.c +7 -1
@@ -208,9 +208,10 @@ int kvm_psci_version(struct kvm_vcpu *vcstatic int kvm_psci_0_2_call (struct kvm_vcpu *vcpu) { -int ret =1 ; +struct kvm *kvm = vcpu->kvm;unsigned long psci_fn =vcpu_get_reg (vcpu,0 ) & ~((u32 )0 );unsigned long val; +int ret =1 ;switch (psci_fn) {case PSCI_0_2_FN_PSCI_VERSION :
@@ -230,7 +231,9 @@ static int kvm_psci_0_2_call(struct kvm_break ;case PSCI_0_2_FN_CPU_ON :case PSCI_0_2_FN64_CPU_ON : +mutex_lock (&kvm->lock); val =kvm_psci_vcpu_on (vcpu); +mutex_unlock (&kvm->lock);break ;case PSCI_0_2_FN_AFFINITY_INFO :case PSCI_0_2_FN64_AFFINITY_INFO :
@@ -279,6 +282,7 @@ static int kvm_psci_0_2_call(struct kvm_static int kvm_psci_0_1_call (struct kvm_vcpu *vcpu) { +struct kvm *kvm = vcpu->kvm;unsigned long psci_fn =vcpu_get_reg (vcpu,0 ) & ~((u32 )0 );unsigned long val;
@@ -288,7 +292,9 @@ static int kvm_psci_0_1_call(struct kvm_ val =PSCI_RET_SUCCESS ;break ;case KVM_PSCI_FN_CPU_ON : +mutex_lock (&kvm->lock); val =kvm_psci_vcpu_on (vcpu); +mutex_unlock (&kvm->lock);break ;default : val =PSCI_RET_NOT_SUPPORTED ;
Greg Kroah-Hartman
maintainerPATCH 25/56 block: fix blk_integrity_register to use templates interval_exp if not 0
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 2859323e35ab5fc42f351fbda23ab544eaa85945 upstream.
When registering an integrity profile: if the template's interval_exp is not 0 use it, otherwise use the ilog2() of logical block size of the provided gendisk.
This fixes a long-standing DM linear target bug where it cannot pass integrity data to the underlying device if its logical block size conflicts with the underlying device's logical block size.
--- block/blk-integrity.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-integrity.c +2 -1
@@ -412,7 +412,8 @@ void blk_integrity_register(struct gendi bi->flags =BLK_INTEGRITY_VERIFY |BLK_INTEGRITY_GENERATE | template->flags; - bi->interval_exp =ilog2 (queue_logical_block_size (disk->queue)); + bi->interval_exp = template->interval_exp ? : +ilog2 (queue_logical_block_size (disk->queue)); bi->profile = template->profile ? template->profile : &nop_profile; bi->tuple_size = template->tuple_size; bi->tag_size = template->tag_size;
Greg Kroah-Hartman
maintainerPATCH 26/56 crypto: algif_aead - Require setkey before accept(2)
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Mueller <[email protected]>
commit 2a2a251f110576b1d89efbd0662677d7e7db21a8 upstream.
Some cipher implementations will crash if you try to use them without calling setkey first. This patch adds a check so that the accept(2) call will fail with -ENOKEY if setkey hasn't been done on the socket yet.
--- crypto/algif_aead.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 149 insertions(+), 8 deletions(-)
crypto/algif_aead.c +149 -8
@@ -29,6 +29,11 @@ struct aead_sg_list {struct scatterlist sg[ALG_MAX_PAGES ]; }; +struct aead_tfm { +struct crypto_aead *aead; +bool has_key; +}; +struct aead_ctx {struct aead_sg_list tsgl;/*
@@ -513,24 +518,146 @@ static struct proto_ops algif_aead_ops = .poll = aead_poll, }; +static int aead_check_key (struct socket *sock) +{ +int err =0 ; +struct sock *psk; +struct alg_sock *pask; +struct aead_tfm *tfm; +struct sock *sk = sock->sk; +struct alg_sock *ask =alg_sk (sk); + +lock_sock (sk); +if (ask->refcnt) + goto unlock_child; + + psk = ask->parent; + pask =alg_sk (ask->parent); + tfm = pask->private; + + err = -ENOKEY ; +lock_sock_nested (psk,SINGLE_DEPTH_NESTING ); +if (!tfm->has_key) + goto unlock; + +if (!pask->refcnt++) +sock_hold (psk); + + ask->refcnt =1 ; +sock_put (psk); + + err =0 ; + +unlock: +release_sock (psk); +unlock_child: +release_sock (sk); + +return err; +} + +static int aead_sendmsg_nokey (struct socket *sock,struct msghdr *msg, +size_t size) +{ +int err; + + err =aead_check_key (sock); +if (err) +return err; + +return aead_sendmsg (sock, msg, size); +} + +static ssize_t aead_sendpage_nokey (struct socket *sock,struct page *page, +int offset,size_t size,int flags) +{ +int err; + + err =aead_check_key (sock); +if (err) +return err; + +return aead_sendpage (sock, page, offset, size, flags); +} + +static int aead_recvmsg_nokey (struct socket *sock,struct msghdr *msg, +size_t ignored,int flags) +{ +int err; + + err =aead_check_key (sock); +if (err) +return err; + +return aead_recvmsg (sock, msg, ignored, flags); +} + +static struct proto_ops algif_aead_ops_nokey = { + .family =PF_ALG , + + .connect = sock_no_connect, + .socketpair = sock_no_socketpair, + .getname = sock_no_getname, + .ioctl = sock_no_ioctl, + .listen = sock_no_listen, + .shutdown = sock_no_shutdown, + .getsockopt = sock_no_getsockopt, + .mmap = sock_no_mmap, + .bind = sock_no_bind, + .accept = sock_no_accept, + .setsockopt = sock_no_setsockopt, + + .release = af_alg_release, + .sendmsg = aead_sendmsg_nokey, + .sendpage = aead_sendpage_nokey, + .recvmsg = aead_recvmsg_nokey, + .poll = aead_poll, +}; +static void *aead_bind (const char *name,u32 type,u32 mask) { -return crypto_alloc_aead (name, type, mask); +struct aead_tfm *tfm; +struct crypto_aead *aead; + + tfm =kzalloc (sizeof (*tfm),GFP_KERNEL ); +if (!tfm) +return ERR_PTR (-ENOMEM ); + + aead =crypto_alloc_aead (name, type, mask); +if (IS_ERR (aead)) { +kfree (tfm); +return ERR_CAST (aead); + } + + tfm->aead = aead; + +return tfm; }static void aead_release (void *private) { -crypto_free_aead (private); +struct aead_tfm *tfm = private; + +crypto_free_aead (tfm->aead); +kfree (tfm); }static int aead_setauthsize (void *private,unsigned int authsize) { -return crypto_aead_setauthsize (private, authsize); +struct aead_tfm *tfm = private; + +return crypto_aead_setauthsize (tfm->aead, authsize); }static int aead_setkey (void *private,const u8 *key,unsigned int keylen) { -return crypto_aead_setkey (private, key, keylen); +struct aead_tfm *tfm = private; +int err; + + err =crypto_aead_setkey (tfm->aead, key, keylen); + tfm->has_key = !err; + +return err; }static void aead_sock_destruct (struct sock *sk)
@@ -546,12 +673,14 @@ static void aead_sock_destruct(struct soaf_alg_release_parent (sk); } -static int aead_accept_parent (void *private,struct sock *sk) +static int aead_accept_parent_nokey (void *private,struct sock *sk) {struct aead_ctx *ctx;struct alg_sock *ask =alg_sk (sk); -unsigned int len =sizeof (*ctx) +crypto_aead_reqsize (private); -unsigned int ivlen =crypto_aead_ivsize (private); +struct aead_tfm *tfm = private; +struct crypto_aead *aead = tfm->aead; +unsigned int len =sizeof (*ctx) +crypto_aead_reqsize (aead); +unsigned int ivlen =crypto_aead_ivsize (aead); ctx =sock_kmalloc (sk, len,GFP_KERNEL );if (!ctx)
@@ -577,7 +706,7 @@ static int aead_accept_parent(void *priv ask->private = ctx; -aead_request_set_tfm (&ctx->aead_req, private); +aead_request_set_tfm (&ctx->aead_req, aead);aead_request_set_callback (&ctx->aead_req,CRYPTO_TFM_REQ_MAY_BACKLOG , af_alg_complete, &ctx->completion);
@@ -586,13 +715,25 @@ static int aead_accept_parent(void *privreturn 0 ; } +static int aead_accept_parent (void *private,struct sock *sk) +{ +struct aead_tfm *tfm = private; + +if (!tfm->has_key) +return -ENOKEY ; + +return aead_accept_parent_nokey (private, sk); +} +static const struct af_alg_type algif_type_aead = { .bind = aead_bind, .release = aead_release, .setkey = aead_setkey, .setauthsize = aead_setauthsize, .accept = aead_accept_parent, + .accept_nokey = aead_accept_parent_nokey, .ops = &algif_aead_ops, + .ops_nokey = &algif_aead_ops_nokey, .name ="aead" , .owner =THIS_MODULE };
Greg Kroah-Hartman
maintainerPATCH 28/56 vfio/type1: Remove locked page accounting workqueue
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit 0cfef2b7410b64d7a430947e0b533314c4f97153 upstream.
If the mmap_sem is contented then the vfio type1 IOMMU backend will defer locked page accounting updates to a workqueue task. This has a few problems and depending on which side the user tries to play, they might be over-penalized for unmaps that haven't yet been accounted or race the workqueue to enter more mappings than they're allowed. The original intent of this workqueue mechanism seems to be focused on reducing latency through the ioctl, but we cannot do so at the cost of correctness. Remove this workqueue mechanism and update the callers to allow for failure. We can also now recheck the limit under write lock to make sure we don't exceed it.
vfio_pin_pages_remote() also now necessarily includes an unwind path which we can jump to directly if the consecutive page pinning finds that we're exceeding the user's memory limits. This avoids the current lazy approach which does accounting and mapping up to the fault, only to return an error on the next iteration to unwind the entire vfio_dma.
--- drivers/vfio/vfio_iommu_type1.c | 100 ++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 58 deletions(-)
drivers/vfio/vfio_iommu_type1.c +42 -58
@@ -130,57 +130,34 @@ static void vfio_unlink_dma(struct vfio_rb_erase (&old->node, &iommu->dma_list); } -struct vwork { -struct mm_struct *mm; -long npage; -struct work_struct work; -}; - -/* delayed decrement/increment for locked_vm */ -static void vfio_lock_acct_bg (struct work_struct *work) +static int vfio_lock_acct (long npage,bool *lock_cap) { - struct vwork *vwork = container_of(work, struct vwork, work); -struct mm_struct *mm; +int ret =0 ; - mm = vwork->mm; -down_write (&mm->mmap_sem); - mm->locked_vm += vwork->npage; -up_write (&mm->mmap_sem); -mmput (mm); -kfree (vwork); -} +if (!npage) +return 0 ; -static void vfio_lock_acct (long npage) -{ -struct vwork *vwork; -struct mm_struct *mm; +if (!current->mm) +return -ESRCH ;/* process exited */ -if (!current->mm || !npage) -return ;/* process exited or nothing to do */ +down_write (¤t->mm->mmap_sem); +if (npage >0 ) { +if (lock_cap ? !*lock_cap : !capable (CAP_IPC_LOCK )) { +unsigned long limit; -if (down_write_trylock (¤t->mm->mmap_sem)) { - current->mm->locked_vm += npage; -up_write (¤t->mm->mmap_sem); -return ; - } + limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; -/* -* Couldn't get mmap_sem lock, so must setup to update -* mm->locked_vm later. If locked_vm were atomic, we -* wouldn't need this silliness -*/ - vwork =kmalloc (sizeof (struct vwork ),GFP_KERNEL ); -if (!vwork) -return ; - mm =get_task_mm (current); -if (!mm) { -kfree (vwork); -return ; +if (current->mm->locked_vm + npage > limit) + ret = -ENOMEM ; + } } -INIT_WORK (&vwork->work, vfio_lock_acct_bg); - vwork->mm = mm; - vwork->npage = npage; -schedule_work (&vwork->work); + +if (!ret) + current->mm->locked_vm += npage; + +up_write (¤t->mm->mmap_sem); + +return ret; }/*
@@ -262,9 +239,9 @@ static int vaddr_get_pfn(unsigned long vstatic long vfio_pin_pages (unsigned long vaddr,long npage,int prot,unsigned long *pfn_base) { -unsigned long limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; +unsigned long pfn =0 , limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ;bool lock_cap =capable (CAP_IPC_LOCK ); -long ret, i; +long ret, i =1 ;bool rsvd;if (!current->mm)
@@ -283,16 +260,11 @@ static long vfio_pin_pages(unsigned longreturn -ENOMEM ; } -if (unlikely (disable_hugepages)) { -if (!rsvd) -vfio_lock_acct (1 ); -return 1 ; - } +if (unlikely (disable_hugepages)) + goto out;/* Lock all the consecutive pages from pfn_base */ -for (i =1 , vaddr +=PAGE_SIZE ; i < npage; i++, vaddr +=PAGE_SIZE ) { -unsigned long pfn =0 ; - +for (vaddr +=PAGE_SIZE ; i < npage; i++, vaddr +=PAGE_SIZE ) { ret =vaddr_get_pfn (vaddr, prot, &pfn);if (ret)break ;
@@ -308,12 +280,24 @@ static long vfio_pin_pages(unsigned longput_pfn (pfn, prot);pr_warn ("%s: RLIMIT_MEMLOCK (%ld) exceeded\n" , __func__, limit <<PAGE_SHIFT ); -break ; + ret = -ENOMEM ; + goto unpin_out; } } +out:if (!rsvd) -vfio_lock_acct (i); + ret =vfio_lock_acct (i, &lock_cap); + +unpin_out: +if (ret) { +if (!rsvd) { +for (pfn = *pfn_base ; i ; pfn++, i--) +put_pfn (pfn, prot); + } + +return ret; + }return i; }
@@ -328,7 +312,7 @@ static long vfio_unpin_pages(unsigned lo unlocked +=put_pfn (pfn++, prot);if (do_accounting) -vfio_lock_acct (-unlocked); +vfio_lock_acct (-unlocked,NULL );return unlocked; }
@@ -390,7 +374,7 @@ static void vfio_unmap_unpin(struct vfiocond_resched (); } -vfio_lock_acct (-unlocked); +vfio_lock_acct (-unlocked,NULL ); }static void vfio_remove_dma (struct vfio_iommu *iommu,struct vfio_dma *dma)
Greg Kroah-Hartman
maintainerPATCH 30/56 IB/IPoIB: ibX: failed to create mcg debug file
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shamir Rabinovitch <[email protected]>
commit 771a52584096c45e4565e8aabb596eece9d73d61 upstream.
When udev renames the netdev devices, ipoib debugfs entries does not get renamed. As a result, if subsequent probe of ipoib device reuse the name then creating a debugfs entry for the new device would fail.
Also, moved ipoib_create_debug_files and ipoib_delete_debug_files as part of ipoib event handling in order to avoid any race condition between these.
--- drivers/infiniband/ulp/ipoib/ipoib_fs.c | 3 ++ drivers/infiniband/ulp/ipoib/ipoib_main.c | 44 ++++++++++++++++++++++++++---- drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 3 -- 3 files changed, 42 insertions(+), 8 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_fs.c +3 -0
@@ -281,8 +281,11 @@ void ipoib_delete_debug_files(struct net {struct ipoib_dev_priv *priv =netdev_priv (dev); +WARN_ONCE (!priv->mcg_dentry,"null mcg debug file\n" ); +WARN_ONCE (!priv->path_dentry,"null path debug file\n" );debugfs_remove (priv->mcg_dentry);debugfs_remove (priv->path_dentry); + priv->mcg_dentry = priv->path_dentry =NULL ; }int ipoib_register_debugfs (void )
drivers/infiniband/ulp/ipoib/ipoib_main.c +39 -5
86 lines not on this page · raw message
drivers/infiniband/ulp/ipoib/ipoib_vlan.c +0 -3
@@ -85,8 +85,6 @@ int __ipoib_vlan_add(struct ipoib_dev_pr goto register_failed; } -ipoib_create_debug_files (priv->dev); -/* RTNL childs don't need proprietary sysfs entries */ if (type ==IPOIB_LEGACY_CHILD ) {if (ipoib_cm_add_mode_attr (priv->dev))
@@ -107,7 +105,6 @@ int __ipoib_vlan_add(struct ipoib_dev_pr sysfs_failed: result = -ENOMEM ; -ipoib_delete_debug_files (priv->dev);unregister_netdevice (priv->dev); register_failed:
Greg Kroah-Hartman
maintainerPATCH 34/56 fs/xattr.c: zero out memory copied to userspace in getxattr
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Hocko <[email protected]>
commit 81be3dee96346fbe08c31be5ef74f03f6b63cf68 upstream.
getxattr uses vmalloc to allocate memory if kzalloc fails. This is filled by vfs_getxattr and then copied to the userspace. vmalloc, however, doesn't zero out the memory so if the specific implementation of the xattr handler is sloppy we can theoretically expose a kernel memory. There is no real sign this is really the case but let's make sure this will not happen and use vzalloc instead.
--- fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xattr.c +1 -1
@@ -442,7 +442,7 @@ getxattr(struct dentry *d, const char __ size =XATTR_SIZE_MAX ; kvalue =kzalloc (size,GFP_KERNEL | __GFP_NOWARN);if (!kvalue) { - vvalue =vmalloc (size); + vvalue =vzalloc (size);if (!vvalue)return -ENOMEM ; kvalue = vvalue;
Greg Kroah-Hartman
maintainerPATCH 35/56 ceph: fix memory leak in __ceph_setxattr()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luis Henriques <[email protected]>
commit eeca958dce0a9231d1969f86196653eb50fcc9b3 upstream.
The ceph_inode_xattr needs to be released when removing an xattr. Easily reproducible running the 'generic/020' test from xfstests or simply by doing:
attr -s attr0 -V 0 /mnt/test && attr -r attr0 /mnt/test
While there, also fix the error path.
Here's the kmemleak splat:
unreferenced object 0xffff88001f86fbc0 (size 64):
comm "attr", pid 244, jiffies 4294904246 (age 98.464s) hex dump (first 32 bytes):
40 fa 86 1f 00 88 ff ff 80 32 38 1f 00 88 ff ff @........28.....
00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de ................
backtrace:
[<ffffffff81560199>] kmemleak_alloc+0x49/0xa0
[<ffffffff810f3e5b>] kmem_cache_alloc+0x9b/0xf0
[<ffffffff812b157e>] __ceph_setxattr+0x17e/0x820
[<ffffffff812b1c57>] ceph_set_xattr_handler+0x37/0x40
[<ffffffff8111fb4b>] __vfs_removexattr+0x4b/0x60
[<ffffffff8111fd37>] vfs_removexattr+0x77/0xd0
[<ffffffff8111fdd1>] removexattr+0x41/0x60
[<ffffffff8111fe65>] path_removexattr+0x75/0xa0
[<ffffffff81120aeb>] SyS_lremovexattr+0xb/0x10
[<ffffffff81564b20>] entry_SYSCALL_64_fastpath+0x13/0x94
[<ffffffffffffffff>] 0xffffffffffffffff--- fs/ceph/xattr.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ceph/xattr.c +3 -0
@@ -369,6 +369,7 @@ static int __set_xattr(struct ceph_inodeif (update_xattr) {int err =0 ; +if (xattr && (flags &XATTR_CREATE )) err = -EEXIST ;else if (!xattr && (flags &XATTR_REPLACE ))
@@ -376,12 +377,14 @@ static int __set_xattr(struct ceph_inodeif (err) {kfree (name);kfree (val); +kfree (*newxattr);return err; }if (update_xattr <0 ) {if (xattr)__remove_xattr (ci, xattr);kfree (name); +kfree (*newxattr);return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 36/56 fs/block_dev: always invalidate cleancache in invalidate_bdev()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit a5f6a6a9c72eac38a7fadd1a038532bc8516337c upstream.
invalidate_bdev() calls cleancache_invalidate_inode() iff ->nrpages != 0 which doen't make any sense.
Make sure that invalidate_bdev() always calls cleancache_invalidate_inode() regardless of mapping->nrpages value.
--- fs/block_dev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/block_dev.c +5 -6
@@ -88,12 +88,11 @@ void invalidate_bdev(struct block_device {struct address_space *mapping = bdev->bd_inode->i_mapping; -if (mapping->nrpages ==0 ) -return ; - -invalidate_bh_lrus (); -lru_add_drain_all ();/* make sure all lru add caches are flushed */ -invalidate_mapping_pages (mapping,0 ,-1 ); +if (mapping->nrpages) { +invalidate_bh_lrus (); +lru_add_drain_all ();/* make sure all lru add caches are flushed */ +invalidate_mapping_pages (mapping,0 ,-1 ); + }/* 99% of the time, we don't need to flush the cleancache on the bdev. * But, for the strange corners, lets be cautious */
Greg Kroah-Hartman
maintainerPATCH 37/56 Set unicode flag on cifs echo request to avoid Mac error
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 26c9cb668c7fbf9830516b75d8bee70b699ed449 upstream.
Mac requires the unicode flag to be set for cifs, even for the smb echo request (which doesn't have strings).
Without this Mac rejects the periodic echo requests (when mounting with cifs) that we use to check if server is down
--- fs/cifs/cifssmb.c | 3 +++ 1 file changed, 3 insertions(+)
fs/cifs/cifssmb.c +3 -0
@@ -717,6 +717,9 @@ CIFSSMBEcho(struct TCP_Server_Info *servif (rc)return rc; +if (server->capabilities &CAP_UNICODE ) + smb->hdr.Flags2 |=SMBFLG2_UNICODE ; +/* set up echo request */ smb->hdr.Tid =0xffff ; smb->hdr.WordCount =1 ;
Greg Kroah-Hartman
maintainerPATCH 38/56 SMB3: Work around mount failure when using SMB3 dialect to Macs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 7db0a6efdc3e990cdfd4b24820d010e9eb7890ad upstream.
Macs send the maximum buffer size in response on ioctl to validate negotiate security information, which causes us to fail the mount as the response buffer is larger than the expected response.
Changed ioctl response processing to allow for padding of validate negotiate ioctl response and limit the maximum response size to maximum buffer size.
--- fs/cifs/smb2pdu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
fs/cifs/smb2pdu.c +11 -3
@@ -564,8 +564,12 @@ int smb3_validate_negotiate(const unsign }if (rsplen !=sizeof (struct validate_negotiate_info_rsp )) { -cifs_dbg (VFS ,"invalid size of protocol negotiate response\n" ); -return -EIO ; +cifs_dbg (VFS ,"invalid protocol negotiate response size: %d\n" , + rsplen); + +/* relax check since Mac returns max bufsize allowed on ioctl */ +if (rsplen > CIFSMaxBufSize) +return -EIO ; }/* check validate negotiate info response matches what we got earlier */
@@ -1518,8 +1522,12 @@ SMB2_ioctl(const unsigned int xid, struc* than one credit. Windows typically sets this smaller, but for some * ioctls it may be useful to allow server to send more. No point * limiting what the server can send as long as fits in one credit +* Unfortunately - we can not handle more than CIFS_MAX_MSG_SIZE +* (by default, note that it can be overridden to make max larger) +* in responses (except for read responses which can be bigger. +* We may want to bump this limit up */ - req->MaxOutputResponse =cpu_to_le32 (0xFF00 );/* < 64K uses 1 credit */ + req->MaxOutputResponse =cpu_to_le32 (CIFSMaxBufSize);if (is_fsctl) req->Flags =cpu_to_le32 (SMB2_0_IOCTL_IS_FSCTL );
Greg Kroah-Hartman
maintainerPATCH 40/56 cifs: fix CIFS_IOC_GET_MNT_INFO oops
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Disseldorp <[email protected]>
commit d8a6e505d6bba2250852fbc1c1c86fe68aaf9af3 upstream.
An open directory may have a NULL private_data pointer prior to readdir.
--- fs/cifs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+)
fs/cifs/ioctl.c +2 -0
@@ -272,6 +272,8 @@ long cifs_ioctl(struct file *filep, unsi rc = -EOPNOTSUPP ;break ;case CIFS_IOC_GET_MNT_INFO : +if (pSMBFile ==NULL ) +break ; tcon =tlink_tcon (pSMBFile->tlink); rc =smb_mnt_get_fsinfo (xid, tcon, (void __user *)arg);break ;
Greg Kroah-Hartman
maintainerPATCH 42/56 padata: free correct variable
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason A. Donenfeld <[email protected]>
commit 07a77929ba672d93642a56dc2255dd21e6e2290b upstream.
The author meant to free the variable that was just allocated, instead of the one that failed to be allocated, but made a simple typo. This patch rectifies that.
--- kernel/padata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/padata.c +1 -1
@@ -357,7 +357,7 @@ static int padata_setup_cpumasks(structcpumask_and (pd->cpumask.pcpu, pcpumask, cpu_online_mask);if (!alloc_cpumask_var (&pd->cpumask.cbcpu,GFP_KERNEL )) { -free_cpumask_var (pd->cpumask.cbcpu); +free_cpumask_var (pd->cpumask.pcpu);return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 43/56 arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit c667186f1c01ca8970c785888868b7ffd74e51ee upstream.
Our 32bit CP14/15 handling inherited some of the ARMv7 code for handling the trapped system registers, completely missing the fact that the fields for Rt and Rt2 are now 5 bit wide, and not 4...
Let's fix it, and provide an accessor for the most common Rt case.
--- arch/arm64/kvm/sys_regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kvm/sys_regs.c +3 -3
@@ -1054,8 +1054,8 @@ static int kvm_handle_cp_64(struct kvm_v {struct sys_reg_params params;u32 hsr =kvm_vcpu_get_hsr (vcpu); -int Rt = (hsr >>5 ) &0xf ; -int Rt2 = (hsr >>10 ) &0xf ; +int Rt = (hsr >>5 ) &0x1f ; +int Rt2 = (hsr >>10 ) &0x1f ; params.is_aarch32 = true; params.is_32bit = false;
@@ -1106,7 +1106,7 @@ static int kvm_handle_cp_32(struct kvm_v {struct sys_reg_params params;u32 hsr =kvm_vcpu_get_hsr (vcpu); -int Rt = (hsr >>5 ) &0xf ; +int Rt = (hsr >>5 ) &0x1f ; params.is_aarch32 = true; params.is_32bit = true;
Greg Kroah-Hartman
maintainerPATCH 45/56 serial: omap: fix runtime-pm handling on unbind
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 099bd73dc17ed77aa8c98323e043613b6e8f54fc upstream.
An unbalanced and misplaced synchronous put was used to suspend the device on driver unbind, something which with a likewise misplaced pm_runtime_disable leads to external aborts when an open port is being removed.
Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa024010
...
[<c046e760>] (serial_omap_set_mctrl) from [<c046a064>] (uart_update_mctrl+0x50/0x60) [<c046a064>] (uart_update_mctrl) from [<c046a400>] (uart_shutdown+0xbc/0x138) [<c046a400>] (uart_shutdown) from [<c046bd2c>] (uart_hangup+0x94/0x190) [<c046bd2c>] (uart_hangup) from [<c045b760>] (__tty_hangup+0x404/0x41c) [<c045b760>] (__tty_hangup) from [<c045b794>] (tty_vhangup+0x1c/0x20) [<c045b794>] (tty_vhangup) from [<c046ccc8>] (uart_remove_one_port+0xec/0x260) [<c046ccc8>] (uart_remove_one_port) from [<c046ef4c>] (serial_omap_remove+0x40/0x60) [<c046ef4c>] (serial_omap_remove) from [<c04845e8>] (platform_drv_remove+0x34/0x4c)
Fix this up by resuming the device before deregistering the port and by suspending and disabling runtime pm only after the port has been removed.
Also make sure to disable autosuspend before disabling runtime pm so that the usage count is balanced and device actually suspended before returning.
Note that due to a negative autosuspend delay being set in probe, the unbalanced put would actually suspend the device on first driver unbind, while rebinding and again unbinding would result in a negative power.usage_count.
--- drivers/tty/serial/omap-serial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/omap-serial.c +5 -1
@@ -1725,9 +1725,13 @@ static int serial_omap_remove(struct pla {struct uart_omap_port *up =platform_get_drvdata (dev); +pm_runtime_get_sync (up->dev); + +uart_remove_one_port (&serial_omap_reg, &up->port); + +pm_runtime_dont_use_autosuspend (up->dev);pm_runtime_put_sync (up->dev);pm_runtime_disable (up->dev); -uart_remove_one_port (&serial_omap_reg, &up->port);pm_qos_remove_request (&up->pm_qos_request);device_init_wakeup (&dev->dev, false);
Greg Kroah-Hartman
maintainerPATCH 48/56 Bluetooth: Fix user channel for 32bit userspace on 64bit kernel
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Szymon Janc <[email protected]>
commit ab89f0bdd63a3721f7cd3f064f39fc4ac7ca14d4 upstream.
Running 32bit userspace on 64bit kernel results in MSG_CMSG_COMPAT being defined as 0x80000000. This results in sendmsg failure if used from 32bit userspace running on 64bit kernel. Fix this by accounting for MSG_CMSG_COMPAT in flags check in hci_sock_sendmsg.
--- net/bluetooth/hci_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/hci_sock.c +2 -1
@@ -1164,7 +1164,8 @@ static int hci_sock_sendmsg(struct sockeif (msg->msg_flags &MSG_OOB )return -EOPNOTSUPP ; -if (msg->msg_flags & ~(MSG_DONTWAIT |MSG_NOSIGNAL |MSG_ERRQUEUE )) +if (msg->msg_flags & ~(MSG_DONTWAIT |MSG_NOSIGNAL |MSG_ERRQUEUE | +MSG_CMSG_COMPAT ))return -EINVAL ;if (len <4 || len >HCI_MAX_FRAME_SIZE )
Greg Kroah-Hartman
maintainerPATCH 52/56 mac80211: pass block ack session timeout to to driver
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
commit 50ea05efaf3bed7dd34bcc2635a8b3f53bd0ccc1 upstream.
Currently mac80211 does not inform the driver of the session block ack timeout when starting a rx aggregation session. Drivers that manage the reorder buffer need to know this parameter.
Seeing that there are now too many arguments for the drv_ampdu_action() function, wrap them inside a structure.
--- drivers/net/wireless/ath/ath10k/mac.c | 7 +- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 7 +- drivers/net/wireless/ath/ath9k/main.c | 8 +- drivers/net/wireless/ath/carl9170/main.c | 8 +- drivers/net/wireless/ath/wcn36xx/main.c | 8 +- drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c | 8 +- drivers/net/wireless/cw1200/sta.c | 4 - drivers/net/wireless/cw1200/sta.h | 4 - drivers/net/wireless/iwlegacy/4965-mac.c | 8 +- drivers/net/wireless/iwlegacy/4965.h | 4 - drivers/net/wireless/iwlwifi/dvm/mac80211.c | 9 ++- drivers/net/wireless/iwlwifi/mvm/mac80211.c | 9 ++- drivers/net/wireless/mac80211_hwsim.c | 8 +- drivers/net/wireless/mediatek/mt7601u/main.c | 8 +- drivers/net/wireless/mwl8k.c | 10 ++- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c | 6 +- drivers/net/wireless/realtek/rtlwifi/core.c | 8 +- drivers/net/wireless/rsi/rsi_91x_mac80211.c | 19 ++---- drivers/net/wireless/rt2x00/rt2800lib.c | 7 +- drivers/net/wireless/rt2x00/rt2800lib.h | 4 - drivers/net/wireless/ti/wlcore/main.c | 8 +- include/net/mac80211.h | 44 ++++++++++---- net/mac80211/agg-rx.c | 25 +++++++- net/mac80211/agg-tx.c | 53 +++++++++++------- net/mac80211/driver-ops.c | 10 +-- net/mac80211/driver-ops.h | 4 - net/mac80211/trace.h | 43 +++++++------- 27 files changed, 202 insertions(+), 139 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +4 -3
@@ -6351,12 +6351,13 @@ static u64 ath10k_get_tsf(struct ieee802static int ath10k_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct ath10k *ar = hw->priv;struct ath10k_vif *arvif =ath10k_vif_to_arvif (vif); +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid;ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac ampdu vdev_id %i sta %pM tid %hu action %d\n" , arvif->vdev_id, sta->addr, tid, action);
drivers/net/wireless/ath/ath9k/htc_drv_main.c +4 -3
@@ -1657,13 +1657,14 @@ static void ath9k_htc_reset_tsf(struct istatic int ath9k_htc_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta, -u16 tid,u16 *ssn,u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct ath9k_htc_priv *priv = hw->priv;struct ath9k_htc_sta *ista;int ret =0 ; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid;mutex_lock (&priv->mutex);ath9k_htc_ps_wakeup (priv);
drivers/net/wireless/ath/ath9k/main.c +5 -3
@@ -1855,14 +1855,16 @@ static void ath9k_reset_tsf(struct ieee8static int ath9k_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta, -u16 tid,u16 *ssn,u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct ath_softc *sc = hw->priv;struct ath_common *common =ath9k_hw_common (sc->sc_ah);bool flush = false;int ret =0 ; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;mutex_lock (&sc->mutex);
drivers/net/wireless/ath/carl9170/main.c +5 -3
@@ -1413,10 +1413,12 @@ static void carl9170_ampdu_work(struct wstatic int carl9170_op_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta, -u16 tid,u16 *ssn,u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) { +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;struct ar9170 *ar = hw->priv;struct carl9170_sta_info *sta_info = (void *) sta->drv_priv;struct carl9170_sta_tid *tid_info;
drivers/net/wireless/ath/wcn36xx/main.c +5 -3
@@ -857,12 +857,14 @@ static int wcn36xx_resume(struct ieee802static int wcn36xx_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct wcn36xx *wcn = hw->priv;struct wcn36xx_sta *sta_priv =NULL ; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;wcn36xx_dbg (WCN36XX_DBG_MAC ,"mac ampdu action action %d tid %d\n" , action, tid);
drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c +5 -3
@@ -818,13 +818,15 @@ brcms_ops_sta_add(struct ieee80211_hw *hstatic int brcms_ops_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct brcms_info *wl = hw->priv;struct scb *scb = &wl->wlc->pri_scb;int status; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u8 buf_size = params->buf_size;if (WARN_ON (scb->magic !=SCB_MAGIC ))return -EIDRM ;
drivers/net/wireless/cw1200/sta.c +1 -3
@@ -2135,9 +2135,7 @@ void cw1200_mcast_timeout(unsigned longint cw1200_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {/* Aggregation is implemented fully in firmware, * including block ack negotiation. Do not allow
drivers/net/wireless/cw1200/sta.h +1 -3
@@ -109,9 +109,7 @@ void cw1200_bss_info_changed(struct ieee u32 changed);int cw1200_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu); +struct ieee80211_ampdu_params *params);void cw1200_suspend_resume (struct cw1200_common *priv,struct wsm_suspend_resume *arg);
drivers/net/wireless/iwlegacy/4965-mac.c +5 -3
@@ -5982,12 +5982,14 @@ il4965_mac_set_key(struct ieee80211_hw *int il4965_mac_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 * ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct il_priv *il = hw->priv;int ret = -EINVAL ; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;D_HT ("A-MPDU action on addr %pM tid %d\n" , sta->addr, tid);
drivers/net/wireless/iwlegacy/4965.h +1 -3
@@ -182,9 +182,7 @@ void il4965_mac_update_tkip_key(struct i struct ieee80211_sta *sta, u32 iv32, u16 *phase1key);int il4965_mac_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 * ssn, -u8 buf_size,bool amsdu); +struct ieee80211_ampdu_params *params);int il4965_mac_sta_add (struct ieee80211_hw *hw,struct ieee80211_vif *vif,struct ieee80211_sta *sta);void
drivers/net/wireless/iwlwifi/dvm/mac80211.c +6 -3
@@ -729,12 +729,15 @@ static inline bool iwl_enable_tx_ampdu(cstatic int iwlagn_mac_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct iwl_priv *priv =IWL_MAC80211_GET_DVM (hw);int ret = -EINVAL ; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn; +u8 buf_size = params->buf_size;struct iwl_station_priv *sta_priv = (void *) sta->drv_priv; IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
drivers/net/wireless/iwlwifi/mvm/mac80211.c +6 -3
@@ -826,13 +826,16 @@ iwl_mvm_ampdu_check_trigger(struct iwl_mstatic int iwl_mvm_mac_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid, -u16 *ssn,u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct iwl_mvm *mvm =IWL_MAC80211_GET_MVM (hw);int ret;bool tx_agg_ref = false; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn; +u8 buf_size = params->buf_size;IWL_DEBUG_HT (mvm,"A-MPDU action on addr %pM tid %d: action %d\n" , sta->addr, tid, action);
drivers/net/wireless/mac80211_hwsim.c +5 -3
@@ -1817,10 +1817,12 @@ static int mac80211_hwsim_testmode_cmd(sstatic int mac80211_hwsim_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) { +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +switch (action) {case IEEE80211_AMPDU_TX_START :ieee80211_start_tx_ba_cb_irqsafe (vif, sta->addr, tid);
drivers/net/wireless/mediatek/mt7601u/main.c +5 -3
@@ -334,11 +334,13 @@ static int mt7601u_set_rts_threshold(strstatic int mt76_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn,u8 buf_size, -bool amsdu) +struct ieee80211_ampdu_params *params) {struct mt7601u_dev *dev = hw->priv; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;struct mt76_sta *msta = (struct mt76_sta *) sta->drv_priv;WARN_ON (msta->wcid.idx >GROUP_WCID (0 ));
drivers/net/wireless/mwl8k.c +6 -4
@@ -5421,11 +5421,13 @@ static int mwl8k_get_survey(struct ieee8static int mwl8k_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) { - +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn; +u8 buf_size = params->buf_size;int i, rc =0 ;struct mwl8k_priv *priv = hw->priv;struct mwl8k_ampdu_stream *stream;
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c +3 -3
@@ -5375,13 +5375,13 @@ static int rtl8xxxu_set_key(struct ieee8static int rtl8xxxu_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn,u8 buf_size, -bool amsdu) +struct ieee80211_ampdu_params *params) {struct rtl8xxxu_priv *priv = hw->priv;struct device *dev = &priv->udev->dev;u8 ampdu_factor, ampdu_density; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action;switch (action) {case IEEE80211_AMPDU_TX_START :
drivers/net/wireless/realtek/rtlwifi/core.c +5 -3
@@ -1369,11 +1369,13 @@ static void rtl_op_sta_notify(struct ieestatic int rtl_op_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct rtl_priv *rtlpriv =rtl_priv (hw); +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;switch (action) {case IEEE80211_AMPDU_TX_START :
drivers/net/wireless/rsi/rsi_91x_mac80211.c +7 -12
@@ -659,29 +659,24 @@ static int rsi_mac80211_set_key(struct i* informs the f/w regarding this. * @hw: Pointer to the ieee80211_hw structure. * @vif: Pointer to the ieee80211_vif structure. -* @action: ieee80211_ampdu_mlme_action enum. -* @sta: Pointer to the ieee80211_sta structure. -* @tid: Traffic identifier. -* @ssn: Pointer to ssn value. -* @buf_size: Buffer size (for kernel version > 2.6.38). -* @amsdu: is AMSDU in AMPDU allowed +* @params: Pointer to A-MPDU action parameters * * Return: status: 0 on success, negative error code on failure. */ static int rsi_mac80211_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta, -unsigned short tid, -unsigned short *ssn, -unsigned char buf_size, -bool amsdu) +struct ieee80211_ampdu_params *params) {int status = -EOPNOTSUPP ;struct rsi_hw *adapter = hw->priv;struct rsi_common *common = adapter->priv;u16 seq_no =0 ;u8 ii =0 ; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn; +u8 buf_size = params->buf_size;for (ii =0 ; ii <RSI_MAX_VIFS ; ii++) {if (vif == adapter->vifs[ii])
drivers/net/wireless/rt2x00/rt2800lib.c +4 -3
@@ -7935,10 +7935,11 @@ u64 rt2800_get_tsf(struct ieee80211_hw *EXPORT_SYMBOL_GPL (rt2800_get_tsf);int rt2800_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) { +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid;struct rt2x00_sta *sta_priv = (struct rt2x00_sta *)sta->drv_priv;int ret =0 ;
drivers/net/wireless/rt2x00/rt2800lib.h +1 -3
@@ -218,9 +218,7 @@ int rt2800_conf_tx(struct ieee80211_hw * const struct ieee80211_tx_queue_params *params);u64 rt2800_get_tsf (struct ieee80211_hw *hw,struct ieee80211_vif *vif);int rt2800_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu); +struct ieee80211_ampdu_params *params);int rt2800_get_survey (struct ieee80211_hw *hw,int idx,struct survey_info *survey);void rt2800_disable_wpdma (struct rt2x00_dev *rt2x00dev);
drivers/net/wireless/ti/wlcore/main.c +5 -3
@@ -5261,14 +5261,16 @@ out:static int wl1271_op_ampdu_action (struct ieee80211_hw *hw,struct ieee80211_vif *vif, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid,u16 *ssn, -u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {struct wl1271 *wl = hw->priv;struct wl12xx_vif *wlvif =wl12xx_vif_to_data (vif);int ret;u8 hlid, *ba_bitmap; +struct ieee80211_sta *sta = params->sta; +enum ieee80211_ampdu_mlme_action action = params->action; +u16 tid = params->tid; +u16 *ssn = ¶ms->ssn;wl1271_debug (DEBUG_MAC80211 ,"mac80211 ampdu action %d tid %d" , action, tid);
include/net/mac80211.h +30 -14
69 lines not on this page · raw message
net/mac80211/agg-rx.c +21 -4
@@ -7,6 +7,7 @@* Copyright 2006-2007 Jiri Benc <[email protected]> * Copyright 2007, Michael Wu <[email protected]> * Copyright 2007-2010, Intel Corporation +* Copyright(c) 2015 Intel Deutschland GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -61,6 +62,14 @@ void ___ieee80211_stop_rx_ba_session(str {struct ieee80211_local *local = sta->local;struct tid_ampdu_rx *tid_rx; +struct ieee80211_ampdu_params params = { + .sta = &sta->sta, + .action =IEEE80211_AMPDU_RX_STOP , + .tid = tid, + .amsdu = false, + .timeout =0 , + .ssn =0 , + };lockdep_assert_held (&sta->ampdu_mlme.mtx);
@@ -78,8 +87,7 @@ void ___ieee80211_stop_rx_ba_session(str initiator ==WLAN_BACK_RECIPIENT ?"recipient" :"inititator" , (int)reason); -if (drv_ampdu_action (local, sta->sdata,IEEE80211_AMPDU_RX_STOP , - &sta->sta, tid,NULL ,0 , false)) +if (drv_ampdu_action (local, sta->sdata, ¶ms))sdata_info (sta->sdata,"HW problem - can not stop rx aggregation for %pM tid %d\n" , sta->sta.addr, tid);
@@ -237,6 +245,15 @@ void __ieee80211_start_rx_ba_session(str {struct ieee80211_local *local = sta->sdata->local;struct tid_ampdu_rx *tid_agg_rx; +struct ieee80211_ampdu_params params = { + .sta = &sta->sta, + .action =IEEE80211_AMPDU_RX_START , + .tid = tid, + .amsdu = false, + .timeout = timeout, + .ssn = start_seq_num, + }; +int i, ret = -EOPNOTSUPP ;u16 status =WLAN_STATUS_REQUEST_DECLINED ;
@@ -275,6 +292,7 @@ void __ieee80211_start_rx_ba_session(str/* make sure the size doesn't exceed the maximum supported by the hw */ if (buf_size > local->hw.max_rx_aggregation_subframes) buf_size = local->hw.max_rx_aggregation_subframes; + params.buf_size = buf_size;/* examine state machine */ mutex_lock (&sta->ampdu_mlme.mtx);
@@ -322,8 +340,7 @@ void __ieee80211_start_rx_ba_session(strfor (i =0 ; i < buf_size; i++)__skb_queue_head_init (&tid_agg_rx->reorder_buf[i]); - ret =drv_ampdu_action (local, sta->sdata,IEEE80211_AMPDU_RX_START , - &sta->sta, tid, &start_seq_num, buf_size, false); + ret =drv_ampdu_action (local, sta->sdata, ¶ms);ht_dbg (sta->sdata,"Rx A-MPDU request on %pM tid %d result %d\n" , sta->sta.addr, tid, ret);if (ret) {
net/mac80211/agg-tx.c +35 -18
117 lines not on this page · raw message
net/mac80211/driver-ops.c +3 -7
@@ -284,9 +284,7 @@ int drv_switch_vif_chanctx(struct ieee80int drv_ampdu_action (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid, -u16 *ssn,u8 buf_size,bool amsdu) +struct ieee80211_ampdu_params *params) {int ret = -EOPNOTSUPP ;
@@ -296,12 +294,10 @@ int drv_ampdu_action(struct ieee80211_loif (!check_sdata_in_driver (sdata))return -EIO ; -trace_drv_ampdu_action (local, sdata, action, sta, tid, - ssn, buf_size, amsdu); +trace_drv_ampdu_action (local, sdata, params);if (local->ops->ampdu_action) - ret = local->ops->ampdu_action (&local->hw, &sdata->vif, action, - sta, tid, ssn, buf_size, amsdu); + ret = local->ops->ampdu_action (&local->hw, &sdata->vif, params);trace_drv_return_int (local, ret);
net/mac80211/driver-ops.h +1 -3
@@ -585,9 +585,7 @@ static inline int drv_tx_last_beacon(strint drv_ampdu_action (struct ieee80211_local *local,struct ieee80211_sub_if_data *sdata, -enum ieee80211_ampdu_mlme_action action, -struct ieee80211_sta *sta,u16 tid, -u16 *ssn,u8 buf_size,bool amsdu); +struct ieee80211_ampdu_params *params);static inline int drv_get_survey (struct ieee80211_local *local,int idx,struct survey_info *survey)
net/mac80211/trace.h +23 -20
68 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 53/56 mac80211: RX BA support for sta max_rx_aggregation_subframes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Altshul <[email protected]>
commit 480dd46b9d6812e5fb7172c305ee0f1154c26eed upstream.
The ability to change the max_rx_aggregation frames is useful in cases of IOP.
There exist some devices (latest mobile phones and some AP's) that tend to not respect a BA sessions maximum size (in Kbps). These devices won't respect the AMPDU size that was negotiated during association (even though they do respect the maximal number of packets).
This violation is characterized by a valid number of packets in a single AMPDU. Even so, the total size will exceed the size negotiated during association.
Eventually, this will cause some undefined behavior, which in turn causes the hw to drop packets, causing the throughput to plummet.
This patch will make the subframe limitation to be held by each station, instead of being held only by hw.
--- include/net/mac80211.h | 4 ++++ net/mac80211/agg-rx.c | 7 +++++-- net/mac80211/sta_info.c | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-)
include/net/mac80211.h +4 -0
@@ -1662,6 +1662,9 @@ struct ieee80211_sta_rates {* @supp_rates: Bitmap of supported rates (per band) * @ht_cap: HT capabilities of this STA; restricted to our own capabilities * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities +* @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU +* that this station is allowed to transmit to us. +* Can be modified by driver. * @wme: indicates whether the STA supports QoS/WME (if local devices does, * otherwise always false) * @drv_priv: data area for driver use, will always be aligned to
@@ -1688,6 +1691,7 @@ struct ieee80211_sta {u16 aid;struct ieee80211_sta_ht_cap ht_cap;struct ieee80211_sta_vht_cap vht_cap; +u8 max_rx_aggregation_subframes;bool wme;u8 uapsd_queues;u8 max_sp;
net/mac80211/agg-rx.c +5 -2
@@ -290,10 +290,13 @@ void __ieee80211_start_rx_ba_session(str buf_size =IEEE80211_MAX_AMPDU_BUF ;/* make sure the size doesn't exceed the maximum supported by the hw */ -if (buf_size > local->hw.max_rx_aggregation_subframes) - buf_size = local->hw.max_rx_aggregation_subframes; +if (buf_size > sta->sta.max_rx_aggregation_subframes) + buf_size = sta->sta.max_rx_aggregation_subframes; params.buf_size = buf_size; +ht_dbg (sta->sdata,"AddBA Req buf_size=%d for %pM\n" , + buf_size, sta->sta.addr); +/* examine state machine */ mutex_lock (&sta->ampdu_mlme.mtx);
net/mac80211/sta_info.c +3 -0
@@ -329,6 +329,9 @@ struct sta_info *sta_info_alloc(struct imemcpy (sta->addr, addr,ETH_ALEN );memcpy (sta->sta.addr, addr,ETH_ALEN ); + sta->sta.max_rx_aggregation_subframes = + local->hw.max_rx_aggregation_subframes; + sta->local = local; sta->sdata = sdata; sta->rx_stats.last_rx = jiffies;
Greg Kroah-Hartman
maintainerPATCH 54/56 wlcore: Pass win_size taken from ieee80211_sta to FW
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Altshul <[email protected]>
commit 42c7372a111630dab200c2f959424f5ec3bf79a4 upstream.
When starting a new BA session, we must pass the win_size to the FW.
To do this we take max_rx_aggregation_subframes (BA RX win size) which is stored in ieee80211_sta structure (e.g per link and not per HW)
We will use the value stored per link when passing the win_size to firmware through the ACX_BA_SESSION_RX_SETUP command.
--- drivers/net/wireless/ti/wlcore/acx.c | 5 +++-- drivers/net/wireless/ti/wlcore/acx.h | 3 ++- drivers/net/wireless/ti/wlcore/main.c | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-)
drivers/net/wireless/ti/wlcore/acx.c +3 -2
@@ -1419,7 +1419,8 @@ out:/* setup BA session receiver setting in the FW. */ int wl12xx_acx_set_ba_receiver_session (struct wl1271 *wl,u8 tid_index, -u16 ssn,bool enable,u8 peer_hlid) +u16 ssn,bool enable,u8 peer_hlid, +u8 win_size) {struct wl1271_acx_ba_receiver_setup *acx;int ret;
@@ -1435,7 +1436,7 @@ int wl12xx_acx_set_ba_receiver_session(s acx->hlid = peer_hlid; acx->tid = tid_index; acx->enable = enable; - acx->win_size = wl->conf.ht.rx_ba_win_size; + acx->win_size = win_size; acx->ssn = ssn; ret = wlcore_cmd_configure_failsafe(wl, ACX_BA_SESSION_RX_SETUP, acx,
drivers/net/wireless/ti/wlcore/acx.h +2 -1
@@ -1112,7 +1112,8 @@ int wl1271_acx_set_ht_information(structint wl12xx_acx_set_ba_initiator_policy (struct wl1271 *wl,struct wl12xx_vif *wlvif);int wl12xx_acx_set_ba_receiver_session (struct wl1271 *wl,u8 tid_index, -u16 ssn,bool enable,u8 peer_hlid); +u16 ssn,bool enable,u8 peer_hlid, +u8 win_size);int wl12xx_acx_tsf_info (struct wl1271 *wl,struct wl12xx_vif *wlvif,u64 *mactime); int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
drivers/net/wireless/ti/wlcore/main.c +4 -2
@@ -5328,7 +5328,9 @@ static int wl1271_op_ampdu_action(struct } ret =wl12xx_acx_set_ba_receiver_session (wl, tid, *ssn, true, - hlid); + hlid, + params->buf_size); +if (!ret) { *ba_bitmap |=BIT (tid); wl->ba_rx_session_count++;
@@ -5349,7 +5351,7 @@ static int wl1271_op_ampdu_action(struct } ret =wl12xx_acx_set_ba_receiver_session (wl, tid,0 , false, - hlid); + hlid,0 );if (!ret) { *ba_bitmap &= ~BIT (tid); wl->ba_rx_session_count--;
Greg Kroah-Hartman
maintainerPATCH 55/56 wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Altshul <[email protected]>
commit e7ee74b56f23ba447d3124f2eccc32033cca501d upstream.
This event is used by the Firmware to limit the RX BA win size for a specific link.
The event handler updates the new size in the mac's sta->sta struct.
BA sessions opened for that link will use the new restricted win_size. This limitation remains until a new update is received or until the link is closed.
--- drivers/net/wireless/ti/wl18xx/event.c | 28 ++++++++++++++++++++++++++++ drivers/net/wireless/ti/wl18xx/event.h | 1 + drivers/net/wireless/ti/wl18xx/main.c | 3 ++- 3 files changed, 31 insertions(+), 1 deletion(-)
drivers/net/wireless/ti/wl18xx/event.c +28 -0
@@ -206,5 +206,33 @@ int wl18xx_process_mailbox_events(struct mbox->sc_pwd_len, mbox->sc_pwd); +if (vector &RX_BA_WIN_SIZE_CHANGE_EVENT_ID ) { +struct wl12xx_vif *wlvif; +struct ieee80211_vif *vif; +struct ieee80211_sta *sta; +u8 link_id = mbox->rx_ba_link_id; +u8 win_size = mbox->rx_ba_win_size; +const u8 *addr; + + wlvif = wl->links[link_id].wlvif; + vif =wl12xx_wlvif_to_vif (wlvif); + +/* Update RX aggregation window size and call +* MAC routine to stop active RX aggregations for this link +*/ +if (wlvif->bss_type !=BSS_TYPE_AP_BSS ) + addr = vif->bss_conf.bssid; +else + addr = wl->links[link_id].addr; + + sta =ieee80211_find_sta (vif, addr); +if (sta) { + sta->max_rx_aggregation_subframes = win_size; +ieee80211_stop_rx_ba_session (vif, + wl->links[link_id].ba_bitmap, + addr); + } + } +return 0 ; }
drivers/net/wireless/ti/wl18xx/event.h +1 -0
@@ -38,6 +38,7 @@ enum {REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID =BIT (18 ),DFS_CHANNELS_CONFIG_COMPLETE_EVENT =BIT (19 ),PERIODIC_SCAN_REPORT_EVENT_ID =BIT (20 ), +RX_BA_WIN_SIZE_CHANGE_EVENT_ID =BIT (21 ),SMART_CONFIG_SYNC_EVENT_ID =BIT (22 ),SMART_CONFIG_DECODE_EVENT_ID =BIT (23 ), TIME_SYNC_EVENT_ID = BIT(24),
drivers/net/wireless/ti/wl18xx/main.c +2 -1
@@ -1029,7 +1029,8 @@ static int wl18xx_boot(struct wl1271 *wlDFS_CHANNELS_CONFIG_COMPLETE_EVENT |SMART_CONFIG_SYNC_EVENT_ID |SMART_CONFIG_DECODE_EVENT_ID | -TIME_SYNC_EVENT_ID ; +TIME_SYNC_EVENT_ID | +RX_BA_WIN_SIZE_CHANGE_EVENT_ID ; wl->ap_event_mask =MAX_TX_FAILURE_EVENT_ID ;
Greg Kroah-Hartman
maintainerPATCH 10/56 staging: vt6656: use off stack for out buffer USB transfers.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 12ecd24ef93277e4e5feaf27b0b18f2d3828bc5e upstream.
Since 4.9 mandated USB buffers be heap allocated this causes the driver to fail.
Since there is a wide range of buffer sizes use kmemdup to create allocated buffer.
--- drivers/staging/vt6656/usbpipe.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/staging/vt6656/usbpipe.c +12 -2
@@ -50,15 +50,25 @@ int vnt_control_out(struct vnt_private * u16 index, u16 length, u8 *buffer) { int status = 0; +u8 *usb_buffer;if (test_bit (DEVICE_FLAGS_DISCONNECTED , &priv->flags))return STATUS_FAILURE ;mutex_lock (&priv->usb_lock); + usb_buffer =kmemdup (buffer, length,GFP_KERNEL ); +if (!usb_buffer) { +mutex_unlock (&priv->usb_lock); +return -ENOMEM ; + } + status =usb_control_msg (priv->usb, -usb_sndctrlpipe (priv->usb,0 ), request,0x40 , value, - index, buffer, length,USB_CTL_WAIT ); +usb_sndctrlpipe (priv->usb,0 ), + request,0x40 , value, + index, usb_buffer, length,USB_CTL_WAIT ); + +kfree (usb_buffer);mutex_unlock (&priv->usb_lock);
Greg Kroah-Hartman
maintainerPATCH 12/56 staging: comedi: jr3_pci: fix possible null pointer dereference
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 45292be0b3db0b7f8286683b376e2d9f949d11f9 upstream.
For some reason, the driver does not consider allocation of the subdevice private data to be a fatal error when attaching the COMEDI device. It tests the subdevice private data pointer for validity at certain points, but omits some crucial tests. In particular, jr3_pci_auto_attach() calls jr3_pci_alloc_spriv() to allocate and initialize the subdevice private data, but the same function subsequently dereferences the pointer to access the next_time_min and next_time_max members without checking it first. The other missing test is in the timer expiry routine jr3_pci_poll_dev(), but it will crash before it gets that far.
Fix the bug by returning -ENOMEM from jr3_pci_auto_attach() as soon as one of the calls to jr3_pci_alloc_spriv() returns NULL. The COMEDI core will subsequently call jr3_pci_detach() to clean up.
--- drivers/staging/comedi/drivers/jr3_pci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/comedi/drivers/jr3_pci.c +6 -5
@@ -726,11 +726,12 @@ static int jr3_pci_auto_attach(struct co s->insn_read = jr3_pci_ai_insn_read; spriv =jr3_pci_alloc_spriv (dev, s); -if (spriv) { -/* Channel specific range and maxdata */ - s->range_table_list = spriv->range_table_list; - s->maxdata_list = spriv->maxdata_list; - } +if (!spriv) +return -ENOMEM ; + +/* Channel specific range and maxdata */ + s->range_table_list = spriv->range_table_list; + s->maxdata_list = spriv->maxdata_list; }/* Reset DSP card */
Greg Kroah-Hartman
maintainerPATCH 20/56 selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
commit 65973dd3fd31151823f4b8c289eebbb3fb7e6bc0 upstream.
i386 glibc is buggy and calls the sigaction syscall incorrectly.
This is asymptomatic for normal programs, but it blows up on programs that do evil things with segmentation. The ldt_gdt self-test is an example of such an evil program.
This doesn't appear to be a regression -- I think I just got lucky with the uninitialized memory that glibc threw at the kernel when I wrote the test.
This hackish fix manually issues sigaction(2) syscalls to undo the damage. Without the fix, ldt_gdt_32 segfaults; with the fix, it passes for me.
See: https://sourceware.org/bugzilla/show_bug.cgi?id=21269
--- tools/testing/selftests/x86/ldt_gdt.c | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
tools/testing/selftests/x86/ldt_gdt.c +46 -0
@@ -394,6 +394,51 @@ static void *threadproc(void *ctx) } } +#ifdef __i386__ + +#ifndef SA_RESTORE +#define SA_RESTORER 0x04000000 +#endif + +/* +* The UAPI header calls this 'struct sigaction', which conflicts with +* glibc. Sigh. +*/ +struct fake_ksigaction { +void *handler;/* the real type is nasty */ +unsigned long sa_flags; +void (*sa_restorer)(void ); +unsigned char sigset[8 ]; +}; + +static void fix_sa_restorer (int sig) +{ +struct fake_ksigaction ksa; + +if (syscall (SYS_rt_sigaction, sig,NULL , &ksa,8 ) ==0 ) { +/* +* glibc has a nasty bug: it sometimes writes garbage to +* sa_restorer. This interacts quite badly with anything +* that fiddles with SS because it can trigger legacy +* stack switching. Patch it up. See: +* +* https://sourceware.org/bugzilla/show_bug.cgi?id=21269 +*/ +if (!(ksa.sa_flags &SA_RESTORER ) && ksa.sa_restorer) { + ksa.sa_restorer =NULL ; +if (syscall (SYS_rt_sigaction, sig, &ksa,NULL , +sizeof (ksa.sigset)) !=0 ) +err (1 ,"rt_sigaction" ); + } + } +} +#else +static void fix_sa_restorer (int sig) +{ +/* 64-bit glibc works fine. */ +} +#endif +static void sethandler (int sig,void (*handler)(int ,siginfo_t *,void *),int flags) {
@@ -405,6 +450,7 @@ static void sethandler(int sig, void (*hif (sigaction (sig, &sa,0 ))err (1 ,"sigaction" ); +fix_sa_restorer (sig); }static jmp_buf jmpbuf;
Greg Kroah-Hartman
maintainerPATCH 2/56 target: Fix compare_and_write_callback handling for non GOOD status
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit a71a5dc7f833943998e97ca8fa6a4c708a0ed1a9 upstream.
Following the bugfix for handling non SAM_STAT_GOOD COMPARE_AND_WRITE status during COMMIT phase in commit 9b2792c3da1, the same bug exists for the READ phase as well.
This would manifest first as a lost SCSI response, and eventual hung task during fabric driver logout or re-login, as existing shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref to reach zero.
To address this bug, compare_and_write_callback() has been changed to set post_ret = 1 and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE as necessary to signal failure status.
--- drivers/target/target_core_sbc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/target/target_core_sbc.c +4 -1
@@ -498,8 +498,11 @@ static sense_reason_t compare_and_write_* been failed with a non-zero SCSI status. */ if (cmd->scsi_status) { -pr_err ("compare_and_write_callback: non zero scsi_status:" +pr_debug ("compare_and_write_callback: non zero scsi_status:" " 0x%02x\n" , cmd->scsi_status); + *post_ret =1 ; +if (cmd->scsi_status ==SAM_STAT_CHECK_CONDITION ) + ret =TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 21/56 x86, pmem: Fix cache flushing for iovec write < 8 bytes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 8376efd31d3d7c44bd05be337adde023cc531fa1 upstream.
Commit 11e63f6d920d added cache flushing for unaligned writes from an iovec, covering the first and last cache line of a >= 8 byte write and the first cache line of a < 8 byte write. But an unaligned write of 2-7 bytes can still cover two cache lines, so make sure we flush both in that case.
--- arch/x86/include/asm/pmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/pmem.h +1 -1
@@ -122,7 +122,7 @@ static inline size_t arch_copy_from_iterif (bytes <8 ) {if (!IS_ALIGNED (dest,4 ) || (bytes !=4 )) -__arch_wb_cache_pmem (addr,1 ); +__arch_wb_cache_pmem (addr, bytes); }else {if (!IS_ALIGNED (dest,8 )) { dest =ALIGN (dest, boot_cpu_data.x86_clflush_size);
Greg Kroah-Hartman
maintainerPATCH 27/56 dm era: save spacemap metadata root after the pre-commit
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Somasundaram Krishnasamy <[email protected]>
commit 117aceb030307dcd431fdcff87ce988d3016c34a upstream.
When committing era metadata to disk, it doesn't always save the latest spacemap metadata root in superblock. Due to this, metadata is getting corrupted sometimes when reopening the device. The correct order of update should be, pre-commit (shadows spacemap root), save the spacemap root (newly shadowed block) to in-core superblock and then the final commit.
--- drivers/md/dm-era-target.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-era-target.c +4 -4
@@ -961,15 +961,15 @@ static int metadata_commit(struct era_me } } - r =save_sm_root (md); + r =dm_tm_pre_commit (md->tm);if (r) { -DMERR ("%s: save_sm_root failed" , __func__); +DMERR ("%s: pre commit failed" , __func__);return r; } - r =dm_tm_pre_commit (md->tm); + r =save_sm_root (md);if (r) { -DMERR ("%s: pre commit failed" , __func__); +DMERR ("%s: save_sm_root failed" , __func__);return r; }
Greg Kroah-Hartman
maintainerPATCH 5/56 iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 197b806ae5db60c6f609d74da04ddb62ea5e1b00 upstream.
While testing modification of per se_node_acl queue_depth forcing session reinstatement via lio_target_nacl_cmdsn_depth_store() -> core_tpg_set_initiator_node_queue_depth(), a hung task bug triggered when changing cmdsn_depth invoked session reinstatement while an iscsi login was already waiting for session reinstatement to complete.
This can happen when an outstanding se_cmd descriptor is taking a long time to complete, and session reinstatement from iscsi login or cmdsn_depth change occurs concurrently.
To address this bug, explicitly set session_fall_back_to_erl0 = 1 when forcing session reinstatement, so session reinstatement is not attempted if an active session is already being shutdown.
This patch has been tested with two scenarios. The first when iscsi login is blocked waiting for iscsi session reinstatement to complete followed by queue_depth change via configfs, and second when queue_depth change via configfs us blocked followed by a iscsi login driven session reinstatement.
Note this patch depends on commit d36ad77f702 to handle multiple sessions per se_node_acl when changing cmdsn_depth, and for pre v4.5 kernels will need to be included for stable as well.
--- drivers/target/iscsi/iscsi_target.c | 1 + drivers/target/iscsi/iscsi_target_configfs.c | 1 + drivers/target/iscsi/iscsi_target_login.c | 1 + 3 files changed, 3 insertions(+)
drivers/target/iscsi/iscsi_target.c +1 -0
@@ -4821,6 +4821,7 @@ int iscsit_release_sessions_for_tpg(strucontinue ; }atomic_set (&sess->session_reinstatement,1 ); +atomic_set (&sess->session_fall_back_to_erl0,1 );spin_unlock (&sess->conn_lock);list_move_tail (&se_sess->sess_list, &free_list);
drivers/target/iscsi/iscsi_target_configfs.c +1 -0
@@ -1608,6 +1608,7 @@ static int lio_tpg_shutdown_session(strureturn 0 ; }atomic_set (&sess->session_reinstatement,1 ); +atomic_set (&sess->session_fall_back_to_erl0,1 );spin_unlock (&sess->conn_lock);iscsit_stop_time2retain_timer (sess);
drivers/target/iscsi/iscsi_target_login.c +1 -0
@@ -195,6 +195,7 @@ int iscsi_check_for_session_reinstatemen initiatorname_param->value) && (sess_p->sess_ops->SessionType == sessiontype))) {atomic_set (&sess_p->session_reinstatement,1 ); +atomic_set (&sess_p->session_fall_back_to_erl0,1 );spin_unlock (&sess_p->conn_lock);iscsit_inc_session_usage_count (sess_p);iscsit_stop_time2retain_timer (sess_p);
Greg Kroah-Hartman
maintainerPATCH 7/56 USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
commit 31c5d1922b90ddc1da6a6ddecef7cd31f17aa32b upstream.
This development kit has an FT4232 on it with a custom USB VID/PID. The FT4232 provides four UARTs, but only two are used. The UART 0 is used by the FlashPro5 programmer and UART 2 is connected to the SmartFusion2 CortexM3 SoC UART port.
Note that the USB VID is registered to Actel according to Linux USB VID database, but that was acquired by Microsemi.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -873,6 +873,7 @@ static const struct usb_device_id id_tab {USB_DEVICE_AND_INTERFACE_INFO (MICROCHIP_VID ,MICROCHIP_USB_BOARD_PID ,USB_CLASS_VENDOR_SPEC , USB_SUBCLASS_VENDOR_SPEC, 0x00) }, + { USB_DEVICE_INTERFACE_NUMBER(ACTEL_VID, MICROSEMI_ARROW_SF2PLUS_BOARD_PID, 2) }, { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -873,6 +873,12 @@#define FIC_VID 0x1457#define FIC_NEO1973_DEBUG_PID 0x5118 +/* +* Actel / Microsemi +*/ +#define ACTEL_VID 0x1514 +#define MICROSEMI_ARROW_SF2PLUS_BOARD_PID 0x2008 +/* Olimex */ #define OLIMEX_VID 0x15BA#define OLIMEX_ARM_USB_OCD_PID 0x0003
Greg Kroah-Hartman
maintainerPATCH 6/56 usb: host: xhci: print correct command ring address
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chen <[email protected]>
commit 6fc091fb0459ade939a795bfdcaf645385b951d4 upstream.
Print correct command ring address using 'val_64'.
--- drivers/usb/host/xhci-mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-mem.c +1 -1
@@ -2493,7 +2493,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, (xhci->cmd_ring->first_seg->dma & (u64 ) ~CMD_RING_RSVD_BITS ) | xhci->cmd_ring->cycle_state;xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"// Setting command ring address to 0x%x" , val); +"// Setting command ring address to 0x%016llx" , val_64);xhci_write_64 (xhci, val_64, &xhci->op_regs->cmd_ring);xhci_dbg_cmd_ptrs (xhci);
Greg Kroah-Hartman
maintainerPATCH 29/56 IB/core: Fix sysfs registration error flow
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit b312be3d87e4c80872cbea869e569175c5eb0f9a upstream.
The kernel commit cited below restructured ib device management so that the device kobject is initialized in ib_alloc_device.
As part of the restructuring, the kobject is now initialized in procedure ib_alloc_device, and is later added to the device hierarchy in the ib_register_device call stack, in procedure ib_device_register_sysfs (which calls device_add).
However, in the ib_device_register_sysfs error flow, if an error occurs following the call to device_add, the cleanup procedure device_unregister is called. This call results in the device object being deleted -- which results in various use-after-free crashes.
The correct cleanup call is device_del -- which undoes device_add without deleting the device object.
The device object will then (correctly) be deleted in the ib_register_device caller's error cleanup flow, when the caller invokes ib_dealloc_device.
--- drivers/infiniband/core/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/sysfs.c +1 -1
@@ -863,7 +863,7 @@ err_put:free_port_list_attributes (device); err_unregister: -device_unregister (class_dev); +device_del (class_dev); err:return ret;
Greg Kroah-Hartman
maintainerPATCH 9/56 staging: vt6656: use off stack for in buffer USB transfers.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 05c0cf88bec588a7cb34de569acd871ceef26760 upstream.
Since 4.9 mandated USB buffers to be heap allocated. This causes the driver to fail.
Create buffer for USB transfers.
--- drivers/staging/vt6656/usbpipe.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/staging/vt6656/usbpipe.c +15 -2
@@ -78,15 +78,28 @@ int vnt_control_in(struct vnt_private *p u16 index, u16 length, u8 *buffer) { int status; +u8 *usb_buffer;if (test_bit (DEVICE_FLAGS_DISCONNECTED , &priv->flags))return STATUS_FAILURE ;mutex_lock (&priv->usb_lock); + usb_buffer =kmalloc (length,GFP_KERNEL ); +if (!usb_buffer) { +mutex_unlock (&priv->usb_lock); +return -ENOMEM ; + } + status =usb_control_msg (priv->usb, -usb_rcvctrlpipe (priv->usb,0 ), request,0xc0 , value, - index, buffer, length,USB_CTL_WAIT ); +usb_rcvctrlpipe (priv->usb,0 ), + request,0xc0 , value, + index, usb_buffer, length,USB_CTL_WAIT ); + +if (status == length) +memcpy (buffer, usb_buffer, length); + +kfree (usb_buffer);mutex_unlock (&priv->usb_lock);
Greg Kroah-Hartman
maintainerPATCH 46/56 serial: omap: suspend device on probe errors
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 77e6fe7fd2b7cba0bf2f2dc8cde51d7b9a35bf74 upstream.
Make sure to actually suspend the device before returning after a failed (or deferred) probe.
Note that autosuspend must be disabled before runtime pm is disabled in order to balance the usage count due to a negative autosuspend delay as well as to make the final put suspend the device synchronously.
--- drivers/tty/serial/omap-serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/omap-serial.c +2 -1
@@ -1712,7 +1712,8 @@ static int serial_omap_probe(struct platreturn 0 ; err_add_port: -pm_runtime_put (&pdev->dev); +pm_runtime_dont_use_autosuspend (&pdev->dev); +pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);pm_qos_remove_request (&up->pm_qos_request);device_init_wakeup (up->dev, false);
Greg Kroah-Hartman
maintainerPATCH 44/56 serial: samsung: Use right device for DMA-mapping calls
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 768d64f491a530062ddad50e016fb27125f8bd7c upstream.
Driver should provide its own struct device for all DMA-mapping calls instead of extracting device pointer from DMA engine channel. Although this is harmless from the driver operation perspective on ARM architecture, it is always good to use the DMA mapping API in a proper way. This patch fixes following DMA API debug warning:
WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:1241 check_sync+0x520/0x9f4 samsung-uart 12c20000.serial: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000006df0f580] [size=64 bytes] Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc1-00137-g07ca963 #51 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c011aaa4>] (unwind_backtrace) from [<c01127c0>] (show_stack+0x20/0x24) [<c01127c0>] (show_stack) from [<c06ba5d8>] (dump_stack+0x84/0xa0) [<c06ba5d8>] (dump_stack) from [<c0139528>] (__warn+0x14c/0x180) [<c0139528>] (__warn) from [<c01395a4>] (warn_slowpath_fmt+0x48/0x50) [<c01395a4>] (warn_slowpath_fmt) from [<c0729058>] (check_sync+0x520/0x9f4) [<c0729058>] (check_sync) from [<c072967c>] (debug_dma_sync_single_for_device+0x88/0xc8) [<c072967c>] (debug_dma_sync_single_for_device) from [<c0803c10>] (s3c24xx_serial_start_tx_dma+0x100/0x2f8) [<c0803c10>] (s3c24xx_serial_start_tx_dma) from [<c0804338>] (s3c24xx_serial_tx_chars+0x198/0x33c)
--- drivers/tty/serial/samsung.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/tty/serial/samsung.c +4 -5
@@ -900,14 +900,13 @@ static int s3c24xx_serial_request_dma(streturn -ENOMEM ; } - dma->rx_addr =dma_map_single (dma->rx_chan->device->dev, dma->rx_buf, + dma->rx_addr =dma_map_single (p->port.dev, dma->rx_buf, dma->rx_size,DMA_FROM_DEVICE );spin_lock_irqsave (&p->port.lock, flags);/* TX buffer */ - dma->tx_addr =dma_map_single (dma->tx_chan->device->dev, - p->port.state->xmit.buf, + dma->tx_addr =dma_map_single (p->port.dev, p->port.state->xmit.buf,UART_XMIT_SIZE ,DMA_TO_DEVICE );spin_unlock_irqrestore (&p->port.lock, flags);
@@ -921,7 +920,7 @@ static void s3c24xx_serial_release_dma(sif (dma->rx_chan) {dmaengine_terminate_all (dma->rx_chan); -dma_unmap_single (dma->rx_chan->device->dev, dma->rx_addr, +dma_unmap_single (p->port.dev, dma->rx_addr, dma->rx_size,DMA_FROM_DEVICE );kfree (dma->rx_buf);dma_release_channel (dma->rx_chan);
@@ -930,7 +929,7 @@ static void s3c24xx_serial_release_dma(sif (dma->tx_chan) {dmaengine_terminate_all (dma->tx_chan); -dma_unmap_single (dma->tx_chan->device->dev, dma->tx_addr, +dma_unmap_single (p->port.dev, dma->tx_addr,UART_XMIT_SIZE ,DMA_TO_DEVICE );dma_release_channel (dma->tx_chan); dma->tx_chan =NULL ;
Greg Kroah-Hartman
maintainerPATCH 47/56 tty: pty: Fix ldisc flush after userspace become aware of the data already
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang YanQing <[email protected]>
commit 77dae6134440420bac334581a3ccee94cee1c054 upstream.
While using emacs, cat or others' commands in konsole with recent kernels, I have met many times that CTRL-C freeze konsole. After konsole freeze I can't type anything, then I have to open a new one, it is very annoying.
See bug report:
https://bugs.kde.org/show_bug.cgi?id=175283
The platform in that bug report is Solaris, but now the pty in linux has the same problem or the same behavior as Solaris :)
It has high possibility to trigger the problem follow steps below:
Note: In my test, BigFile is a text file whose size is bigger than 1G 1:open konsole
1:cat BigFile
2:CTRL-C
After some digging, I find out the reason is that commit 1d1d14da12e7 ("pty: Fix buffer flush deadlock") changes the behavior of pty_flush_buffer.
Thread A Thread B
-------- --------
1:n_tty_poll return POLLIN
2:CTRL-C trigger pty_flush_buffer
tty_buffer_flush
n_tty_flush_buffer
3:attempt to check count of chars:
ioctl(fd, TIOCINQ, &available)
available is equal to 0
4:read(fd, buffer, avaiable)
return 0
5:konsole close fd
Yes, I know we could use the same patch included in the BUG report as a workaround for linux platform too. But I think the data in ldisc is belong to application of another side, we shouldn't clear it when we want to flush write buffer of this side in pty_flush_buffer. So I think it is better to disable ldisc flush in pty_flush_buffer, because its new hehavior bring no benefit except that it mess up the behavior between POLLIN, and TIOCINQ or FIONREAD.
Also I find no flush_buffer function in others' tty driver has the same behavior as current pty_flush_buffer.
--- drivers/tty/pty.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/tty/pty.c +1 -6
@@ -216,16 +216,11 @@ static int pty_signal(struct tty_structstatic void pty_flush_buffer (struct tty_struct *tty) {struct tty_struct *to = tty->link; -struct tty_ldisc *ld;if (!to)return ; - ld =tty_ldisc_ref (to); -tty_buffer_flush (to, ld); -if (ld) -tty_ldisc_deref (ld); - +tty_buffer_flush (to,NULL );if (to->packet) {spin_lock_irq (&tty->ctrl_lock); tty->ctrl_status |=TIOCPKT_FLUSHWRITE ;
Greg Kroah-Hartman
maintainerPATCH 49/56 Bluetooth: hci_bcm: add missing tty-device sanity check
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 95065a61e9bf25fb85295127fba893200c2bbbd8 upstream.
Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.
--- drivers/bluetooth/hci_bcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_bcm.c +4 -1
@@ -287,6 +287,9 @@ static int bcm_open(struct hci_uart *hu) hu->priv = bcm; +if (!hu->tty->dev) + goto out; +mutex_lock (&bcm_device_lock);list_for_each (p, &bcm_device_list) { struct bcm_device *dev = list_entry(p, struct bcm_device, list);
@@ -307,7 +310,7 @@ static int bcm_open(struct hci_uart *hu) }mutex_unlock (&bcm_device_lock); - +out:return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 51/56 mac80211: pass RX aggregation window size to driver
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sara Sharon <[email protected]>
commit fad471860c097844432c7cf5d3ae6a0a059c2bdc upstream.
Currently mac80211 does not inform the driver of the window size when starting an RX aggregation session.
To enable managing the reorder buffer in the driver or hardware the window size is needed.
--- include/net/mac80211.h | 8 +++++--- net/mac80211/agg-rx.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
include/net/mac80211.h +5 -3
@@ -3020,9 +3020,11 @@ enum ieee80211_reconfig_type {* ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) * is the first frame we expect to perform the action on. Notice * that TX/RX_STOP can pass NULL for this parameter. -* The @buf_size parameter is only valid when the action is set to -* %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder -* buffer size (number of subframes) for this session -- the driver +* The @buf_size parameter is valid only when the action is set to +* %IEEE80211_AMPDU_RX_START or %IEEE80211_AMPDU_TX_OPERATIONAL and +* indicates the reorder buffer size (number of subframes) for this +* session. +* When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver * may neither send aggregates containing more subframes than this * nor send aggregates in a way that lost frames would exceed the * buffer size. If just limiting the aggregate size, this would be
net/mac80211/agg-rx.c +1 -1
@@ -323,7 +323,7 @@ void __ieee80211_start_rx_ba_session(str__skb_queue_head_init (&tid_agg_rx->reorder_buf[i]); ret =drv_ampdu_action (local, sta->sdata,IEEE80211_AMPDU_RX_START , - &sta->sta, tid, &start_seq_num,0 , false); + &sta->sta, tid, &start_seq_num, buf_size, false);ht_dbg (sta->sdata,"Rx A-MPDU request on %pM tid %d result %d\n" , sta->sta.addr, tid, ret);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 50/56 Bluetooth: hci_intel: add missing tty-device sanity check
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit dcb9cfaa5ea9aa0ec08aeb92582ccfe3e4c719a9 upstream.
Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.
--- drivers/bluetooth/hci_intel.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_intel.c +12 -1
@@ -307,6 +307,9 @@ static int intel_set_power(struct hci_uastruct list_head *p;int err = -ENODEV ; +if (!hu->tty->dev) +return err; +mutex_lock (&intel_device_list_lock);list_for_each (p, &intel_device_list) {
@@ -379,6 +382,9 @@ static void intel_busy_work(struct work_ struct intel_data *intel = container_of(work, struct intel_data, busy_work); +if (!intel->hu->tty->dev) +return ; +/* Link is busy, delay the suspend */ mutex_lock (&intel_device_list_lock);list_for_each (p, &intel_device_list) {
@@ -913,6 +919,8 @@ done:list_for_each (p, &intel_device_list) { struct intel_device *dev = list_entry(p, struct intel_device, list); +if (!hu->tty->dev) +break ;if (hu->tty->dev->parent == dev->pdev->dev.parent) {if (device_may_wakeup (&dev->pdev->dev)) idev = dev;
@@ -1094,6 +1102,9 @@ static int intel_enqueue(struct hci_uartBT_DBG ("hu %p skb %p" , hu, skb); +if (!hu->tty->dev) + goto out_enqueue; +/* Be sure our controller is resumed and potential LPM transaction * completed before enqueuing any packet. */
@@ -1110,7 +1121,7 @@ static int intel_enqueue(struct hci_uart } }mutex_unlock (&intel_device_list_lock); - +out_enqueue:skb_queue_tail (&intel->txq, skb);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 56/56 ipmi: Fix kernel panic at ipmi_ssif_thread()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joeseph Chang <[email protected]>
commit 6de65fcfdb51835789b245203d1bfc8d14cb1e06 upstream.
msg_written_handler() may set ssif_info->multi_data to NULL when using ipmitool to write fru.
Before setting ssif_info->multi_data to NULL, add new local pointer "data_to_send" and store correct i2c data pointer to it to fix NULL pointer kernel panic and incorrect ssif_info->multi_pos.
--- drivers/char/ipmi/ipmi_ssif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_ssif.c +3 -1
@@ -888,6 +888,7 @@ static void msg_written_handler(struct s* for details on the intricacies of this. */ int left; +unsigned char *data_to_send;ssif_inc_stat (ssif_info, sent_messages_parts);
@@ -896,6 +897,7 @@ static void msg_written_handler(struct s left =32 ;/* Length byte. */ ssif_info->multi_data[ssif_info->multi_pos] = left; + data_to_send = ssif_info->multi_data + ssif_info->multi_pos; ssif_info->multi_pos += left;if (left <32 )/*
@@ -909,7 +911,7 @@ static void msg_written_handler(struct s rv =ssif_i2c_send (ssif_info, msg_written_handler,I2C_SMBUS_WRITE ,SSIF_IPMI_MULTI_PART_REQUEST_MIDDLE , - ssif_info->multi_data + ssif_info->multi_pos, + data_to_send,I2C_SMBUS_BLOCK_DATA );if (rv <0 ) {/* request failed, just return the error. */
Greg Kroah-Hartman
maintainerPATCH 31/56 IB/mlx4: Fix ib device initialization error flow
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit 99e68909d5aba1861897fe7afc3306c3c81b6de0 upstream.
In mlx4_ib_add, procedure mlx4_ib_alloc_eqs is called to allocate EQs.
However, in the mlx4_ib_add error flow, procedure mlx4_ib_free_eqs is not called to free the allocated EQs.
--- drivers/infiniband/hw/mlx4/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx4/main.c +1 -0
@@ -2491,6 +2491,7 @@ err_counter:mlx4_ib_delete_counters_table (ibdev, &ibdev->counters_table[i]); err_map: +mlx4_ib_free_eqs (dev, ibdev);iounmap (ibdev->uar_map); err_uar:
Greg Kroah-Hartman
maintainerPATCH 32/56 IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit fb7a91746af18b2ebf596778b38a709cdbc488d3 upstream.
A warning message during SRIOV multicast cleanup should have actually been a debug level message. The condition generating the warning does no harm and can fill the message log.
In some cases, during testing, some tests were so intense as to swamp the message log with these warning messages, causing a stall in the console message log output task. This stall caused an NMI to be sent to all CPUs (so that they all dumped their stacks into the message log). Aside from the message flood causing an NMI, the tests all passed.
Once the message flood which caused the NMI is removed (by reducing the warning message to debug level), the NMI no longer occurs.
Sample message log (console log) output illustrating the flood and resultant NMI (snippets with comments and modified with ... instead of hex digits, to satisfy checkpatch.pl):
<mlx4_ib> _mlx4_ib_mcg_port_cleanup: ... WARNING: group refcount 1!!!... *** About 4000 almost identical lines in less than one second *** <mlx4_ib> _mlx4_ib_mcg_port_cleanup: ... WARNING: group refcount 1!!!...
INFO: rcu_sched detected stalls on CPUs/tasks: { 17} (...)
*** { 17} above indicates that CPU 17 was the one that stalled ***
sending NMI to all CPUs:
...
NMI backtrace for cpu 17
CPU: 17 PID: 45909 Comm: kworker/17:2
Hardware name: HP ProLiant DL360p Gen8, BIOS P71 09/08/2013
Workqueue: events fb_flashcursor
task: ffff880478...... ti: ffff88064e...... task.ti: ffff88064e......
RIP: 0010:[ffffffff81......] [ffffffff81......] io_serial_in+0x15/0x20
RSP: 0018:ffff88064e257cb0 EFLAGS: 00000002
RAX: 0000000000...... RBX: ffffffff81...... RCX: 0000000000......
RDX: 0000000000...... RSI: 0000000000...... RDI: ffffffff81......
RBP: ffff88064e...... R08: ffffffff81...... R09: 0000000000......
R10: 0000000000...... R11: ffff88064e...... R12: 0000000000......
R13: 0000000000...... R14: ffffffff81...... R15: 0000000000......
FS: 0000000000......(0000) GS:ffff8804af......(0000) knlGS:000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080......
CR2: 00007f2a2f...... CR3: 0000000001...... CR4: 0000000000......
DR0: 0000000000...... DR1: 0000000000...... DR2: 0000000000......
DR3: 0000000000...... DR6: 00000000ff...... DR7: 0000000000......
Stack:
ffff88064e...... ffffffff81...... ffffffff81...... 0000000000......
ffffffff81...... ffff88064e...... ffffffff81...... ffffffff81......
ffffffff81...... ffff88064e...... ffffffff81...... 0000000000......
Call Trace:
[<ffffffff813d099b>] wait_for_xmitr+0x3b/0xa0
[<ffffffff813d0b5c>] serial8250_console_putchar+0x1c/0x30
[<ffffffff813d0b40>] ? serial8250_console_write+0x140/0x140
[<ffffffff813cb5fa>] uart_console_write+0x3a/0x80
[<ffffffff813d0aae>] serial8250_console_write+0xae/0x140
[<ffffffff8107c4d1>] call_console_drivers.constprop.15+0x91/0xf0
[<ffffffff8107d6cf>] console_unlock+0x3bf/0x400
[<ffffffff813503cd>] fb_flashcursor+0x5d/0x140
[<ffffffff81355c30>] ? bit_clear+0x120/0x120
[<ffffffff8109d5fb>] process_one_work+0x17b/0x470
[<ffffffff8109e3cb>] worker_thread+0x11b/0x400
[<ffffffff8109e2b0>] ? rescuer_thread+0x400/0x400
[<ffffffff810a5aef>] kthread+0xcf/0xe0
[<ffffffff810a5a20>] ? kthread_create_on_node+0x140/0x140
[<ffffffff81645858>] ret_from_fork+0x58/0x90
[<ffffffff810a5a20>] ? kthread_create_on_node+0x140/0x140
Code: 48 89 e5 d3 e6 48 63 f6 48 03 77 10 8b 06 5d c3 66 0f 1f 44 00 00 66 66 66 6As indicated in the stack trace above, the console output task got swamped.
--- drivers/infiniband/hw/mlx4/mcg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx4/mcg.c +2 -1
@@ -1105,7 +1105,8 @@ static void _mlx4_ib_mcg_port_cleanup(stwhile ((p =rb_first (&ctx->mcg_table)) !=NULL ) { group = rb_entry(p, struct mcast_group, node);if (atomic_read (&group->refcount)) -mcg_warn_group (group,"group refcount %d!!! (pointer %p)\n" ,atomic_read (&group->refcount), group); +mcg_debug_group (group,"group refcount %d!!! (pointer %p)\n" , +atomic_read (&group->refcount), group);force_clean_group (group); }
Greg Kroah-Hartman
maintainerPATCH 33/56 ext4: evict inline data when writing to memory map
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 7b4cc9787fe35b3ee2dfb1c35e22eafc32e00c33 upstream.
Currently the case of writing via mmap to a file with inline data is not handled. This is maybe a rare case since it requires a writable memory map of a very small file, but it is trivial to trigger with on inline_data filesystem, and it causes the 'BUG_ON(ext4_test_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA));' in ext4_writepages() to be hit:
mkfs.ext4 -O inline_data /dev/vdb
mount /dev/vdb /mnt
xfs_io -f /mnt/file \
-c 'pwrite 0 1' \
-c 'mmap -w 0 1m' \
-c 'mwrite 0 1' \
-c 'fsync'
kernel BUG at fs/ext4/inode.c:2723!
invalid opcode: 0000 [#1] SMP
CPU: 1 PID: 2532 Comm: xfs_io Not tainted 4.11.0-rc1-xfstests-00301-g071d9acf3d1f #633
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-20170228_101828-anatol 04/01/2014
task: ffff88003d3a8040 task.stack: ffffc90000300000
RIP: 0010:ext4_writepages+0xc89/0xf8a
RSP: 0018:ffffc90000303ca0 EFLAGS: 00010283
RAX: 0000028410000000 RBX: ffff8800383fa3b0 RCX: ffffffff812afcdc
RDX: 00000a9d00000246 RSI: ffffffff81e660e0 RDI: 0000000000000246
RBP: ffffc90000303dc0 R08: 0000000000000002 R09: 869618e8f99b4fa5
R10: 00000000852287a2 R11: 00000000a03b49f4 R12: ffff88003808e698
R13: 0000000000000000 R14: 7fffffffffffffff R15: 7fffffffffffffff
FS: 00007fd3e53094c0(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd3e4c51000 CR3: 000000003d554000 CR4: 00000000003406e0
Call Trace:
? _raw_spin_unlock+0x27/0x2a
? kvm_clock_read+0x1e/0x20
do_writepages+0x23/0x2c
? do_writepages+0x23/0x2c
__filemap_fdatawrite_range+0x80/0x87
filemap_write_and_wait_range+0x67/0x8c
ext4_sync_file+0x20e/0x472
vfs_fsync_range+0x8e/0x9f
? syscall_trace_enter+0x25b/0x2d0
vfs_fsync+0x1c/0x1e
do_fsync+0x31/0x4a
SyS_fsync+0x10/0x14
do_syscall_64+0x69/0x131
entry_SYSCALL64_slow_path+0x25/0x25We could try to be smart and keep the inline data in this case, or at least support delayed allocation when allocating the block, but these solutions would be more complicated and don't seem worthwhile given how rare this case seems to be. So just fix the bug by calling ext4_convert_inline_data() when we're asked to make a page writable, so that any inline data gets evicted, with the block allocated immediately.
--- fs/ext4/inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/inode.c +5 -0
@@ -5393,6 +5393,11 @@ int ext4_page_mkwrite(struct vm_area_strfile_update_time (vma->vm_file);down_read (&EXT4_I (inode)->i_mmap_sem); + + ret =ext4_convert_inline_data (inode); +if (ret) + goto out_ret; +/* Delalloc case is easy... */ if (test_opt(inode->i_sb, DELALLOC) && !ext4_should_journal_data(inode) &&
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.69 release. There are 56 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 May 20 10:48:24 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.69-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.69 release. There are 56 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 May 20 10:48:24 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 115 pass: 115 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Re: [PATCH 4.4 49/56] Bluetooth: hci_bcm: add missing tty-device sanity check
In reply to Greg Kroah-HartmanQuoted 35 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit
95065a61e9bf25fb85295127fba893200c2bbbd8upstream.Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.
Fixes 0395ffc1ee05 ("Bluetooth: hci_bcm: Add PM for BCM devices")Cc Frederic Danis <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Marcel Holtmann <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/bluetooth/hci_bcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/bluetooth/hci_bcm.c +3
-0@@ -287,6 +287,9 @@ static int bcm_open(struct hci_uart *hu) hu->priv = bcm; +if (!hu->tty->dev) + goto out; +mutex_lock (&bcm_device_lock);list_for_each (p, &bcm_device_list) { struct bcm_device *dev = list_entry(p, struct bcm_device, list);
drivers/bluetooth/hci_bcm.c static int bcm_open(struct hci_uart *hu) · line 315
Quoted 7 lines
drivers/bluetooth/hci_bcm.c +1
-1@@ -307,7 +310,7 @@ static int bcm_open(struct hci_uart *hu) }mutex_unlock (&bcm_device_lock); - +out:return 0 ; }
I'm a bit sceptical that this is fixing a real bug, but if it is - surely bcm_open() should fail if the tty device is not the right type? bcm_setup() would certainly fail after this.
Ben.
Signature · 2 lines
Ben Hutchings Software Developer, Codethink Ltd.
Re: [PATCH 4.4 49/56] Bluetooth: hci_bcm: add missing tty-device sanity check
Quoted 38 lines · Ben Hutchings
Quoted 37 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit
95065a61e9bf25fb85295127fba893200c2bbbd8upstream.Make sure to check the tty-device pointer before looking up the sibling platform device to avoid dereferencing a NULL-pointer when the tty is one end of a Unix98 pty.
Fixes 0395ffc1ee05 ("Bluetooth: hci_bcm: Add PM for BCM devices")Cc Frederic Danis <[email protected]>Signed-off-by Johan Hovold <[email protected]>Signed-off-by Marcel Holtmann <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- drivers/bluetooth/hci_bcm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/bluetooth/hci_bcm.c +3
-0@@ -287,6 +287,9 @@ static int bcm_open(struct hci_uart *hu) hu->priv = bcm; +if (!hu->tty->dev) + goto out; +mutex_lock (&bcm_device_lock);list_for_each (p, &bcm_device_list) { struct bcm_device *dev = list_entry(p, struct bcm_device, list);@@ -307,7 +310,7 @@ static int bcm_open(struct hci_uart *hu) }
Quoted 7 lines
drivers/bluetooth/hci_bcm.c static int bcm_open(struct hci_uart *hu) · line 315
Quoted 5 lines
drivers/bluetooth/hci_bcm.c +1
-1mutex_unlock (&bcm_device_lock); - +out:return 0 ; }I'm a bit sceptical that this is fixing a real bug,
Please take a look at bcm_open() where the tty device is being dereferenced whenever there is bcm platform device registered:
list_for_each(p, &bcm_device_list) {
struct bcm_device *dev = list_entry(p, struct bcm_device, list);
...
if (hu->tty->dev->parent == dev->pdev->dev.parent) {This can be used by an unprivileged user to trigger a NULL-dereference:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 ... [<bf0d5d74>] (bcm_open [hci_uart]) from [<bf0d1284>] (hci_uart_tty_ioctl+0x1b0/0x3c8 [hci_uart]) [<bf0d1284>] (hci_uart_tty_ioctl [hci_uart]) from [<c0465bcc>] (tty_ioctl+0x5bc/0xbc8) [<c0465bcc>] (tty_ioctl) from [<c0258ad4>] (do_vfs_ioctl+0xac/0x9e8) [<c0258ad4>] (do_vfs_ioctl) from [<c0259454>] (SyS_ioctl+0x44/0x6c) [<c0259454>] (SyS_ioctl) from [<c01092e0>] (ret_fast_syscall+0x0/0x1c)
Quoted 3 lines
but if it is -
surelybcm_open()should fail if the tty device is not the right type?bcm_setup()would certainly fail after this.
The driver is written to be able to handle a non-existing platform device (e.g. see use of bcm_device_exists() in the commit introducing this issue), although since commit 6cc4396c8829 ("Bluetooth: hci_bcm:
Add wake-up capability") setup would indeed fail in this case (well at least when firmware *is* available...).
Perhaps that is a separate issue that should be fixed (by failing early in open as you suggest or by again allowing the driver to work without a platform device), but I believe this patch is correct nonetheless. And it does specifically fix the local DoS-attack.
Thanks,
Johan