3.0.44-stable review
Subsystems (84)
Greg Kroah-Hartman
maintainercover 3.0.44-stable review
This is the start of the stable review cycle for the 3.0.44 release. There are 127 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 Sun Sep 30 20:29:56 UTC 2012. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.44-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Alan Stern <[email protected]>
USB: Fix race condition when removing host controllers
Andi Kleen <[email protected]>
MCE: Fix vm86 handling for 32bit mce handler
Yasunori Goto <[email protected]>
sched: Fix ancient race in do_exit()
Herton Ronaldo Krzesinski <[email protected]>
spi/spi-fsl-spi: reference correct pdata in fsl_spi_cs_control
Kenth Eriksson <[email protected]>
spi/mpc83xx: fix NULL pdata dereference bug
Artem Bityutskiy <[email protected]>
UBI: fix a horrible memory deallocation bug
Chris Boot <[email protected]>
e1000e: Disable ASPM L1 on 82574
Al Cooper <[email protected]>
mmc: Prevent 1.8V switch for SD hosts that don't support UHS modes.
Subhash Jadavani <[email protected]>
mmc: sd: Handle SD3.0 cards not supporting UHS-I bus speed mode
Phillip Lougher <[email protected]>
Squashfs: fix mount time sanity check for corrupted superblock
Tomoya MORINAGA <[email protected]>
pch_uart: Fix parity setting issue
Tomoya MORINAGA <[email protected]>
pch_uart: Fix rx error interrupt setting issue
Alan Cox <[email protected]>
pch_uart: Fix missing break for 16 byte fifo
Douglas Bagnall <[email protected]>
media: Avoid sysfs oops when an rc_dev's raw device is absent
John Stultz <[email protected]>
time: Move ktime_t overflow checking into timespec_valid_strict
John Stultz <[email protected]>
time: Avoid making adjustments if we haven't accumulated anything
John Stultz <[email protected]>
time: Improve sanity checking of timekeeping inputs
Eric Dumazet <[email protected]>
drop_monitor: dont sleep in atomic context
Neil Horman <[email protected]>
drop_monitor: prevent init path from scheduling on the wrong cpu
Neil Horman <[email protected]>
drop_monitor: Make updating data->skb smp safe
Neil Horman <[email protected]>
drop_monitor: fix sleeping in invalid context warning
Jarod Wilson <[email protected]>
media: lirc_sir: make device registration work
Peter Zijlstra <[email protected]>
sched: Fix race in task_group()
Thomas Renninger <[email protected]>
cpufreq / ACPI: Fix not loading acpi-cpufreq driver regression
Daniel J Blueman <[email protected]>
libata: Prevent interface errors with Seagate FreeAgent GoFlex
Weiping Pan <[email protected]>
rds: set correct msg_namelen
Li Zhong <[email protected]>
Fix a dead loop in async_synchronize_full()
Rustad, Mark D <[email protected]>
net: Statically initialize init_net.dev_base_head
Henrik Rydberg <[email protected]>
Bluetooth: Add support for Apple vendor-specific devices
Gustavo Padovan <[email protected]>
Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices
Manoj Iyer <[email protected]>
Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0
Alan Cox <[email protected]>
x86: Fix boot on Twinhead H12Y
Lai Jiangshan <[email protected]>
workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic
NeilBrown <[email protected]>
md: make sure metadata is updated when spares are activated or removed.
Wang Xingchao <[email protected]>
drm/i915: HDMI - Clear Audio Enable bit for Hot Plug
AceLan Kao <[email protected]>
asus-nb-wmi: add some video toggle keys
Corentin Chary <[email protected]>
asus-laptop: HRWS/HWRS typo
Tvrtko Ursulin <[email protected]>
drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping
Dave Airlie <[email protected]>
fbcon: fix race condition between console lock and cursor timer (v1.1)
Robin Holt <[email protected]>
drivers/misc/sgi-xp/xpc_uv.c: SGI XPC fails to load when cpu 0 is out of IRQ resources
Rafael J. Wysocki <[email protected]>
PM / Runtime: Clear power.deferred_resume on success in rpm_suspend()
Rafael J. Wysocki <[email protected]>
PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set
Atsushi Nemoto <[email protected]>
drivers/rtc/rtc-rs5c348.c: fix hour decoding in 12-hour mode
Will Deacon <[email protected]>
mutex: Place lock in contended state after fastpath_lock failure
Sarah Sharp <[email protected]>
xhci: Fix bug after deq ptr set to link TRB.
Moiz Sonasath <[email protected]>
usb: host: xhci: fix compilation error for non-PCI based stacks
Manoj Iyer <[email protected]>
xhci: Recognize USB 3.0 devices as superspeed at powerup
Matthew Garrett <[email protected]>
xhci: Make handover code more robust
Dan Carpenter <[email protected]>
xhci: Fix a logical vs bitwise AND bug
Keng-Yu Lin <[email protected]>
Intel xhci: Only switch the switchable ports
Alan Stern <[email protected]>
USB: add device quirk for Joss Optical touchboard
Éric Piel <[email protected]>
USB: ftdi-sio: add support for more Physik Instrumente devices
Bjørn Mork <[email protected]>
USB: ftdi_sio: do not claim CDC ACM function
Horst Schirmeier <[email protected]>
USB: ftdi_sio: PID for NZR SEM 16+ USB
Pavankumar Kondeti <[email protected]>
EHCI: Update qTD next pointer in QH overlay region during unlink
Weston Andros Adamson <[email protected]>
NFS: return error from decode_getfh in decode open
Trond Myklebust <[email protected]>
NFS: Fix a problem with the legacy binary mount code
Trond Myklebust <[email protected]>
NFS: Fix the initialisation of the readdir 'cookieverf' array
Gertjan van Wingerde <[email protected]>
rt2x00: Fix rfkill polling prior to interface start.
Gertjan van Wingerde <[email protected]>
rt2x00: Fix word size of rt2500usb MAC_CSR19 register.
Nicolas Ferre <[email protected]>
dmaengine: at_hdmac: check that each sg data length is non-null
Nicolas Ferre <[email protected]>
dmaengine: at_hdmac: fix comment in atc_prep_slave_sg()
Luis R. Rodriguez <[email protected]>
cfg80211: fix possible circular lock on reg_regdb_search()
Ira W. Snyder <[email protected]>
can: janz-ican3: fix support for older hardware revisions
Marc Kleine-Budde <[email protected]>
can: ti_hecc: fix oops during rmmod
Søren Holm <[email protected]>
asix: Support DLink DUB-E100 H/W Ver C1
Anisse Astier <[email protected]>
Input: i8042 - disable mux on Toshiba C850D
Wen Congyang <[email protected]>
tracing: Don't call page_to_pfn() if page is NULL
Matthew Leach <[email protected]>
ARM: 7532/1: decompressor: reset SCTLR.TRE for VMSA ARMv7 cores
Tetsuyuki Kobayashi <[email protected]>
ARM: fix bad applied patch for arch/arm/Kconfig of stable 3.0.y tree.
Toshi Kani <[email protected]>
hpwdt: Fix kdump issue in hpwdt
Vinicius Costa Gomes <[email protected]>
Bluetooth: Fix not removing power_off delayed work
Stephen M. Cameron <[email protected]>
SCSI: hpsa: fix handling of protocol error
Eddie Wai <[email protected]>
SCSI: bnx2i: Fixed NULL ptr deference for 1G bnx2 Linux iSCSI offload
[email protected] <[email protected]>
SCSI: mpt2sas: Fix for issue - Unable to boot from the drive connected to HBA
Guenter Roeck <[email protected]>
hwmon: (ads7871) Add 'name' sysfs attribute
Andreas Herrmann <[email protected]>
hwmon: (fam15h_power) Tweak runavg_range on resume
Konrad Rzeszutek Wilk <[email protected]>
xen/boot: Disable NUMA for PV guests.
qiuxishi <[email protected]>
memory hotplug: fix section info double registration bug
Jianguo Wu <[email protected]>
mm/ia64: fix a memory block size bug
Benoît Locher <[email protected]>
can: mcp251x: avoid repeated frame bug
Guenter Roeck <[email protected]>
hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure elements
Kevin Hilman <[email protected]>
drivers/rtc/rtc-twl.c: ensure all interrupts are disabled during probe
Li Haifeng <[email protected]>
mm/page_alloc: fix the page address of higher page's buddy calculation
NeilBrown <[email protected]>
md: Don't truncate size at 4TB for RAID0 and Linear
Mel Gorman <[email protected]>
Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts
Bjørn Mork <[email protected]>
kobject: fix oops with "input0: bad kobj_uevent_env content in show_uevent()"
Alan Cox <[email protected]>
ahci: Add alternate identifier for the 88SE9172
Shawn Guo <[email protected]>
mmc: sdhci-esdhc: break out early if clock is 0
Lauri Hintsala <[email protected]>
mmc: mxs-mmc: fix deadlock in SDIO IRQ case
Al Viro <[email protected]>
perf_event: Switch to internal refcount, fix race with close()
Bjørn Mork <[email protected]>
USB: option: replace ZTE K5006-Z entry with vendor class rule
Ian Abbott <[email protected]>
staging: comedi: das08: Correct AO output for das08jr-16-ao
Eric Dumazet <[email protected]>
staging: r8712u: fix bug in r8712_recv_indicatepkt()
Malcolm Priestley <[email protected]>
staging: vt6656: [BUG] - Failed connection, incorrect endian.
Christopher Brannon <[email protected]>
Staging: speakup: fix an improperly-declared variable.
Matteo Frigo <[email protected]>
ALSA: ice1724: Use linear scale for AK4396 volume control.
Nicholas Bellinger <[email protected]>
target: Fix ->data_length re-assignment bug with SCSI overflow
Tyler Hicks <[email protected]>
eCryptfs: Copy up attributes of the lower target inode after rename
Amerigo Wang <[email protected]>
netconsole: remove a redundant netconsole_target_put()
Miklos Szeredi <[email protected]>
vfs: dcache: use DCACHE_DENTRY_KILLED instead of DCACHE_DISCONNECTED in d_kill()
Linus Torvalds <[email protected]>
vfs: make O_PATH file descriptors usable for 'fstat()'
Stephen M. Cameron <[email protected]>
cciss: fix handling of protocol error
Tejun Heo <[email protected]>
cpufreq/powernow-k8: workqueue user shouldn't migrate the kworker to another CPU
Tejun Heo <[email protected]>
workqueue: reimplement work_on_cpu() using system_wq
Francesco Ruggeri <[email protected]>
net: ipv4: ipmr_expire_timer causes crash when removing net namespace
[email protected] <[email protected]>
l2tp: avoid to use synchronize_rcu in tunnel free function
Pablo Neira Ayuso <[email protected]>
netlink: fix possible spoofing from non-root processes
Mathias Krause <[email protected]>
net: fix info leak in compat dev_ifconf()
Mathias Krause <[email protected]>
ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT)
Mathias Krause <[email protected]>
dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO)
Mathias Krause <[email protected]>
llc: fix info leak via getsockname()
Mathias Krause <[email protected]>
Bluetooth: L2CAP - Fix info leak via getsockname()
Mathias Krause <[email protected]>
Bluetooth: RFCOMM - Fix info leak via getsockname()
Mathias Krause <[email protected]>
Bluetooth: RFCOMM - Fix info leak in ioctl(RFCOMMGETDEVLIST)
Mathias Krause <[email protected]>
Bluetooth: HCI - Fix info leak via getsockname()
Mathias Krause <[email protected]>
Bluetooth: HCI - Fix info leak in getsockopt(HCI_FILTER)
Mathias Krause <[email protected]>
atm: fix info leak via getsockname()
Mathias Krause <[email protected]>
atm: fix info leak in getsockopt(SO_ATMPVC)
Ben Hutchings <[email protected]>
ipv6: addrconf: Avoid calling netdevice notifiers with RCU read-side lock
[email protected] <[email protected]>
af_packet: remove BUG statement in tpacket_destruct_skb
Alexey Khoroshilov <[email protected]>
net/core: Fix potential memory leak in dev_set_alias()
Wu Fengguang <[email protected]>
isdnloop: fix and simplify isdnloop_init()
Hiroaki SHIMODA <[email protected]>
net_sched: gact: Fix potential panic in tcf_gact().
Ben Hutchings <[email protected]>
tcp: Apply device TSO segment limit earlier
Ben Hutchings <[email protected]>
sfc: Fix maximum number of TSO segments and minimum TX queue size
Ben Hutchings <[email protected]>
net: Allow driver to limit number of GSO segments per skb
-------------
Diffstat:
Makefile | 4 +- arch/alpha/include/asm/atomic.h | 4 +- arch/arm/Kconfig | 52 +++++++++++++------------- arch/arm/boot/compressed/head.S | 1 + arch/x86/kernel/cpu/mcheck/mce.c | 9 ++++- arch/x86/pci/fixup.c | 17 +++++++++ arch/x86/xen/setup.c | 4 ++ drivers/acpi/processor_core.c | 6 ++- drivers/ata/ahci.c | 2 + drivers/ata/libata-core.c | 1 + drivers/base/power/runtime.c | 5 ++- drivers/block/cciss_scsi.c | 1 + drivers/bluetooth/btusb.c | 10 +++-- drivers/cpufreq/powernow-k8.c | 63 +++++++++++++++++--------------- drivers/dma/at_hdmac.c | 13 ++++++- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- drivers/gpu/drm/radeon/radeon_atombios.c | 2 +- drivers/hwmon/ads7871.c | 9 +++++ drivers/hwmon/fam15h_power.c | 15 +++++++- drivers/hwmon/twl4030-madc-hwmon.c | 9 +++-- drivers/input/serio/i8042-x86ia64io.h | 6 +++ drivers/isdn/isdnloop/isdnloop.c | 12 ------ drivers/md/md.c | 17 +++++++-- drivers/media/rc/rc-main.c | 5 ++- drivers/misc/sgi-xp/xpc_uv.c | 84 ++++++++++++++++++++++++++++++++---------- drivers/mmc/core/sd.c | 6 +-- drivers/mmc/host/mxs-mmc.c | 4 +- drivers/mmc/host/sdhci-esdhc.h | 6 +-- drivers/mmc/host/sdhci.c | 5 ++- drivers/mtd/ubi/vtbl.c | 4 +- drivers/net/can/janz-ican3.c | 4 +- drivers/net/can/mcp251x.c | 11 +++++- drivers/net/can/ti_hecc.c | 2 +- drivers/net/e1000e/82571.c | 3 +- drivers/net/netconsole.c | 1 - drivers/net/sfc/efx.c | 6 +++ drivers/net/sfc/efx.h | 14 +++++-- drivers/net/sfc/ethtool.c | 16 +++++--- drivers/net/sfc/nic.h | 5 +++ drivers/net/sfc/tx.c | 19 ++++++++++ drivers/net/usb/asix.c | 4 ++ drivers/net/wireless/rt2x00/rt2400pci.c | 9 +++++ drivers/net/wireless/rt2x00/rt2400pci.h | 1 + drivers/net/wireless/rt2x00/rt2500pci.c | 9 +++++ drivers/net/wireless/rt2x00/rt2500usb.c | 11 +++++- drivers/net/wireless/rt2x00/rt2500usb.h | 17 +++++---- drivers/net/wireless/rt2x00/rt2800pci.c | 9 +++++ drivers/net/wireless/rt2x00/rt2800usb.c | 9 +++++ drivers/net/wireless/rt2x00/rt61pci.c | 9 +++++ drivers/net/wireless/rt2x00/rt61pci.h | 1 + drivers/net/wireless/rt2x00/rt73usb.c | 9 +++++ drivers/net/wireless/rt2x00/rt73usb.h | 3 ++ drivers/platform/x86/asus-laptop.c | 8 ++-- drivers/platform/x86/asus-nb-wmi.c | 4 ++ drivers/rtc/rtc-rs5c348.c | 7 +++- drivers/rtc/rtc-twl.c | 5 +++ drivers/scsi/bnx2i/bnx2i_hwi.c | 3 ++ drivers/scsi/hpsa.c | 3 +- drivers/scsi/mpt2sas/mpt2sas_base.c | 7 ++++ drivers/spi/spi_fsl_spi.c | 6 ++- drivers/staging/comedi/drivers/das08.c | 2 +- drivers/staging/lirc/lirc_sir.c | 60 +++++++++++++++++++++++++++++- drivers/staging/rtl8712/recv_linux.c | 7 +--- drivers/staging/speakup/main.c | 2 +- drivers/staging/vt6656/dpc.c | 2 +- drivers/staging/vt6656/rxtx.c | 38 +++++++++---------- drivers/target/target_core_transport.c | 9 ++++- drivers/tty/serial/pch_uart.c | 21 +++++++---- drivers/usb/core/devices.c | 2 +- drivers/usb/core/hcd.c | 6 +-- drivers/usb/core/quirks.c | 4 ++ drivers/usb/host/ehci-q.c | 12 +++++- drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++---- drivers/usb/host/pci-quirks.h | 1 + drivers/usb/host/xhci-ring.c | 39 ++++++++++++-------- drivers/usb/host/xhci.c | 2 +- drivers/usb/serial/ftdi_sio.c | 22 ++++++++++- drivers/usb/serial/ftdi_sio_ids.h | 29 ++++++++++++++- drivers/usb/serial/option.c | 6 ++- drivers/video/console/fbcon.c | 9 ++++- drivers/watchdog/hpwdt.c | 3 ++ fs/dcache.c | 4 +- fs/ecryptfs/inode.c | 5 +++ fs/nfs/inode.c | 2 +- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 4 +- fs/nfs/nfs4xdr.c | 3 +- fs/nfs/super.c | 2 + fs/squashfs/super.c | 2 +- fs/stat.c | 2 +- include/asm-generic/mutex-xchg.h | 11 +++++- include/linux/dcache.h | 2 + include/linux/init_task.h | 12 +++++- include/linux/kobject.h | 2 +- include/linux/ktime.h | 7 ---- include/linux/memory.h | 2 +- include/linux/netdevice.h | 2 + include/linux/nfs_fs.h | 5 --- include/linux/perf_event.h | 2 +- include/linux/sched.h | 5 ++- include/linux/time.h | 29 ++++++++++++++- include/net/sock.h | 2 + include/trace/events/kmem.h | 4 +- kernel/async.c | 13 +++++-- kernel/events/core.c | 62 ++++++++++++++++--------------- kernel/exit.c | 16 ++++++++ kernel/sched.c | 32 +++++++++------- kernel/time/timekeeping.c | 36 +++++++++++++++++- kernel/workqueue.c | 34 +++++++---------- mm/memory_hotplug.c | 16 +++++--- mm/page_alloc.c | 2 +- net/atm/common.c | 1 + net/atm/pvc.c | 1 + net/bluetooth/hci_core.c | 2 + net/bluetooth/hci_sock.c | 2 + net/bluetooth/l2cap_sock.c | 1 + net/bluetooth/rfcomm/sock.c | 1 + net/bluetooth/rfcomm/tty.c | 2 +- net/core/dev.c | 14 +++++-- net/core/drop_monitor.c | 113 ++++++++++++++++++++++++++++++--------------------------- net/core/net_namespace.c | 4 +- net/core/sock.c | 1 + net/dccp/ccids/ccid3.c | 1 + net/ipv4/ipmr.c | 14 ++++++- net/ipv4/tcp.c | 4 +- net/ipv4/tcp_cong.c | 3 +- net/ipv4/tcp_output.c | 21 ++++++----- net/ipv6/addrconf.c | 4 +- net/l2tp/l2tp_core.c | 3 +- net/l2tp/l2tp_core.h | 1 + net/llc/af_llc.c | 3 +- net/netfilter/ipvs/ip_vs_ctl.c | 1 + net/netlink/af_netlink.c | 4 +- net/packet/af_packet.c | 1 - net/rds/recv.c | 3 ++ net/sched/act_gact.c | 14 +++++-- net/socket.c | 1 + net/wireless/reg.c | 12 ++++-- sound/pci/ice1712/prodigy_hifi.c | 3 +- 139 files changed, 1037 insertions(+), 431 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/127 net: Allow driver to limit number of GSO segments per skb
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 30b678d844af3305cda5953467005cebb5d7b687 ]
A peer (or local user) may cause TCP to use a nominal MSS of as little as 88 (actual MSS of 76 with timestamps). Given that we have a sufficiently prodigious local sender and the peer ACKs quickly enough, it is nevertheless possible to grow the window for such a connection to the point that we will try to send just under 64K at once. This results in a single skb that expands to 861 segments.
In some drivers with TSO support, such an skb will require hundreds of DMA descriptors; a substantial fraction of a TX ring or even more than a full ring. The TX queue selected for the skb may stall and trigger the TX watchdog repeatedly (since the problem skb will be retried after the TX reset). This particularly affects sfc, for which the issue is designated as CVE-2012-3412.
Therefore:
1. Add the field net_device::gso_max_segs holding the device-specific limit.
2. In netif_skb_features(), if the number of segments is too high then mask out GSO features to force fall back to software GSO.
--- include/linux/netdevice.h | 2 ++ net/core/dev.c | 4 ++++ 2 files changed, 6 insertions(+)
include/linux/netdevice.h +2 -0
@@ -1329,6 +1329,8 @@ struct net_device {/* for setting kernel sock attribute on TCP connection setup */ #define GSO_MAX_SIZE 65536unsigned int gso_max_size; +#define GSO_MAX_SEGS 65535 +u16 gso_max_segs;#ifdef CONFIG_DCB /* Data Center Bridging netlink ops */
net/core/dev.c +4 -0
@@ -2050,6 +2050,9 @@ u32 netif_skb_features(struct sk_buff *s__be16 protocol = skb->protocol;u32 features = skb->dev->features; +if (skb_shinfo (skb)->gso_segs > skb->dev->gso_max_segs) + features &= ~NETIF_F_GSO_MASK ; +if (protocol ==htons (ETH_P_8021Q )) {struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; protocol = veh->h_vlan_encapsulated_proto;
@@ -5870,6 +5873,7 @@ struct net_device *alloc_netdev_mqs(intdev_net_set (dev, &init_net); dev->gso_max_size =GSO_MAX_SIZE ; + dev->gso_max_segs =GSO_MAX_SEGS ;INIT_LIST_HEAD (&dev->ethtool_ntuple_list.list); dev->ethtool_ntuple_list.count =0 ;
Greg Kroah-Hartman
maintainerPATCH 2/127 sfc: Fix maximum number of TSO segments and minimum TX queue size
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 7e6d06f0de3f74ca929441add094518ae332257c ]
Currently an skb requiring TSO may not fit within a minimum-size TX queue. The TX queue selected for the skb may stall and trigger the TX watchdog repeatedly (since the problem skb will be retried after the TX reset). This issue is designated as CVE-2012-3412.
Set the maximum number of TSO segments for our devices to 100. This should make no difference to behaviour unless the actual MSS is less than about 700. Increase the minimum TX queue size accordingly to allow for 2 worst-case skbs, so that there will definitely be space to add an skb after we wake a queue.
To avoid invalidating existing configurations, change efx_ethtool_set_ringparam() to fix up values that are too small rather than returning -EINVAL.
--- drivers/net/sfc/efx.c | 6 ++++++ drivers/net/sfc/efx.h | 14 ++++++++++---- drivers/net/sfc/ethtool.c | 16 +++++++++++----- drivers/net/sfc/nic.h | 5 +++++ drivers/net/sfc/tx.c | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 9 deletions(-)
drivers/net/sfc/efx.c +6 -0
@@ -1383,6 +1383,11 @@ static int efx_probe_all(struct efx_nic goto fail2; } +BUILD_BUG_ON (EFX_DEFAULT_DMAQ_SIZE <EFX_RXQ_MIN_ENT ); +if (WARN_ON (EFX_DEFAULT_DMAQ_SIZE <EFX_TXQ_MIN_ENT (efx))) { + rc = -EINVAL ; + goto fail3; + } efx->rxq_entries = efx->txq_entries =EFX_DEFAULT_DMAQ_SIZE ; rc =efx_probe_channels (efx);if (rc)
@@ -1942,6 +1947,7 @@ static int efx_register_netdev(struct ef net_dev->irq = efx->pci_dev->irq; net_dev->netdev_ops = &efx_netdev_ops;SET_ETHTOOL_OPS (net_dev, &efx_ethtool_ops); + net_dev->gso_max_segs =EFX_TSO_MAX_SEGS ;/* Clear MAC statistics */ efx->mac_op->update_stats (efx);
drivers/net/sfc/efx.h +10 -4
@@ -38,6 +38,7 @@ extern netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb);extern void efx_xmit_done (struct efx_tx_queue *tx_queue,unsigned int index);extern int efx_setup_tc (struct net_device *net_dev,u8 num_tc); +extern unsigned int efx_tx_max_skb_descs (struct efx_nic *efx);/* RX */ extern int efx_probe_rx_queue (struct efx_rx_queue *rx_queue);
@@ -60,10 +61,15 @@ extern void efx_schedule_slow_fill(struc#define EFX_MAX_EVQ_SIZE 16384UL#define EFX_MIN_EVQ_SIZE 512UL -/* The smallest [rt]xq_entries that the driver supports. Callers of -* efx_wake_queue() assume that they can subsequently send at least one -* skb. Falcon/A1 may require up to three descriptors per skb_frag. */ -#define EFX_MIN_RING_SIZE (roundup_pow_of_two(2 * 3 * MAX_SKB_FRAGS)) +/* Maximum number of TCP segments we support for soft-TSO */ +#define EFX_TSO_MAX_SEGS 100 + +/* The smallest [rt]xq_entries that the driver supports. RX minimum +* is a bit arbitrary. For TX, we must have space for at least 2 +* TSO skbs. +*/ +#define EFX_RXQ_MIN_ENT 128U +#define EFX_TXQ_MIN_ENT (efx) (2 * efx_tx_max_skb_descs(efx))/* Filters */ extern int efx_probe_filters (struct efx_nic *efx);
drivers/net/sfc/ethtool.c +11 -5
@@ -677,21 +677,27 @@ static int efx_ethtool_set_ringparam(str struct ethtool_ringparam *ring) {struct efx_nic *efx =netdev_priv (net_dev); +u32 txq_entries;if (ring->rx_mini_pending || ring->rx_jumbo_pending || ring->rx_pending >EFX_MAX_DMAQ_SIZE || ring->tx_pending >EFX_MAX_DMAQ_SIZE )return -EINVAL ; -if (ring->rx_pending <EFX_MIN_RING_SIZE || - ring->tx_pending <EFX_MIN_RING_SIZE ) { +if (ring->rx_pending <EFX_RXQ_MIN_ENT ) {netif_err (efx, drv, efx->net_dev, -"TX and RX queues cannot be smaller than %ld\n" , -EFX_MIN_RING_SIZE ); +"RX queues cannot be smaller than %u\n" , +EFX_RXQ_MIN_ENT );return -EINVAL ; } -return efx_realloc_channels (efx, ring->rx_pending, ring->tx_pending); + txq_entries =max (ring->tx_pending,EFX_TXQ_MIN_ENT (efx)); +if (txq_entries != ring->tx_pending) +netif_warn (efx, drv, efx->net_dev, +"increasing TX queue size to minimum of %u\n" , + txq_entries); + +return efx_realloc_channels (efx, ring->rx_pending, txq_entries); } static int efx_ethtool_set_pauseparam(struct net_device *net_dev,
drivers/net/sfc/nic.h +5 -0
@@ -65,6 +65,11 @@ enum {#define FALCON_GMAC_LOOPBACKS \ (1 << LOOPBACK_GMAC) +/* Alignment of PCIe DMA boundaries (4KB) */ +#define EFX_PAGE_SIZE 4096 +/* Size and alignment of buffer table entries (same) */ +#define EFX_BUF_SIZE EFX_PAGE_SIZE +/** * struct falcon_board_type - board operations and type information * @id: Board type id, as found in NVRAM
drivers/net/sfc/tx.c +19 -0
@@ -115,6 +115,25 @@ efx_max_tx_len(struct efx_nic *efx, dma_return len; } +unsigned int efx_tx_max_skb_descs (struct efx_nic *efx) +{ +/* Header and payload descriptor for each output segment, plus +* one for every input fragment boundary within a segment +*/ +unsigned int max_descs =EFX_TSO_MAX_SEGS *2 +MAX_SKB_FRAGS ; + +/* Possibly one more per segment for the alignment workaround */ +if (EFX_WORKAROUND_5391 (efx)) + max_descs +=EFX_TSO_MAX_SEGS ; + +/* Possibly more for PCIe page boundaries within input fragments */ +if (PAGE_SIZE >EFX_PAGE_SIZE ) + max_descs += max_t(unsigned int, MAX_SKB_FRAGS, +DIV_ROUND_UP (GSO_MAX_SIZE ,EFX_PAGE_SIZE )); + +return max_descs; +} +/* * Add a socket buffer to a TX queue *
Greg Kroah-Hartman
maintainerPATCH 3/127 tcp: Apply device TSO segment limit earlier
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 1485348d2424e1131ea42efc033cbd9366462b01 ]
Cache the device gso_max_segs in sock::sk_gso_max_segs and use it to limit the size of TSO skbs. This avoids the need to fall back to software GSO for local TCP senders.
--- include/net/sock.h | 2 ++ net/core/sock.c | 1 + net/ipv4/tcp.c | 4 +++- net/ipv4/tcp_cong.c | 3 ++- net/ipv4/tcp_output.c | 21 ++++++++++++--------- 5 files changed, 20 insertions(+), 11 deletions(-)
include/net/sock.h +2 -0
@@ -194,6 +194,7 @@ struct sock_common {* @sk_route_nocaps: forbidden route capabilities (e.g NETIF_F_GSO_MASK) * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) * @sk_gso_max_size: Maximum GSO segment size to build +* @sk_gso_max_segs: Maximum number of GSO segments * @sk_lingertime: %SO_LINGER l_linger setting * @sk_backlog: always used with the per-socket spinlock held * @sk_callback_lock: used with the callbacks in the end of this struct
@@ -310,6 +311,7 @@ struct sock {int sk_route_nocaps;int sk_gso_type;unsigned int sk_gso_max_size; +u16 sk_gso_max_segs;int sk_rcvlowat;unsigned long sk_lingertime;struct sk_buff_head sk_error_queue;
net/core/sock.c +1 -0
@@ -1312,6 +1312,7 @@ void sk_setup_caps(struct sock *sk, stru }else { sk->sk_route_caps |=NETIF_F_SG |NETIF_F_HW_CSUM ; sk->sk_gso_max_size = dst->dev->gso_max_size; + sk->sk_gso_max_segs = dst->dev->gso_max_segs; } } }
net/ipv4/tcp.c +3 -1
@@ -739,7 +739,9 @@ static unsigned int tcp_xmit_size_goal(s old_size_goal + mss_now > xmit_size_goal)) { xmit_size_goal = old_size_goal; }else { - tp->xmit_size_goal_segs = xmit_size_goal / mss_now; + tp->xmit_size_goal_segs = +min_t (u16, xmit_size_goal / mss_now, + sk->sk_gso_max_segs); xmit_size_goal = tp->xmit_size_goal_segs * mss_now; } }
net/ipv4/tcp_cong.c +2 -1
@@ -290,7 +290,8 @@ int tcp_is_cwnd_limited(const struct soc left = tp->snd_cwnd - in_flight;if (sk_can_gso (sk) && left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd && - left * tp->mss_cache < sk->sk_gso_max_size) + left * tp->mss_cache < sk->sk_gso_max_size && + left < sk->sk_gso_max_segs)return 1 ;return left <=tcp_max_burst (tp); }
net/ipv4/tcp_output.c +12 -9
@@ -1310,21 +1310,21 @@ static void tcp_cwnd_validate(struct soc* when we would be allowed to send the split-due-to-Nagle skb fully. */ static unsigned int tcp_mss_split_point (struct sock *sk,struct sk_buff *skb, -unsigned int mss_now,unsigned int cwnd) +unsigned int mss_now,unsigned int max_segs) {struct tcp_sock *tp =tcp_sk (sk); -u32 needed, window, cwnd_len; +u32 needed, window, max_len; window =tcp_wnd_end (tp) -TCP_SKB_CB (skb)->seq; - cwnd_len = mss_now * cwnd; + max_len = mss_now * max_segs; -if (likely (cwnd_len <= window && skb !=tcp_write_queue_tail (sk))) -return cwnd_len; +if (likely (max_len <= window && skb !=tcp_write_queue_tail (sk))) +return max_len; needed =min (skb->len, window); -if (cwnd_len <= needed) -return cwnd_len; +if (max_len <= needed) +return max_len;return needed - needed % mss_now; }
@@ -1551,7 +1551,8 @@ static int tcp_tso_should_defer(struct s limit =min (send_win, cong_win);/* If a full-sized TSO skb can be sent, do it. */ -if (limit >= sk->sk_gso_max_size) + if (limit >= min_t(unsigned int, sk->sk_gso_max_size, + sk->sk_gso_max_segs * tp->mss_cache)) goto send_now;/* Middle in queue won't get any more data, full sendable already? */
@@ -1777,7 +1778,9 @@ static int tcp_write_xmit(struct sock *s limit = mss_now;if (tso_segs >1 && !tcp_urg_mode (tp)) limit =tcp_mss_split_point (sk, skb, mss_now, - cwnd_quota); + min_t(unsigned int, + cwnd_quota, + sk->sk_gso_max_segs));if (skb->len > limit &&unlikely (tso_fragment (sk, skb, limit, mss_now, gfp)))
Greg Kroah-Hartman
maintainerPATCH 4/127 net_sched: gact: Fix potential panic in tcf_gact().
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hiroaki SHIMODA <[email protected]>
[ Upstream commit 696ecdc10622d86541f2e35cc16e15b6b3b1b67e ]
gact_rand array is accessed by gact->tcfg_ptype whose value is assumed to less than MAX_RAND, but any range checks are not performed.
So add a check in tcf_gact_init(). And in tcf_gact(), we can reduce a branch.
--- net/sched/act_gact.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
net/sched/act_gact.c +11 -3
@@ -67,6 +67,9 @@ static int tcf_gact_init(struct nlattr *struct tcf_common *pc;int ret =0 ;int err; +#ifdef CONFIG_GACT_PROB +struct tc_gact_p *p_parm =NULL ; +#endif if (nla ==NULL )return -EINVAL ;
@@ -82,6 +85,12 @@ static int tcf_gact_init(struct nlattr *#ifndef CONFIG_GACT_PROB if (tb[TCA_GACT_PROB ] !=NULL )return -EOPNOTSUPP ; +#else +if (tb[TCA_GACT_PROB ]) { + p_parm =nla_data (tb[TCA_GACT_PROB ]); +if (p_parm->ptype >=MAX_RAND ) +return -EINVAL ; + }#endif pc =tcf_hash_check (parm->index, a, bind, &gact_hash_info);
@@ -103,8 +112,7 @@ static int tcf_gact_init(struct nlattr *spin_lock_bh (&gact->tcf_lock); gact->tcf_action = parm->action;#ifdef CONFIG_GACT_PROB -if (tb[TCA_GACT_PROB ] !=NULL ) { -struct tc_gact_p *p_parm =nla_data (tb[TCA_GACT_PROB ]); +if (p_parm) { gact->tcfg_paction = p_parm->paction; gact->tcfg_pval = p_parm->pval; gact->tcfg_ptype = p_parm->ptype;
@@ -132,7 +140,7 @@ static int tcf_gact(struct sk_buff *skb,spin_lock (&gact->tcf_lock);#ifdef CONFIG_GACT_PROB -if (gact->tcfg_ptype && gact_rand[gact->tcfg_ptype] !=NULL ) +if (gact->tcfg_ptype) action = gact_rand[gact->tcfg_ptype](gact);else action = gact->tcf_action;
Greg Kroah-Hartman
maintainerPATCH 5/127 isdnloop: fix and simplify isdnloop_init()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wu Fengguang <[email protected]>
[ Upstream commit 77f00f6324cb97cf1df6f9c4aaeea6ada23abdb2 ]
Fix a buffer overflow bug by removing the revision and printk.
[ 22.016214] isdnloop-ISDN-driver Rev 1.11.6.7 [ 22.097508] isdnloop: (loop0) virtual card added [ 22.174400] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: ffffffff83244972 [ 22.174400] [ 22.436157] Pid: 1, comm: swapper Not tainted 3.5.0-bisect-00018-gfa8bbb1-dirty #129 [ 22.624071] Call Trace: [ 22.720558] [<ffffffff832448c3>] ? CallcNew+0x56/0x56 [ 22.815248] [<ffffffff8222b623>] panic+0x110/0x329 [ 22.914330] [<ffffffff83244972>] ? isdnloop_init+0xaf/0xb1 [ 23.014800] [<ffffffff832448c3>] ? CallcNew+0x56/0x56 [ 23.090763] [<ffffffff8108e24b>] __stack_chk_fail+0x2b/0x30 [ 23.185748] [<ffffffff83244972>] isdnloop_init+0xaf/0xb1
--- drivers/isdn/isdnloop/isdnloop.c | 12 ------------ 1 file changed, 12 deletions(-)
drivers/isdn/isdnloop/isdnloop.c +0 -12
@@ -16,7 +16,6 @@#include <linux/sched.h> #include "isdnloop.h" -static char *revision ="$Revision: 1.11.6.7 $" ;static char *isdnloop_id ="loop0" ;MODULE_DESCRIPTION ("ISDN4Linux: Pseudo Driver that simulates an ISDN card" );
@@ -1494,17 +1493,6 @@ isdnloop_addcard(char *id1)static int __init isdnloop_init (void ) { -char *p; -char rev[10 ]; - -if ((p =strchr (revision,':' ))) { -strcpy (rev, p +1 ); - p =strchr (rev,'$' ); - *p =0 ; - }else -strcpy (rev," ??? " ); -printk (KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n" , rev); -if (isdnloop_id)return (isdnloop_addcard (isdnloop_id));
Greg Kroah-Hartman
maintainerPATCH 6/127 net/core: Fix potential memory leak in dev_set_alias()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Khoroshilov <[email protected]>
[ Upstream commit 7364e445f62825758fa61195d237a5b8ecdd06ec ]
Do not leak memory by updating pointer with potentially NULL realloc return value.
Found by Linux Driver Verification project (linuxtesting.org).
--- net/core/dev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/core/dev.c +5 -2
@@ -1045,6 +1045,8 @@ rollback:*/ int dev_set_alias (struct net_device *dev,const char *alias,size_t len) { +char *new_ifalias; +ASSERT_RTNL ();if (len >=IFALIASZ )
@@ -1058,9 +1060,10 @@ int dev_set_alias(struct net_device *devreturn 0 ; } - dev->ifalias =krealloc (dev->ifalias, len +1 ,GFP_KERNEL ); -if (!dev->ifalias) + new_ifalias =krealloc (dev->ifalias, len +1 ,GFP_KERNEL ); +if (!new_ifalias)return -ENOMEM ; + dev->ifalias = new_ifalias;strlcpy (dev->ifalias, alias, len+1 );return len;
Greg Kroah-Hartman
maintainerPATCH 7/127 af_packet: remove BUG statement in tpacket_destruct_skb
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 7f5c3e3a80e6654cf48dfba7cf94f88c6b505467 ]
Here's a quote of the comment about the BUG macro from asm-generic/bug.h:
Don't use BUG() or BUG_ON() unless there's really no way out; one example might be detecting data structure corruption in the middle of an operation that can't be backed out of. If the (sub)system can somehow continue operating, perhaps with reduced functionality, it's probably not BUG-worthy.
If you're tempted to BUG(), think again: is completely giving up really the *only* solution? There are usually better options, where users don't need to reboot ASAP and can mostly shut down cleanly.
In our case, the status flag of a ring buffer slot is managed from both sides, the kernel space and the user space. This means that even though the kernel side might work as expected, the user space screws up and changes this flag right between the send(2) is triggered when the flag is changed to TP_STATUS_SENDING and a given skb is destructed after some time. Then, this will hit the BUG macro. As David suggested, the best solution is to simply remove this statement since it cannot be used for kernel side internal consistency checks. I've tested it and the system still behaves /stable/ in this case, so in accordance with the above comment, we should rather remove it.
--- net/packet/af_packet.c | 1 - 1 file changed, 1 deletion(-)
net/packet/af_packet.c +0 -1
@@ -866,7 +866,6 @@ static void tpacket_destruct_skb(structif (likely (po->tx_ring.pg_vec)) { ph =skb_shinfo (skb)->destructor_arg; -BUG_ON (__packet_get_status (po, ph) !=TP_STATUS_SENDING );BUG_ON (atomic_read (&po->tx_ring.pending) ==0 );atomic_dec (&po->tx_ring.pending);__packet_set_status (po, ph,TP_STATUS_AVAILABLE );
Greg Kroah-Hartman
maintainerPATCH 8/127 ipv6: addrconf: Avoid calling netdevice notifiers with RCU read-side lock
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 4acd4945cd1e1f92b20d14e349c6c6a52acbd42d ]
Cong Wang reports that lockdep detected suspicious RCU usage while enabling IPV6 forwarding:
[ 1123.310275] ===============================
[ 1123.442202] [ INFO: suspicious RCU usage. ]
[ 1123.558207] 3.6.0-rc1+ #109 Not tainted
[ 1123.665204] -------------------------------
[ 1123.768254] include/linux/rcupdate.h:430 Illegal context switch in RCU read-side critical section!
[ 1123.992320]
[ 1123.992320] other info that might help us debug this:
[ 1123.992320]
[ 1124.307382]
[ 1124.307382] rcu_scheduler_active = 1, debug_locks = 0
[ 1124.522220] 2 locks held by sysctl/5710:
[ 1124.648364] #0: (rtnl_mutex){+.+.+.}, at: [<ffffffff81768498>] rtnl_trylock+0x15/0x17
[ 1124.882211] #1: (rcu_read_lock){.+.+.+}, at: [<ffffffff81871df8>] rcu_lock_acquire+0x0/0x29
[ 1125.085209]
[ 1125.085209] stack backtrace:
[ 1125.332213] Pid: 5710, comm: sysctl Not tainted 3.6.0-rc1+ #109
[ 1125.441291] Call Trace:
[ 1125.545281] [<ffffffff8109d915>] lockdep_rcu_suspicious+0x109/0x112
[ 1125.667212] [<ffffffff8107c240>] rcu_preempt_sleep_check+0x45/0x47
[ 1125.781838] [<ffffffff8107c260>] __might_sleep+0x1e/0x19b
[...]
[ 1127.445223] [<ffffffff81757ac5>] call_netdevice_notifiers+0x4a/0x4f
[...]
[ 1127.772188] [<ffffffff8175e125>] dev_disable_lro+0x32/0x6b
[ 1127.885174] [<ffffffff81872d26>] dev_forward_change+0x30/0xcb
[ 1128.013214] [<ffffffff818738c4>] addrconf_forward_change+0x85/0xc5[...]
addrconf_forward_change() uses RCU iteration over the netdev list, which is unnecessary since it already holds the RTNL lock. We also cannot reasonably require netdevice notifier functions not to sleep.
--- net/ipv6/addrconf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv6/addrconf.c +1 -3
@@ -492,8 +492,7 @@ static void addrconf_forward_change(strustruct net_device *dev;struct inet6_dev *idev; -rcu_read_lock (); -for_each_netdev_rcu (net, dev) { +for_each_netdev (net, dev) { idev =__in6_dev_get (dev);if (idev) {int changed = (!idev->cnf.forwarding) ^ (!newf);
@@ -502,7 +501,6 @@ static void addrconf_forward_change(strudev_forward_change (idev); } } -rcu_read_unlock (); }static int addrconf_fixup_forwarding (struct ctl_table *table,int *p,int old)
Greg Kroah-Hartman
maintainerPATCH 9/127 atm: fix info leak in getsockopt(SO_ATMPVC)
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit e862f1a9b7df4e8196ebec45ac62295138aa3fc2 ]
The ATM code fails to initialize the two padding bytes of struct sockaddr_atmpvc inserted for alignment. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/atm/common.c | 1 + 1 file changed, 1 insertion(+)
net/atm/common.c +1 -0
@@ -784,6 +784,7 @@ int vcc_getsockopt(struct socket *sock,if (!vcc->dev || !test_bit (ATM_VF_ADDR , &vcc->flags))return -ENOTCONN ; +memset (&pvc,0 ,sizeof (pvc)); pvc.sap_family =AF_ATMPVC ; pvc.sap_addr.itf = vcc->dev->number; pvc.sap_addr.vpi = vcc->vpi;
Greg Kroah-Hartman
maintainerPATCH 10/127 atm: fix info leak via getsockname()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 3c0c5cfdcd4d69ffc4b9c0907cec99039f30a50a ]
The ATM code fails to initialize the two padding bytes of struct sockaddr_atmpvc inserted for alignment. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/atm/pvc.c | 1 + 1 file changed, 1 insertion(+)
net/atm/pvc.c +1 -0
@@ -94,6 +94,7 @@ static int pvc_getname(struct socket *soreturn -ENOTCONN ; *sockaddr_len =sizeof (struct sockaddr_atmpvc ); addr = (struct sockaddr_atmpvc *)sockaddr; +memset (addr,0 ,sizeof (*addr)); addr->sap_family =AF_ATMPVC ; addr->sap_addr.itf = vcc->dev->number; addr->sap_addr.vpi = vcc->vpi;
Greg Kroah-Hartman
maintainerPATCH 11/127 Bluetooth: HCI - Fix info leak in getsockopt(HCI_FILTER)
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit e15ca9a0ef9a86f0477530b0f44a725d67f889ee ]
The HCI code fails to initialize the two padding bytes of struct hci_ufilter before copying it to userland -- that for leaking two bytes kernel stack. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/bluetooth/hci_sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_sock.c +1 -0
@@ -644,6 +644,7 @@ static int hci_sock_setsockopt(struct so {struct hci_filter *f = &hci_pi (sk)->filter; +memset (&uf,0 ,sizeof (uf)); uf.type_mask = f->type_mask; uf.opcode = f->opcode; uf.event_mask[0 ] = *((u32 *) f->event_mask +0 );
Greg Kroah-Hartman
maintainerPATCH 12/127 Bluetooth: HCI - Fix info leak via getsockname()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 3f68ba07b1da811bf383b4b701b129bfcb2e4988 ]
The HCI code fails to initialize the hci_channel member of struct sockaddr_hci and that for leaks two bytes kernel stack via the getsockname() syscall. Initialize hci_channel with 0 to avoid the info leak.
--- net/bluetooth/hci_sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_sock.c +1 -0
@@ -432,6 +432,7 @@ static int hci_sock_getname(struct socke *addr_len =sizeof (*haddr); haddr->hci_family =AF_BLUETOOTH ; haddr->hci_dev = hdev->id; + haddr->hci_channel=0 ;release_sock (sk);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 13/127 Bluetooth: RFCOMM - Fix info leak in ioctl(RFCOMMGETDEVLIST)
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit f9432c5ec8b1e9a09b9b0e5569e3c73db8de432a ]
The RFCOMM code fails to initialize the two padding bytes of struct rfcomm_dev_list_req inserted for alignment before copying it to userland. Additionally there are two padding bytes in each instance of struct rfcomm_dev_info. The ioctl() that for disclosures two bytes plus dev_num times two bytes uninitialized kernel heap memory.
Allocate the memory using kzalloc() to fix this issue.
--- net/bluetooth/rfcomm/tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/rfcomm/tty.c +1 -1
@@ -471,7 +471,7 @@ static int rfcomm_get_dev_list(void __us size =sizeof (*dl) + dev_num *sizeof (*di); - dl =kmalloc (size,GFP_KERNEL ); + dl =kzalloc (size,GFP_KERNEL );if (!dl)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 14/127 Bluetooth: RFCOMM - Fix info leak via getsockname()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 9344a972961d1a6d2c04d9008b13617bcb6ec2ef ]
The RFCOMM code fails to initialize the trailing padding byte of struct sockaddr_rc added for alignment. It that for leaks one byte kernel stack via the getsockname() syscall. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/bluetooth/rfcomm/sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/rfcomm/sock.c +1 -0
@@ -544,6 +544,7 @@ static int rfcomm_sock_getname(struct soBT_DBG ("sock %p, sk %p" , sock, sk); +memset (sa,0 ,sizeof (*sa)); sa->rc_family =AF_BLUETOOTH ; sa->rc_channel =rfcomm_pi (sk)->channel;if (peer)
Greg Kroah-Hartman
maintainerPATCH 15/127 Bluetooth: L2CAP - Fix info leak via getsockname()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 792039c73cf176c8e39a6e8beef2c94ff46522ed ]
The L2CAP code fails to initialize the l2_bdaddr_type member of struct sockaddr_l2 and the padding byte added for alignment. It that for leaks two bytes kernel stack via the getsockname() syscall. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/bluetooth/l2cap_sock.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/l2cap_sock.c +1 -0
@@ -329,6 +329,7 @@ static int l2cap_sock_getname(struct socBT_DBG ("sock %p, sk %p" , sock, sk); +memset (la,0 ,sizeof (struct sockaddr_l2 )); addr->sa_family =AF_BLUETOOTH ; *len =sizeof (struct sockaddr_l2 );
Greg Kroah-Hartman
maintainerPATCH 16/127 llc: fix info leak via getsockname()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 3592aaeb80290bda0f2cf0b5456c97bfc638b192 ]
The LLC code wrongly returns 0, i.e. "success", when the socket is zapped. Together with the uninitialized uaddrlen pointer argument from sys_getsockname this leads to an arbitrary memory leak of up to 128 bytes kernel stack via the getsockname() syscall.
Return an error instead when the socket is zapped to prevent the info leak. Also remove the unnecessary memset(0). We don't directly write to the memory pointed by uaddr but memcpy() a local structure at the end of the function that is properly initialized.
--- net/llc/af_llc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/llc/af_llc.c +1 -2
@@ -966,14 +966,13 @@ static int llc_ui_getname(struct socketstruct sockaddr_llc sllc;struct sock *sk = sock->sk;struct llc_sock *llc =llc_sk (sk); -int rc =0 ; +int rc = -EBADF ;memset (&sllc,0 ,sizeof (sllc));lock_sock (sk);if (sock_flag (sk,SOCK_ZAPPED )) goto out; *uaddrlen =sizeof (sllc); -memset (uaddr,0 , *uaddrlen);if (peer) { rc = -ENOTCONN ;if (sk->sk_state !=TCP_ESTABLISHED )
Greg Kroah-Hartman
maintainerPATCH 17/127 dccp: fix info leak via getsockopt(DCCP_SOCKOPT_CCID_TX_INFO)
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 7b07f8eb75aa3097cdfd4f6eac3da49db787381d ]
The CCID3 code fails to initialize the trailing padding bytes of struct tfrc_tx_info added for alignment on 64 bit architectures. It that for potentially leaks four bytes kernel stack via the getsockopt() syscall. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/dccp/ccids/ccid3.c | 1 + 1 file changed, 1 insertion(+)
net/dccp/ccids/ccid3.c +1 -0
@@ -532,6 +532,7 @@ static int ccid3_hc_tx_getsockopt(structcase DCCP_SOCKOPT_CCID_TX_INFO :if (len <sizeof (tfrc))return -EINVAL ; +memset (&tfrc,0 ,sizeof (tfrc)); tfrc.tfrctx_x = hc->tx_x; tfrc.tfrctx_x_recv = hc->tx_x_recv; tfrc.tfrctx_x_calc = hc->tx_x_calc;
Greg Kroah-Hartman
maintainerPATCH 18/127 ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT)
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 2d8a041b7bfe1097af21441cb77d6af95f4f4680 ]
If at least one of CONFIG_IP_VS_PROTO_TCP or CONFIG_IP_VS_PROTO_UDP is not set, __ip_vs_get_timeouts() does not fully initialize the structure that gets copied to userland and that for leaks up to 12 bytes of kernel stack. Add an explicit memset(0) before passing the structure to __ip_vs_get_timeouts() to avoid the info leak.
--- net/netfilter/ipvs/ip_vs_ctl.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/ipvs/ip_vs_ctl.c +1 -0
@@ -2675,6 +2675,7 @@ do_ip_vs_get_ctl(struct sock *sk, int cm {struct ip_vs_timeout_user t; +memset (&t,0 ,sizeof (t));__ip_vs_get_timeouts (net, &t);if (copy_to_user (user, &t,sizeof (t)) !=0 ) ret = -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 19/127 net: fix info leak in compat dev_ifconf()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 43da5f2e0d0c69ded3d51907d9552310a6b545e8 ]
The implementation of dev_ifconf() for the compat ioctl interface uses an intermediate ifc structure allocated in userland for the duration of the syscall. Though, it fails to initialize the padding bytes inserted for alignment and that for leaks four bytes of kernel stack. Add an explicit memset(0) before filling the structure to avoid the info leak.
--- net/socket.c | 1 + 1 file changed, 1 insertion(+)
net/socket.c +1 -0
@@ -2645,6 +2645,7 @@ static int dev_ifconf(struct net *net, sif (copy_from_user (&ifc32, uifc32,sizeof (struct compat_ifconf )))return -EFAULT ; +memset (&ifc,0 ,sizeof (ifc));if (ifc32.ifcbuf ==0 ) { ifc32.ifc_len =0 ; ifc.ifc_len =0 ;
Greg Kroah-Hartman
maintainerPATCH 20/127 netlink: fix possible spoofing from non-root processes
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 20e1db19db5d6b9e4e83021595eab0dc8f107bef ]
Non-root user-space processes can send Netlink messages to other processes that are well-known for being subscribed to Netlink asynchronous notifications. This allows ilegitimate non-root process to send forged messages to Netlink subscribers.
The userspace process usually verifies the legitimate origin in two ways:
a) Socket credentials. If UID != 0, then the message comes from some ilegitimate process and the message needs to be dropped.
b) Netlink portID. In general, portID == 0 means that the origin of the messages comes from the kernel. Thus, discarding any message not coming from the kernel.
However, ctnetlink sets the portID in event messages that has been triggered by some user-space process, eg. conntrack utility. So other processes subscribed to ctnetlink events, eg. conntrackd, know that the event was triggered by some user-space action.
Neither of the two ways to discard ilegitimate messages coming from non-root processes can help for ctnetlink.
This patch adds capability validation in case that dst_pid is set in netlink_sendmsg(). This approach is aggressive since existing applications using any Netlink bus to deliver messages between two user-space processes will break. Note that the exception is NETLINK_USERSOCK, since it is reserved for netlink-to-netlink userspace communication.
Still, if anyone wants that his Netlink bus allows netlink-to-netlink userspace, then they can set NL_NONROOT_SEND. However, by default, I don't think it makes sense to allow to use NETLINK_ROUTE to communicate two processes that are sending no matter what information that is not related to link/neighbouring/routing. They should be using NETLINK_USERSOCK instead for that.
--- net/netlink/af_netlink.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netlink/af_netlink.c +3 -1
@@ -1345,7 +1345,8 @@ static int netlink_sendmsg(struct kiocb dst_pid = addr->nl_pid; dst_group =ffs (addr->nl_groups); err = -EPERM ; -if (dst_group && !netlink_capable (sock,NL_NONROOT_SEND )) +if ((dst_group || dst_pid) && + !netlink_capable (sock,NL_NONROOT_SEND )) goto out; }else { dst_pid = nlk->dst_pid;
@@ -2098,6 +2099,7 @@ static void __init netlink_add_usersock_rcu_assign_pointer (nl_table[NETLINK_USERSOCK ].listeners, listeners); nl_table[NETLINK_USERSOCK ].module =THIS_MODULE ; nl_table[NETLINK_USERSOCK ].registered =1 ; + nl_table[NETLINK_USERSOCK ].nl_nonroot =NL_NONROOT_SEND ;netlink_table_ungrab (); }
Greg Kroah-Hartman
maintainerPATCH 21/127 l2tp: avoid to use synchronize_rcu in tunnel free function
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 99469c32f79a32d8481f87be0d3c66dad286f4ec ]
Avoid to use synchronize_rcu in l2tp_tunnel_free because context may be atomic.
--- net/l2tp/l2tp_core.c | 3 +-- net/l2tp/l2tp_core.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
net/l2tp/l2tp_core.c +1 -2
@@ -1252,11 +1252,10 @@ static void l2tp_tunnel_free(struct l2tp/* Remove from tunnel list */ spin_lock_bh (&pn->l2tp_tunnel_list_lock);list_del_rcu (&tunnel->list); +kfree_rcu (tunnel, rcu);spin_unlock_bh (&pn->l2tp_tunnel_list_lock); -synchronize_rcu ();atomic_dec (&l2tp_tunnel_count); -kfree (tunnel); }/* Create a socket for the tunnel, if one isn't set up by
net/l2tp/l2tp_core.h +1 -0
@@ -157,6 +157,7 @@ struct l2tp_tunnel_cfg {struct l2tp_tunnel {int magic;/* Should be L2TP_TUNNEL_MAGIC */ +struct rcu_head rcu;rwlock_t hlist_lock;/* protect session_hlist */ struct hlist_head session_hlist[L2TP_HASH_SIZE ];/* hashed list of sessions,
Greg Kroah-Hartman
maintainerPATCH 22/127 net: ipv4: ipmr_expire_timer causes crash when removing net namespace
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francesco Ruggeri <[email protected]>
[ Upstream commit acbb219d5f53821b2d0080d047800410c0420ea1 ]
When tearing down a net namespace, ipv4 mr_table structures are freed without first deactivating their timers. This can result in a crash in run_timer_softirq.
This patch mimics the corresponding behaviour in ipv6.
Locking and synchronization seem to be adequate.
We are about to kfree mrt, so existing code should already make sure that no other references to mrt are pending or can be created by incoming traffic. The functions invoked here do not cause new references to mrt or other race conditions to be created.
Invoking del_timer_sync guarantees that ipmr_expire_timer is inactive. Both ipmr_expire_process (whose completion we may have to wait in del_timer_sync) and mroute_clean_tables internally use mfc_unres_lock or other synchronizations when needed, and they both only modify mrt.
Tested in Linux 3.4.8.
--- net/ipv4/ipmr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/ipv4/ipmr.c +12 -2
@@ -124,6 +124,8 @@ static DEFINE_SPINLOCK(mfc_unres_lock);static struct kmem_cache *mrt_cachep__read_mostly ;static struct mr_table *ipmr_new_table (struct net *net,u32 id); +static void ipmr_free_table (struct mr_table *mrt); +static int ip_mr_forward (struct net *net,struct mr_table *mrt,struct sk_buff *skb,struct mfc_cache *cache,int local);
@@ -131,6 +133,7 @@ static int ipmr_cache_report(struct mr_t struct sk_buff *pkt, vifi_t vifi, int assert);static int __ipmr_fill_mroute (struct mr_table *mrt,struct sk_buff *skb,struct mfc_cache *c,struct rtmsg *rtm); +static void mroute_clean_tables (struct mr_table *mrt);static void ipmr_expire_process (unsigned long arg);#ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES
@@ -271,7 +274,7 @@ static void __net_exit ipmr_rules_exit(slist_for_each_entry_safe (mrt, next, &net->ipv4.mr_tables, list) {list_del (&mrt->list); -kfree (mrt); +ipmr_free_table (mrt); }fib_rules_unregister (net->ipv4.mr_rules_ops); }
@@ -299,7 +302,7 @@ static int __net_init ipmr_rules_init(st static void __net_exit ipmr_rules_exit(struct net *net) { -kfree (net->ipv4.mrt); +ipmr_free_table (net->ipv4.mrt); }#endif
@@ -336,6 +339,13 @@ static struct mr_table *ipmr_new_table(sreturn mrt; } +static void ipmr_free_table (struct mr_table *mrt) +{ +del_timer_sync (&mrt->ipmr_expire_timer); +mroute_clean_tables (mrt); +kfree (mrt); +} +/* Service routines creating virtual interfaces: DVMRP tunnels and PIMREG */ static void ipmr_del_tunnel (struct net_device *dev,struct vifctl *v)
Greg Kroah-Hartman
maintainerPATCH 23/127 workqueue: reimplement work_on_cpu() using system_wq
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit ed48ece27cd3d5ee0354c32bbaec0f3e1d4715c3 upstream.
The existing work_on_cpu() implementation is hugely inefficient. It creates a new kthread, execute that single function and then let the kthread die on each invocation.
Now that system_wq can handle concurrent executions, there's no advantage of doing this. Reimplement work_on_cpu() using system_wq which makes it simpler and way more efficient.
stable: While this isn't a fix in itself, it's needed to fix a
workqueue related bug in cpufreq/powernow-k8. AFAICS, this shouldn't break other existing users.
--- kernel/workqueue.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
kernel/workqueue.c +8 -17
@@ -3599,18 +3599,17 @@ static int __devinit workqueue_cpu_down_#ifdef CONFIG_SMP struct work_for_cpu { -struct completion completion; +struct work_struct work;long (*fn)(void *);void *arg;long ret; }; -static int do_work_for_cpu (void *_wfc) +static void work_for_cpu_fn (struct work_struct *work) { -struct work_for_cpu *wfc = _wfc; + struct work_for_cpu *wfc = container_of(work, struct work_for_cpu, work); + wfc->ret = wfc->fn (wfc->arg); -complete (&wfc->completion); -return 0 ; }/**
@@ -3625,19 +3624,11 @@ static int do_work_for_cpu(void *_wfc)*/ long work_on_cpu (unsigned int cpu,long (*fn)(void *),void *arg) { -struct task_struct *sub_thread; -struct work_for_cpu wfc = { - .completion =COMPLETION_INITIALIZER_ONSTACK (wfc.completion), - .fn = fn, - .arg = arg, - }; +struct work_for_cpu wfc = { .fn = fn, .arg = arg }; - sub_thread =kthread_create (do_work_for_cpu, &wfc,"work_for_cpu" ); -if (IS_ERR (sub_thread)) -return PTR_ERR (sub_thread); -kthread_bind (sub_thread, cpu); -wake_up_process (sub_thread); -wait_for_completion (&wfc.completion); +INIT_WORK_ONSTACK (&wfc.work, work_for_cpu_fn); +schedule_work_on (cpu, &wfc.work); +flush_work (&wfc.work);return wfc.ret; }EXPORT_SYMBOL_GPL (work_on_cpu);
Greg Kroah-Hartman
maintainerPATCH 24/127 cpufreq/powernow-k8: workqueue user shouldnt migrate the kworker to another CPU
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 6889125b8b4e09c5e53e6ecab3433bed1ce198c9 upstream.
powernowk8_target() runs off a per-cpu work item and if the cpufreq_policy->cpu is different from the current one, it migrates the kworker to the target CPU by manipulating current->cpus_allowed. The function migrates the kworker back to the original CPU but this is still broken. Workqueue concurrency management requires the kworkers to stay on the same CPU and powernowk8_target() ends up triggerring BUG_ON(rq != this_rq()) in try_to_wake_up_local() if it contends on fidvid_mutex and sleeps.
It is unclear why this bug is being reported now. Duncan says it appeared to be a regression of 3.6-rc1 and couldn't reproduce it on 3.5. Bisection seemed to point to 63d95a91 "workqueue: use @pool instead of @gcwq or @cpu where applicable" which is an non-functional change. Given that the reproduce case sometimes took upto days to trigger, it's easy to be misled while bisecting. Maybe something made contention on fidvid_mutex more likely? I don't know.
This patch fixes the bug by using work_on_cpu() instead if @pol->cpu isn't the same as the current one. The code assumes that cpufreq_policy->cpu is kept online by the caller, which Rafael tells me is the case.
stable: ed48ece27c ("workqueue: reimplement work_on_cpu() using
system_wq") should be applied before this; otherwise, the behavior could be horrible.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47301
--- drivers/cpufreq/powernow-k8.c | 65 ++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 30 deletions(-)
drivers/cpufreq/powernow-k8.c +35 -30
@@ -32,7 +32,6 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/cpumask.h> -#include <linux/sched.h> /* for current / set_cpus_allowed() */ #include <linux/io.h> #include <linux/delay.h>
@@ -1132,16 +1131,23 @@ static int transition_frequency_pstate(sreturn res; } -/* Driver entry point to switch to the target frequency */ -static int powernowk8_target (struct cpufreq_policy *pol, -unsigned targfreq,unsigned relation) -{ -cpumask_var_t oldmask; +struct powernowk8_target_arg { +struct cpufreq_policy *pol; +unsigned targfreq; +unsigned relation; +}; + +static long powernowk8_target_fn (void *arg) +{ +struct powernowk8_target_arg *pta = arg; +struct cpufreq_policy *pol = pta->pol; +unsigned targfreq = pta->targfreq; +unsigned relation = pta->relation;struct powernow_k8_data *data =per_cpu (powernow_data, pol->cpu);u32 checkfid;u32 checkvid;unsigned int newstate; -int ret = -EIO ; +int ret;if (!data)return -EINVAL ;
@@ -1149,29 +1155,16 @@ static int powernowk8_target(struct cpuf checkfid = data->currfid; checkvid = data->currvid; -/* only run on specific CPU from here on. */ -/* This is poor form: use a workqueue or smp_call_function_single */ -if (!alloc_cpumask_var (&oldmask,GFP_KERNEL )) -return -ENOMEM ; - -cpumask_copy (oldmask,tsk_cpus_allowed (current)); -set_cpus_allowed_ptr (current,cpumask_of (pol->cpu)); - -if (smp_processor_id () != pol->cpu) { - printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); - goto err_out; - } -if (pending_bit_stuck ()) { printk(KERN_ERR PFX "failing targ, change pending bit set\n"); - goto err_out; +return -EIO ; }pr_debug ("targ: cpu %d, %d kHz, min %d, max %d, relation %d\n" , pol->cpu, targfreq, pol->min, pol->max, relation);if (query_current_values_with_pending_wait (data)) - goto err_out; +return -EIO ;if (cpu_family !=CPU_HW_PSTATE ) { pr_debug("targ: curr fid 0x%x, vid 0x%x\n",
@@ -1189,7 +1182,7 @@ static int powernowk8_target(struct cpufif (cpufreq_frequency_table_target (pol, data->powernow_table, targfreq, relation, &newstate)) - goto err_out; +return -EIO ;mutex_lock (&fidvid_mutex);
@@ -1202,9 +1195,8 @@ static int powernowk8_target(struct cpuf ret =transition_frequency_fidvid (data, newstate);if (ret) { printk(KERN_ERR PFX "transition frequency failed\n"); - ret =1 ;mutex_unlock (&fidvid_mutex); - goto err_out; +return 1 ; }mutex_unlock (&fidvid_mutex);
@@ -1213,12 +1205,25 @@ static int powernowk8_target(struct cpuf data->powernow_table[newstate].index); else pol->cur = find_khz_freq_from_fid(data->currfid); - ret =0 ; -err_out: -set_cpus_allowed_ptr (current, oldmask); -free_cpumask_var (oldmask); -return ret; +return 0 ; +} + +/* Driver entry point to switch to the target frequency */ +static int powernowk8_target (struct cpufreq_policy *pol, +unsigned targfreq,unsigned relation) +{ +struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq, + .relation = relation }; + +/* +* Must run on @pol->cpu. cpufreq core is responsible for ensuring +* that we're bound to the current CPU and pol->cpu stays online. +*/ +if (smp_processor_id () == pol->cpu) +return powernowk8_target_fn (&pta); +else +return work_on_cpu (pol->cpu, powernowk8_target_fn, &pta); }/* Driver entry point to verify the policy and range of frequencies */
Greg Kroah-Hartman
maintainerPATCH 25/127 cciss: fix handling of protocol error
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Stephen M. Cameron" <[email protected]>
commit 2453f5f992717251cfadab6184fbb3ec2f2e8b40 upstream.
If a command completes with a status of CMD_PROTOCOL_ERR, this information should be conveyed to the SCSI mid layer, not dropped on the floor. Unlike a similar bug in the hpsa driver, this bug only affects tape drives and CD and DVD ROM drives in the cciss driver, and to induce it, you have to disconnect (or damage) a cable, so it is not a very likely scenario (which would explain why the bug has gone undetected for the last 10 years.)
--- drivers/block/cciss_scsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/cciss_scsi.c +1 -0
@@ -795,6 +795,7 @@ static void complete_scsi_command(Comman }break ;case CMD_PROTOCOL_ERR : + cmd->result =DID_ERROR <<16 ;dev_warn (&h->pdev->dev,"%p has protocol error\n" , c);break ;
Greg Kroah-Hartman
maintainerPATCH 26/127 vfs: make O_PATH file descriptors usable for fstat()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2 upstream.
We already use them for openat() and friends, but fstat() also wants to be able to use O_PATH file descriptors. This should make it more directly comparable to the O_SEARCH of Solaris.
Note that you could already do the same thing with "fstatat()" and an empty path, but just doing "fstat()" directly is simpler and faster, so there is no reason not to just allow it directly.
See also commit 332a2e1244bd, which did the same thing for fchdir, for the same reasons.
--- fs/stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/stat.c +1 -1
@@ -57,7 +57,7 @@ EXPORT_SYMBOL(vfs_getattr);int vfs_fstat (unsigned int fd,struct kstat *stat) { -struct file *f =fget (fd); +struct file *f =fget_raw (fd);int error = -EBADF ;if (f) {
Greg Kroah-Hartman
maintainerPATCH 27/127 vfs: dcache: use DCACHE_DENTRY_KILLED instead of DCACHE_DISCONNECTED in d_kill()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
commit b161dfa6937ae46d50adce8a7c6b12233e96e7bd upstream.
IBM reported a soft lockup after applying the fix for the rename_lock deadlock. Commit c83ce989cb5f ("VFS: Fix the nfs sillyrename regression in kernel 2.6.38") was found to be the culprit.
The nfs sillyrename fix used DCACHE_DISCONNECTED to indicate that the dentry was killed. This flag can be set on non-killed dentries too, which results in infinite retries when trying to traverse the dentry tree.
This patch introduces a separate flag: DCACHE_DENTRY_KILLED, which is only set in d_kill() and makes try_to_ascend() test only this flag.
IBM reported successful test results with this patch.
--- fs/dcache.c | 4 ++-- include/linux/dcache.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
fs/dcache.c +2 -2
@@ -290,7 +290,7 @@ static struct dentry *d_kill(struct dent* Inform try_to_ascend() that we are no longer attached to the * dentry tree */ - dentry->d_flags |=DCACHE_DISCONNECTED ; + dentry->d_flags |=DCACHE_DENTRY_KILLED ;if (parent)spin_unlock (&parent->d_lock);dentry_iput (dentry);
@@ -1015,7 +1015,7 @@ static struct dentry *try_to_ascend(stru* or deletion */ if (new != old->d_parent || - (old->d_flags &DCACHE_DISCONNECTED ) || + (old->d_flags &DCACHE_DENTRY_KILLED ) || (!locked &&read_seqretry (&rename_lock, seq))) {spin_unlock (&new->d_lock); new =NULL ;
include/linux/dcache.h +2 -0
@@ -220,6 +220,8 @@ struct dentry_operations {#define DCACHE_MANAGED_DENTRY \ (DCACHE_MOUNTED|DCACHE_NEED_AUTOMOUNT|DCACHE_MANAGE_TRANSIT) +#define DCACHE_DENTRY_KILLED 0x100000 +extern seqlock_t rename_lock;static inline int dname_external (struct dentry *dentry)
Greg Kroah-Hartman
maintainerPATCH 28/127 netconsole: remove a redundant netconsole_target_put()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amerigo Wang <[email protected]>
commit 72d3eb13b5c0abe7d63efac41f39c5b644c7bbaa upstream.
This netconsole_target_put() is obviously redundant, and it causes a kernel segfault when removing a bridge device which has netconsole running on it.
This is caused by:
commit 8d8fc29d02a33e4bd5f4fa47823c1fd386346093 Author: Amerigo Wang <[email protected]> Date: Thu May 19 21:39:10 2011 +0000 netpoll: disable netpoll when enslave a device
--- drivers/net/netconsole.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/netconsole.c +0 -1
@@ -652,7 +652,6 @@ static int netconsole_netdev_event(struc flags);dev_put (nt->np.dev); nt->np.dev =NULL ; -netconsole_target_put (nt); } nt->enabled =0 ; stopped = true;
Greg Kroah-Hartman
maintainerPATCH 29/127 eCryptfs: Copy up attributes of the lower target inode after rename
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
commit 8335eafc2859e1a26282bef7c3d19f3d68868b8a upstream.
After calling into the lower filesystem to do a rename, the lower target inode's attributes were not copied up to the eCryptfs target inode. This resulted in the eCryptfs target inode staying around, rather than being evicted, because i_nlink was not updated for the eCryptfs inode. This also meant that eCryptfs didn't do the final iput() on the lower target inode so it stayed around, as well. This would result in a failure to free up space occupied by the target file in the rename() operation. Both target inodes would eventually be evicted when the eCryptfs filesystem was unmounted.
This patch calls fsstack_copy_attr_all() after the lower filesystem does its ->rename() so that important inode attributes, such as i_nlink, are updated at the eCryptfs layer. ecryptfs_evict_inode() is now called and eCryptfs can drop its final reference on the lower inode.
http://launchpad.net/bugs/561129
--- fs/ecryptfs/inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ecryptfs/inode.c +5 -0
@@ -653,6 +653,7 @@ ecryptfs_rename(struct inode *old_dir, sstruct dentry *lower_old_dir_dentry;struct dentry *lower_new_dir_dentry;struct dentry *trap =NULL ; +struct inode *target_inode; lower_old_dentry =ecryptfs_dentry_to_lower (old_dentry); lower_new_dentry =ecryptfs_dentry_to_lower (new_dentry);
@@ -660,6 +661,7 @@ ecryptfs_rename(struct inode *old_dir, sdget (lower_new_dentry); lower_old_dir_dentry =dget_parent (lower_old_dentry); lower_new_dir_dentry =dget_parent (lower_new_dentry); + target_inode = new_dentry->d_inode; trap =lock_rename (lower_old_dir_dentry, lower_new_dir_dentry);/* source should not be ancestor of target */ if (trap == lower_old_dentry) {
@@ -675,6 +677,9 @@ ecryptfs_rename(struct inode *old_dir, s lower_new_dir_dentry->d_inode, lower_new_dentry);if (rc) goto out_lock; +if (target_inode) +fsstack_copy_attr_all (target_inode, +ecryptfs_inode_to_lower (target_inode));fsstack_copy_attr_all (new_dir, lower_new_dir_dentry->d_inode);if (new_dir != old_dir)fsstack_copy_attr_all (old_dir, lower_old_dir_dentry->d_inode);
Greg Kroah-Hartman
maintainerPATCH 30/127 target: Fix ->data_length re-assignment bug with SCSI overflow
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 4c054ba63ad47ef244cfcfa1cea38134620a5bae upstream.
This patch fixes a long-standing bug with SCSI overflow handling where se_cmd->data_length was incorrectly being re-assigned to the larger CDB extracted allocation length, resulting in a number of fabric level errors that would end up causing a session reset in most cases. So instead now:
- Only re-assign se_cmd->data_length durining UNDERFLOW (to use the smaller value)
- Use existing se_cmd->data_length for OVERFLOW (to use the smaller value)
This fix has been tested with the following CDB to generate an SCSI overflow:
sg_raw -r512 /dev/sdc 28 0 0 0 0 0 0 0 9 0
Tested using iscsi-target, tcm_qla2xxx, loopback and tcm_vhost fabric ports. Here is a bit more detail on each case:
- iscsi-target: Bug with open-iscsi with overflow, sg_raw returns
-3584 bytes of data.
- tcm_qla2xxx: Working as expected, returnins 512 bytes of data
- loopback: sg_raw returns CHECK_CONDITION, from overflow rejection in transport_generic_map_mem_to_cmd()
- tcm_vhost: Same as loopback
--- drivers/target/target_core_transport.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/target/target_core_transport.c +7 -2
@@ -3672,15 +3672,20 @@ static int transport_generic_cmd_sequenc/* Returns CHECK_CONDITION + INVALID_CDB_FIELD */ goto out_invalid_cdb_field; } - +/* +* For the overflow case keep the existing fabric provided +* ->data_length. Otherwise for the underflow case, reset +* ->data_length to the smaller SCSI expected data transfer +* length. +*/ if (size > cmd->data_length) { cmd->se_cmd_flags |=SCF_OVERFLOW_BIT ; cmd->residual_count = (size - cmd->data_length); }else { cmd->se_cmd_flags |=SCF_UNDERFLOW_BIT ; cmd->residual_count = (cmd->data_length - size); + cmd->data_length = size; } - cmd->data_length = size; }transport_set_supported_SAM_opcode (cmd);
Greg Kroah-Hartman
maintainerPATCH 31/127 ALSA: ice1724: Use linear scale for AK4396 volume control.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matteo Frigo <[email protected]>
commit 3737e2be505d872bf2b3c1cd4151b2d2b413d7b5 upstream.
The AK4396 DAC has a linear-scale attentuator, but sound/pci/ice1712/prodigy_hifi.c used a log scale instead, which is not quite right. This patch restores the correct scale, borrowing from the ak4396 code in sound/pci/oxygen/oxygen.c.
--- sound/pci/ice1712/prodigy_hifi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/prodigy_hifi.c +2 -1
@@ -297,6 +297,7 @@ static int ak4396_dac_vol_put(struct snd } static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); +static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);static struct snd_kcontrol_new prodigy_hd2_controls[]__devinitdata = { {
@@ -307,7 +308,7 @@ static struct snd_kcontrol_new prodigy_h .info = ak4396_dac_vol_info, .get = ak4396_dac_vol_get, .put = ak4396_dac_vol_put, - .tlv = { .p = db_scale_wm_dac }, + .tlv = { .p = ak4396_db_scale }, }, };
Greg Kroah-Hartman
maintainerPATCH 32/127 Staging: speakup: fix an improperly-declared variable.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Brannon <[email protected]>
commit 4ea418b8b2fa8a70d0fcc8231b65e67b3a72984b upstream.
A local static variable was declared as a pointer to a string constant. We're assigning to the underlying memory, so it needs to be an array instead.
--- drivers/staging/speakup/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/main.c +1 -1
@@ -1855,7 +1855,7 @@ static void speakup_bits(struct vc_datastatic int handle_goto (struct vc_data *vc,u_char type,u_char ch,u_short key) { -static u_char *goto_buf ="\0\0\0\0\0\0" ; +static u_char goto_buf[8 ];static int num;int maxlen, go_pos;char *cp;
Greg Kroah-Hartman
maintainerPATCH 33/127 staging: vt6656: [BUG] - Failed connection, incorrect endian.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit aa209eef3ce8419ff2926c2fa944dfbfb5afbacb upstream.
Hi,
This patch fixes a bug with driver failing to negotiate a connection.
The bug was traced to commit 203e4615ee9d9fa8d3506b9d0ef30095e4d5bc90
staging: vt6656: removed custom definitions of Ethernet packet types
In that patch, definitions in include/linux/if_ether.h replaced ones in tether.h which had both big and little endian definitions.
include/linux/if_ether.h only refers to big endian values, cpu_to_be16 should be used for the correct endian architectures.
--- drivers/staging/vt6656/dpc.c | 2 +- drivers/staging/vt6656/rxtx.c | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-)
drivers/staging/vt6656/dpc.c +1 -1
@@ -200,7 +200,7 @@ s_vProcessRxMACHeader ( }else if (!compare_ether_addr (pbyRxBuffer, &pDevice->abySNAP_RFC1042[0 ])) { cbHeaderSize +=6 ; pwType = (PWORD ) (pbyRxBufferAddr + cbHeaderSize); -if ((*pwType ==cpu_to_le16 (ETH_P_IPX )) || +if ((*pwType ==cpu_to_be16 (ETH_P_IPX )) || (*pwType ==cpu_to_le16 (0xF380 ))) { cbHeaderSize -=8 ; pwType = (PWORD ) (pbyRxBufferAddr + cbHeaderSize);
drivers/staging/vt6656/rxtx.c +19 -19
@@ -1701,7 +1701,7 @@ s_bPacketToWirelessUsb(// 802.1H if (ntohs (psEthHeader->wType) >ETH_DATA_LEN ) {if (pDevice->dwDiagRefCount ==0 ) { -if ((psEthHeader->wType ==cpu_to_le16 (ETH_P_IPX )) || +if ((psEthHeader->wType ==cpu_to_be16 (ETH_P_IPX )) || (psEthHeader->wType ==cpu_to_le16 (0xF380 ))) {memcpy ((PBYTE ) (pbyPayloadHead), abySNAP_Bridgetunnel,6 );
@@ -2840,10 +2840,10 @@ int nsDMA_tx_packet(PSDevice pDevice, un Packet_Type = skb->data[ETH_HLEN +1 ]; Descriptor_type = skb->data[ETH_HLEN +1 +1 +2 ]; Key_info = (skb->data[ETH_HLEN +1 +1 +2 +1 ] <<8 )|(skb->data[ETH_HLEN +1 +1 +2 +2 ]); -if (pDevice->sTxEthHeader.wType ==cpu_to_le16 (ETH_P_PAE )) { -/* 802.1x OR eapol-key challenge frame transfer */ -if (((Protocol_Version ==1 ) || (Protocol_Version ==2 )) && - (Packet_Type ==3 )) { +if (pDevice->sTxEthHeader.wType ==cpu_to_be16 (ETH_P_PAE )) { +/* 802.1x OR eapol-key challenge frame transfer */ +if (((Protocol_Version ==1 ) || (Protocol_Version ==2 )) && + (Packet_Type ==3 )) { bTxeapol_key = TRUE;if (!(Key_info &BIT3 ) &&//WPA or RSN group-key challenge (Key_info &BIT8 ) && (Key_info &BIT9 )) {//send 2/2 key
@@ -2989,19 +2989,19 @@ int nsDMA_tx_packet(PSDevice pDevice, un } } -if (pDevice->sTxEthHeader.wType ==cpu_to_le16 (ETH_P_PAE )) { -if (pDevice->byBBType !=BB_TYPE_11A ) { - pDevice->wCurrentRate =RATE_1M ; - pDevice->byACKRate =RATE_1M ; - pDevice->byTopCCKBasicRate =RATE_1M ; - pDevice->byTopOFDMBasicRate =RATE_6M ; - }else { - pDevice->wCurrentRate =RATE_6M ; - pDevice->byACKRate =RATE_6M ; - pDevice->byTopCCKBasicRate =RATE_1M ; - pDevice->byTopOFDMBasicRate =RATE_6M ; - } - } +if (pDevice->sTxEthHeader.wType ==cpu_to_be16 (ETH_P_PAE )) { +if (pDevice->byBBType !=BB_TYPE_11A ) { + pDevice->wCurrentRate =RATE_1M ; + pDevice->byACKRate =RATE_1M ; + pDevice->byTopCCKBasicRate =RATE_1M ; + pDevice->byTopOFDMBasicRate =RATE_6M ; + }else { + pDevice->wCurrentRate =RATE_6M ; + pDevice->byACKRate =RATE_6M ; + pDevice->byTopCCKBasicRate =RATE_1M ; + pDevice->byTopOFDMBasicRate =RATE_6M ; + } + } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma_tx: pDevice->wCurrentRate = %d\n",
@@ -3017,7 +3017,7 @@ int nsDMA_tx_packet(PSDevice pDevice, unif (bNeedEncryption == TRUE) {DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "ntohs Pkt Type=%04x\n" ,ntohs (pDevice->sTxEthHeader.wType)); -if ((pDevice->sTxEthHeader.wType) ==cpu_to_le16 (ETH_P_PAE )) { +if ((pDevice->sTxEthHeader.wType) ==cpu_to_be16 (ETH_P_PAE )) { bNeedEncryption = FALSE;DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "Pkt Type=%04x\n" , (pDevice->sTxEthHeader.wType));if ((pMgmt->eCurrMode ==WMAC_MODE_ESS_STA ) && (pMgmt->eCurrState ==WMAC_STATE_ASSOC )) {
Greg Kroah-Hartman
maintainerPATCH 34/127 staging: r8712u: fix bug in r8712_recv_indicatepkt()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit abf02cfc179bb4bd30d05f582d61b3b8f429b813 upstream.
64bit arches have a buggy r8712u driver, let's fix it.
skb->tail must be set properly or network stack behavior is undefined.
Addresses https://bugzilla.redhat.com/show_bug.cgi?id=847525
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=45071
--- drivers/staging/rtl8712/recv_linux.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/staging/rtl8712/recv_linux.c +1 -6
@@ -113,13 +113,8 @@ void r8712_recv_indicatepkt(struct _adapif (skb ==NULL ) goto _recv_indicatepkt_drop; skb->data = precv_frame->u.hdr.rx_data; -#ifdef NET_SKBUFF_DATA_USES_OFFSET - skb->tail = (sk_buff_data_t)(precv_frame->u.hdr.rx_tail - - precv_frame->u.hdr.rx_head); -#else - skb->tail = (sk_buff_data_t )precv_frame->u.hdr.rx_tail; -#endif skb->len = precv_frame->u.hdr.len; +skb_set_tail_pointer (skb, skb->len);if ((pattrib->tcpchk_valid ==1 ) && (pattrib->tcp_chkrpt ==1 )) skb->ip_summed =CHECKSUM_UNNECESSARY ;else
Greg Kroah-Hartman
maintainerPATCH 35/127 staging: comedi: das08: Correct AO output for das08jr-16-ao
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 61ed59ed09e6ad2b8395178ea5ad5f653bba08e3 upstream.
Don't zero out bits 15..12 of the data value in das08jr_ao_winsn() as that knobbles the upper three-quarters of the output range for the 'das08jr-16-ao' board.
--- drivers/staging/comedi/drivers/das08.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/das08.c +1 -1
@@ -655,7 +655,7 @@ static int das08jr_ao_winsn(struct comedint chan; lsb = data[0 ] &0xff ; - msb = (data[0 ] >>8 ) &0xf ; + msb = (data[0 ] >>8 ) &0xff ; chan =CR_CHAN (insn->chanspec);
Greg Kroah-Hartman
maintainerPATCH 36/127 USB: option: replace ZTE K5006-Z entry with vendor class rule
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
commit ba9edaa468869a8cea242a411066b0f490751798 upstream.
Fix the ZTE K5006-Z entry so that it actually matches anything
commit f1b5c997 USB: option: add ZTE K5006-Z
added a device specific entry assuming that the device would use class/subclass/proto == ff/ff/ff like other ZTE devices. It turns out that ZTE has started using vendor specific subclass and protocol codes:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=19d2 ProdID=1018 Rev= 0.00 S: Manufacturer=ZTE,Incorporated S: Product=ZTE LTE Technologies MSM S: SerialNumber=MF821Vxxxxxxx C:* #Ifs= 5 Cfg#= 1 Atr=c0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=86 Prot=10 Driver=(none) E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=02 Prot=05 Driver=(none) E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=01 Driver=(none) E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=06 Prot=00 Driver=qmi_wwan E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
We do not have any information on how ZTE intend to use these codes, but let us assume for now that the 3 sets matching serial functions in the K5006-Z always will identify a serial function in a ZTE device.
--- drivers/usb/serial/option.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/serial/option.c +4 -2
@@ -882,8 +882,6 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff), - .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
@@ -1088,6 +1086,10 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, + { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, + { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, { USB_DEVICE(ALINK_VENDOR_ID, DLINK_PRODUCT_DWM_652_U5) }, /* Yes, ALINK_VENDOR_ID */
Greg Kroah-Hartman
maintainerPATCH 37/127 perf_event: Switch to internal refcount, fix race with close()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit a6fa941d94b411bbd2b6421ffbde6db3c93e65ab upstream.
Don't mess with file refcounts (or keep a reference to file, for that matter) in perf_event. Use explicit refcount of its own instead. Deal with the race between the final reference to event going away and new children getting created for it by use of atomic_long_inc_not_zero() in inherit_event(); just have the latter free what it had allocated and return NULL, that works out just fine (children of siblings of something doomed are created as singletons, same as if the child of leader had been created and immediately killed).
--- include/linux/perf_event.h | 2 - kernel/events/core.c | 62 +++++++++++++++++++++++---------------------- 2 files changed, 34 insertions(+), 30 deletions(-)
include/linux/perf_event.h +1 -1
@@ -807,7 +807,7 @@ struct perf_event {struct hw_perf_event hw;struct perf_event_context *ctx; -struct file *filp; +atomic_long_t refcount;/* * These accumulate total time (in nanoseconds) that children
kernel/events/core.c +33 -29
160 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 38/127 mmc: mxs-mmc: fix deadlock in SDIO IRQ case
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lauri Hintsala <[email protected]>
commit 1af36b2a993dddfa3d6860ec4879c9e8abc9b976 upstream.
Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_irq_handler.
Backtrace:
[ 79.660000] =============================================
[ 79.660000] [ INFO: possible recursive locking detected ]
[ 79.660000] 3.4.0-00009-g3e96082-dirty #11 Not tainted
[ 79.660000] ---------------------------------------------
[ 79.660000] swapper/0 is trying to acquire lock:
[ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026ea3c>] mxs_mmc_enable_sdio_irq+0x18/0xd4
[ 79.660000]
[ 79.660000] but task is already holding lock:
[ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8
[ 79.660000]
[ 79.660000] other info that might help us debug this:
[ 79.660000] Possible unsafe locking scenario:
[ 79.660000]
[ 79.660000] CPU0
[ 79.660000] ----
[ 79.660000] lock(&(&host->lock)->rlock#2);
[ 79.660000] lock(&(&host->lock)->rlock#2);
[ 79.660000]
[ 79.660000] *** DEADLOCK ***
[ 79.660000]
[ 79.660000] May be due to missing lock nesting notation
[ 79.660000]
[ 79.660000] 1 lock held by swapper/0:
[ 79.660000] #0: (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8
[ 79.660000]
[ 79.660000] stack backtrace:
[ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c005f9c0>] (__lock_acquire+0x1948/0x1d48)
[ 79.660000] [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) from [<c005fea0>] (lock_acquire+0xe0/0xf8)
[ 79.660000] [<c005fea0>] (lock_acquire+0xe0/0xf8) from [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58)
[ 79.660000] [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4)
[ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8)
[ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254)
[ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c)
[ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110)
[ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50)
[ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84)
[ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60)
[ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40)
[ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc)
[ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8)
[ 79.660000] BUG: spinlock lockup on CPU#0, swapper/0
[ 79.660000] lock: c398cb2c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0
[ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144)
[ 79.660000] [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) from [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58)
[ 79.660000] [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4)
[ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8)
[ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254)
[ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c)
[ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110)
[ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50)
[ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84)
[ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60)
[ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40)
[ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc)
[ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8)--- drivers/mmc/host/mxs-mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/mxs-mmc.c +2 -2
@@ -278,11 +278,11 @@ static irqreturn_t mxs_mmc_irq_handler(iwritel (stat &MXS_MMC_IRQ_BITS , host->base +HW_SSP_CTRL1 +MXS_CLR_ADDR ); +spin_unlock (&host->lock); +if ((stat &BM_SSP_CTRL1_SDIO_IRQ ) && (stat &BM_SSP_CTRL1_SDIO_IRQ_EN ))mmc_signal_sdio_irq (host->mmc); -spin_unlock (&host->lock); -if (stat &BM_SSP_CTRL1_RESP_TIMEOUT_IRQ ) cmd->error = -ETIMEDOUT ;else if (stat &BM_SSP_CTRL1_RESP_ERR_IRQ )
Greg Kroah-Hartman
maintainerPATCH 39/127 mmc: sdhci-esdhc: break out early if clock is 0
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shawn Guo <[email protected]>
commit 74f330bceaa7b88d06062e1cac3d519a3dfc041e upstream.
Since commit 30832ab56 ("mmc: sdhci: Always pass clock request value zero to set_clock host op") was merged, esdhc_set_clock starts hitting "if (clock == 0)" where ESDHC_SYSTEM_CONTROL has been operated. This causes SDHCI card-detection function being broken. Fix the regression by moving "if (clock == 0)" above ESDHC_SYSTEM_CONTROL operation.
--- drivers/mmc/host/sdhci-esdhc.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-esdhc.h +3 -3
@@ -48,14 +48,14 @@ static inline void esdhc_set_clock(strucint div =1 ;u32 temp; +if (clock ==0 ) + goto out; + temp =sdhci_readl (host,ESDHC_SYSTEM_CONTROL ); temp &= ~(ESDHC_CLOCK_IPGEN |ESDHC_CLOCK_HCKEN |ESDHC_CLOCK_PEREN |ESDHC_CLOCK_MASK );sdhci_writel (host, temp,ESDHC_SYSTEM_CONTROL ); -if (clock ==0 ) - goto out; -while (host->max_clk / pre_div /16 > clock && pre_div <256 ) pre_div *=2 ;
Greg Kroah-Hartman
maintainerPATCH 40/127 ahci: Add alternate identifier for the 88SE9172
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 17c60c6b763cb5b83b0185e7d38d01d18e55a05a upstream.
This can also appear as 0x9192. Reported in bugzilla and confirmed with the board documentation for these boards.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=42970
--- drivers/ata/ahci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/ata/ahci.c +2 -0
@@ -394,6 +394,8 @@ static const struct pci_device_id ahci_p .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ { PCI_DEVICE(0x1b4b, 0x917a), .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ + { PCI_DEVICE(0x1b4b, 0x9192), + .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ { PCI_DEVICE(0x1b4b, 0x91a3), .driver_data = board_ahci_yes_fbs },
Greg Kroah-Hartman
maintainerPATCH 41/127 kobject: fix oops with "input0: bad kobj_uevent_env content in show_uevent()"
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 60e233a56609fd963c59e99bd75c663d63fa91b6 upstream.
Quoted 18 lines · Fengguang Wu
After the __devinit* removal series, I can still get kernel panic in
show_uevent(). So there are more sources of bug..Debug patch:
(quoted diff) +4
-1@@ -343,8 +343,11 @@ static ssize_t show_uevent(struct device goto out; /* copy keys to file */ - for (i = 0; i < env->envp_idx; i++) + dev_err(dev, "uevent %d env[%d]: %s/.../%s\n", env->buflen, env->envp_idx, top_kobj->name, dev->kobj.name); + for (i = 0; i < env->envp_idx; i++) { + printk(KERN_ERR "uevent %d env[%d]: %s\n", (int)count, i, env->envp[i]); count += sprintf(&buf[count], "%s\n", env->envp[i]); + }Oops message, the env[] is again not properly initilized:
Quoted 2 lines
[ 44.068623] input input0: uevent 61 env[805306368]: input0/.../input0 [ 44.069552] uevent 0 env[0]: (null)
This is a completely different CONFIG_HOTPLUG problem, only demonstrating another reason why CONFIG_HOTPLUG should go away. I had a hard time trying to disable it anyway ;-)
The problem this time is lots of code assuming that a call to add_uevent_var() will guarantee that env->buflen > 0. This is not true if CONFIG_HOTPLUG is unset. So things like this end up overwriting env->envp_idx because the array index is -1:
if (add_uevent_var(env, "MODALIAS="))
return -ENOMEM;
len = input_print_modalias(&env->buf[env->buflen - 1],
sizeof(env->buf) - env->buflen,
dev, 0);Don't know what the best action is, given that there seem to be a *lot* of this around the kernel. This patch "fixes" the problem for me, but I don't know if it can be considered an appropriate fix.
[ It is the correct fix for now, for 3.7 forcing CONFIG_HOTPLUG to always be on is the longterm fix, but it's too late for 3.6 and older kernels to resolve this that way - gregkh ]
--- include/linux/kobject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/kobject.h +1 -1
@@ -228,7 +228,7 @@ static inline int kobject_uevent_env(strstatic inline __attribute__((format (printf,2 ,3 )))int add_uevent_var (struct kobj_uevent_env *env,const char *format, ...) -{return 0 ; } +{return -ENOMEM ; }static inline int kobject_action_type (const char *buf,size_t count,enum kobject_action *type)
Greg Kroah-Hartman
maintainerPATCH 42/127 Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit 67a806d9499353fabd5b5ff07337f3aa88a1c3ba upstream.
The following build error occurred during an alpha build:
net/core/sock.c:274:36: error: initializer element is not constant
Dave Anglin says:
Quoted 4 lines
Here is the line in sock.i:
struct
static_keymemalloc_socks= ((structstatic_key) { .enabled = ((atomic_t) { (0) }) });
The above line contains two compound literals. It also uses a designated initializer to initialize the field enabled. A compound literal is not a constant expression.
The location of the above statement isn't fully clear, but if a compound literal occurs outside the body of a function, the initializer list must consist of constant expressions.
--- arch/alpha/include/asm/atomic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/alpha/include/asm/atomic.h +2 -2
@@ -14,8 +14,8 @@*/ -#define ATOMIC_INIT (i) ( (atomic_t) { (i) } ) -#define ATOMIC64_INIT (i) ( (atomic64_t) { (i) } ) +#define ATOMIC_INIT (i) { (i) } +#define ATOMIC64_INIT (i) { (i) }#define atomic_read (v) (*(volatile int *)&(v)->counter)#define atomic64_read (v) (*(volatile long *)&(v)->counter)
Greg Kroah-Hartman
maintainerPATCH 43/127 md: Dont truncate size at 4TB for RAID0 and Linear
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 667a5313ecd7308d79629c0738b0db588b0b0a4e upstream.
commit 27a7b260f71439c40546b43588448faac01adb93
md: Fix handling for devices from 2TB to 4TB in 0.90 metadata.
changed 0.90 metadata handling to truncated size to 4TB as that is all that 0.90 can record.
However for RAID0 and Linear, 0.90 doesn't need to record the size, so this truncation is not needed and causes working arrays to become too small.
So avoid the truncation for RAID0 and Linear
This bug was introduced in 3.1 and is suitable for any stable kernels from then onwards.
As the offending commit was tagged for 'stable', any stable kernel that it was applied to should also get this patch. That includes at least 2.6.32, 2.6.33 and 3.0. (Thanks to Ben Hutchings for providing that list).
--- drivers/md/md.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/md/md.c +6 -3
@@ -1096,8 +1096,11 @@ static int super_90_load(mdk_rdev_t *rde ret =0 ; } rdev->sectors = rdev->sb_start; -/* Limit to 4TB as metadata cannot record more than that */ -if (rdev->sectors >= (2ULL <<32 )) +/* Limit to 4TB as metadata cannot record more than that. +* (not needed for Linear and RAID0 as metadata doesn't +* record this size) +*/ +if (rdev->sectors >= (2ULL <<32 ) && sb->level >=1 ) rdev->sectors = (2ULL <<32 ) -2 ;if (rdev->sectors < ((sector_t )sb->size) *2 && sb->level >=1 )
@@ -1379,7 +1382,7 @@ super_90_rdev_size_change(mdk_rdev_t *rd/* Limit to 4TB as metadata cannot record more than that. * 4TB == 2^32 KB, or 2*2^32 sectors. */ -if (num_sectors >= (2ULL <<32 )) +if (num_sectors >= (2ULL <<32 ) && rdev->mddev->level >=1 ) num_sectors = (2ULL <<32 ) -2 ;md_super_write (rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page);
Greg Kroah-Hartman
maintainerPATCH 44/127 mm/page_alloc: fix the page address of higher pages buddy calculation
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Haifeng <[email protected]>
commit 0ba8f2d59304dfe69b59c034de723ad80f7ab9ac upstream.
The heuristic method for buddy has been introduced since commit 43506fad21ca ("mm/page_alloc.c: simplify calculation of combined index of adjacent buddy lists"). But the page address of higher page's buddy was wrongly calculated, which will lead page_is_buddy to fail for ever. IOW, the heuristic method would be disabled with the wrong page address of higher page's buddy.
Calculating the page address of higher page's buddy should be based higher_page with the offset between index of higher page and index of higher page's buddy.
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -540,7 +540,7 @@ static inline void __free_one_page(struc combined_idx = buddy_idx & page_idx; higher_page = page + (combined_idx - page_idx); buddy_idx =__find_buddy_index (combined_idx, order +1 ); - higher_buddy = page + (buddy_idx - combined_idx); + higher_buddy = higher_page + (buddy_idx - combined_idx);if (page_is_buddy (higher_page, higher_buddy, order +1 )) {list_add_tail (&page->lru, &zone->free_area[order].free_list[migratetype]);
Greg Kroah-Hartman
maintainerPATCH 45/127 drivers/rtc/rtc-twl.c: ensure all interrupts are disabled during probe
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Hilman <[email protected]>
commit 8dcebaa9a0ae8a0487f4342f3d56d2cb1c980860 upstream.
On some platforms, bootloaders are known to do some interesting RTC programming. Without going into the obscurities as to why this may be the case, suffice it to say the the driver should not make any assumptions about the state of the RTC when the driver loads. In particular, the driver probe should be sure that all interrupts are disabled until otherwise programmed.
This was discovered when finding bursty I2C traffic every second on Overo platforms. This I2C overhead was keeping the SoC from hitting deep power states. The cause was found to be the RTC firing every second on the I2C-connected TWL PMIC.
Special thanks to Felipe Balbi for suggesting to look for a rogue driver as the source of the I2C traffic rather than the I2C driver itself.
Special thanks to Steve Sakoman for helping track down the source of the continuous RTC interrups on the Overo boards.
--- drivers/rtc/rtc-twl.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/rtc/rtc-twl.c +5 -0
@@ -490,6 +490,11 @@ static int __devinit twl_rtc_probe(struc goto out2; } +/* ensure interrupts are disabled, bootloaders can be strange */ + ret =twl_rtc_write_u8 (0 ,REG_RTC_INTERRUPTS_REG ); +if (ret <0 ) +dev_warn (&pdev->dev,"unable to disable interrupt\n" ); +/* init cached IRQ enable bits */ ret =twl_rtc_read_u8 (&rtc_irq_bits,REG_RTC_INTERRUPTS_REG );if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 46/127 hwmon: (twl4030-madc-hwmon) Initialize uninitialized structure elements
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 73d7c119255615a26070f9d6cdb722a166a29015 upstream.
twl4030_madc_conversion uses do_avg and type structure elements of twl4030_madc_request. Initialize structure to avoid random operation.
Fix for: Coverity CID 200794 Uninitialized scalar variable.
--- drivers/hwmon/twl4030-madc-hwmon.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/hwmon/twl4030-madc-hwmon.c +5 -4
@@ -44,12 +44,13 @@ static ssize_t madc_read(struct device * struct device_attribute *devattr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); -struct twl4030_madc_request req; +struct twl4030_madc_request req = { + .channels =1 << attr->index, + .method =TWL4030_MADC_SW2 , + .type =TWL4030_MADC_WAIT , + };long val; - req.channels = (1 << attr->index); - req.method =TWL4030_MADC_SW2 ; - req.func_cb =NULL ; val =twl4030_madc_conversion (&req);if (val <0 )return val;
Greg Kroah-Hartman
maintainerPATCH 47/127 can: mcp251x: avoid repeated frame bug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benoît Locher <[email protected]>
commit cab32f39dcc5b35db96497dc0a026b5dea76e4e7 upstream.
The MCP2515 has a silicon bug causing repeated frame transmission, see section 5 of MCP2515 Rev. B Silicon Errata Revision G (March 2007).
Basically, setting TXBnCTRL.TXREQ in either SPI mode (00 or 11) will eventually cause the bug. The workaround proposed by Microchip is to use mode 00 and send a RTS command on the SPI bus to initiate the transmission.
--- drivers/net/can/mcp251x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/net/can/mcp251x.c +10 -1
@@ -83,6 +83,11 @@#define INSTRUCTION_LOAD_TXB (n) (0x40 + 2 * (n))#define INSTRUCTION_READ_RXB (n) (((n) == 0) ? 0x90 : 0x94)#define INSTRUCTION_RESET 0xC0 +#define RTS_TXB0 0x01 +#define RTS_TXB1 0x02 +#define RTS_TXB2 0x04 +#define INSTRUCTION_RTS (n) (0x80 | ((n) & 0x07)) +/* MPC251x registers */ #define CANSTAT 0x0e
@@ -397,6 +402,7 @@ static void mcp251x_hw_tx_frame(struct sstatic void mcp251x_hw_tx (struct spi_device *spi,struct can_frame *frame,int tx_buf_idx) { +struct mcp251x_priv *priv =dev_get_drvdata (&spi->dev);u32 sid, eid, exide, rtr;u8 buf[SPI_TRANSFER_BUF_LEN ];
@@ -418,7 +424,10 @@ static void mcp251x_hw_tx(struct spi_dev buf[TXBDLC_OFF ] = (rtr <<DLC_RTR_SHIFT ) | frame->can_dlc;memcpy (buf +TXBDAT_OFF , frame->data, frame->can_dlc);mcp251x_hw_tx_frame (spi, buf, frame->can_dlc, tx_buf_idx); -mcp251x_write_reg (spi,TXBCTRL (tx_buf_idx),TXBCTRL_TXREQ ); + +/* use INSTRUCTION_RTS, to avoid "repeated frame problem" */ + priv->spi_tx_buf[0 ] =INSTRUCTION_RTS (1 << tx_buf_idx); +mcp251x_spi_trans (priv->spi,1 ); } static void mcp251x_hw_rx_frame(struct spi_device *spi, u8 *buf,
Greg Kroah-Hartman
maintainerPATCH 48/127 mm/ia64: fix a memory block size bug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianguo Wu <[email protected]>
commit 05cf96398e1b6502f9e191291b715c7463c9d5dd upstream.
I found following definition in include/linux/memory.h, in my IA64 platform, SECTION_SIZE_BITS is equal to 32, and MIN_MEMORY_BLOCK_SIZE will be 0.
#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS)
Because MIN_MEMORY_BLOCK_SIZE is int type and length of 32bits, so MIN_MEMORY_BLOCK_SIZE(1 << 32) will will equal to 0. Actually when SECTION_SIZE_BITS >= 31, MIN_MEMORY_BLOCK_SIZE will be wrong. This will cause wrong system memory infomation in sysfs.
I think it should be:
#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)
And "echo offline > memory0/state" will cause following call trace:
kernel BUG at mm/memory_hotplug.c:885!
sh[6455]: bugcheck! 0 [1]
Pid: 6455, CPU 0, comm: sh
psr : 0000101008526030 ifs : 8000000000000fa4 ip : [<a0000001008c40f0>] Not tainted (3.6.0-rc1)
ip is at offline_pages+0x210/0xee0
Call Trace:
show_stack+0x80/0xa0
show_regs+0x640/0x920
die+0x190/0x2c0
die_if_kernel+0x50/0x80
ia64_bad_break+0x3d0/0x6e0
ia64_native_leave_kernel+0x0/0x270
offline_pages+0x210/0xee0
alloc_pages_current+0x180/0x2a0--- include/linux/memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/memory.h +1 -1
@@ -20,7 +20,7 @@#include <linux/compiler.h> #include <linux/mutex.h> -#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS) +#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)struct memory_block {unsigned long start_section_nr;
Greg Kroah-Hartman
maintainerPATCH 49/127 memory hotplug: fix section info double registration bug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: qiuxishi <[email protected]>
commit f14851af0ebb32745c6c5a2e400aa0549f9d20df upstream.
There may be a bug when registering section info. For example, on my Itanium platform, the pfn range of node0 includes the other nodes, so other nodes' section info will be double registered, and memmap's page count will equal to 3.
node0: start_pfn=0x100, spanned_pfn=0x20fb00, present_pfn=0x7f8a3, => 0x000100-0x20fc00
node1: start_pfn=0x80000, spanned_pfn=0x80000, present_pfn=0x80000, => 0x080000-0x100000 node2: start_pfn=0x100000, spanned_pfn=0x80000, present_pfn=0x80000, => 0x100000-0x180000 node3: start_pfn=0x180000, spanned_pfn=0x80000, present_pfn=0x80000, => 0x180000-0x200000
free_all_bootmem_node()
register_page_bootmem_info_node()
register_page_bootmem_info_section()
When hot remove memory, we can't free the memmap's page because page_count() is 2 after put_page_bootmem().
sparse_remove_one_section()
free_section_usemap()
free_map_bootmem()
put_page_bootmem()
--- mm/memory_hotplug.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
mm/memory_hotplug.c +10 -6
@@ -116,9 +116,6 @@ static void register_page_bootmem_info_sstruct mem_section *ms;struct page *page, *memmap; -if (!pfn_valid (start_pfn)) -return ; - section_nr =pfn_to_section_nr (start_pfn); ms =__nr_to_section (section_nr);
@@ -177,9 +174,16 @@ void register_page_bootmem_info_node(str end_pfn = pfn + pgdat->node_spanned_pages;/* register_section info */ -for (; pfn < end_pfn; pfn +=PAGES_PER_SECTION ) - register_page_bootmem_info_section(pfn); - +for (; pfn < end_pfn; pfn +=PAGES_PER_SECTION ) { +/* +* Some platforms can assign the same pfn to multiple nodes - on +* node0 as well as nodeN. To avoid registering a pfn against +* multiple nodes we check that this pfn does not already +* reside in some other node. +*/ +if (pfn_valid (pfn) && (pfn_to_nid (pfn) == node)) +register_page_bootmem_info_section (pfn); + } }#endif /* !CONFIG_SPARSEMEM_VMEMMAP */
Greg Kroah-Hartman
maintainerPATCH 50/127 xen/boot: Disable NUMA for PV guests.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 8d54db795dfb1049d45dc34f0dddbc5347ec5642 upstream.
The hypervisor is in charge of allocating the proper "NUMA" memory and dealing with the CPU scheduler to keep them bound to the proper NUMA node. The PV guests (and PVHVM) have no inkling of where they run and do not need to know that right now. In the future we will need to inject NUMA configuration data (if a guest spans two or more NUMA nodes) so that the kernel can make the right choices. But those patches are not yet present.
In the meantime, disable the NUMA capability in the PV guest, which also fixes a bootup issue. Andre says:
"we see Dom0 crashes due to the kernel detecting the NUMA topology not by ACPI, but directly from the northbridge (CONFIG_AMD_NUMA).
This will detect the actual NUMA config of the physical machine, but will crash about the mismatch with Dom0's virtual memory. Variation of the theme: Dom0 sees what it's not supposed to see.
This happens with the said config option enabled and on a machine where this scanning is still enabled (K8 and Fam10h, not Bulldozer class)
We have this dump then:
NUMA: Warning: node ids are out of bound, from=-1 to=-1 distance=10 Scanning NUMA topology in Northbridge 24
Number of physical nodes 4
Node 0 MemBase 0000000000000000 Limit 0000000040000000 Node 1 MemBase 0000000040000000 Limit 0000000138000000 Node 2 MemBase 0000000138000000 Limit 00000001f8000000 Node 3 MemBase 00000001f8000000 Limit 0000000238000000 Initmem setup node 0 0000000000000000-0000000040000000
NODE_DATA [000000003ffd9000 - 000000003fffffff]
Initmem setup node 1 0000000040000000-0000000138000000
NODE_DATA [0000000137fd9000 - 0000000137ffffff]
Initmem setup node 2 0000000138000000-00000001f8000000
NODE_DATA [00000001f095e000 - 00000001f0984fff]
Initmem setup node 3 00000001f8000000-0000000238000000 Cannot find 159744 bytes in node 3
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff81d220e6>] __alloc_bootmem_node+0x43/0x96 Pid: 0, comm: swapper Not tainted 3.3.6 #1 AMD Dinar/Dinar RIP: e030:[<ffffffff81d220e6>] [<ffffffff81d220e6>] __alloc_bootmem_node+0x43/0x96 .. snip.. [<ffffffff81d23024>] sparse_early_usemaps_alloc_node+0x64/0x178 [<ffffffff81d23348>] sparse_init+0xe4/0x25a [<ffffffff81d16840>] paging_init+0x13/0x22 [<ffffffff81d07fbb>] setup_arch+0x9c6/0xa9b [<ffffffff81683954>] ? printk+0x3c/0x3e [<ffffffff81d01a38>] start_kernel+0xe5/0x468 [<ffffffff81d012cf>] x86_64_start_reservations+0xba/0xc1 [<ffffffff81007153>] ? xen_setup_runstate_info+0x2c/0x36 [<ffffffff81d050ee>] xen_start_kernel+0x565/0x56c
"
so we just disable NUMA scanning by setting numa_off=1.
--- arch/x86/xen/setup.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/xen/setup.c +4 -0
@@ -15,6 +15,7 @@#include <asm/e820.h> #include <asm/setup.h> #include <asm/acpi.h> +#include <asm/numa.h> #include <asm/xen/hypervisor.h> #include <asm/xen/hypercall.h>
@@ -463,4 +464,7 @@ void __init xen_arch_setup(void) boot_option_idle_override =IDLE_HALT ;fiddle_vdso (); +#ifdef CONFIG_NUMA + numa_off =1 ; +#endif }
Greg Kroah-Hartman
maintainerPATCH 51/127 hwmon: (fam15h_power) Tweak runavg_range on resume
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Herrmann <[email protected]>
commit 5f0ecb907deb1e6f28071ee3bd568903b9da1be4 upstream.
The quirk introduced with commit 00250ec90963b7ef6678438888f3244985ecde14 (hwmon: fam15h_power: fix bogus values with current BIOSes) is not only required during driver load but also when system resumes from suspend. The BIOS might set the previously recommended (but unsuitable) initilization value for the running average range register during resume.
--- drivers/hwmon/fam15h_power.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/hwmon/fam15h_power.c +13 -2
@@ -128,12 +128,12 @@ static bool __devinit fam15h_power_is_in* counter saturations resulting in bogus power readings. * We correct this value ourselves to cope with older BIOSes. */ -static DEFINE_PCI_DEVICE_TABLE (affected_device) = { +static const struct pci_device_id affected_device[] = { {PCI_VDEVICE (AMD ,PCI_DEVICE_ID_AMD_15H_NB_F4 ) }, {0 } }; -static void __devinit tweak_runavg_range (struct pci_dev *pdev) +static void tweak_runavg_range (struct pci_dev *pdev) {u32 val;
@@ -157,6 +157,16 @@ static void __devinit tweak_runavg_range REG_TDP_RUNNING_AVERAGE, val); } +#ifdef CONFIG_PM +static int fam15h_power_resume (struct pci_dev *pdev) +{ +tweak_runavg_range (pdev); +return 0 ; +} +#else +#define fam15h_power_resume NULL +#endif +static void __devinit fam15h_power_init_data (struct pci_dev *f4,struct fam15h_power_data *data) {
@@ -255,6 +265,7 @@ static struct pci_driver fam15h_power_dr .id_table = fam15h_power_id_table, .probe = fam15h_power_probe, .remove = __devexit_p(fam15h_power_remove), + .resume = fam15h_power_resume, };static int __init fam15h_power_init (void )
Greg Kroah-Hartman
maintainerPATCH 52/127 hwmon: (ads7871) Add name sysfs attribute
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 4e21f4eaa49f78d3e977e316514c941053871c76 upstream.
The 'name' sysfs attribute is mandatory for hwmon devices, but was missing in this driver.
--- drivers/hwmon/ads7871.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hwmon/ads7871.c +9 -0
@@ -133,6 +133,12 @@ static ssize_t show_voltage(struct devic } } +static ssize_t ads7871_show_name (struct device *dev, +struct device_attribute *devattr,char *buf) +{ +return sprintf (buf,"%s\n" ,to_spi_device (dev)->modalias); +} + static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2);
@@ -142,6 +148,8 @@ static SENSOR_DEVICE_ATTR(in5_input, S_I static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); +static DEVICE_ATTR(name, S_IRUGO, ads7871_show_name, NULL); +static struct attribute *ads7871_attributes[] = { &sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in1_input.dev_attr.attr,
@@ -151,6 +159,7 @@ static struct attribute *ads7871_attribu &sensor_dev_attr_in5_input.dev_attr.attr, &sensor_dev_attr_in6_input.dev_attr.attr, &sensor_dev_attr_in7_input.dev_attr.attr, + &dev_attr_name.attr, NULL };
Greg Kroah-Hartman
maintainerPATCH 53/127 SCSI: mpt2sas: Fix for issue - Unable to boot from the drive connected to HBA
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 10cce6d8b5af0b32bc4254ae4a28423a74c0921c upstream.
This patch checks whether HBA is SAS2008 B0 controller.
if it is a SAS2008 B0 controller then it use IO-APIC interrupt instead of MSIX, as SAS2008 B0 controller doesn't support MSIX interrupts.
--- drivers/scsi/mpt2sas/mpt2sas_base.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/scsi/mpt2sas/mpt2sas_base.c +7 -0
@@ -1097,6 +1097,13 @@ _base_check_enable_msix(struct MPT2SAS_Au16 message_control; +/* Check whether controller SAS2008 B0 controller, +if it is SAS2008 B0 controller use IO-APIC instead of MSIX */ +if (ioc->pdev->device ==MPI2_MFGPAGE_DEVID_SAS2008 && + ioc->pdev->revision ==0x01 ) { +return -EINVAL ; + } + base =pci_find_capability (ioc->pdev,PCI_CAP_ID_MSIX );if (!base) { dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "msix not "
Greg Kroah-Hartman
maintainerPATCH 54/127 SCSI: bnx2i: Fixed NULL ptr deference for 1G bnx2 Linux iSCSI offload
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eddie Wai <[email protected]>
commit d6532207116307eb7ecbfa7b9e02c53230096a50 upstream.
This patch fixes the following kernel panic invoked by uninitialized fields in the chip initialization for the 1G bnx2 iSCSI offload.
One of the bits in the chip initialization is being used by the latest firmware to control overflow packets. When this control bit gets enabled erroneously, it would ultimately result in a bad packet placement which would cause the bnx2 driver to dereference a NULL ptr in the placement handler.
This can happen under certain stress I/O environment under the Linux iSCSI offload operation.
This change only affects Broadcom's 5709 chipset.
Unable to handle kernel NULL pointer dereference at 0000000000000008 RIP: [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5 Pid: 0, comm: swapper Tainted: G ---- 2.6.18-333.el5debug #2 RIP: 0010:[<ffffffff881f0e7d>] [<ffffffff881f0e7d>] :bnx2:bnx2_poll_work+0xd0d/0x13c5 RSP: 0018:ffff8101b575bd50 EFLAGS: 00010216 RAX: 0000000000000005 RBX: ffff81007c5fb180 RCX: 0000000000000000 RDX: 0000000000000ffc RSI: 00000000817e8000 RDI: 0000000000000220 RBP: ffff81015bbd7ec0 R08: ffff8100817e9000 R09: 0000000000000000 R10: ffff81007c5fb180 R11: 00000000000000c8 R12: 000000007a25a010 R13: 0000000000000000 R14: 0000000000000005 R15: ffff810159f80558 FS: 0000000000000000(0000) GS:ffff8101afebc240(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 0000000000000008 CR3: 0000000000201000 CR4: 00000000000006a0 Process swapper (pid: 0, threadinfo ffff8101b5754000, task ffff8101afebd820) Stack: 000000000000000b ffff810159f80000 0000000000000040 ffff810159f80520 ffff810159f80500 00cf00cf8008e84b ffffc200100939e0 ffff810009035b20 0000502900000000 000000be00000001 ffff8100817e7810 00d08101b575bea8 Call Trace: <IRQ> [<ffffffff8008e0d0>] show_schedstat+0x1c2/0x25b [<ffffffff881f1886>] :bnx2:bnx2_poll+0xf6/0x231 [<ffffffff8000c9b9>] net_rx_action+0xac/0x1b1 [<ffffffff800125a0>] __do_softirq+0x89/0x133 [<ffffffff8005e30c>] call_softirq+0x1c/0x28 [<ffffffff8006d5de>] do_softirq+0x2c/0x7d [<ffffffff8006d46e>] do_IRQ+0xee/0xf7 [<ffffffff8005d625>] ret_from_intr+0x0/0xa <EOI> [<ffffffff801a5780>] acpi_processor_idle_simple+0x1c5/0x341 [<ffffffff801a573d>] acpi_processor_idle_simple+0x182/0x341 [<ffffffff801a55bb>] acpi_processor_idle_simple+0x0/0x341 [<ffffffff80049560>] cpu_idle+0x95/0xb8 [<ffffffff80078b1c>] start_secondary+0x479/0x488
--- drivers/scsi/bnx2i/bnx2i_hwi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/bnx2i/bnx2i_hwi.c +3 -0
@@ -1260,6 +1260,9 @@ int bnx2i_send_fw_iscsi_init_msg(structint rc =0 ;u64 mask64; +memset (&iscsi_init,0x00 ,sizeof (struct iscsi_kwqe_init1 )); +memset (&iscsi_init2,0x00 ,sizeof (struct iscsi_kwqe_init2 )); +bnx2i_adjust_qp_size (hba); iscsi_init.flags =
Greg Kroah-Hartman
maintainerPATCH 55/127 SCSI: hpsa: fix handling of protocol error
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Stephen M. Cameron" <[email protected]>
commit 256d0eaac87da1e993190846064f339f4c7a63f5 upstream.
If a command status of CMD_PROTOCOL_ERR is received, this information should be conveyed to the SCSI mid layer, not dropped on the floor. CMD_PROTOCOL_ERR may be received from the Smart Array for any commands destined for an external RAID controller such as a P2000, or commands destined for tape drives or CD/DVD-ROM drives, if for instance a cable is disconnected. This mostly affects multipath configurations, as disconnecting a cable on a non-multipath configuration is not going to do anything good regardless of whether CMD_PROTOCOL_ERR is handled correctly or not. Not handling CMD_PROTOCOL_ERR correctly in a multipath configaration involving external RAID controllers may cause data corruption, so this is quite a serious bug. This bug should not normally cause a problem for direct attached disk storage.
--- drivers/scsi/hpsa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/hpsa.c +2 -1
@@ -1209,8 +1209,9 @@ static void complete_scsi_command(struct }break ;case CMD_PROTOCOL_ERR : + cmd->result =DID_ERROR <<16 ;dev_warn (&h->pdev->dev,"cp %p has " -"protocol error \n" , cp); +"protocol error\n" , cp);break ;case CMD_HARDWARE_ERR : cmd->result =DID_ERROR <<16 ;
Greg Kroah-Hartman
maintainerPATCH 56/127 Bluetooth: Fix not removing power_off delayed work
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit 78c04c0bf52360dc2f7185e99c8e9aa05d73ae5a upstream.
For example, when a usb reset is received (I could reproduce it running something very similar to this[1] in a loop) it could be that the device is unregistered while the power_off delayed work is still scheduled to run.
Backtrace: WARNING: at lib/debugobjects.c:261 debug_print_object+0x7c/0x8d() Hardware name: To Be Filled By O.E.M. ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x26 Modules linked in: nouveau mxm_wmi btusb wmi bluetooth ttm coretemp drm_kms_helper Pid: 2114, comm: usb-reset Not tainted 3.5.0bt-next #2 Call Trace: [<ffffffff8124cc00>] ? free_obj_work+0x57/0x91 [<ffffffff81058f88>] warn_slowpath_common+0x7e/0x97 [<ffffffff81059035>] warn_slowpath_fmt+0x41/0x43 [<ffffffff8124ccb6>] debug_print_object+0x7c/0x8d [<ffffffff8106e3ec>] ? __queue_work+0x259/0x259 [<ffffffff8124d63e>] ? debug_check_no_obj_freed+0x6f/0x1b5 [<ffffffff8124d667>] debug_check_no_obj_freed+0x98/0x1b5 [<ffffffffa00aa031>] ? bt_host_release+0x10/0x1e [bluetooth] [<ffffffff810fc035>] kfree+0x90/0xe6 [<ffffffffa00aa031>] bt_host_release+0x10/0x1e [bluetooth] [<ffffffff812ec2f9>] device_release+0x4a/0x7e [<ffffffff8123ef57>] kobject_release+0x11d/0x154 [<ffffffff8123ed98>] kobject_put+0x4a/0x4f [<ffffffff812ec0d9>] put_device+0x12/0x14 [<ffffffffa009472b>] hci_free_dev+0x22/0x26 [bluetooth] [<ffffffffa0280dd0>] btusb_disconnect+0x96/0x9f [btusb] [<ffffffff813581b4>] usb_unbind_interface+0x57/0x106 [<ffffffff812ef988>] __device_release_driver+0x83/0xd6 [<ffffffff812ef9fb>] device_release_driver+0x20/0x2d [<ffffffff813582a7>] usb_driver_release_interface+0x44/0x7b [<ffffffff81358795>] usb_forced_unbind_intf+0x45/0x4e [<ffffffff8134f959>] usb_reset_device+0xa6/0x12e [<ffffffff8135df86>] usbdev_do_ioctl+0x319/0xe20 [<ffffffff81203244>] ? avc_has_perm_flags+0xc9/0x12e [<ffffffff812031a0>] ? avc_has_perm_flags+0x25/0x12e [<ffffffff81050101>] ? do_page_fault+0x31e/0x3a1 [<ffffffff8135eaa6>] usbdev_ioctl+0x9/0xd [<ffffffff811126b1>] vfs_ioctl+0x21/0x34 [<ffffffff81112f7b>] do_vfs_ioctl+0x408/0x44b [<ffffffff81208d45>] ? file_has_perm+0x76/0x81 [<ffffffff8111300f>] sys_ioctl+0x51/0x76 [<ffffffff8158db22>] system_call_fastpath+0x16/0x1b
[1] http://cpansearch.perl.org/src/DPAVLIN/Biblio-RFID-0.03/examples/usbreset.c
--- net/bluetooth/hci_core.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_core.c +2 -0
@@ -588,6 +588,8 @@ static int hci_dev_do_close(struct hci_d {BT_DBG ("%s %p" , hdev->name, hdev); +cancel_delayed_work (&hdev->power_off); +hci_req_cancel (hdev,ENODEV );hci_req_lock (hdev);
Re: [ 056/127] Bluetooth: Fix not removing power_off delayed work
Quoted 12 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit
78c04c0bf52360dc2f7185e99c8e9aa05d73ae5aupstream.For example, when a usb reset is received (I could reproduce it running something very similar to this[1] in a loop) it could be that the device is unregistered while the
power_offdelayed work is still scheduled to run.
[...]
net/bluetooth/hci_core.c static int hci_dev_do_close(struct hci_d · line 591
Quoted 7 lines
net/bluetooth/hci_core.c +1
-0@@ -588,6 +588,8 @@ static int hci_dev_do_close(struct hci_d {BT_DBG ("%s %p" , hdev->name, hdev); +cancel_delayed_work (&hdev->power_off);
[...]
This is not right for 3.0 as the type of hdev->power_off is struct work_struct, not struct delayed_work.
When I looked at this for 3.2 it appeared that this fix might not be required at all.
Ben.
Signature · 3 lines
Ben Hutchings
Usenet is essentially a HUGE group of people passing notes in class.
- Rachel Kadel, `A Quick Guide to Newsgroup Etiquette'Re: [ 056/127] Bluetooth: Fix not removing power_off delayed work
Quoted 20 lines · Ben Hutchings
Quoted 12 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit
78c04c0bf52360dc2f7185e99c8e9aa05d73ae5aupstream.For example, when a usb reset is received (I could reproduce it running something very similar to this[1] in a loop) it could be that the device is unregistered while the
power_offdelayed work is still scheduled to run.[...]
Quoted 6 lines
net/bluetooth/hci_core.c +0
-0@@ -588,6 +588,8 @@ static int hci_dev_do_close(struct hci_d {BT_DBG ("%s %p" , hdev->name, hdev);
Quoted 8 lines
net/bluetooth/hci_core.c static int hci_dev_do_close(struct hci_d · line 591
Quoted 1 line
net/bluetooth/hci_core.c +1
-0+cancel_delayed_work (&hdev->power_off);[...]
This is not right for 3.0 as the type of
hdev->power_offis structwork_struct, not structdelayed_work.When I looked at this for 3.2 it appeared that this fix might not be required at all.
Yes, at that time we had a timer to run the work, at some point we changed it with a delayed_work but I don't remember exactly which version was it, 3.3 I think.
Gustavo
Greg Kroah-Hartman
maintainerRe: [ 056/127] Bluetooth: Fix not removing power_off delayed work
Quoted 28 lines · Gustavo Padovan
Quoted 26 lines · Ben Hutchings
Quoted 12 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinicius Costa Gomes <[email protected]>
commit
78c04c0bf52360dc2f7185e99c8e9aa05d73ae5aupstream.For example, when a usb reset is received (I could reproduce it running something very similar to this[1] in a loop) it could be that the device is unregistered while the
power_offdelayed work is still scheduled to run.[...]
net/bluetooth/hci_core.c static int hci_dev_do_close(struct hci_d · line 591
Quoted 7 lines
net/bluetooth/hci_core.c +1
-0@@ -588,6 +588,8 @@ static int hci_dev_do_close(struct hci_d {BT_DBG ("%s %p" , hdev->name, hdev); +cancel_delayed_work (&hdev->power_off);[...]
This is not right for 3.0 as the type of
hdev->power_offis structwork_struct, not structdelayed_work.
Quoted 6 lines
Quoted 2 lines
When I looked at this for 3.2 it appeared that this fix might not be required at all.
Yes, at that time we had a timer to run the work, at some point we changed it with a
delayed_workbut I don't remember exactly which version was it, 3.3 I think.
Thanks for letting me know, I'll go delete this from the 3.0 queue.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 57/127 hpwdt: Fix kdump issue in hpwdt
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit 308b135e4fcc00c80c07e0e04e7afa8edf78583c upstream.
kdump can be interrupted by watchdog timer when the timer is left activated on the crash kernel. Changed the hpwdt driver to disable watchdog timer at boot-time. This assures that watchdog timer is disabled until /dev/watchdog is opened, and prevents watchdog timer to be left running on the crash kernel.
--- drivers/watchdog/hpwdt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/watchdog/hpwdt.c +3 -0
@@ -773,6 +773,9 @@ static int __devinit hpwdt_init_one(stru hpwdt_timer_reg = pci_mem_addr +0x70 ; hpwdt_timer_con = pci_mem_addr +0x72 ; +/* Make sure that timer is disabled until /dev/watchdog is opened */ +hpwdt_stop (); +/* Make sure that we have a valid soft_margin */ if (hpwdt_change_timer (soft_margin))hpwdt_change_timer (DEFAULT_MARGIN );
Greg Kroah-Hartman
maintainerPATCH 58/127 ARM: fix bad applied patch for arch/arm/Kconfig of stable 3.0.y tree.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuyuki Kobayashi <[email protected]>
No upstream commit as this is a merge error in the 3.0 tree.
ARM_ERRATA_764369 and PL310_ERRATA_769419 do not appear in config menu in stable 3.0.y tree.
This is because backported patch for arm/arm/Kconfig applied wrong place. This patch solves it.
--- arch/arm/Kconfig | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
arch/arm/Kconfig +26 -26
@@ -1234,6 +1234,32 @@ config ARM_ERRATA_754327 This workaround defines cpu_relax() as smp_mb(), preventing correctly written polling loops from denying visibility of updates to memory. +config ARM_ERRATA_764369 + bool "ARM errata: Data cache line maintenance operation by MVA may not succeed" + depends on CPU_V7 && SMP + help + This option enables the workaround for erratum 764369 + affecting Cortex-A9 MPCore with two or more processors (all + current revisions). Under certain timing circumstances, a data + cache line maintenance operation by MVA targeting an Inner + Shareable memory region may fail to proceed up to either the + Point of Coherency or to the Point of Unification of the + system. This workaround adds a DSB instruction before the + relevant cache maintenance functions and sets a specific bit + in the diagnostic control register of the SCU. + +config PL310_ERRATA_769419 + bool "PL310 errata: no automatic Store Buffer drain" + depends on CACHE_L2X0 + help + On revisions of the PL310 prior to r3p2, the Store Buffer does + not automatically drain. This can cause normal, non-cacheable + writes to be retained when the memory system is idle, leading + to suboptimal I/O performance for drivers using coherent DMA. + This option adds a write barrier to the cpu_idle loop so that, + on systems with an outer cache, the store buffer is drained + explicitly. + endmenu source "arch/arm/common/Kconfig"
@@ -1298,32 +1324,6 @@ source "drivers/pci/Kconfig" source "drivers/pcmcia/Kconfig" -config ARM_ERRATA_764369 - bool "ARM errata: Data cache line maintenance operation by MVA may not succeed" - depends on CPU_V7 && SMP - help - This option enables the workaround for erratum 764369 - affecting Cortex-A9 MPCore with two or more processors (all - current revisions). Under certain timing circumstances, a data - cache line maintenance operation by MVA targeting an Inner - Shareable memory region may fail to proceed up to either the - Point of Coherency or to the Point of Unification of the - system. This workaround adds a DSB instruction before the - relevant cache maintenance functions and sets a specific bit - in the diagnostic control register of the SCU. - -config PL310_ERRATA_769419 - bool "PL310 errata: no automatic Store Buffer drain" - depends on CACHE_L2X0 - help - On revisions of the PL310 prior to r3p2, the Store Buffer does - not automatically drain. This can cause normal, non-cacheable - writes to be retained when the memory system is idle, leading - to suboptimal I/O performance for drivers using coherent DMA. - This option adds a write barrier to the cpu_idle loop so that, - on systems with an outer cache, the store buffer is drained - explicitly. - endmenu menu "Kernel Features"
Greg Kroah-Hartman
maintainerPATCH 59/127 ARM: 7532/1: decompressor: reset SCTLR.TRE for VMSA ARMv7 cores
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Leach <[email protected]>
commit e1e5b7e4251c7538ca08c2c5545b0c2fbd8a6635 upstream.
This patch zeroes the SCTLR.TRE bit prior to setting the mapping as cacheable for ARMv7 cores in the decompressor, ensuring that the memory region attributes are obtained from the C and B bits, not from the page tables.
--- arch/arm/boot/compressed/head.S | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/compressed/head.S +1 -0
@@ -539,6 +539,7 @@ __armv7_mmu_cache_on: mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs #endif mrc p15, 0, r0, c1, c0, 0 @ read control reg + bic r0, r0, #1 << 28 @ clear SCTLR.TRE orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement orr r0, r0, #0x003c @ write buffer #ifdef CONFIG_MMU
Greg Kroah-Hartman
maintainerPATCH 60/127 tracing: Dont call page_to_pfn() if page is NULL
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wen Congyang <[email protected]>
commit 85f2a2ef1d0ab99523e0b947a2b723f5650ed6aa upstream.
When allocating memory fails, page is NULL. page_to_pfn() will cause the kernel panicked if we don't use sparsemem vmemmap.
--- include/trace/events/kmem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/trace/events/kmem.h +2 -2
@@ -214,7 +214,7 @@ TRACE_EVENT(mm_page_alloc,TP_printk ("page=%p pfn=%lu order=%d migratetype=%d gfp_flags=%s" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype,show_gfp_flags (__entry->gfp_flags))
@@ -240,7 +240,7 @@ DECLARE_EVENT_CLASS(mm_page,TP_printk ("page=%p pfn=%lu order=%u migratetype=%d percpu_refill=%d" , __entry->page, -page_to_pfn (__entry->page), + __entry->page ?page_to_pfn (__entry->page) :0 , __entry->order, __entry->migratetype, __entry->order ==0 )
Greg Kroah-Hartman
maintainerPATCH 61/127 Input: i8042 - disable mux on Toshiba C850D
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anisse Astier <[email protected]>
commit 8669cf6793bb38307a30fb6b9565ddc8840ebd3f upstream.
On Toshiba Satellite C850D, the touchpad and the keyboard might randomly not work at boot. Preventing MUX mode activation solves this issue.
--- drivers/input/serio/i8042-x86ia64io.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +6 -0
@@ -335,6 +335,12 @@ static const struct dmi_system_id __init }, { .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"), + }, + }, + { + .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"ALIENWARE" ), DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), },
Greg Kroah-Hartman
maintainerPATCH 62/127 asix: Support DLink DUB-E100 H/W Ver C1
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Søren Holm <[email protected]>
commit ed3770a9cd5764a575b83810ea679bbff2b03082 upstream.
--- drivers/net/usb/asix.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/usb/asix.c +4 -0
@@ -1537,6 +1537,10 @@ static const struct usb_device_id produc USB_DEVICE (0x2001, 0x3c05), .driver_info = (unsigned long ) &ax88772_info, }, { +// DLink DUB-E100 H/W Ver C1 +USB_DEVICE (0x2001 ,0x1a02 ), + .driver_info = (unsigned long) &ax88772_info, +}, {// Linksys USB1000 USB_DEVICE (0x1737 ,0x0039 ), .driver_info = (unsigned long) &ax88178_info,
Greg Kroah-Hartman
maintainerPATCH 63/127 can: ti_hecc: fix oops during rmmod
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Kleine-Budde <[email protected]>
commit ab04c8bd423edb03e2148350a091836c196107fc upstream.
This patch fixes an oops which occurs when unloading the driver, while the network interface is still up. The problem is that first the io mapping is teared own, then the CAN device is unregistered, resulting in accessing the hardware's iomem:
[ 172.744232] Unable to handle kernel paging request at virtual address c88b0040 [ 172.752441] pgd = c7be4000 [ 172.755645] [c88b0040] *pgd=87821811, *pte=00000000, *ppte=00000000 [ 172.762207] Internal error: Oops: 807 [#1] PREEMPT ARM [ 172.767517] Modules linked in: ti_hecc(-) can_dev [ 172.772430] CPU: 0 Not tainted (3.5.0alpha-00037-g3554cc0 #126) [ 172.778961] PC is at ti_hecc_close+0xb0/0x100 [ti_hecc] [ 172.784423] LR is at __dev_close_many+0x90/0xc0 [ 172.789123] pc : [<bf00c768>] lr : [<c033be58>] psr: 60000013 [ 172.789123] sp : c5c1de68 ip : 00040081 fp : 00000000 [ 172.801025] r10: 00000001 r9 : c5c1c000 r8 : 00100100 [ 172.806457] r7 : c5d0a48c r6 : c5d0a400 r5 : 00000000 r4 : c5d0a000 [ 172.813232] r3 : c88b0000 r2 : 00000001 r1 : c5d0a000 r0 : c5d0a000 [ 172.820037] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 172.827423] Control: 10c5387d Table: 87be4019 DAC: 00000015 [ 172.833404] Process rmmod (pid: 600, stack limit = 0xc5c1c2f0) [ 172.839447] Stack: (0xc5c1de68 to 0xc5c1e000) [ 172.843994] de60: bf00c6b8 c5c1dec8 c5d0a000 c5d0a000 00200200 c033be58 [ 172.852478] de80: c5c1de44 c5c1dec8 c5c1dec8 c033bf2c c5c1de90 c5c1de90 c5d0a084 c5c1de44 [ 172.860992] dea0: c5c1dec8 c033c098 c061d3dc c5d0a000 00000000 c05edf28 c05edb34 c000d724 [ 172.869476] dec0: 00000000 c033c2f8 c5d0a084 c5d0a084 00000000 c033c370 00000000 c5d0a000 [ 172.877990] dee0: c05edb00 c033c3b8 c5d0a000 bf00d3ac c05edb00 bf00d7c8 bf00d7c8 c02842dc [ 172.886474] df00: c02842c8 c0282f90 c5c1c000 c05edb00 bf00d7c8 c0283668 bf00d7c8 00000000 [ 172.894989] df20: c0611f98 befe2f80 c000d724 c0282d10 bf00d804 00000000 00000013 c0068a8c [ 172.903472] df40: c5c538e8 685f6974 00636365 c61571a8 c5cb9980 c61571a8 c6158a20 c00c9bc4 [ 172.911987] df60: 00000000 00000000 c5cb9980 00000000 c5cb9980 00000000 c7823680 00000006 [ 172.920471] df80: bf00d804 00000880 c5c1df8c 00000000 000d4267 befe2f80 00000001 b6d90068 [ 172.928985] dfa0: 00000081 c000d5a0 befe2f80 00000001 befe2f80 00000880 b6d90008 00000008 [ 172.937469] dfc0: befe2f80 00000001 b6d90068 00000081 00000001 00000000 befe2eac 00000000 [ 172.945983] dfe0: 00000000 befe2b18 00023ba4 b6e6addc 60000010 befe2f80 a8e00190 86d2d344 [ 172.954498] [<bf00c768>] (ti_hecc_close+0xb0/0x100 [ti_hecc]) from [<c033be58>] (__dev__registered_many+0xc0/0x2a0) [ 172.984161] [<c033c098>] (rollback_registered_many+0xc0/0x2a0) from [<c033c2f8>] (rollback_registered+0x20/0x30) [ 172.994750] [<c033c2f8>] (rollback_registered+0x20/0x30) from [<c033c370>] (unregister_netdevice_queue+0x68/0x98) [ 173.005401] [<c033c370>] (unregister_netdevice_queue+0x68/0x98) from [<c033c3b8>] (unregister_netdev+0x18/0x20) [ 173.015899] [<c033c3b8>] (unregister_netdev+0x18/0x20) from [<bf00d3ac>] (ti_hecc_remove+0x60/0x80 [ti_hecc]) [ 173.026245] [<bf00d3ac>] (ti_hecc_remove+0x60/0x80 [ti_hecc]) from [<c02842dc>] (platform_drv_remove+0x14/0x18) [ 173.036712] [<c02842dc>] (platform_drv_remove+0x14/0x18) from [<c0282f90>] (__device_release_driver+0x7c/0xbc)
--- drivers/net/can/ti_hecc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/ti_hecc.c +1 -1
@@ -969,12 +969,12 @@ static int __devexit ti_hecc_remove(strustruct net_device *ndev =platform_get_drvdata (pdev);struct ti_hecc_priv *priv =netdev_priv (ndev); +unregister_candev (ndev);clk_disable (priv->clk);clk_put (priv->clk); res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );iounmap (priv->base);release_mem_region (res->start,resource_size (res)); -unregister_candev (ndev);free_candev (ndev);platform_set_drvdata (pdev,NULL );
Greg Kroah-Hartman
maintainerPATCH 64/127 can: janz-ican3: fix support for older hardware revisions
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Ira W. Snyder" <[email protected]>
commit e21093ef6fb4cbecdf926102286dbe280ae965db upstream.
The Revision 1.0 Janz CMOD-IO Carrier Board does not have support for the reset registers. To support older hardware, the code is changed to use the hardware reset register on the Janz VMOD-ICAN3 hardware itself.
--- drivers/net/can/janz-ican3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/can/janz-ican3.c +1 -3
@@ -1249,7 +1249,6 @@ static irqreturn_t ican3_irq(int irq, vo*/ static int ican3_reset_module (struct ican3_dev *mod) { -u8 val =1 << mod->num;unsigned long start;u8 runold, runnew;
@@ -1263,8 +1262,7 @@ static int ican3_reset_module(struct ica runold =ioread8 (mod->dpm +TARGET_RUNNING );/* reset the module */ -iowrite8 (val, &mod->ctrl->reset_assert); -iowrite8 (val, &mod->ctrl->reset_deassert); +iowrite8 (0x00 , &mod->dpmctrl->hwreset);/* wait until the module has finished resetting and is running */ start = jiffies;
Greg Kroah-Hartman
maintainerPATCH 65/127 cfg80211: fix possible circular lock on reg_regdb_search()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Luis R. Rodriguez" <[email protected]>
commit a85d0d7f3460b1a123b78e7f7e39bf72c37dfb78 upstream.
When call_crda() is called we kick off a witch hunt search for the same regulatory domain on our internal regulatory database and that work gets kicked off on a workqueue, this is done while the cfg80211_mutex is held. If that workqueue kicks off it will first lock reg_regdb_search_mutex and later cfg80211_mutex but to ensure two CPUs will not contend against cfg80211_mutex the right thing to do is to have the reg_regdb_search() wait until the cfg80211_mutex is let go.
The lockdep report is pasted below.
cfg80211: Calling CRDA to update world regulatory domain
======================================================
[ INFO: possible circular locking dependency detected ]
3.3.8 #3 Tainted: G O
-------------------------------------------------------
kworker/0:1/235 is trying to acquire lock:
(cfg80211_mutex){+.+...}, at: [<816468a4>] set_regdom+0x78c/0x808 [cfg80211]
but task is already holding lock:
(reg_regdb_search_mutex){+.+...}, at: [<81646828>] set_regdom+0x710/0x808 [cfg80211]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (reg_regdb_search_mutex){+.+...}:
[<800a8384>] lock_acquire+0x60/0x88
[<802950a8>] mutex_lock_nested+0x54/0x31c
[<81645778>] is_world_regdom+0x9f8/0xc74 [cfg80211]-> #1 (reg_mutex#2){+.+...}:
[<800a8384>] lock_acquire+0x60/0x88
[<802950a8>] mutex_lock_nested+0x54/0x31c
[<8164539c>] is_world_regdom+0x61c/0xc74 [cfg80211]-> #0 (cfg80211_mutex){+.+...}:
[<800a77b8>] __lock_acquire+0x10d4/0x17bc
[<800a8384>] lock_acquire+0x60/0x88
[<802950a8>] mutex_lock_nested+0x54/0x31c
[<816468a4>] set_regdom+0x78c/0x808 [cfg80211]other info that might help us debug this:
Chain exists of: cfg80211_mutex --> reg_mutex#2 --> reg_regdb_search_mutex Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(reg_regdb_search_mutex);
lock(reg_mutex#2);
lock(reg_regdb_search_mutex); lock(cfg80211_mutex);
*** DEADLOCK ***
3 locks held by kworker/0:1/235:
#0: (events){.+.+..}, at: [<80089a00>] process_one_work+0x230/0x460
#1: (reg_regdb_work){+.+...}, at: [<80089a00>] process_one_work+0x230/0x460
#2: (reg_regdb_search_mutex){+.+...}, at: [<81646828>] set_regdom+0x710/0x808 [cfg80211]stack backtrace: Call Trace: [<80290fd4>] dump_stack+0x8/0x34 [<80291bc4>] print_circular_bug+0x2ac/0x2d8 [<800a77b8>] __lock_acquire+0x10d4/0x17bc [<800a8384>] lock_acquire+0x60/0x88 [<802950a8>] mutex_lock_nested+0x54/0x31c [<816468a4>] set_regdom+0x78c/0x808 [cfg80211]
--- net/wireless/reg.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/wireless/reg.c +9 -3
@@ -331,6 +331,9 @@ static void reg_regdb_search(struct workstruct reg_regdb_search_request *request;const struct ieee80211_regdomain *curdom, *regdom;int i, r; +bool set_reg = false; + +mutex_lock (&cfg80211_mutex);mutex_lock (®_regdb_search_mutex);while (!list_empty (®_regdb_search_list)) {
@@ -346,9 +349,7 @@ static void reg_regdb_search(struct work r =reg_copy_regd (®dom, curdom);if (r)break ; -mutex_lock (&cfg80211_mutex); -set_regdom (regdom); -mutex_unlock (&cfg80211_mutex); + set_reg = true;break ; } }
@@ -356,6 +357,11 @@ static void reg_regdb_search(struct workkfree (request); }mutex_unlock (®_regdb_search_mutex); + +if (set_reg) +set_regdom (regdom); + +mutex_unlock (&cfg80211_mutex); } static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
Greg Kroah-Hartman
maintainerPATCH 66/127 dmaengine: at_hdmac: fix comment in atc_prep_slave_sg()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
commit c618a9be0e8c0f36baee2560860a0118a428fb26 upstream.
s/dma_memcpy/slave_sg/ and it is sg length that we are talking about.
--- drivers/dma/at_hdmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/at_hdmac.c +1 -1
@@ -674,7 +674,7 @@ atc_prep_slave_sg(struct dma_chan *chan, flags);if (unlikely (!atslave || !sg_len)) { -dev_dbg (chan2dev (chan),"prep_dma_memcpy: length is zero!\n" ); +dev_dbg (chan2dev (chan),"prep_slave_sg: sg length is zero!\n" );return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 67/127 dmaengine: at_hdmac: check that each sg data length is non-null
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
commit c456797681db814f4f5b36909e8e94047bf53d9c upstream.
Avoid the construction of a malformed DMA request sent to the DMA controller.
Log message is for debug only because this condition is unlikely to append and may only trigger at driver development time.
--- drivers/dma/at_hdmac.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/dma/at_hdmac.c +11 -0
@@ -702,6 +702,11 @@ atc_prep_slave_sg(struct dma_chan *chan, mem =sg_dma_address (sg); len =sg_dma_len (sg); +if (unlikely (!len)) { +dev_dbg (chan2dev (chan), +"prep_slave_sg: sg(%d) data length is zero\n" , i); + goto err; + } mem_width =2 ;if (unlikely (mem &3 || len &3 )) mem_width =0 ;
@@ -736,6 +741,11 @@ atc_prep_slave_sg(struct dma_chan *chan, mem =sg_dma_address (sg); len =sg_dma_len (sg); +if (unlikely (!len)) { +dev_dbg (chan2dev (chan), +"prep_slave_sg: sg(%d) data length is zero\n" , i); + goto err; + } mem_width =2 ;if (unlikely (mem &3 || len &3 )) mem_width =0 ;
@@ -769,6 +779,7 @@ atc_prep_slave_sg(struct dma_chan *chan, err_desc_get:dev_err (chan2dev (chan),"not enough descriptors available\n" ); +err:atc_desc_put (atchan, first);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 68/127 rt2x00: Fix word size of rt2500usb MAC_CSR19 register.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gertjan van Wingerde <[email protected]>
commit 6ced58a5dbb94dbfbea1b33ca3c56d1e929cd548 upstream.
The register is 16 bits wide, not 32.
--- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.h | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/rt2x00/rt2500usb.c +1 -1
@@ -283,7 +283,7 @@ static int rt2500usb_rfkill_poll(structu16 reg;rt2500usb_register_read (rt2x00dev,MAC_CSR19 , ®); -return rt2x00_get_field32 (reg,MAC_CSR19_BIT7 ); +return rt2x00_get_field16 (reg,MAC_CSR19_BIT7 ); }#ifdef CONFIG_RT2X00_LIB_LEDS
drivers/net/wireless/rt2x00/rt2500usb.h +8 -8
@@ -189,14 +189,14 @@* MAC_CSR19: GPIO control register. */ #define MAC_CSR19 0x0426 -#define MAC_CSR19_BIT0 FIELD32(0x0001) -#define MAC_CSR19_BIT1 FIELD32(0x0002) -#define MAC_CSR19_BIT2 FIELD32(0x0004) -#define MAC_CSR19_BIT3 FIELD32(0x0008) -#define MAC_CSR19_BIT4 FIELD32(0x0010) -#define MAC_CSR19_BIT5 FIELD32(0x0020) -#define MAC_CSR19_BIT6 FIELD32(0x0040) -#define MAC_CSR19_BIT7 FIELD32(0x0080) +#define MAC_CSR19_BIT0 FIELD16(0x0001) +#define MAC_CSR19_BIT1 FIELD16(0x0002) +#define MAC_CSR19_BIT2 FIELD16(0x0004) +#define MAC_CSR19_BIT3 FIELD16(0x0008) +#define MAC_CSR19_BIT4 FIELD16(0x0010) +#define MAC_CSR19_BIT5 FIELD16(0x0020) +#define MAC_CSR19_BIT6 FIELD16(0x0040) +#define MAC_CSR19_BIT7 FIELD16(0x0080)/* * MAC_CSR20: LED control register.
Greg Kroah-Hartman
maintainerPATCH 69/127 rt2x00: Fix rfkill polling prior to interface start.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gertjan van Wingerde <[email protected]>
commit a396e10019eaf3809b0219c966865aaafec12630 upstream.
We need to program the rfkill switch GPIO pin direction to input at device initialization time, not only when the interface is brought up. Doing this only when the interface is brought up could lead to rfkill detecting the switch is turned on erroneously and inability to create the interface and bringing it up.
--- drivers/net/wireless/rt2x00/rt2400pci.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt2400pci.h | 1 + drivers/net/wireless/rt2x00/rt2500pci.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt2500usb.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt2500usb.h | 1 + drivers/net/wireless/rt2x00/rt2800pci.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt2800usb.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt61pci.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt61pci.h | 1 + drivers/net/wireless/rt2x00/rt73usb.c | 9 +++++++++ drivers/net/wireless/rt2x00/rt73usb.h | 3 +++ 11 files changed, 69 insertions(+)
drivers/net/wireless/rt2x00/rt2400pci.c +9 -0
@@ -1618,6 +1618,7 @@ static int rt2400pci_probe_hw_mode(strucstatic int rt2400pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -1631,6 +1632,14 @@ static int rt2400pci_probe_hw(struct rt2return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®); +rt2x00_set_field32 (®,GPIOCSR_BIT8 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIOCSR , reg); + +/* * Initialize hw specifications. */ retval =rt2400pci_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt2400pci.h +1 -0
@@ -670,6 +670,7 @@#define GPIOCSR_BIT5 FIELD32(0x00000020)#define GPIOCSR_BIT6 FIELD32(0x00000040)#define GPIOCSR_BIT7 FIELD32(0x00000080) +#define GPIOCSR_BIT8 FIELD32(0x00000100)/* * BBPPCSR: BBP Pin control register.
drivers/net/wireless/rt2x00/rt2500pci.c +9 -0
@@ -1936,6 +1936,7 @@ static int rt2500pci_probe_hw_mode(strucstatic int rt2500pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -1949,6 +1950,14 @@ static int rt2500pci_probe_hw(struct rt2return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIOCSR , ®); +rt2x00_set_field32 (®,GPIOCSR_DIR0 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIOCSR , reg); + +/* * Initialize hw specifications. */ retval =rt2500pci_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt2500usb.c +9 -0
@@ -1768,6 +1768,7 @@ static int rt2500usb_probe_hw_mode(strucstatic int rt2500usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u16 reg;/* * Allocate eeprom data.
@@ -1781,6 +1782,14 @@ static int rt2500usb_probe_hw(struct rt2return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2500usb_register_read (rt2x00dev,MAC_CSR19 , ®); +rt2x00_set_field16 (®,MAC_CSR19_BIT8 ,0 ); +rt2500usb_register_write (rt2x00dev,MAC_CSR19 , reg); + +/* * Initialize hw specifications. */ retval =rt2500usb_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt2500usb.h +1 -0
@@ -197,6 +197,7 @@#define MAC_CSR19_BIT5 FIELD16(0x0020)#define MAC_CSR19_BIT6 FIELD16(0x0040)#define MAC_CSR19_BIT7 FIELD16(0x0080) +#define MAC_CSR19_BIT8 FIELD16(0x0100)/* * MAC_CSR20: LED control register.
drivers/net/wireless/rt2x00/rt2800pci.c +9 -0
@@ -941,6 +941,7 @@ static int rt2800pci_validate_eeprom(strstatic int rt2800pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -954,6 +955,14 @@ static int rt2800pci_probe_hw(struct rt2return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); +rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT2 ,1 ); +rt2x00pci_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); + +/* * Initialize hw specifications. */ retval =rt2800_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt2800usb.c +9 -0
@@ -600,6 +600,7 @@ static int rt2800usb_validate_eeprom(strstatic int rt2800usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -613,6 +614,14 @@ static int rt2800usb_probe_hw(struct rt2return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00usb_register_read (rt2x00dev,GPIO_CTRL_CFG , ®); +rt2x00_set_field32 (®,GPIO_CTRL_CFG_GPIOD_BIT2 ,1 ); +rt2x00usb_register_write (rt2x00dev,GPIO_CTRL_CFG , reg); + +/* * Initialize hw specifications. */ retval =rt2800_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt61pci.c +9 -0
@@ -2840,6 +2840,7 @@ static int rt61pci_probe_hw_mode(structstatic int rt61pci_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Disable power saving.
@@ -2858,6 +2859,14 @@ static int rt61pci_probe_hw(struct rt2x0return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00pci_register_read (rt2x00dev,MAC_CSR13 , ®); +rt2x00_set_field32 (®,MAC_CSR13_BIT13 ,1 ); +rt2x00pci_register_write (rt2x00dev,MAC_CSR13 , reg); + +/* * Initialize hw specifications. */ retval =rt61pci_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt61pci.h +1 -0
@@ -372,6 +372,7 @@ struct hw_pairwise_ta_entry {#define MAC_CSR13_BIT10 FIELD32(0x00000400)#define MAC_CSR13_BIT11 FIELD32(0x00000800)#define MAC_CSR13_BIT12 FIELD32(0x00001000) +#define MAC_CSR13_BIT13 FIELD32(0x00002000)/* * MAC_CSR14: LED control register.
drivers/net/wireless/rt2x00/rt73usb.c +9 -0
@@ -2177,6 +2177,7 @@ static int rt73usb_probe_hw_mode(structstatic int rt73usb_probe_hw (struct rt2x00_dev *rt2x00dev) {int retval; +u32 reg;/* * Allocate eeprom data.
@@ -2190,6 +2191,14 @@ static int rt73usb_probe_hw(struct rt2x0return retval;/* +* Enable rfkill polling by setting GPIO direction of the +* rfkill switch GPIO pin correctly. +*/ +rt2x00usb_register_read (rt2x00dev,MAC_CSR13 , ®); +rt2x00_set_field32 (®,MAC_CSR13_BIT15 ,0 ); +rt2x00usb_register_write (rt2x00dev,MAC_CSR13 , reg); + +/* * Initialize hw specifications. */ retval =rt73usb_probe_hw_mode (rt2x00dev);
drivers/net/wireless/rt2x00/rt73usb.h +3 -0
@@ -282,6 +282,9 @@ struct hw_pairwise_ta_entry {#define MAC_CSR13_BIT10 FIELD32(0x00000400)#define MAC_CSR13_BIT11 FIELD32(0x00000800)#define MAC_CSR13_BIT12 FIELD32(0x00001000) +#define MAC_CSR13_BIT13 FIELD32(0x00002000) +#define MAC_CSR13_BIT14 FIELD32(0x00004000) +#define MAC_CSR13_BIT15 FIELD32(0x00008000)/* * MAC_CSR14: LED control register.
Greg Kroah-Hartman
maintainerPATCH 70/127 NFS: Fix the initialisation of the readdir cookieverf array
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c3f52af3e03013db5237e339c817beaae5ec9e3a upstream.
When the NFS_COOKIEVERF helper macro was converted into a static inline function in commit 99fadcd764 (nfs: convert NFS_*(inode) helpers to static inline), we broke the initialisation of the readdir cookies, since that depended on doing a memset with an argument of 'sizeof(NFS_COOKIEVERF(inode))' which therefore changed from sizeof(be32 cookieverf[2]) to sizeof(be32 *).
At this point, NFS_COOKIEVERF seems to be more of an obfuscation than a helper, so the best thing would be to just get rid of it.
Also see: https://bugzilla.kernel.org/show_bug.cgi?id=46881
--- fs/nfs/inode.c | 2 +- fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 4 ++-- include/linux/nfs_fs.h | 5 ----- 4 files changed, 4 insertions(+), 9 deletions(-)
fs/nfs/inode.c +1 -1
@@ -150,7 +150,7 @@ static void nfs_zap_caches_locked(struct nfsi->attrtimeo =NFS_MINATTRTIMEO (inode); nfsi->attrtimeo_timestamp = jiffies; -memset (NFS_COOKIEVERF (inode),0 ,sizeof (NFS_COOKIEVERF (inode))); +memset (NFS_I (inode)->cookieverf,0 ,sizeof (NFS_I (inode)->cookieverf));if (S_ISREG (mode) ||S_ISDIR (mode) ||S_ISLNK (mode)) nfsi->cache_validity |=NFS_INO_INVALID_ATTR |NFS_INO_INVALID_DATA |NFS_INO_INVALID_ACCESS |NFS_INO_INVALID_ACL |NFS_INO_REVAL_PAGECACHE ;else
fs/nfs/nfs3proc.c +1 -1
@@ -633,7 +633,7 @@ nfs3_proc_readdir(struct dentry *dentry, u64 cookie, struct page **pages, unsigned int count, int plus) { struct inode *dir = dentry->d_inode; -__be32 *verf =NFS_COOKIEVERF (dir); +__be32 *verf =NFS_I (dir)->cookieverf; struct nfs3_readdirargs arg = { .fh = NFS_FH(dir), .cookie = cookie,
fs/nfs/nfs4proc.c +2 -2
@@ -3018,11 +3018,11 @@ static int _nfs4_proc_readdir(struct den dentry->d_parent->d_name.name, dentry->d_name.name, (unsigned long long)cookie); -nfs4_setup_readdir (cookie,NFS_COOKIEVERF (dir), dentry, &args); +nfs4_setup_readdir (cookie,NFS_I (dir)->cookieverf, dentry, &args); res.pgbase = args.pgbase; status =nfs4_call_sync (NFS_SERVER (dir)->client,NFS_SERVER (dir), &msg, &args.seq_args, &res.seq_res,0 );if (status >=0 ) { -memcpy (NFS_COOKIEVERF (dir), res.verifier.data,NFS4_VERIFIER_SIZE ); +memcpy (NFS_I (dir)->cookieverf, res.verifier.data,NFS4_VERIFIER_SIZE ); status += args.pgbase; }
include/linux/nfs_fs.h +0 -5
@@ -261,11 +261,6 @@ static inline const struct nfs_rpc_ops *return NFS_SERVER (inode)->nfs_client->rpc_ops; } -static inline __be32 *NFS_COOKIEVERF (const struct inode *inode) -{ -return NFS_I (inode)->cookieverf; -} -static inline unsigned NFS_MINATTRTIMEO (const struct inode *inode) {struct nfs_server *nfss =NFS_SERVER (inode);
Greg Kroah-Hartman
maintainerPATCH 71/127 NFS: Fix a problem with the legacy binary mount code
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit 872ece86ea5c367aa92f44689c2d01a1c767aeb3 upstream.
Apparently, am-utils is still using the legacy binary mountdata interface, and is having trouble parsing /proc/mounts due to the 'port=' field being incorrectly set.
The following patch should fix up the regression.
--- fs/nfs/super.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/super.c +2 -0
@@ -1815,6 +1815,7 @@ static int nfs_validate_mount_data(voidmemcpy (sap, &data->addr,sizeof (data->addr)); args->nfs_server.addrlen =sizeof (data->addr); + args->nfs_server.port =ntohs (data->addr.sin_port);if (!nfs_verify_server_address (sap)) goto out_no_address;
@@ -2528,6 +2529,7 @@ static int nfs4_validate_mount_data(voidreturn -EFAULT ;if (!nfs_verify_server_address (sap)) goto out_no_address; + args->nfs_server.port =ntohs (((struct sockaddr_in *)sap)->sin_port);if (data->auth_flavourlen) {if (data->auth_flavourlen >1 )
Greg Kroah-Hartman
maintainerPATCH 72/127 NFS: return error from decode_getfh in decode open
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit 01913b49cf1dc6409a07dd2a4cc6af2e77f3c410 upstream.
If decode_getfh failed, nfs4_xdr_dec_open would return 0 since the last decode_* call must have succeeded.
--- fs/nfs/nfs4xdr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/nfs4xdr.c +2 -1
@@ -5745,7 +5745,8 @@ static int nfs4_xdr_dec_open(struct rpc_ status =decode_open (xdr, res);if (status) goto out; -if (decode_getfh (xdr, &res->fh) !=0 ) + status =decode_getfh (xdr, &res->fh); +if (status) goto out;if (decode_getfattr (xdr, res->f_attr, res->server, !RPC_IS_ASYNC (rqstp->rq_task)) !=0 )
Greg Kroah-Hartman
maintainerPATCH 73/127 EHCI: Update qTD next pointer in QH overlay region during unlink
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavankumar Kondeti <[email protected]>
commit 3d037774b42ed677f699b1dce7d548d55f4e4c2b upstream.
There is a possibility of QH overlay region having reference to a stale qTD pointer during unlink.
Consider an endpoint having two pending qTD before unlink process begins. The endpoint's QH queue looks like this.
qTD1 --> qTD2 --> Dummy
To unlink qTD2, QH is removed from asynchronous list and Asynchronous Advance Doorbell is programmed. The qTD1's next qTD pointer is set to qTD2'2 next qTD pointer and qTD2 is retired upon controller's doorbell interrupt. If QH's current qTD pointer points to qTD1, transfer overlay region still have reference to qTD2. But qtD2 is just unlinked and freed. This may cause EHCI system error. Fix this by updating qTD next pointer in QH overlay region with the qTD next pointer of the current qTD.
--- drivers/usb/host/ehci-q.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/host/ehci-q.c +10 -2
@@ -130,9 +130,17 @@ qh_refresh (struct ehci_hcd *ehci, strucelse { qtd =list_entry (qh->qtd_list.next, struct ehci_qtd, qtd_list); -/* first qtd may already be partially processed */ -if (cpu_to_hc32 (ehci, qtd->qtd_dma) == qh->hw->hw_current) +/* +* first qtd may already be partially processed. +* If we come here during unlink, the QH overlay region +* might have reference to the just unlinked qtd. The +* qtd is updated in qh_completions(). Update the QH +* overlay here. +*/ +if (cpu_to_hc32 (ehci, qtd->qtd_dma) == qh->hw->hw_current) { + qh->hw->hw_qtd_next = qtd->hw_next; qtd =NULL ; + } }if (qtd)
Greg Kroah-Hartman
maintainerPATCH 74/127 USB: ftdi_sio: PID for NZR SEM 16+ USB
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horst Schirmeier <[email protected]>
commit 26a538b9ea2a3ee10dafc0068f0560dfd7b7ba37 upstream.
This adds the USB PID for the NZR SEM 16+ USB energy monitor device
<http://www.nzr.de>. It works perfectly with the GPL software on
<http://schou.dk/linux/sparometer/>.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -702,6 +702,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, { USB_DEVICE(FTDI_VID, FTDI_RRCIRKITS_LOCOBUFFER_PID) }, { USB_DEVICE(FTDI_VID, FTDI_ASK_RDR400_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_NZR_SEM_USB_PID) }, { USB_DEVICE(ICOM_VID, ICOM_ID_1_PID) }, { USB_DEVICE(ICOM_VID, ICOM_OPC_U_UC_PID) }, { USB_DEVICE(ICOM_VID, ICOM_ID_RP2C1_PID) },
drivers/usb/serial/ftdi_sio_ids.h +3 -0
@@ -75,6 +75,9 @@#define FTDI_OPENDCC_GATEWAY_PID 0xBFDB#define FTDI_OPENDCC_GBM_PID 0xBFDC +/* NZR SEM 16+ USB (http://www.nzr.de) */ +#define FTDI_NZR_SEM_USB_PID 0xC1E0/* NZR SEM-LOG16+ */ +/* * RR-CirKits LocoBuffer USB (http://www.rr-cirkits.com) */
Greg Kroah-Hartman
maintainerPATCH 75/127 USB: ftdi_sio: do not claim CDC ACM function
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit f08dea734844aa42ec57c229b0b73b3d7d21f810 upstream.
The Microchip vid:pid 04d8:000a is used for their CDC ACM demo firmware application. This is a device with a single function conforming to the CDC ACM specification and with the intention of demonstrating CDC ACM class firmware and driver interaction. The demo is used on a number of development boards, and may also be used unmodified by vendors using Microchip hardware.
Some vendors have re-used this vid:pid for other types of firmware, emulating FTDI chips. Attempting to continue to support such devices without breaking class based applications that by matching on interface class/subclass/proto being ff/ff/00. I have no information about the actual device or interface descriptors, but this will at least make the proper CDC ACM devices work again. Anyone having details of the offending device's descriptors should update this entry with the details.
--- drivers/usb/serial/ftdi_sio.c | 4 +++- drivers/usb/serial/ftdi_sio_ids.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +3 -1
@@ -803,7 +803,9 @@ static struct usb_device_id id_table_com .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID) }, + {USB_DEVICE_AND_INTERFACE_INFO (MICROCHIP_VID ,MICROCHIP_USB_BOARD_PID , +USB_CLASS_VENDOR_SPEC , + USB_SUBCLASS_VENDOR_SPEC, 0x00) }, { 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 +4 -1
@@ -542,7 +542,10 @@/* * Microchip Technology, Inc. * -* MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are also used by: +* MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are +* used by single function CDC ACM class based firmware demo +* applications. The VID/PID has also been used in firmware +* emulating FTDI serial chips by: * Hornby Elite - Digital Command Control Console * http://www.hornby.com/hornby-dcc/controllers/ */
Greg Kroah-Hartman
maintainerPATCH 76/127 USB: ftdi-sio: add support for more Physik Instrumente devices
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Éric Piel <[email protected]>
commit dafc4f7be1a556ca3868d343c00127728b397068 upstream.
Commit b69cc672052540 added support for the E-861. After acquiring a C-867, I realised that every Physik Instrumente's device has a different PID. They are listed in the Windows device driver's .inf file. So here are all PIDs for the current (and probably future) USB devices from Physik Instrumente.
Compiled, but only actually tested on the E-861 and C-867.
--- drivers/usb/serial/ftdi_sio.c | 17 +++++++++++++++++ drivers/usb/serial/ftdi_sio_ids.h | 21 ++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-)
drivers/usb/serial/ftdi_sio.c +17 -0
@@ -811,7 +811,24 @@ static struct usb_device_id id_table_com .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) }, { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) }, + { USB_DEVICE(FTDI_VID, PI_C865_PID) }, + { USB_DEVICE(FTDI_VID, PI_C857_PID) }, + { USB_DEVICE(PI_VID, PI_C866_PID) }, + { USB_DEVICE(PI_VID, PI_C663_PID) }, + { USB_DEVICE(PI_VID, PI_C725_PID) }, + { USB_DEVICE(PI_VID, PI_E517_PID) }, + { USB_DEVICE(PI_VID, PI_C863_PID) }, { USB_DEVICE(PI_VID, PI_E861_PID) }, + { USB_DEVICE(PI_VID, PI_C867_PID) }, + { USB_DEVICE(PI_VID, PI_E609_PID) }, + { USB_DEVICE(PI_VID, PI_E709_PID) }, + { USB_DEVICE(PI_VID, PI_100F_PID) }, + { USB_DEVICE(PI_VID, PI_1011_PID) }, + { USB_DEVICE(PI_VID, PI_1012_PID) }, + { USB_DEVICE(PI_VID, PI_1013_PID) }, + { USB_DEVICE(PI_VID, PI_1014_PID) }, + { USB_DEVICE(PI_VID, PI_1015_PID) }, + { USB_DEVICE(PI_VID, PI_1016_PID) }, { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) }, { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
drivers/usb/serial/ftdi_sio_ids.h +20 -1
@@ -797,8 +797,27 @@* Physik Instrumente * http://www.physikinstrumente.com/en/products/ */ +/* These two devices use the VID of FTDI */ +#define PI_C865_PID 0xe0a0/* PI C-865 Piezomotor Controller */ +#define PI_C857_PID 0xe0a1/* PI Encoder Trigger Box */ +#define PI_VID 0x1a72/* Vendor ID */ -#define PI_E861_PID 0x1008/* E-861 piezo controller USB connection */ +#define PI_C866_PID 0x1000/* PI C-866 Piezomotor Controller */ +#define PI_C663_PID 0x1001/* PI C-663 Mercury-Step */ +#define PI_C725_PID 0x1002/* PI C-725 Piezomotor Controller */ +#define PI_E517_PID 0x1005/* PI E-517 Digital Piezo Controller Operation Module */ +#define PI_C863_PID 0x1007/* PI C-863 */ +#define PI_E861_PID 0x1008/* PI E-861 Piezomotor Controller */ +#define PI_C867_PID 0x1009/* PI C-867 Piezomotor Controller */ +#define PI_E609_PID 0x100D/* PI E-609 Digital Piezo Controller */ +#define PI_E709_PID 0x100E/* PI E-709 Digital Piezo Controller */ +#define PI_100F_PID 0x100F/* PI Digital Piezo Controller */ +#define PI_1011_PID 0x1011/* PI Digital Piezo Controller */ +#define PI_1012_PID 0x1012/* PI Motion Controller */ +#define PI_1013_PID 0x1013/* PI Motion Controller */ +#define PI_1014_PID 0x1014/* PI Device */ +#define PI_1015_PID 0x1015/* PI Device */ +#define PI_1016_PID 0x1016/* PI Digital Servo Module */ /* * Kondo Kagaku Co.Ltd.
Greg Kroah-Hartman
maintainerPATCH 77/127 USB: add device quirk for Joss Optical touchboard
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 92fc7a8b0f20bdb243c706daf42658e8e0cd2ef0 upstream.
This patch (as1604) adds a CONFIG_INTF_STRINGS quirk for the Joss infrared touchboard device. The device doesn't like to be asked for its interface strings.
--- drivers/usb/core/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/core/quirks.c +4 -0
@@ -96,6 +96,10 @@ static const struct usb_device_id usb_qu { USB_DEVICE(0x04b4, 0x0526), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Microchip Joss Optical infrared touchboard device */ + { USB_DEVICE(0x04d8, 0x000c), .driver_info = + USB_QUIRK_CONFIG_INTF_STRINGS }, + /* Samsung Android phone modem - ID conflict with SPH-I500 */ { USB_DEVICE(0x04e8, 0x6601), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS },
Greg Kroah-Hartman
maintainerPATCH 78/127 Intel xhci: Only switch the switchable ports
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keng-Yu Lin <[email protected]>
commit a96874a2a92feaef607ddd3137277a788cb927a6 upstream.
With a previous patch to enable the EHCI/XHCI port switching, it switches all the available ports.
The assumption is not correct because the BIOS may expect some ports not switchable by the OS.
There are two more registers that contains the information of the switchable and non-switchable ports.
This patch adds the checking code for the two register so that only the switchable ports are altered.
This patch should be backported to kernels as old as 3.0, that contain commit ID 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support EHCI/xHCI port switching."
--- drivers/usb/host/pci-quirks.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
drivers/usb/host/pci-quirks.c +23 -4
@@ -73,7 +73,9 @@#define NB_PIF0_PWRDOWN_1 0x01100013#define USB_INTEL_XUSB2PR 0xD0 +#define USB_INTEL_USB2PRM 0xD4#define USB_INTEL_USB3_PSSEN 0xD8 +#define USB_INTEL_USB3PRM 0xDC static struct amd_chipset_info { struct pci_dev *nb_dev;
@@ -758,10 +760,18 @@ void usb_enable_xhci_ports(struct pci_de#if defined(CONFIG_USB_XHCI_HCD ) || defined(CONFIG_USB_XHCI_HCD_MODULE )u32 ports_available; - ports_available =0xffffffff ; +/* Read USB3PRM, the USB 3.0 Port Routing Mask Register +* Indicate the ports that can be changed from OS. +*/ +pci_read_config_dword (xhci_pdev,USB_INTEL_USB3PRM , + &ports_available); + +dev_dbg (&xhci_pdev->dev,"Configurable ports to enable SuperSpeed: 0x%x\n" , + ports_available); +/* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable -* Register, to turn on SuperSpeed terminations for all -* available ports. +* Register, to turn on SuperSpeed terminations for the +* switchable ports. */ pci_write_config_dword (xhci_pdev,USB_INTEL_USB3_PSSEN ,cpu_to_le32 (ports_available));
@@ -771,7 +781,16 @@ void usb_enable_xhci_ports(struct pci_dedev_dbg (&xhci_pdev->dev,"USB 3.0 ports that are now enabled " "under xHCI: 0x%x\n" , ports_available); - ports_available =0xffffffff ; +/* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register +* Indicate the USB 2.0 ports to be controlled by the xHCI host. +*/ + +pci_read_config_dword (xhci_pdev,USB_INTEL_USB2PRM , + &ports_available); + +dev_dbg (&xhci_pdev->dev,"Configurable USB 2.0 ports to hand over to xCHI: 0x%x\n" , + ports_available); +/* Write XUSB2PR, the xHC USB 2.0 Port Routing Register, to * switch the USB 2.0 power and data lines over to the xHCI * host.
Greg Kroah-Hartman
maintainerPATCH 79/127 xhci: Fix a logical vs bitwise AND bug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 052c7f9ffb0e95843e75448d02664459253f9ff8 upstream.
The intent was to test whether the flag was set.
This patch should be backported to stable kernels as old as 3.0, since it fixes a bug in commit e95829f474f0db3a4d940cae1423783edd966027 "xhci:
Switch PPT ports to EHCI on shutdown.", which was marked for stable.
--- drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.c +1 -1
@@ -594,7 +594,7 @@ void xhci_shutdown(struct usb_hcd *hcd) {struct xhci_hcd *xhci =hcd_to_xhci (hcd); -if (xhci->quirks &&XHCI_SPURIOUS_REBOOT ) +if (xhci->quirks &XHCI_SPURIOUS_REBOOT )usb_disable_xhci_ports (to_pci_dev (hcd->self.controller));spin_lock_irq (&xhci->lock);
Greg Kroah-Hartman
maintainerPATCH 80/127 xhci: Make handover code more robust
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Garrett <[email protected]>
commit e955a1cd086de4d165ae0f4c7be7289d84b63bdc upstream.
My test platform (Intel DX79SI) boots reliably under BIOS, but frequently crashes when booting via UEFI. I finally tracked this down to the xhci handoff code. It seems that reads from the device occasionally just return 0xff, resulting in xhci_find_next_cap_offset generating a value that's larger than the resource region. We then oops when attempting to read the value. Sanity checking that value lets us avoid the crash.
I've no idea what's causing the underlying problem, and xhci still doesn't actually *work* even with this, but the machine at least boots which will probably make further debugging easier.
This should be backported to kernels as old as 2.6.31, that contain the commit 66d4eadd8d067269ea8fead1a50fe87c2979a80d "USB: xhci: BIOS handoff and HW initialization."
--- drivers/usb/host/pci-quirks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/host/pci-quirks.c +10 -2
@@ -839,12 +839,12 @@ static void __devinit quirk_usb_handoff_void __iomem *op_reg_base;u32 val;int timeout; +int len =pci_resource_len (pdev,0 );if (!mmio_resource_enabled (pdev,0 ))return ; - base =ioremap_nocache (pci_resource_start (pdev,0 ), -pci_resource_len (pdev,0 )); + base =ioremap_nocache (pci_resource_start (pdev,0 ), len);if (base ==NULL )return ;
@@ -854,9 +854,17 @@ static void __devinit quirk_usb_handoff_*/ ext_cap_offset =xhci_find_next_cap_offset (base,XHCI_HCC_PARAMS_OFFSET ); do { + if ((ext_cap_offset + sizeof(val)) > len) { + /* We're reading garbage from the controller */ + dev_warn(&pdev->dev, + "xHCI controller failing to respond"); + return; + } + if (!ext_cap_offset) /* We've reached the end of the extended capabilities */ goto hc_init; + val = readl(base + ext_cap_offset); if (XHCI_EXT_CAPS_ID(val) == XHCI_EXT_CAPS_LEGACY) break;
Greg Kroah-Hartman
maintainerPATCH 81/127 xhci: Recognize USB 3.0 devices as superspeed at powerup
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manoj Iyer <[email protected]>
commit 29d214576f936db627ff62afb9ef438eea18bcd2 upstream.
On Intel Panther Point chipset USB 3.0 devices show up as high-speed devices on powerup, but after an s3 cycle they are correctly recognized as SuperSpeed. At powerup switch the port to xHCI so that USB 3.0 devices are correctly recognized.
This patch should be backported to kernels as old as 3.0, that contain commit ID 69e848c2090aebba5698a1620604c7dccb448684 "Intel xhci: Support EHCI/xHCI port switching."
--- drivers/usb/host/pci-quirks.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/pci-quirks.c +2 -1
@@ -895,9 +895,10 @@ static void __devinit quirk_usb_handoff_/* Disable any BIOS SMIs and clear all SMI events*/ writel (val, base + ext_cap_offset +XHCI_LEGACY_CONTROL_OFFSET ); +hc_init:if (usb_is_intel_switchable_xhci (pdev))usb_enable_xhci_ports (pdev); -hc_init: + op_reg_base = base +XHCI_HC_LENGTH (readl (base));/* Wait for the host controller to be ready before writing any
Greg Kroah-Hartman
maintainerPATCH 82/127 usb: host: xhci: fix compilation error for non-PCI based stacks
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moiz Sonasath <[email protected]>
commit 296365781903226a3fb8758901eaeec09d2798e4 upstream.
For non PCI-based stacks, this function call usb_disable_xhci_ports(to_pci_dev(hcd->self.controller)); made from xhci_shutdown is not applicable.
Ideally, we wouldn't have any PCI-specific code on a generic driver such as the xHCI stack, but it looks like we should just stub usb_disable_xhci_ports() out for non-PCI devices.
[ [email protected]: slight improvement to commit log ]
This patch should be backported to kernels as old as 3.0, since the commit it fixes (e95829f474f0db3a4d940cae1423783edd966027 "xhci: Switch PPT ports to EHCI on shutdown.") was marked for stable.
--- drivers/usb/host/pci-quirks.h | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/pci-quirks.h +1 -0
@@ -15,6 +15,7 @@ void usb_disable_xhci_ports(struct pci_dstatic inline void usb_amd_quirk_pll_disable (void ) {}static inline void usb_amd_quirk_pll_enable (void ) {}static inline void usb_amd_dev_put (void ) {} +static inline void usb_disable_xhci_ports (struct pci_dev *xhci_pdev) {}#endif /* CONFIG_PCI */ #endif /* __LINUX_USB_PCI_QUIRKS_H */
Greg Kroah-Hartman
maintainerPATCH 83/127 xhci: Fix bug after deq ptr set to link TRB.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 50d0206fcaea3e736f912fd5b00ec6233fb4ce44 upstream.
This patch fixes a particularly nasty bug that was revealed by the ring expansion patches. The bug has been present since the very beginning of the xHCI driver history, and could have caused general protection faults from bad memory accesses.
The first thing to note is that a Set TR Dequeue Pointer command can move the dequeue pointer to a link TRB, if the canceled or stalled transfer TD ended just before a link TRB. The function to increment the dequeue pointer, inc_deq, was written before cancellation and stall support was added. It assumed that the dequeue pointer could never point to a link TRB. It would unconditionally increment the dequeue pointer at the start of the function, check if the pointer was now on a link TRB, and move it to the top of the next segment if so.
This means that if a Set TR Dequeue Point command moved the dequeue pointer to a link TRB, a subsequent call to inc_deq() would move the pointer off the segment and into la-la-land. It would then read from that memory to determine if it was a link TRB. Other functions would often call inc_deq() until the dequeue pointer matched some other pointer, which means this function would quite happily read all of system memory before wrapping around to the right pointer value.
Often, there would be another endpoint segment from a different ring allocated from the same DMA pool, which would be contiguous to the segment inc_deq just stepped off of. inc_deq would eventually find the link TRB in that segment, and blindly move the dequeue pointer back to the top of the correct ring segment.
The only reason the original code worked at all is because there was only one ring segment. With the ring expansion patches, the dequeue pointer would eventually wrap into place, but the dequeue segment would be out-of-sync. On the second TD after the dequeue pointer was moved to a link TRB, trb_in_td() would fail (because the dequeue pointer and dequeue segment were out-of-sync), and this message would appear:
ERROR Transfer event TRB DMA ptr not part of current TD
This fixes bugzilla entry 4333 (option-based modem unhappy on USB 3.0
port: "Transfer event TRB DMA ptr not part of current TD", "rejecting I/O to offline device"),
https://bugzilla.kernel.org/show_bug.cgi?id=43333
and possibly other general protection fault bugs as well.
This patch should be backported to kernels as old as 2.6.31. A separate patch will be created for kernels older than 3.4, since inc_deq was modified in 3.4 and this patch will not apply.
--- drivers/usb/host/xhci-ring.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-)
drivers/usb/host/xhci-ring.c +24 -15
@@ -147,25 +147,34 @@ static void next_trb(struct xhci_hcd *xh*/ static void inc_deq (struct xhci_hcd *xhci,struct xhci_ring *ring,bool consumer) { -union xhci_trb *next = ++(ring->dequeue);unsigned long long addr; ring->deq_updates++; -/* Update the dequeue pointer further if that was a link TRB or we're at -* the end of an event ring segment (which doesn't have link TRBS) -*/ -while (last_trb (xhci, ring, ring->deq_seg, next)) { -if (consumer &&last_trb_on_last_seg (xhci, ring, ring->deq_seg, next)) { - ring->cycle_state = (ring->cycle_state ?0 :1 ); -if (!in_interrupt ()) -xhci_dbg (xhci,"Toggle cycle state for ring %p = %i\n" , - ring, - (unsigned int ) ring->cycle_state); + +do { +/* +* Update the dequeue pointer further if that was a link TRB or +* we're at the end of an event ring segment (which doesn't have +* link TRBS) +*/ +if (last_trb (xhci, ring, ring->deq_seg, ring->dequeue)) { +if (consumer &&last_trb_on_last_seg (xhci, ring, + ring->deq_seg, ring->dequeue)) { +if (!in_interrupt ()) +xhci_dbg (xhci,"Toggle cycle state " +"for ring %p = %i\n" , + ring, + (unsigned int ) + ring->cycle_state); + ring->cycle_state = (ring->cycle_state ?0 :1 ); + } + ring->deq_seg = ring->deq_seg->next; + ring->dequeue = ring->deq_seg->trbs; + }else { + ring->dequeue++; } - ring->deq_seg = ring->deq_seg->next; - ring->dequeue = ring->deq_seg->trbs; - next = ring->dequeue; - } + }while (last_trb (xhci, ring, ring->deq_seg, ring->dequeue)); + addr = (unsigned long long )xhci_trb_virt_to_dma (ring->deq_seg, ring->dequeue); }
Greg Kroah-Hartman
maintainerPATCH 84/127 mutex: Place lock in contended state after fastpath_lock failure
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 0bce9c46bf3b15f485d82d7e81dabed6ebcc24b1 upstream.
ARM recently moved to asm-generic/mutex-xchg.h for its mutex implementation after the previous implementation was found to be missing some crucial memory barriers. However, this has revealed some problems running hackbench on SMP platforms due to the way in which the MUTEX_SPIN_ON_OWNER code operates.
The symptoms are that a bunch of hackbench tasks are left waiting on an unlocked mutex and therefore never get woken up to claim it. This boils down to the following sequence of events:
Task A Task B Task C Lock value
0 1 1 lock() 0 2 lock() 0 3 spin(A) 0 4 unlock() 1 5 lock() 0 6 cmpxchg(1,0) 0 7 contended() -1 8 lock() 0 9 spin(C) 0 10 unlock() 1 11 cmpxchg(1,0) 0 12 unlock() 1
At this point, the lock is unlocked, but Task B is in an uninterruptible sleep with nobody to wake it up.
This patch fixes the problem by ensuring we put the lock into the contended state if we fail to acquire it on the fastpath, ensuring that any blocked waiters are woken up when the mutex is released.
--- include/asm-generic/mutex-xchg.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
include/asm-generic/mutex-xchg.h +9 -2
@@ -26,7 +26,13 @@ static inline void __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) {if (unlikely (atomic_xchg (count,0 ) !=1 )) -fail_fn (count); +/* +* We failed to acquire the lock, so mark it contended +* to ensure that any waiting tasks are woken up by the +* unlock slow path. +*/ +if (likely (atomic_xchg (count,-1 ) !=1 )) +fail_fn (count); }/**
@@ -43,7 +49,8 @@ static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) {if (unlikely (atomic_xchg (count,0 ) !=1 )) -return fail_fn (count); +if (likely (atomic_xchg (count,-1 ) !=1 )) +return fail_fn (count);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 85/127 drivers/rtc/rtc-rs5c348.c: fix hour decoding in 12-hour mode
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Atsushi Nemoto <[email protected]>
commit 7dbfb315b2aaef0a115765946bf3026d074c33a7 upstream.
Correct the offset by subtracting 20 from tm_hour before taking the modulo 12.
[ "Why 20?" I hear you ask. Or at least I did.
Here's the reason why: RS5C348_BIT_PM is 32, and is - stupidly - included in the RS5C348_HOURS_MASK define. So it's really subtracting out that bit to get "hour+12". But then because it does things modulo 12, it needs to add the 12 in again afterwards anyway.
This code is confused. It would be much clearer if RS5C348_HOURS_MASK just didn't include the RS5C348_BIT_PM bit at all, then it wouldn't need to do the silly subtract either.
Whatever. It's all just math, the end result is the same. - Linus ]
--- drivers/rtc/rtc-rs5c348.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/rtc/rtc-rs5c348.c +5 -2
@@ -121,9 +121,12 @@ rs5c348_rtc_read_time(struct device *dev tm->tm_min =bcd2bin (rxbuf[RS5C348_REG_MINS ] &RS5C348_MINS_MASK ); tm->tm_hour =bcd2bin (rxbuf[RS5C348_REG_HOURS ] &RS5C348_HOURS_MASK );if (!pdata->rtc_24h) { - tm->tm_hour %=12 ; -if (rxbuf[RS5C348_REG_HOURS ] &RS5C348_BIT_PM ) +if (rxbuf[RS5C348_REG_HOURS ] &RS5C348_BIT_PM ) { + tm->tm_hour -=20 ; + tm->tm_hour %=12 ; tm->tm_hour +=12 ; + }else + tm->tm_hour %=12 ; } tm->tm_wday =bcd2bin (rxbuf[RS5C348_REG_WDAY ] &RS5C348_WDAY_MASK ); tm->tm_mday =bcd2bin (rxbuf[RS5C348_REG_DAY ] &RS5C348_DAY_MASK );
Greg Kroah-Hartman
maintainerPATCH 86/127 PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 7f321c26c04807834fef4c524d2b21573423fc74 upstream.
For devices whose power.no_callbacks flag is set, rpm_resume() should return 1 if the device's parent is already active, so that the callers of pm_runtime_get() don't think that they have to wait for the device to resume (asynchronously) in that case (the core won't queue up an asynchronous resume in that case, so there's nothing to wait for anyway).
Modify the code accordingly (and make sure that an idle notification will be queued up on success, even if 1 is to be returned).
--- drivers/base/power/runtime.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/base/power/runtime.c +2 -1
@@ -533,6 +533,7 @@ static int rpm_resume(struct device *dev || dev->parent->power.runtime_status == RPM_ACTIVE) {atomic_inc (&dev->parent->power.child_count);spin_unlock (&dev->parent->power.lock); + retval =1 ; goto no_callback;/* Assume success. */ }spin_unlock (&dev->parent->power.lock);
@@ -610,7 +611,7 @@ static int rpm_resume(struct device *dev }wake_up_all (&dev->power.wait_queue); -if (!retval) +if (retval >=0 )rpm_idle (dev,RPM_ASYNC ); out:
Greg Kroah-Hartman
maintainerPATCH 87/127 PM / Runtime: Clear power.deferred_resume on success in rpm_suspend()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 58a34de7b1a920d287d17d2ca08bc9aaf7e6d35b upstream.
The power.deferred_resume can only be set if the runtime PM status of device is RPM_SUSPENDING and it should be cleared after its status has been changed, regardless of whether or not the runtime suspend has been successful. However, it only is cleared on suspend failure, while it may remain set on successful suspend and is happily leaked to rpm_resume() executed in that case.
That shouldn't happen, so if power.deferred_resume is set in rpm_suspend() after the status has been changed to RPM_SUSPENDED, clear it before calling rpm_resume(). Then, it doesn't need to be cleared before changing the status to RPM_SUSPENDING any more, because it's always cleared after the status has been changed to either RPM_SUSPENDED (on success) or RPM_ACTIVE (on failure).
--- drivers/base/power/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/runtime.c +1 -1
@@ -360,7 +360,6 @@ static int rpm_suspend(struct device *de goto repeat; } - dev->power.deferred_resume = false;if (dev->power.no_callbacks) goto no_callback;/* Assume success. */
@@ -420,6 +419,7 @@ static int rpm_suspend(struct device *dewake_up_all (&dev->power.wait_queue);if (dev->power.deferred_resume) { + dev->power.deferred_resume = false;rpm_resume (dev,0 ); retval = -EAGAIN ; goto out;
Greg Kroah-Hartman
maintainerPATCH 88/127 drivers/misc/sgi-xp/xpc_uv.c: SGI XPC fails to load when cpu 0 is out of IRQ resources
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Holt <[email protected]>
commit 7838f994b4fceff24c343f4e26a6cf4393869579 upstream.
On many of our larger systems, CPU 0 has had all of its IRQ resources consumed before XPC loads. Worst cases on machines with multiple 10 GigE cards and multiple IB cards have depleted the entire first socket of IRQs.
This patch makes selecting the node upon which IRQs are allocated (as well as all the other GRU Message Queue structures) specifiable as a module load param and has a default behavior of searching all nodes/cpus for an available resources.
--- drivers/misc/sgi-xp/xpc_uv.c | 84 +++++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 19 deletions(-)
drivers/misc/sgi-xp/xpc_uv.c +65 -19
@@ -18,6 +18,8 @@#include <linux/interrupt.h> #include <linux/delay.h> #include <linux/device.h> +#include <linux/cpu.h> +#include <linux/module.h> #include <linux/err.h> #include <linux/slab.h> #include <asm/uv/uv_hub.h>
@@ -59,6 +61,8 @@ static struct xpc_heartbeat_uv *xpc_hear XPC_NOTIFY_MSG_SIZE_UV)#define XPC_NOTIFY_IRQ_NAME "xpc_notify" +static int xpc_mq_node =-1 ; +static struct xpc_gru_mq_uv *xpc_activate_mq_uv;static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
@@ -109,11 +113,8 @@ xpc_get_gru_mq_irq_uv(struct xpc_gru_mq_#if definedCONFIG_X86_64 mq->irq =uv_setup_irq (irq_name, cpu, mq->mmr_blade, mq->mmr_offset,UV_AFFINITY_CPU ); -if (mq->irq <0 ) { -dev_err (xpc_part,"uv_setup_irq() returned error=%d\n" , - -mq->irq); +if (mq->irq <0 )return mq->irq; - } mq->mmr_value =uv_read_global_mmr64 (mmr_pnode, mq->mmr_offset);
@@ -238,8 +239,9 @@ xpc_create_gru_mq_uv(unsigned int mq_siz mq->mmr_blade =uv_cpu_to_blade_id (cpu); nid =cpu_to_node (cpu); - page =alloc_pages_exact_node (nid,GFP_KERNEL | __GFP_ZERO |GFP_THISNODE , - pg_order); + page =alloc_pages_exact_node (nid, +GFP_KERNEL | __GFP_ZERO |GFP_THISNODE , + pg_order);if (page ==NULL ) {dev_err (xpc_part,"xpc_create_gru_mq_uv() failed to alloc %d " "bytes of memory on nid=%d for GRU mq\n" , mq_size, nid);
@@ -1731,9 +1733,50 @@ static struct xpc_arch_operations xpc_ar .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv, }; +static int +xpc_init_mq_node (int nid) +{ +int cpu; + +get_online_cpus (); + +for_each_cpu (cpu,cpumask_of_node (nid)) { + xpc_activate_mq_uv = +xpc_create_gru_mq_uv (XPC_ACTIVATE_MQ_SIZE_UV , nid, +XPC_ACTIVATE_IRQ_NAME , + xpc_handle_activate_IRQ_uv); +if (!IS_ERR (xpc_activate_mq_uv)) +break ; + } +if (IS_ERR (xpc_activate_mq_uv)) { +put_online_cpus (); +return PTR_ERR (xpc_activate_mq_uv); + } + +for_each_cpu (cpu,cpumask_of_node (nid)) { + xpc_notify_mq_uv = +xpc_create_gru_mq_uv (XPC_NOTIFY_MQ_SIZE_UV , nid, +XPC_NOTIFY_IRQ_NAME , + xpc_handle_notify_IRQ_uv); +if (!IS_ERR (xpc_notify_mq_uv)) +break ; + } +if (IS_ERR (xpc_notify_mq_uv)) { +xpc_destroy_gru_mq_uv (xpc_activate_mq_uv); +put_online_cpus (); +return PTR_ERR (xpc_notify_mq_uv); + } + +put_online_cpus (); +return 0 ; +} +int xpc_init_uv (void ) { +int nid; +int ret =0 ; + xpc_arch_ops = xpc_arch_ops_uv;if (sizeof (struct xpc_notify_mq_msghdr_uv ) >XPC_MSG_HDR_MAX_SIZE ) {
@@ -1742,21 +1785,21 @@ xpc_init_uv(void)return -E2BIG ; } - xpc_activate_mq_uv =xpc_create_gru_mq_uv (XPC_ACTIVATE_MQ_SIZE_UV ,0 , -XPC_ACTIVATE_IRQ_NAME , - xpc_handle_activate_IRQ_uv); -if (IS_ERR (xpc_activate_mq_uv)) -return PTR_ERR (xpc_activate_mq_uv); +if (xpc_mq_node <0 ) +for_each_online_node (nid) { + ret =xpc_init_mq_node (nid); - xpc_notify_mq_uv =xpc_create_gru_mq_uv (XPC_NOTIFY_MQ_SIZE_UV ,0 , -XPC_NOTIFY_IRQ_NAME , - xpc_handle_notify_IRQ_uv); -if (IS_ERR (xpc_notify_mq_uv)) { -xpc_destroy_gru_mq_uv (xpc_activate_mq_uv); -return PTR_ERR (xpc_notify_mq_uv); - } +if (!ret) +break ; + } +else + ret =xpc_init_mq_node (xpc_mq_node); -return 0 ; +if (ret <0 ) +dev_err (xpc_part,"xpc_init_mq_node() returned error=%d\n" , + -ret); + +return ret; }void
@@ -1765,3 +1808,6 @@ xpc_exit_uv(void)xpc_destroy_gru_mq_uv (xpc_notify_mq_uv);xpc_destroy_gru_mq_uv (xpc_activate_mq_uv); } + +module_param (xpc_mq_node, int,0 ); +MODULE_PARM_DESC (xpc_mq_node,"Node number on which to allocate message queues." );
Greg Kroah-Hartman
maintainerPATCH 89/127 fbcon: fix race condition between console lock and cursor timer (v1.1)
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit d8636a2717bb3da2a7ce2154bf08de90bb8c87b0 upstream.
So we've had a fair few reports of fbcon handover breakage between efi/vesafb and i915 surface recently, so I dedicated a couple of days to finding the problem.
Essentially the last thing we saw was the conflicting framebuffer message and that was all.
So after much tracing with direct netconsole writes (printks under console_lock not so useful), I think I found the race.
Thread A (driver load) Thread B (timer thread)
unbind_con_driver -> |
bind_con_driver -> |
vc->vc_sw->con_deinit -> |
fbcon_deinit -> |
console_lock() |
| |
| fbcon_flashcursor timer fires
| console_lock() <- blocked for A
|
|fbcon_del_cursor_timer ->
del_timer_sync
(BOOM)
Of course because all of this is under the console lock, we never see anything, also since we also just unbound the active console guess what we never see anything.
Hopefully this fixes the problem for anyone seeing vesafb->kms driver handoff.
v1.1: add comment suggestion from Alan.
--- drivers/video/console/fbcon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/video/console/fbcon.c +8 -1
@@ -373,8 +373,15 @@ static void fb_flashcursor(struct work_sstruct vc_data *vc =NULL ;int c;int mode; +int ret; + +/* FIXME: we should sort out the unbind locking instead */ +/* instead we just fail to flash the cursor if we can't get +* the lock instead of blocking fbcon deinit */ + ret =console_trylock (); +if (ret ==0 ) +return ; -console_lock ();if (ops && ops->currcon !=-1 ) vc = vc_cons[ops->currcon].d;
Greg Kroah-Hartman
maintainerPATCH 90/127 drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tvrtko Ursulin <[email protected]>
commit 52e9b39d9a89ae33662596bd30e62dd56bddbe73 upstream.
There is a more recent APU stepping with a new PCI ID shipping in the same board by Fujitsu which needs the same quirk to correctly mark the back plane connectors.
--- drivers/gpu/drm/radeon/radeon_atombios.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_atombios.c +1 -1
@@ -488,7 +488,7 @@ static bool radeon_atom_apply_quirks(str }/* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ -if ((dev->pdev->device ==0x9802 ) && +if (((dev->pdev->device ==0x9802 ) || (dev->pdev->device ==0x9806 )) && (dev->pdev->subsystem_vendor ==0x1734 ) && (dev->pdev->subsystem_device ==0x11bd )) {if (*connector_type ==DRM_MODE_CONNECTOR_VGA ) {
Greg Kroah-Hartman
maintainerPATCH 91/127 asus-laptop: HRWS/HWRS typo
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corentin Chary <[email protected]>
commit 8871e99f89b7d7b1ea99de550eea2a56273f42ab upstream.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=24222
--- drivers/platform/x86/asus-laptop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/platform/x86/asus-laptop.c +4 -4
@@ -646,9 +646,9 @@ static ssize_t show_infos(struct device* The significance of others is yet to be found. * If we don't find the method, we assume the device are present. */ - rv =acpi_evaluate_integer (asus->handle,"HRWS" ,NULL , &temp); + rv =acpi_evaluate_integer (asus->handle,"HWRS" ,NULL , &temp);if (!ACPI_FAILURE (rv)) - len +=sprintf (page + len,"HRWS value : %#x\n" , + len +=sprintf (page + len,"HWRS value : %#x\n" , (uint ) temp);/* * Another value for userspace: the ASYM method returns 0x02 for
@@ -1340,9 +1340,9 @@ static int asus_laptop_get_info(struct a* The significance of others is yet to be found. */ status = -acpi_evaluate_integer (asus->handle,"HRWS" ,NULL , &hwrs_result); +acpi_evaluate_integer (asus->handle,"HWRS" ,NULL , &hwrs_result);if (!ACPI_FAILURE (status)) -pr_notice (" HRWS returned %x" , (int )hwrs_result); +pr_notice (" HWRS returned %x" , (int )hwrs_result);if (!acpi_check_handle (asus->handle,METHOD_WL_STATUS ,NULL )) asus->have_rsts = true;
Greg Kroah-Hartman
maintainerPATCH 92/127 asus-nb-wmi: add some video toggle keys
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: AceLan Kao <[email protected]>
commit 3766054fff4af1b58a1440a284907887f4d2e8be upstream.
There are some new video switch keys that used by newer machines. 0xA0 - SDSP HDMI only0xA1 - SDSP LCD + HDMI0xA2 - SDSP CRT + HDMI0xA3 - SDSP TV + HDMI
But in Linux, there is no suitable userspace application to handle this, so, mapping them all to KEY_SWITCHVIDEOMODE.
--- drivers/platform/x86/asus-nb-wmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +4 -0
@@ -68,6 +68,10 @@ static const struct key_entry asus_nb_wm { KE_KEY, 0x8A, { KEY_PROG1 } }, { KE_KEY, 0x95, { KEY_MEDIA } }, { KE_KEY, 0x99, { KEY_PHONE } }, + { KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */ + { KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */ + { KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */ + { KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */ { KE_KEY, 0xb5, { KEY_CALC } }, { KE_KEY, 0xc4, { KEY_KBDILLUMUP } }, { KE_KEY, 0xc5, { KEY_KBDILLUMDOWN } },
Greg Kroah-Hartman
maintainerPATCH 93/127 drm/i915: HDMI - Clear Audio Enable bit for Hot Plug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Xingchao <[email protected]>
commit b98b60167279df3acac9422c3c9820d9ebbcf9fb upstream.
Clear Audio Enable bit to trigger unsolicated event to notify Audio Driver part the HDMI hot plug change. The patch fixed the bug when remove HDMI cable the bit was not cleared correctly.
In intel_hdmi_dpms(), if intel_hdmi->has_audio been true, the "Audio enable bit" will be set to trigger unsolicated event to notify Alsa driver the change.
intel_hdmi->has_audio will be reset to false from intel_hdmi_detect() after remove the hdmi cable, here's debug log:
[ 187.494153] [drm:output_poll_execute], [CONNECTOR:17:HDMI-A-1] status updated from 1 to 2 [ 187.525349] [drm:intel_hdmi_detect], HDMI: has_audio = 0
so when comes back to intel_hdmi_dpms(), the "Audio enable bit" will not be cleared. And this cause the eld infomation and pin presence doesnot update accordingly in alsa driver side.
This patch will also trigger unsolicated event to alsa driver to notify the hot plug event:
[ 187.853159] ALSA sound/pci/hda/patch_hdmi.c:772 HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=1 [ 187.853268] ALSA sound/pci/hda/patch_hdmi.c:990 HDMI status: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=0
--- drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +1 -1
@@ -160,7 +160,7 @@ static void intel_hdmi_dpms(struct drm_eu32 temp;u32 enable_bits =SDVO_ENABLE ; -if (intel_hdmi->has_audio) +if (intel_hdmi->has_audio || mode !=DRM_MODE_DPMS_ON ) enable_bits |=SDVO_AUDIO_ENABLE ; temp =I915_READ (intel_hdmi->sdvox_reg);
Greg Kroah-Hartman
maintainerPATCH 94/127 md: make sure metadata is updated when spares are activated or removed.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 6dafab6b1383e912cd252fa809570b484eb6e0dc upstream.
It isn't always necessary to update the metadata when spares are removed as the presence-or-not of a spare isn't really important to the integrity of an array.
Also activating a spare doesn't always require updating the metadata as the update on 'recovery-completed' is usually sufficient.
However the introduction of 'replacement' devices have made these transitions sometimes more important. For example the 'Replacement' flag isn't cleared until the original device is removed, so we need to ensure a metadata update after that 'spare' is removed.
So set MD_CHANGE_DEVS whenever a spare is activated or removed, to complement the current situation where it is set when a spare is added or a device is failed (or a number of other less common situations).
This is suitable for -stable as out-of-data metadata could lead to data corruption.
This is only relevant for 3.3 and later 9when 'replacement' as introduced.
--- drivers/md/md.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/md/md.c +7 -1
@@ -7096,6 +7096,7 @@ static int remove_and_add_spares(mddev_t {mdk_rdev_t *rdev;int spares =0 ; +int removed =0 ; mddev->curr_resync_completed =0 ;
@@ -7111,6 +7112,7 @@ static int remove_and_add_spares(mddev_tsprintf (nm,"rd%d" , rdev->raid_disk);sysfs_remove_link (&mddev->kobj, nm); rdev->raid_disk =-1 ; + removed =1 ; } }
@@ -7139,6 +7141,8 @@ static int remove_and_add_spares(mddev_t } } } +if (removed) +set_bit (MD_CHANGE_DEVS , &mddev->flags);return spares; }
@@ -7152,9 +7156,11 @@ static void reap_sync_thread(mddev_t *md !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {/* success...*/ /* activate any spares */ -if (mddev->pers->spare_active (mddev)) +if (mddev->pers->spare_active (mddev)) {sysfs_notify (&mddev->kobj,NULL ,"degraded" ); +set_bit (MD_CHANGE_DEVS , &mddev->flags); + } }if (test_bit (MD_RECOVERY_RESHAPE , &mddev->recovery) && mddev->pers->finish_reshape)
Re: [ 094/127] md: make sure metadata is updated when spares are activated or removed.
Quoted 7 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
6dafab6b1383e912cd252fa809570b484eb6e0dcupstream.
[...]
Quoted 4 lines
This is suitable for -stable as out-of-data metadata could lead to data corruption.
This is only relevant for 3.3 and later 9when 'replacement' as introduced.
[...]
Assuming Neil hasn't changed his mind about this, it should therefore not be applied to 3.0.
Ben.
Signature · 3 lines
Ben Hutchings
Usenet is essentially a HUGE group of people passing notes in class.
- Rachel Kadel, `A Quick Guide to Newsgroup Etiquette'Greg Kroah-Hartman
maintainerRe: [ 094/127] md: make sure metadata is updated when spares are activated or removed.
Quoted 9 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
6dafab6b1383e912cd252fa809570b484eb6e0dcupstream.[...]
Quoted 8 lines
Quoted 4 lines
This is suitable for -stable as out-of-data metadata could lead to data corruption.
This is only relevant for 3.3 and later 9when 'replacement' as introduced.[...]
Assuming Neil hasn't changed his mind about this, it should therefore not be applied to 3.0.
Neil, is this true?
greg k-h
Re: [ 094/127] md: make sure metadata is updated when spares are activated or removed.
Quoted 14 lines · On Fri, 28 Sep 2012 16:57:45 -0700 Greg Kroah-Hartman…
Quoted 13 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
6dafab6b1383e912cd252fa809570b484eb6e0dcupstream.[...]
Quoted 4 lines
This is suitable for -stable as out-of-data metadata could lead to data corruption.
This is only relevant for 3.3 and later 9when 'replacement' as introduced.
Quoted 8 lines
Quoted 4 lines
[...]
Assuming Neil hasn't changed his mind about this, it should therefore not be applied to 3.0.
Neil, is this true?
greg k-h
Yes it is true - my bad.
I should have realised that when you pointed out that the backport wasn't clean.
The patch won't hurt 3.0, but it isn't necessary at all, so best leave it out.
Thanks,
NeilBrown
Greg Kroah-Hartman
maintainerRe: [ 094/127] md: make sure metadata is updated when spares are activated or removed.
Quoted 24 lines · NeilBrown
Quoted 21 lines · On Fri, 28 Sep 2012 16:57:45 -0700 Greg Kroah-Hartman…
Quoted 9 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit
6dafab6b1383e912cd252fa809570b484eb6e0dcupstream.[...]
Quoted 8 lines
Quoted 4 lines
This is suitable for -stable as out-of-data metadata could lead to data corruption.
This is only relevant for 3.3 and later 9when 'replacement' as introduced.[...]
Assuming Neil hasn't changed his mind about this, it should therefore not be applied to 3.0.
Neil, is this true?
Quoted 7 lines
Quoted 1 line
greg k-h
Yes it is true - my bad.
I should have realised that when you pointed out that the backport wasn't clean.
The patch won't hurt 3.0, but it isn't necessary at all, so best leave it out.
Thanks for letting us know, I've now dropped this.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 95/127 workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lai Jiangshan <[email protected]>
commit 96e65306b81351b656835c15931d1d237b252f27 upstream.
The compiler may compile the following code into TWO write/modify instructions.
worker->flags &= ~WORKER_UNBOUND; worker->flags |= WORKER_REBIND;
so the other CPU may temporarily see worker->flags which doesn't have either WORKER_UNBOUND or WORKER_REBIND set and perform local wakeup prematurely.
Fix it by using single explicit assignment via ACCESS_ONCE().
Because idle workers have another WORKER_NOT_RUNNING flag, this bug doesn't exist for them; however, update it to use the same pattern for consistency.
tj: Applied the change to idle workers too and updated comments and
patch description a bit.
--- kernel/workqueue.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
kernel/workqueue.c +6 -3
@@ -3412,14 +3412,17 @@ static int __cpuinit trustee_thread(voidfor_each_busy_worker (worker, i, pos, gcwq) {struct work_struct *rebind_work = &worker->rebind_work; +unsigned long worker_flags = worker->flags;/* * Rebind_work may race with future cpu hotplug * operations. Use a separate flag to mark that -* rebinding is scheduled. +* rebinding is scheduled. The morphing should +* be atomic. */ - worker->flags |=WORKER_REBIND ; - worker->flags &= ~WORKER_ROGUE ; + worker_flags |=WORKER_REBIND ; + worker_flags &= ~WORKER_ROGUE ; +ACCESS_ONCE (worker->flags) = worker_flags;/* queue rebind_work, wq doesn't matter, use the default one */ if (test_and_set_bit(WORK_STRUCT_PENDING_BIT,
Greg Kroah-Hartman
maintainerPATCH 96/127 x86: Fix boot on Twinhead H12Y
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 80b3e557371205566a71e569fbfcce5b11f92dbe upstream.
Despite lots of investigation into why this is needed we don't know or have an elegant cure. The only answer found on this laptop is to mark a problem region as used so that Linux doesn't put anything there.
Currently all the users add reserve= command lines and anyone not knowing this needs to find the magic page that documents it. Automate it instead.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=10231
--- arch/x86/pci/fixup.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/x86/pci/fixup.c +17 -0
@@ -521,3 +521,20 @@ static void sb600_disable_hpet_bar(struc } }DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_ATI ,0x4385 , sb600_disable_hpet_bar); + +/* +* Twinhead H12Y needs us to block out a region otherwise we map devices +* there and any access kills the box. +* +* See: https://bugzilla.kernel.org/show_bug.cgi?id=10231 +* +* Match off the LPC and svid/sdid (older kernels lose the bridge subvendor) +*/ +static void __devinit twinhead_reserve_killing_zone (struct pci_dev *dev) +{ +if (dev->subsystem_vendor ==0x14FF && dev->subsystem_device ==0xA003 ) { +pr_info ("Reserving memory on Twinhead H12Y\n" ); +request_mem_region (0xFFB00000 ,0x100000 ,"twinhead" ); + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x27B9 , twinhead_reserve_killing_zone);
Greg Kroah-Hartman
maintainerPATCH 97/127 Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manoj Iyer <[email protected]>
commit 61c964ba1748e984cb232b431582815899bf10fe upstream.
Patch adds support for BCM20702A0 device id (0a5c:21f4).
usb-devices after patch was applied:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f4 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=E4D53DF154D6
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
usb-devices before patch was applied:
T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0a5c ProdID=21f4 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM20702A0
S: SerialNumber=E4D53DF154D6
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -106,6 +106,7 @@ static struct usb_device_id btusb_table[ { USB_DEVICE(0x0a5c, 0x21e6) }, { USB_DEVICE(0x0a5c, 0x21e8) }, { USB_DEVICE(0x0a5c, 0x21f3) }, + { USB_DEVICE(0x0a5c, 0x21f4) }, { USB_DEVICE(0x413c, 0x8197) },/* Foxconn - Hon Hai */
Greg Kroah-Hartman
maintainerPATCH 98/127 Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Padovan <[email protected]>
commit 92c385f46b30f4954e9dd2d2005c12d233b479ea upstream.
Many Broadcom devices has a vendor specific devices class, with this rule we match all existent and future controllers with this behavior.
We also remove old rules to that matches product id for Broadcom devices.
--- drivers/bluetooth/btusb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/bluetooth/btusb.c +3 -5
@@ -102,16 +102,14 @@ static struct usb_device_id btusb_table[/* Broadcom BCM20702A0 */ { USB_DEVICE(0x0489, 0xe042) }, - { USB_DEVICE(0x0a5c, 0x21e3) }, - { USB_DEVICE(0x0a5c, 0x21e6) }, - { USB_DEVICE(0x0a5c, 0x21e8) }, - { USB_DEVICE(0x0a5c, 0x21f3) }, - { USB_DEVICE(0x0a5c, 0x21f4) }, { USB_DEVICE(0x413c, 0x8197) },/* Foxconn - Hon Hai */ { USB_DEVICE(0x0489, 0xe033) }, +/*Broadcom devices with vendor specific id */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }, + { } /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 99/127 Bluetooth: Add support for Apple vendor-specific devices
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henrik Rydberg <[email protected]>
commit 1fa6535faf055cd71311ab887e94fc234f04ee18 upstream.
As pointed out by Gustavo and Marcel, all Apple-specific Broadcom devices seen so far have the same interface class, subclass and protocol numbers. This patch adds an entry which matches all of them, using the new USB_VENDOR_AND_INTERFACE_INFO() macro.
In particular, this patch adds support for the MacBook Pro Retina (05ac:8286), which is not in the present list.
--- drivers/bluetooth/btusb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btusb.c +3 -0
@@ -60,6 +60,9 @@ static struct usb_device_id btusb_table[/* Generic Bluetooth USB device */ { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, +/* Apple-specific (Broadcom) devices */ + { USB_VENDOR_AND_INTERFACE_INFO(0x05ac, 0xff, 0x01, 0x01) }, +/* Broadcom SoftSailing reporting vendor specific */ { USB_DEVICE(0x0a5c, 0x21e1) },
Greg Kroah-Hartman
maintainerPATCH 100/127 net: Statically initialize init_net.dev_base_head
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rustad, Mark D" <[email protected]>
commit 734b65417b24d6eea3e3d7457e1f11493890ee1d upstream.
This change eliminates an initialization-order hazard most recently seen when netprio_cgroup is built into the kernel.
With thanks to Eric Dumazet for catching a bug.
--- net/core/dev.c | 3 ++- net/core/net_namespace.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
net/core/dev.c +2 -1
@@ -6260,7 +6260,8 @@ static struct hlist_head *netdev_create_/* Initialize per network namespace state */ static int __net_init netdev_init (struct net *net) { -INIT_LIST_HEAD (&net->dev_base_head); +if (net != &init_net) +INIT_LIST_HEAD (&net->dev_base_head); net->dev_name_head =netdev_create_hash ();if (net->dev_name_head ==NULL )
net/core/net_namespace.c +3 -1
@@ -24,7 +24,9 @@ static DEFINE_MUTEX(net_mutex);LIST_HEAD (net_namespace_list);EXPORT_SYMBOL_GPL (net_namespace_list); -struct net init_net; +struct net init_net = { + .dev_base_head =LIST_HEAD_INIT (init_net.dev_base_head), +};EXPORT_SYMBOL (init_net);#define INITIAL_NET_GEN_PTRS 13/* +1 for len +2 for rcu_head */
Greg Kroah-Hartman
maintainerPATCH 101/127 Fix a dead loop in async_synchronize_full()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhong <[email protected]>
[Fixed upstream by commits 2955b47d2c1983998a8c5915cb96884e67f7cb53 and a4683487f90bfe3049686fc5c566bdc1ad03ace6 from Dan Williams, but they are much more intrusive than this tiny fix, according to Andrew - gregkh]
This patch tries to fix a dead loop in async_synchronize_full(), which could be seen when preemption is disabled on a single cpu machine.
void async_synchronize_full(void)
{
do {
async_synchronize_cookie(next_cookie);
} while (!list_empty(&async_running) || !list_empty(&async_pending));
}
async_synchronize_cookie() calls async_synchronize_cookie_domain() with &async_running as the default domain to synchronize.
However, there might be some works in the async_pending list from other domains. On a single cpu system, without preemption, there is no chance for the other works to finish, so async_synchronize_full() enters a dead loop.
It seems async_synchronize_full() wants to synchronize all entries in all running lists(domains), so maybe we could just check the entry_count to know whether all works are finished.
Currently, async_synchronize_cookie_domain() expects a non-NULL running list ( if NULL, there would be NULL pointer dereference ), so maybe a NULL pointer could be used as an indication for the functions to synchronize all works in all domains.
--- kernel/async.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/async.c +9 -4
@@ -87,6 +87,13 @@ static async_cookie_t __lowest_in_progr {struct async_entry *entry; +if (!running) {/* just check the entry count */ +if (atomic_read (&entry_count)) +return 0 ;/* smaller than any cookie */ +else +return next_cookie; + } +if (!list_empty (running)) { entry =list_first_entry (running, struct async_entry, list);
@@ -236,9 +243,7 @@ EXPORT_SYMBOL_GPL(async_schedule_domain)*/ void async_synchronize_full (void ) { -do { -async_synchronize_cookie (next_cookie); - }while (!list_empty (&async_running) || !list_empty (&async_pending)); +async_synchronize_cookie_domain (next_cookie,NULL ); }EXPORT_SYMBOL_GPL (async_synchronize_full);
@@ -258,7 +263,7 @@ EXPORT_SYMBOL_GPL(async_synchronize_full/** * async_synchronize_cookie_domain - synchronize asynchronous function calls within a certain domain with cookie checkpointing * @cookie: async_cookie_t to use as checkpoint -* @running: running list to synchronize on +* @running: running list to synchronize on, NULL indicates all lists * * This function waits until all asynchronous function calls for the * synchronization domain specified by the running list @list submitted
Greg Kroah-Hartman
maintainerPATCH 102/127 rds: set correct msg_namelen
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weiping Pan <[email protected]>
commit 06b6a1cf6e776426766298d055bb3991957d90a7 upstream.
Jay Fenlason ([email protected]) found a bug,
that recvfrom() on an RDS socket can return the contents of random kernel memory to userspace if it was called with a address length larger than sizeof(struct sockaddr_in).rds_recvmsg() also fails to set the addr_len paramater properly before returning, but that's just a bug.
There are also a number of cases wher recvfrom() can return an entirely bogus address. Anything in rds_recvmsg() that returns a non-negative value but does not go through the "sin = (struct sockaddr_in *)msg->msg_name;" code path at the end of the while(1) loop will return up to 128 bytes of kernel memory to userspace.
And I write two test programs to reproduce this bug, you will see that in rds_server, fromAddr will be overwritten and the following sock_fd will be destroyed.
Yes, it is the programmer's fault to set msg_namelen incorrectly, but it is better to make the kernel copy the real length of address to user space in such case.
How to run the test programs ?
I test them on 32bit x86 system, 3.5.0-rc7.
1 compile
gcc -o rds_client rds_client.c
gcc -o rds_server rds_server.c
2 run ./rds_server on one console
3 run ./rds_client on another console
4 you will see something like:
server is waiting to receive data...
old socket fd=3
server received data from client:data from client
msg.msg_namelen=32
new socket fd=-1067277685sendmsg()
: Bad file descriptor
/***************** rds_client.c ********************/
int main(void)
{
int sock_fd;
struct sockaddr_in serverAddr;
struct sockaddr_in toAddr;
char recvBuffer[128] = "data from client";
struct msghdr msg;
struct iovec iov;
sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
if (sock_fd < 0) {
perror("create socket error\n");
exit(1);
}
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddr.sin_port = htons(4001);
if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
perror("bind() error\n");
close(sock_fd);
exit(1);
}
memset(&toAddr, 0, sizeof(toAddr));
toAddr.sin_family = AF_INET;
toAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
toAddr.sin_port = htons(4000);
msg.msg_name = &toAddr;
msg.msg_namelen = sizeof(toAddr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = strlen(recvBuffer) + 1;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
if (sendmsg(sock_fd, &msg, 0) == -1) {
perror("sendto() error\n");
close(sock_fd);
exit(1);
}
printf("client send data:%s\n", recvBuffer);
memset(recvBuffer, '\0', 128);
msg.msg_name = &toAddr;
msg.msg_namelen = sizeof(toAddr);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = 128;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
if (recvmsg(sock_fd, &msg, 0) == -1) {
perror("recvmsg() error\n");
close(sock_fd);
exit(1);
}
printf("receive data from server:%s\n", recvBuffer);
close(sock_fd);
return 0;
}/***************** rds_server.c ********************/
int main(void)
{
struct sockaddr_in fromAddr;
int sock_fd;
struct sockaddr_in serverAddr;
unsigned int addrLen;
char recvBuffer[128];
struct msghdr msg;
struct iovec iov;
sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
if(sock_fd < 0) {
perror("create socket error\n");
exit(0);
}
memset(&serverAddr, 0, sizeof(serverAddr));
serverAddr.sin_family = AF_INET;
serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
serverAddr.sin_port = htons(4000);
if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
perror("bind error\n");
close(sock_fd);
exit(1);
}
printf("server is waiting to receive data...\n");
msg.msg_name = &fromAddr;
/*
* I add 16 to sizeof(fromAddr), ie 32,
* and pay attention to the definition of fromAddr,
* recvmsg() will overwrite sock_fd,
* since kernel will copy 32 bytes to userspace.
*
* If you just use sizeof(fromAddr), it works fine.
* */
msg.msg_namelen = sizeof(fromAddr) + 16;
/* msg.msg_namelen = sizeof(fromAddr); */
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
msg.msg_iov->iov_base = recvBuffer;
msg.msg_iov->iov_len = 128;
msg.msg_control = 0;
msg.msg_controllen = 0;
msg.msg_flags = 0;
while (1) {
printf("old socket fd=%d\n", sock_fd);
if (recvmsg(sock_fd, &msg, 0) == -1) {
perror("recvmsg() error\n");
close(sock_fd);
exit(1);
}
printf("server received data from client:%s\n", recvBuffer);
printf("msg.msg_namelen=%d\n", msg.msg_namelen);
printf("new socket fd=%d\n", sock_fd);
strcat(recvBuffer, "--data from server");
if (sendmsg(sock_fd, &msg, 0) == -1) {
perror("sendmsg()\n");
close(sock_fd);
exit(1);
}
}
close(sock_fd);
return 0;
}--- net/rds/recv.c | 3 +++ 1 file changed, 3 insertions(+)
net/rds/recv.c +3 -0
@@ -409,6 +409,8 @@ int rds_recvmsg(struct kiocb *iocb, strurdsdebug ("size %zu flags 0x%x timeo %ld\n" , size, msg_flags, timeo); + msg->msg_namelen =0 ; +if (msg_flags &MSG_OOB ) goto out;
@@ -484,6 +486,7 @@ int rds_recvmsg(struct kiocb *iocb, stru sin->sin_port = inc->i_hdr.h_sport; sin->sin_addr.s_addr = inc->i_saddr;memset (sin->sin_zero,0 ,sizeof (sin->sin_zero)); + msg->msg_namelen =sizeof (*sin); }break ; }
Greg Kroah-Hartman
maintainerPATCH 103/127 libata: Prevent interface errors with Seagate FreeAgent GoFlex
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel J Blueman <[email protected]>
commit c531077f40abc9f2129c4c83a30b3f8d6ce1c0e7 upstream.
When using my Seagate FreeAgent GoFlex eSATAp external disk enclosure, interface errors are always seen until 1.5Gbps is negotiated [1]. This occurs using any disk in the enclosure, and when the disk is connected directly with a generic passive eSATAp cable, we see stable 3Gbps operation as expected.
Blacklist 3Gbps mode to avoid dataloss and the ~30s delay bus reset and renegotiation incurs.
--- drivers/ata/libata-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-core.c +1 -0
@@ -4138,6 +4138,7 @@ static const struct ata_blacklist_entry/* Devices which aren't very happy with higher link speeds */ { "WD My Book", NULL, ATA_HORKAGE_1_5_GBPS, }, + { "Seagate FreeAgent GoFlex", NULL, ATA_HORKAGE_1_5_GBPS, },/* * Devices which choke on SETXFER. Applies only if both the
Greg Kroah-Hartman
maintainerPATCH 104/127 cpufreq / ACPI: Fix not loading acpi-cpufreq driver regression
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Renninger <[email protected]>
commit c4686c71a9183f76e3ef59098da5c098748672f6 upstream.
Commit d640113fe80e45ebd4a5b420b introduced a regression on SMP systems where the processor core with ACPI id zero is disabled (typically should be the case because of hyperthreading). The regression got spread through stable kernels.
On 3.0.X it got introduced via 3.0.18.
Such platforms may be rare, but do exist.
Look out for a disabled processor with acpi_id 0 in dmesg:
ACPI: LAPIC (acpi_id[0x00] lapic_id[0x10] disabled)
This problem has been observed on a:
HP Proliant BL280c G6 blade
This patch restricts the introduced workaround to platforms with nr_cpu_ids <= 1.
--- drivers/acpi/processor_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/acpi/processor_core.c +4 -2
@@ -188,10 +188,12 @@ int acpi_get_cpuid(acpi_handle handle, i* Processor (CPU3, 0x03, 0x00000410, 0x06) {} * } * -* Ignores apic_id and always return 0 for CPU0's handle. +* Ignores apic_id and always returns 0 for the processor +* handle with acpi id 0 if nr_cpu_ids is 1. +* This should be the case if SMP tables are not found. * Return -1 for other CPU's handle. */ -if (acpi_id ==0 ) +if (nr_cpu_ids <=1 && acpi_id ==0 )return acpi_id;else return apic_id;
Greg Kroah-Hartman
maintainerPATCH 105/127 sched: Fix race in task_group()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit 8323f26ce3425460769605a6aece7a174edaa7d1 upstream.
Stefan reported a crash on a kernel before a3e5d1091c1 ("sched:
Don't call task_group() too many times in set_task_rq()"), he found the reason to be that the multiple task_group() invocations in set_task_rq() returned different values.
Looking at all that I found a lack of serialization and plain wrong comments.
The below tries to fix it using an extra pointer which is updated under the appropriate scheduler locks. Its not pretty, but I can't really see another way given how all the cgroup stuff works.
--- include/linux/init_task.h | 12 +++++++++++- include/linux/sched.h | 5 ++++- kernel/sched.c | 32 ++++++++++++++++++-------------- 3 files changed, 33 insertions(+), 16 deletions(-)
include/linux/init_task.h +11 -1
@@ -124,8 +124,17 @@ extern struct group_info init_groups;extern struct cred init_cred; +extern struct task_group root_task_group; + +#ifdef CONFIG_CGROUP_SCHED +# define INIT_CGROUP_SCHED (tsk) \ + .sched_task_group = &root_task_group, +#else +# define INIT_CGROUP_SCHED (tsk) +#endif +#ifdef CONFIG_PERF_EVENTS -# define INIT_PERF_EVENTS (tsk) \ +# define INIT_PERF_EVENTS (tsk) \ .perf_event_mutex = \ __MUTEX_INITIALIZER(tsk.perf_event_mutex), \ .perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
@@ -160,6 +169,7 @@ extern struct cred init_cred; }, \ .tasks = LIST_HEAD_INIT(tsk.tasks), \ INIT_PUSHABLE_TASKS(tsk) \ +INIT_CGROUP_SCHED (tsk) \ .ptraced = LIST_HEAD_INIT(tsk.ptraced), \ .ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \ .real_parent = &tsk, \
include/linux/sched.h +4 -1
@@ -1235,6 +1235,9 @@ struct task_struct {const struct sched_class *sched_class;struct sched_entity se;struct sched_rt_entity rt; +#ifdef CONFIG_CGROUP_SCHED +struct task_group *sched_task_group; +#endif #ifdef CONFIG_PREEMPT_NOTIFIERS /* list of struct preempt_notifier: */
@@ -2613,7 +2616,7 @@ extern int sched_group_set_rt_period(strextern long sched_group_rt_period (struct task_group *tg);extern int sched_rt_can_attach (struct task_group *tg,struct task_struct *tsk);#endif -#endif +#endif /* CONFIG_CGROUP_SCHED */ extern int task_can_switch_user (struct user_struct *up,struct task_struct *tsk);
kernel/sched.c +18 -14
@@ -605,22 +605,19 @@ static inline int cpu_of(struct rq *rq)/* * Return the group to which this tasks belongs. * -* We use task_subsys_state_check() and extend the RCU verification with -* pi->lock and rq->lock because cpu_cgroup_attach() holds those locks for each -* task it moves into the cgroup. Therefore by holding either of those locks, -* we pin the task to the current cgroup. +* We cannot use task_subsys_state() and friends because the cgroup +* subsystem changes that value before the cgroup_subsys::attach() method +* is called, therefore we cannot pin it and might observe the wrong value. +* +* The same is true for autogroup's p->signal->autogroup->tg, the autogroup +* core changes this before calling sched_move_task(). +* +* Instead we use a 'copy' which is updated from sched_move_task() while +* holding both task_struct::pi_lock and rq::lock. */ static inline struct task_group *task_group (struct task_struct *p) { -struct task_group *tg; -struct cgroup_subsys_state *css; - - css =task_subsys_state_check (p, cpu_cgroup_subsys_id, -lockdep_is_held (&p->pi_lock) || -lockdep_is_held (&task_rq (p)->lock)); - tg = container_of(css, struct task_group, css); - -return autogroup_task_group (p, tg); +return p->sched_task_group; }/* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
@@ -2206,7 +2203,7 @@ void set_task_cpu(struct task_struct *p,* a task's CPU. ->pi_lock for waking tasks, rq->lock for runnable tasks. * * sched_move_task() holds both and thus holding either pins the cgroup, -* see set_task_rq(). +* see task_group(). * * Furthermore, all task_rq users should acquire both locks, see * task_rq_lock().
@@ -8545,6 +8542,7 @@ void sched_destroy_group(struct task_gro*/ void sched_move_task (struct task_struct *tsk) { +struct task_group *tg;int on_rq, running;unsigned long flags;struct rq *rq;
@@ -8559,6 +8557,12 @@ void sched_move_task(struct task_structif (unlikely (running)) tsk->sched_class->put_prev_task (rq, tsk); + tg =container_of (task_subsys_state_check (tsk, cpu_cgroup_subsys_id, +lockdep_is_held (&tsk->sighand->siglock)), + struct task_group, css); + tg =autogroup_task_group (tsk, tg); + tsk->sched_task_group = tg; +#ifdef CONFIG_FAIR_GROUP_SCHED if (tsk->sched_class->task_move_group) tsk->sched_class->task_move_group (tsk, on_rq);
Greg Kroah-Hartman
maintainerPATCH 106/127 media: lirc_sir: make device registration work
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarod Wilson <[email protected]>
commit 4b71ca6bce8fab3d08c61bf330e781f957934ae1 upstream.
For one, the driver device pointer needs to be filled in, or the lirc core will refuse to load the driver. And we really need to wire up all the platform_device bits. This has been tested via the lirc sourceforge tree and verified to work, been sitting there for months, finally getting around to sending it. :\
--- drivers/staging/lirc/lirc_sir.c | 60 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-)
drivers/staging/lirc/lirc_sir.c +58 -2
@@ -53,6 +53,7 @@#include <linux/io.h> #include <asm/irq.h> #include <linux/fcntl.h> +#include <linux/platform_device.h> #ifdef LIRC_ON_SA1100 #include <asm/hardware.h> #ifdef CONFIG_SA1100_COLLIE
@@ -488,9 +489,11 @@ static struct lirc_driver driver = { .owner = THIS_MODULE, }; +static struct platform_device *lirc_sir_dev;static int init_chrdev (void ) { + driver.dev = &lirc_sir_dev->dev; driver.minor =lirc_register_driver (&driver);if (driver.minor <0 ) { printk(KERN_ERR LIRC_DRIVER_NAME ": init_chrdev() failed.\n");
@@ -1216,20 +1219,71 @@ static int init_lirc_sir(void)return 0 ; } +static int __devinit lirc_sir_probe (struct platform_device *dev) +{ +return 0 ; +} + +static int __devexit lirc_sir_remove(struct platform_device *dev) +{ +return 0 ; +} + +static struct platform_driver lirc_sir_driver = { + .probe = lirc_sir_probe, + .remove =__devexit_p (lirc_sir_remove), + .driver = { + .name ="lirc_sir" , + .owner =THIS_MODULE , + }, +};static int __init lirc_sir_init (void ) {int retval; + retval =platform_driver_register (&lirc_sir_driver); +if (retval) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform driver register " + "failed!\n"); +return -ENODEV ; + } + + lirc_sir_dev =platform_device_alloc ("lirc_dev" ,0 ); +if (!lirc_sir_dev) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device alloc " + "failed!\n"); + retval = -ENOMEM ; + goto pdev_alloc_fail; + } + + retval =platform_device_add (lirc_sir_dev); +if (retval) { + printk(KERN_ERR LIRC_DRIVER_NAME ": Platform device add " + "failed!\n"); + retval = -ENODEV ; + goto pdev_add_fail; + } + retval =init_chrdev ();if (retval <0 ) -return retval; + goto fail; + retval =init_lirc_sir ();if (retval) {drop_chrdev (); -return retval; + goto fail; } +return 0 ; + +fail: +platform_device_del (lirc_sir_dev); +pdev_add_fail: +platform_device_put (lirc_sir_dev); +pdev_alloc_fail: +platform_driver_unregister (&lirc_sir_driver); +return retval; } static void __exit lirc_sir_exit(void)
@@ -1237,6 +1291,8 @@ static void __exit lirc_sir_exit(void)drop_hardware ();drop_chrdev ();drop_port (); +platform_device_unregister (lirc_sir_dev); +platform_driver_unregister (&lirc_sir_driver); printk(KERN_INFO LIRC_DRIVER_NAME ": Uninstalled.\n"); }
Greg Kroah-Hartman
maintainerPATCH 107/127 drop_monitor: fix sleeping in invalid context warning
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
commit cde2e9a651b76d8db36ae94cd0febc82b637e5dd upstream.
Eric Dumazet pointed out this warning in the drop_monitor protocol to me:
[ 38.352571] BUG: sleeping function called from invalid context at kernel/mutex.c:85 [ 38.352576] in_atomic(): 1, irqs_disabled(): 0, pid: 4415, name: dropwatch [ 38.352580] Pid: 4415, comm: dropwatch Not tainted 3.4.0-rc2+ #71 [ 38.352582] Call Trace: [ 38.352592] [<ffffffff8153aaf0>] ? trace_napi_poll_hit+0xd0/0xd0 [ 38.352599] [<ffffffff81063f2a>] __might_sleep+0xca/0xf0 [ 38.352606] [<ffffffff81655b16>] mutex_lock+0x26/0x50 [ 38.352610] [<ffffffff8153aaf0>] ? trace_napi_poll_hit+0xd0/0xd0 [ 38.352616] [<ffffffff810b72d9>] tracepoint_probe_register+0x29/0x90 [ 38.352621] [<ffffffff8153a585>] set_all_monitor_traces+0x105/0x170 [ 38.352625] [<ffffffff8153a8ca>] net_dm_cmd_trace+0x2a/0x40 [ 38.352630] [<ffffffff8154a81a>] genl_rcv_msg+0x21a/0x2b0 [ 38.352636] [<ffffffff810f8029>] ? zone_statistics+0x99/0xc0 [ 38.352640] [<ffffffff8154a600>] ? genl_rcv+0x30/0x30 [ 38.352645] [<ffffffff8154a059>] netlink_rcv_skb+0xa9/0xd0 [ 38.352649] [<ffffffff8154a5f0>] genl_rcv+0x20/0x30 [ 38.352653] [<ffffffff81549a7e>] netlink_unicast+0x1ae/0x1f0 [ 38.352658] [<ffffffff81549d76>] netlink_sendmsg+0x2b6/0x310 [ 38.352663] [<ffffffff8150824f>] sock_sendmsg+0x10f/0x130 [ 38.352668] [<ffffffff8150abe0>] ? move_addr_to_kernel+0x60/0xb0 [ 38.352673] [<ffffffff81515f04>] ? verify_iovec+0x64/0xe0 [ 38.352677] [<ffffffff81509c46>] __sys_sendmsg+0x386/0x390 [ 38.352682] [<ffffffff810ffaf9>] ? handle_mm_fault+0x139/0x210 [ 38.352687] [<ffffffff8165b5bc>] ? do_page_fault+0x1ec/0x4f0 [ 38.352693] [<ffffffff8106ba4d>] ? set_next_entity+0x9d/0xb0 [ 38.352699] [<ffffffff81310b49>] ? tty_ldisc_deref+0x9/0x10 [ 38.352703] [<ffffffff8106d363>] ? pick_next_task_fair+0x63/0x140 [ 38.352708] [<ffffffff8150b8d4>] sys_sendmsg+0x44/0x80 [ 38.352713] [<ffffffff8165f8e2>] system_call_fastpath+0x16/0x1b
It stems from holding a spinlock (trace_state_lock) while attempting to register or unregister tracepoint hooks, making in_atomic() true in this context, leading to the warning when the tracepoint calls might_sleep() while its taking a mutex. Since we only use the trace_state_lock to prevent trace protocol state races, as well as hardware stat list updates on an rcu write side, we can just convert the spinlock to a mutex to avoid this problem.
--- net/core/drop_monitor.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/core/drop_monitor.c +7 -7
@@ -42,7 +42,7 @@ static void send_dm_alert(struct work_st* netlink alerts */ static int trace_state =TRACE_OFF ; -static DEFINE_SPINLOCK (trace_state_lock); +static DEFINE_MUTEX (trace_state_mutex);struct per_cpu_dm_data {struct work_struct dm_alert_work;
@@ -213,7 +213,7 @@ static int set_all_monitor_traces(int ststruct dm_hw_stat_delta *new_stat =NULL ;struct dm_hw_stat_delta *temp; -spin_lock (&trace_state_lock); +mutex_lock (&trace_state_mutex);if (state == trace_state) { rc = -EAGAIN ;
@@ -252,7 +252,7 @@ static int set_all_monitor_traces(int st rc = -EINPROGRESS ; out_unlock: -spin_unlock (&trace_state_lock); +mutex_unlock (&trace_state_mutex);return rc; }
@@ -295,12 +295,12 @@ static int dropmon_net_event(struct noti new_stat->dev = dev; new_stat->last_rx = jiffies; -spin_lock (&trace_state_lock); +mutex_lock (&trace_state_mutex);list_add_rcu (&new_stat->list, &hw_stats_list); -spin_unlock (&trace_state_lock); +mutex_unlock (&trace_state_mutex);break ;case NETDEV_UNREGISTER : -spin_lock (&trace_state_lock); +mutex_lock (&trace_state_mutex);list_for_each_entry_safe (new_stat, tmp, &hw_stats_list, list) {if (new_stat->dev == dev) { new_stat->dev =NULL ;
@@ -311,7 +311,7 @@ static int dropmon_net_event(struct noti } } } -spin_unlock (&trace_state_lock); +mutex_unlock (&trace_state_mutex);break ; } out:
Greg Kroah-Hartman
maintainerPATCH 108/127 drop_monitor: Make updating data->skb smp safe
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
commit 3885ca785a3618593226687ced84f3f336dc3860 upstream.
Eric Dumazet pointed out to me that the drop_monitor protocol has some holes in its smp protections. Specifically, its possible to replace data->skb while its being written. This patch corrects that by making data->skb an rcu protected variable. That will prevent it from being overwritten while a tracepoint is modifying it.
--- net/core/drop_monitor.c | 70 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 16 deletions(-)
net/core/drop_monitor.c +54 -16
@@ -46,7 +46,7 @@ static DEFINE_MUTEX(trace_state_mutex);struct per_cpu_dm_data {struct work_struct dm_alert_work; -struct sk_buff *skb; +struct sk_buff __rcu *skb;atomic_t dm_hit_count;struct timer_list send_timer; };
@@ -73,35 +73,58 @@ static int dm_hit_limit = 64;static int dm_delay =1 ;static unsigned long dm_hw_check_delta =2 *HZ ;static LIST_HEAD (hw_stats_list); +static int initialized =0 ;static void reset_per_cpu_data (struct per_cpu_dm_data *data) {size_t al;struct net_dm_alert_msg *msg;struct nlattr *nla; +struct sk_buff *skb; +struct sk_buff *oskb =rcu_dereference_protected (data->skb,1 ); al =sizeof (struct net_dm_alert_msg ); al += dm_hit_limit *sizeof (struct net_dm_drop_point ); al +=sizeof (struct nlattr ); - data->skb =genlmsg_new (al,GFP_KERNEL ); -genlmsg_put (data->skb,0 ,0 , &net_drop_monitor_family, -0 ,NET_DM_CMD_ALERT ); - nla =nla_reserve (data->skb,NLA_UNSPEC ,sizeof (struct net_dm_alert_msg )); - msg =nla_data (nla); -memset (msg,0 , al); -atomic_set (&data->dm_hit_count, dm_hit_limit); + skb =genlmsg_new (al,GFP_KERNEL ); + +if (skb) { +genlmsg_put (skb,0 ,0 , &net_drop_monitor_family, +0 ,NET_DM_CMD_ALERT ); + nla =nla_reserve (skb,NLA_UNSPEC , +sizeof (struct net_dm_alert_msg )); + msg =nla_data (nla); +memset (msg,0 , al); + }else if (initialized) +schedule_work_on (smp_processor_id (), &data->dm_alert_work); + +/* +* Don't need to lock this, since we are guaranteed to only +* run this on a single cpu at a time. +* Note also that we only update data->skb if the old and new skb +* pointers don't match. This ensures that we don't continually call +* synchornize_rcu if we repeatedly fail to alloc a new netlink message. +*/ +if (skb != oskb) { +rcu_assign_pointer (data->skb, skb); + +synchronize_rcu (); + +atomic_set (&data->dm_hit_count, dm_hit_limit); + } + }static void send_dm_alert (struct work_struct *unused) {struct sk_buff *skb; -struct per_cpu_dm_data *data = &__get_cpu_var (dm_cpu_data); +struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data);/* * Grab the skb we're about to send */ - skb = data->skb; + skb =rcu_dereference_protected (data->skb,1 );/* * Replace it with a new one
@@ -111,8 +134,10 @@ static void send_dm_alert(struct work_st/* * Ship it! */ -genlmsg_multicast (skb,0 ,NET_DM_GRP_ALERT ,GFP_KERNEL ); +if (skb) +genlmsg_multicast (skb,0 ,NET_DM_GRP_ALERT ,GFP_KERNEL ); +put_cpu_var (dm_cpu_data); }/*
@@ -123,9 +148,11 @@ static void send_dm_alert(struct work_st*/ static void sched_send_work (unsigned long unused) { -struct per_cpu_dm_data *data = &__get_cpu_var (dm_cpu_data); +struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data); + +schedule_work_on (smp_processor_id (), &data->dm_alert_work); -schedule_work (&data->dm_alert_work); +put_cpu_var (dm_cpu_data); }static void trace_drop_common (struct sk_buff *skb,void *location)
@@ -134,9 +161,16 @@ static void trace_drop_common(struct sk_struct nlmsghdr *nlh;struct nlattr *nla;int i; -struct per_cpu_dm_data *data = &__get_cpu_var (dm_cpu_data); +struct sk_buff *dskb; +struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data); +rcu_read_lock (); + dskb =rcu_dereference (data->skb); + +if (!dskb) + goto out; +if (!atomic_add_unless (&data->dm_hit_count,-1 ,0 )) {/* * we're already at zero, discard this hit
@@ -144,7 +178,7 @@ static void trace_drop_common(struct sk_ goto out; } - nlh = (struct nlmsghdr *)data->skb->data; + nlh = (struct nlmsghdr *)dskb->data; nla =genlmsg_data (nlmsg_data (nlh)); msg =nla_data (nla);for (i =0 ; i < msg->entries; i++) {
@@ -157,7 +191,7 @@ static void trace_drop_common(struct sk_/* * We need to create a new entry */ -__nla_reserve_nohdr (data->skb,sizeof (struct net_dm_drop_point )); +__nla_reserve_nohdr (dskb,sizeof (struct net_dm_drop_point )); nla->nla_len +=NLA_ALIGN (sizeof (struct net_dm_drop_point ));memcpy (msg->points[msg->entries].pc, &location,sizeof (void *)); msg->points[msg->entries].count =1 ;
@@ -169,6 +203,8 @@ static void trace_drop_common(struct sk_ } out: +rcu_read_unlock (); +put_cpu_var (dm_cpu_data);return ; }
@@ -374,6 +410,8 @@ static int __init init_net_drop_monitor( data->send_timer.function = sched_send_work; } + initialized =1 ; + goto out; out_unreg:
Greg Kroah-Hartman
maintainerPATCH 109/127 drop_monitor: prevent init path from scheduling on the wrong cpu
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
commit 4fdcfa12843bca38d0c9deff70c8720e4e8f515f upstream.
I just noticed after some recent updates, that the init path for the drop monitor protocol has a minor error. drop monitor maintains a per cpu structure, that gets initalized from a single cpu. Normally this is fine, as the protocol isn't in use yet, but I recently made a change that causes a failed skb allocation to reschedule itself . Given the current code, the implication is that this workqueue reschedule will take place on the wrong cpu. If drop monitor is used early during the boot process, its possible that two cpus will access a single per-cpu structure in parallel, possibly leading to data corruption.
This patch fixes the situation, by storing the cpu number that a given instance of this per-cpu data should be accessed from. In the case of a need for a reschedule, the cpu stored in the struct is assigned the rescheule, rather than the currently executing cpu
Tested successfully by myself.
--- net/core/drop_monitor.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/core/drop_monitor.c +7 -5
@@ -49,6 +49,7 @@ struct per_cpu_dm_data {struct sk_buff __rcu *skb;atomic_t dm_hit_count;struct timer_list send_timer; +int cpu; };struct dm_hw_stat_delta {
@@ -73,7 +74,6 @@ static int dm_hit_limit = 64;static int dm_delay =1 ;static unsigned long dm_hw_check_delta =2 *HZ ;static LIST_HEAD (hw_stats_list); -static int initialized =0 ;static void reset_per_cpu_data (struct per_cpu_dm_data *data) {
@@ -96,8 +96,8 @@ static void reset_per_cpu_data(struct pe sizeof(struct net_dm_alert_msg)); msg =nla_data (nla);memset (msg,0 , al); - }else if (initialized) -schedule_work_on (smp_processor_id (), &data->dm_alert_work); + }else +schedule_work_on (data->cpu, &data->dm_alert_work);/* * Don't need to lock this, since we are guaranteed to only
@@ -121,6 +121,8 @@ static void send_dm_alert(struct work_ststruct sk_buff *skb;struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data); +WARN_ON_ONCE (data->cpu !=smp_processor_id ()); +/* * Grab the skb we're about to send */
@@ -403,14 +405,14 @@ static int __init init_net_drop_monitor(for_each_present_cpu (cpu) { data = &per_cpu (dm_cpu_data, cpu); -reset_per_cpu_data (data); + data->cpu = cpu;INIT_WORK (&data->dm_alert_work, send_dm_alert);init_timer (&data->send_timer); data->send_timer.data = cpu; data->send_timer.function = sched_send_work; +reset_per_cpu_data (data); } - initialized =1 ; goto out;
Greg Kroah-Hartman
maintainerPATCH 110/127 drop_monitor: dont sleep in atomic context
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit bec4596b4e6770c7037f21f6bd27567b152dc0d6 upstream.
drop_monitor calls several sleeping functions while in atomic context.
BUG: sleeping function called from invalid context at mm/slub.c:943 in_atomic(): 1, irqs_disabled(): 0, pid: 2103, name: kworker/0:2 Pid: 2103, comm: kworker/0:2 Not tainted 3.5.0-rc1+ #55 Call Trace: [<ffffffff810697ca>] __might_sleep+0xca/0xf0 [<ffffffff811345a3>] kmem_cache_alloc_node+0x1b3/0x1c0 [<ffffffff8105578c>] ? queue_delayed_work_on+0x11c/0x130 [<ffffffff815343fb>] __alloc_skb+0x4b/0x230 [<ffffffffa00b0360>] ? reset_per_cpu_data+0x160/0x160 [drop_monitor] [<ffffffffa00b022f>] reset_per_cpu_data+0x2f/0x160 [drop_monitor] [<ffffffffa00b03ab>] send_dm_alert+0x4b/0xb0 [drop_monitor] [<ffffffff810568e0>] process_one_work+0x130/0x4c0 [<ffffffff81058249>] worker_thread+0x159/0x360 [<ffffffff810580f0>] ? manage_workers.isra.27+0x240/0x240 [<ffffffff8105d403>] kthread+0x93/0xa0 [<ffffffff816be6d4>] kernel_thread_helper+0x4/0x10 [<ffffffff8105d370>] ? kthread_freezable_should_stop+0x80/0x80 [<ffffffff816be6d0>] ? gs_change+0xb/0xb
Rework the logic to call the sleeping functions in right context.
Use standard timer/workqueue api to let system chose any cpu to perform the allocation and netlink send.
Also avoid a loop if reset_per_cpu_data() cannot allocate memory :
use mod_timer() to wait 1/10 second before next try.
--- net/core/drop_monitor.c | 101 +++++++++++++++--------------------------------- 1 file changed, 33 insertions(+), 68 deletions(-)
net/core/drop_monitor.c +33 -68
@@ -33,9 +33,6 @@#define TRACE_ON 1#define TRACE_OFF 0 -static void send_dm_alert (struct work_struct *unused); - -/* * Globals, our netlink socket pointer * and the work handle that will send up
@@ -45,11 +42,10 @@ static int trace_state = TRACE_OFF;static DEFINE_MUTEX (trace_state_mutex);struct per_cpu_dm_data { -struct work_struct dm_alert_work; -struct sk_buff __rcu *skb; -atomic_t dm_hit_count; -struct timer_list send_timer; -int cpu; +spinlock_t lock; +struct sk_buff *skb; +struct work_struct dm_alert_work; +struct timer_list send_timer; };struct dm_hw_stat_delta {
@@ -75,13 +71,13 @@ static int dm_delay = 1;static unsigned long dm_hw_check_delta =2 *HZ ;static LIST_HEAD (hw_stats_list); -static void reset_per_cpu_data (struct per_cpu_dm_data *data) +static struct sk_buff *reset_per_cpu_data (struct per_cpu_dm_data *data) {size_t al;struct net_dm_alert_msg *msg;struct nlattr *nla;struct sk_buff *skb; -struct sk_buff *oskb =rcu_dereference_protected (data->skb,1 ); +unsigned long flags; al =sizeof (struct net_dm_alert_msg ); al += dm_hit_limit *sizeof (struct net_dm_drop_point );
@@ -96,65 +92,40 @@ static void reset_per_cpu_data(struct pe sizeof(struct net_dm_alert_msg)); msg =nla_data (nla);memset (msg,0 , al); - }else -schedule_work_on (data->cpu, &data->dm_alert_work); - -/* -* Don't need to lock this, since we are guaranteed to only -* run this on a single cpu at a time. -* Note also that we only update data->skb if the old and new skb -* pointers don't match. This ensures that we don't continually call -* synchornize_rcu if we repeatedly fail to alloc a new netlink message. -*/ -if (skb != oskb) { -rcu_assign_pointer (data->skb, skb); - -synchronize_rcu (); - -atomic_set (&data->dm_hit_count, dm_hit_limit); + }else { +mod_timer (&data->send_timer, jiffies +HZ /10 ); } +spin_lock_irqsave (&data->lock, flags); +swap (data->skb, skb); +spin_unlock_irqrestore (&data->lock, flags); + +return skb; } -static void send_dm_alert (struct work_struct *unused) +static void send_dm_alert (struct work_struct *work) {struct sk_buff *skb; -struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data); +struct per_cpu_dm_data *data; -WARN_ON_ONCE (data->cpu !=smp_processor_id ()); + data = container_of(work, struct per_cpu_dm_data, dm_alert_work); -/* -* Grab the skb we're about to send -*/ - skb =rcu_dereference_protected (data->skb,1 ); + skb =reset_per_cpu_data (data); -/* -* Replace it with a new one -*/ -reset_per_cpu_data (data); - -/* -* Ship it! -*/ if (skb)genlmsg_multicast (skb,0 ,NET_DM_GRP_ALERT ,GFP_KERNEL ); - -put_cpu_var (dm_cpu_data); }/* * This is the timer function to delay the sending of an alert * in the event that more drops will arrive during the -* hysteresis period. Note that it operates under the timer interrupt -* so we don't need to disable preemption here +* hysteresis period. */ -static void sched_send_work (unsigned long unused) +static void sched_send_work (unsigned long _data) { -struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data); +struct per_cpu_dm_data *data = (struct per_cpu_dm_data *)_data; -schedule_work_on (smp_processor_id (), &data->dm_alert_work); - -put_cpu_var (dm_cpu_data); +schedule_work (&data->dm_alert_work); }static void trace_drop_common (struct sk_buff *skb,void *location)
@@ -164,22 +135,17 @@ static void trace_drop_common(struct sk_struct nlattr *nla;int i;struct sk_buff *dskb; -struct per_cpu_dm_data *data = &get_cpu_var (dm_cpu_data); - +struct per_cpu_dm_data *data; +unsigned long flags; -rcu_read_lock (); - dskb =rcu_dereference (data->skb); +local_irq_save (flags); + data = &__get_cpu_var (dm_cpu_data); +spin_lock (&data->lock); + dskb = data->skb;if (!dskb) goto out; -if (!atomic_add_unless (&data->dm_hit_count,-1 ,0 )) { -/* -* we're already at zero, discard this hit -*/ - goto out; - } - nlh = (struct nlmsghdr *)dskb->data; nla =genlmsg_data (nlmsg_data (nlh)); msg =nla_data (nla);
@@ -189,7 +155,8 @@ static void trace_drop_common(struct sk_ goto out; } } - +if (msg->entries == dm_hit_limit) + goto out;/* * We need to create a new entry */
@@ -201,13 +168,11 @@ static void trace_drop_common(struct sk_if (!timer_pending (&data->send_timer)) { data->send_timer.expires = jiffies + dm_delay *HZ ; -add_timer_on (&data->send_timer,smp_processor_id ()); +add_timer (&data->send_timer); } out: -rcu_read_unlock (); -put_cpu_var (dm_cpu_data); -return ; +spin_unlock_irqrestore (&data->lock, flags); }static void trace_kfree_skb_hit (void *ignore,struct sk_buff *skb,void *location)
@@ -405,11 +370,11 @@ static int __init init_net_drop_monitor(for_each_present_cpu (cpu) { data = &per_cpu (dm_cpu_data, cpu); - data->cpu = cpu;INIT_WORK (&data->dm_alert_work, send_dm_alert);init_timer (&data->send_timer); - data->send_timer.data = cpu; + data->send_timer.data = (unsigned long )data; data->send_timer.function = sched_send_work; +spin_lock_init (&data->lock);reset_per_cpu_data (data); }
Greg Kroah-Hartman
maintainerPATCH 111/127 time: Improve sanity checking of timekeeping inputs
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit 4e8b14526ca7fb046a81c94002c1c43b6fdf0e9b upstream
Unexpected behavior could occur if the time is set to a value large enough to overflow a 64bit ktime_t (which is something larger then the year 2262).
Also unexpected behavior could occur if large negative offsets are injected via adjtimex.
So this patch improves the sanity check timekeeping inputs by improving the timespec_valid() check, and then makes better use of timespec_valid() to make sure we don't set the time to an invalid negative value or one that overflows ktime_t.
Note: This does not protect from setting the time close to overflowing ktime_t and then letting natural accumulation cause the overflow.
--- include/linux/ktime.h | 7 ------- include/linux/time.h | 22 ++++++++++++++++++++-- kernel/time/timekeeping.c | 26 ++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 11 deletions(-)
include/linux/ktime.h +0 -7
@@ -58,13 +58,6 @@ union ktime {typedef union ktime ktime_t ;/* Kill this */ -#define KTIME_MAX ((s64)~((u64)1 << 63)) -#if (BITS_PER_LONG ==64 ) -# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) -#else -# define KTIME_SEC_MAX LONG_MAX -#endif -/* * ktime_t definitions when using the 64-bit scalar representation: */
include/linux/time.h +20 -2
@@ -107,11 +107,29 @@ static inline struct timespec timespec_sreturn ts_delta; } +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#if (BITS_PER_LONG ==64 ) +# define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) +#else +# define KTIME_SEC_MAX LONG_MAX +#endif +/* * Returns true if the timespec is norm, false if denorm: */ -#define timespec_valid (ts) \ - (((ts)->tv_sec >= 0) && (((unsigned long) (ts)->tv_nsec) < NSEC_PER_SEC)) +static inline bool timespec_valid (const struct timespec *ts) +{ +/* Dates before 1970 are bogus */ +if (ts->tv_sec <0 ) +return false; +/* Can't have more nanoseconds then a second */ +if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC ) +return false; +/* Disallow values that could overflow ktime_t */ +if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX ) +return false; +return true; +}extern void read_persistent_clock (struct timespec *ts);extern void read_boot_clock (struct timespec *ts);
kernel/time/timekeeping.c +24 -2
@@ -382,7 +382,7 @@ int do_settimeofday(const struct timespestruct timespec ts_delta;unsigned long flags; -if ((unsigned long )tv->tv_nsec >=NSEC_PER_SEC ) +if (!timespec_valid (tv))return -EINVAL ;write_seqlock_irqsave (&xtime_lock, flags);
@@ -417,6 +417,8 @@ EXPORT_SYMBOL(do_settimeofday);int timekeeping_inject_offset (struct timespec *ts) {unsigned long flags; +struct timespec tmp; +int ret =0 ;if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return -EINVAL ;
@@ -425,9 +427,16 @@ int timekeeping_inject_offset(struct timtimekeeping_forward_now (); + tmp =timespec_add (xtime, *ts); +if (!timespec_valid (&tmp)) { + ret = -EINVAL ; + goto error; + } + xtime =timespec_add (xtime, *ts); wall_to_monotonic =timespec_sub (wall_to_monotonic, *ts); +error:/* even if we error out, we forwarded the time, so call update */ timekeeping_update (true);write_sequnlock_irqrestore (&xtime_lock, flags);
@@ -435,7 +444,7 @@ int timekeeping_inject_offset(struct tim/* signal hrtimers about time change */ clock_was_set (); -return 0 ; +return ret; }EXPORT_SYMBOL (timekeeping_inject_offset);
@@ -582,7 +591,20 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); +if (!timespec_valid (&now)) { +pr_warn ("WARNING: Persistent clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + now.tv_sec =0 ; + now.tv_nsec =0 ; + } +read_boot_clock (&boot); +if (!timespec_valid (&boot)) { +pr_warn ("WARNING: Boot clock returned invalid value!\n" +" Check your CMOS/BIOS settings.\n" ); + boot.tv_sec =0 ; + boot.tv_nsec =0 ; + }write_seqlock_irqsave (&xtime_lock, flags);
Greg Kroah-Hartman
maintainerPATCH 112/127 time: Avoid making adjustments if we havent accumulated anything
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Stultz <[email protected]>
commit bf2ac312195155511a0f79325515cbb61929898a upstream
If update_wall_time() is called and the current offset isn't large enough to accumulate, avoid re-calling timekeeping_adjust which may change the clock freq and can cause 1ns inconsistencies with CLOCK_REALTIME_COARSE/CLOCK_MONOTONIC_COARSE.
--- kernel/time/timekeeping.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/time/timekeeping.c +4 -0
@@ -919,6 +919,10 @@ static void update_wall_time(void)#else offset = (clock->read (clock) - clock->cycle_last) & clock->mask;#endif +/* Check if there's really nothing to do */ +if (offset < timekeeper.cycle_interval) +return ; + timekeeper.xtime_nsec = (s64 )xtime.tv_nsec << timekeeper.shift;/*
Greg Kroah-Hartman
maintainerPATCH 113/127 time: Move ktime_t overflow checking into timespec_valid_strict
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
commit cee58483cf56e0ba355fdd97ff5e8925329aa936 upstream
Andreas Bombe reported that the added ktime_t overflow checking added to timespec_valid in commit 4e8b14526ca7 ("time: Improve sanity checking of timekeeping inputs") was causing problems with X.org because it caused timeouts larger then KTIME_T to be invalid.
Previously, these large timeouts would be clamped to KTIME_MAX and would never expire, which is valid.
This patch splits the ktime_t overflow checking into a new timespec_valid_strict function, and converts the timekeeping codes internal checking to use this more strict function.
--- include/linux/time.h | 7 +++++++ kernel/time/timekeeping.c | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)
include/linux/time.h +7 -0
@@ -125,6 +125,13 @@ static inline bool timespec_valid(const/* Can't have more nanoseconds then a second */ if ((unsigned long )ts->tv_nsec >=NSEC_PER_SEC )return false; +return true; +} + +static inline bool timespec_valid_strict (const struct timespec *ts) +{ +if (!timespec_valid (ts)) +return false;/* Disallow values that could overflow ktime_t */ if ((unsigned long long )ts->tv_sec >=KTIME_SEC_MAX )return false;
kernel/time/timekeeping.c +10 -4
@@ -382,7 +382,7 @@ int do_settimeofday(const struct timespestruct timespec ts_delta;unsigned long flags; -if (!timespec_valid (tv)) +if (!timespec_valid_strict (tv))return -EINVAL ;write_seqlock_irqsave (&xtime_lock, flags);
@@ -428,7 +428,7 @@ int timekeeping_inject_offset(struct timtimekeeping_forward_now (); tmp =timespec_add (xtime, *ts); -if (!timespec_valid (&tmp)) { +if (!timespec_valid_strict (&tmp)) { ret = -EINVAL ; goto error; }
@@ -591,7 +591,7 @@ void __init timekeeping_init(void)struct timespec now, boot;read_persistent_clock (&now); -if (!timespec_valid (&now)) { +if (!timespec_valid_strict (&now)) {pr_warn ("WARNING: Persistent clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); now.tv_sec =0 ;
@@ -599,7 +599,7 @@ void __init timekeeping_init(void) }read_boot_clock (&boot); -if (!timespec_valid (&boot)) { +if (!timespec_valid_strict (&boot)) {pr_warn ("WARNING: Boot clock returned invalid value!\n" " Check your CMOS/BIOS settings.\n" ); boot.tv_sec =0 ;
@@ -649,6 +649,12 @@ static void update_sleep_time(struct tim*/ static void __timekeeping_inject_sleeptime (struct timespec *delta) { +if (!timespec_valid_strict (delta)) { +printk (KERN_WARNING "__timekeeping_inject_sleeptime: Invalid " +"sleep delta value!\n" ); +return ; + } + xtime =timespec_add (xtime, *delta); wall_to_monotonic =timespec_sub (wall_to_monotonic, *delta);update_sleep_time (timespec_add (total_sleep_time, *delta));
Greg Kroah-Hartman
maintainerPATCH 114/127 media: Avoid sysfs oops when an rc_devs raw device is absent
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Bagnall <[email protected]>
commit 720bb6436ff30fccad05cf5bdf961ea5b1f5686d upstream.
For some reason, when the lirc daemon learns that a usb remote control has been unplugged, it wants to read the sysfs attributes of the disappearing device. This is useful for uncovering transient inconsistencies, but less so for keeping the system running when such inconsistencies exist.
Under some circumstances (like every time I unplug my dvb stick from my laptop), lirc catches an rc_dev whose raw event handler has been removed (presumably by ir_raw_event_unregister), and proceeds to interrogate the raw protocols supported by the NULL pointer.
This patch avoids the NULL dereference, and ignores the issue of how this state of affairs came about in the first place.
Version 2 incorporates changes recommended by Mauro Carvalho Chehab (-ENODEV instead of -EINVAL, and a signed-off-by).
--- drivers/media/rc/rc-main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/rc/rc-main.c +3 -2
@@ -772,10 +772,11 @@ static ssize_t show_protocols(struct devif (dev->driver_type ==RC_DRIVER_SCANCODE ) { enabled = dev->rc_map.rc_type; allowed = dev->allowed_protos; - }else { + }else if (dev->raw) { enabled = dev->raw->enabled_protocols; allowed =ir_raw_get_allowed_protocols (); - } + }else +return -ENODEV ; IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", (long long)allowed,
Greg Kroah-Hartman
maintainerPATCH 115/127 pch_uart: Fix missing break for 16 byte fifo
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 9bc03743fff0770dc5a5324ba92e67cc377f16ca upstream.
Otherwise we fall back to the wrong value.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44091
--- drivers/tty/serial/pch_uart.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/pch_uart.c +1 -0
@@ -1161,6 +1161,7 @@ static int pch_uart_startup(struct uart_break ;case 16 : fifo_size =PCH_UART_HAL_FIFO16 ; +break ;case 1 :default : fifo_size =PCH_UART_HAL_FIFO_DIS ;
Greg Kroah-Hartman
maintainerPATCH 116/127 pch_uart: Fix rx error interrupt setting issue
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 9539dfb7ac1c84522fe1f79bb7dac2990f3de44a upstream.
Rx Error interrupt(E.G. parity error) is not enabled. So, when parity error occurs, error interrupt is not occurred. As a result, the received data is not dropped.
This patch adds enable/disable rx error interrupt code.
--- drivers/tty/serial/pch_uart.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/tty/serial/pch_uart.c +12 -6
@@ -658,7 +658,8 @@ static void pch_dma_rx_complete(void *artty_flip_buffer_push (tty);tty_kref_put (tty);async_tx_ack (priv->desc_rx); -pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }static void pch_dma_tx_complete (void *arg)
@@ -713,7 +714,8 @@ static int handle_rx_to(struct eg20t_porint rx_size;int ret;if (!priv->start_rx) { -pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT );return 0 ; } buf = &priv->rxbuf;
@@ -975,11 +977,13 @@ static irqreturn_t pch_uart_interrupt(incase PCH_UART_IID_RDR :/* Received Data Ready */ if (priv->use_dma) {pch_uart_hal_disable_interrupt (priv, -PCH_UART_HAL_RX_INT ); +PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); ret =dma_handle_rx (priv);if (!ret)pch_uart_hal_enable_interrupt (priv, -PCH_UART_HAL_RX_INT ); +PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); }else { ret =handle_rx (priv); }
@@ -1105,7 +1109,8 @@ static void pch_uart_stop_rx(struct uartstruct eg20t_port *priv; priv = container_of(port, struct eg20t_port, port); priv->start_rx =0 ; -pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_disable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT ); priv->int_dis_flag =1 ; }
@@ -1199,7 +1204,8 @@ static int pch_uart_startup(struct uart_pch_request_dma (port); priv->start_rx =1 ; -pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT ); +pch_uart_hal_enable_interrupt (priv,PCH_UART_HAL_RX_INT | +PCH_UART_HAL_RX_ERR_INT );uart_update_timeout (port,CS8 , default_baud);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 117/127 pch_uart: Fix parity setting issue
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 38bd2a1ac736901d1cf4971c78ef952ba92ef78b upstream.
Parity Setting value is reverse.
E.G. In case of setting ODD parity, EVEN value is set. This patch inverts "if" condition.
--- drivers/tty/serial/pch_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/pch_uart.c +1 -1
@@ -1263,7 +1263,7 @@ static void pch_uart_set_termios(struct stb =PCH_UART_HAL_STB1 ;if (termios->c_cflag &PARENB ) { -if (!(termios->c_cflag &PARODD )) +if (termios->c_cflag &PARODD ) parity =PCH_UART_HAL_PARITY_ODD ;else parity =PCH_UART_HAL_PARITY_EVEN ;
Greg Kroah-Hartman
maintainerPATCH 118/127 Squashfs: fix mount time sanity check for corrupted superblock
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phillip Lougher <[email protected]>
commit cc37f75a9ffbbfcb1c3297534f293c8284e3c5a6 upstream.
A Squashfs filesystem containing nothing but an empty directory, although unusual and ultimately pointless, is still valid.
The directory_table >= next_table sanity check rejects these filesystems as invalid because the directory_table is empty and equal to next_table.
--- fs/squashfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/squashfs/super.c +1 -1
@@ -290,7 +290,7 @@ handle_fragments: check_directory_table:/* Sanity check directory_table */ -if (msblk->directory_table >= next_table) { +if (msblk->directory_table > next_table) { err = -EINVAL ; goto failed_mount; }
Greg Kroah-Hartman
maintainerPATCH 119/127 mmc: sd: Handle SD3.0 cards not supporting UHS-I bus speed mode
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subhash Jadavani <[email protected]>
commit f2815f68dabbb373fd1c9f0fd4a609d486697c2b upstream.
Here is Essential conditions to indicate Version 3.00 Card (SD_SPEC=2 and SD_SPEC3=1) :
(1) The card shall support CMD6
(2) The card shall support CMD8
(3) The card shall support CMD42
(4) User area capacity shall be up to 2GB (SDSC) or 32GB (SDHC) User area capacity shall be more than or equal to 32GB and up to 2TB (SDXC)
(5) Speed Class shall be supported (SDHC or SDXC)
So even if SD card doesn't support any of the newly defined UHS-I bus speed mode, it can advertise itself as SD3.0 cards as long as it supports all the essential conditions of SD3.0 cards. Given this, these type of cards should atleast run in High Speed mode @50MHZ if it supports HS.
But current initialization sequence for SD3.0 cards is such that these non-UHS-I SD3.0 cards runs in Default Speed mode @25MHz.
This patch makes sure that these non-UHS-I SD3.0 cards run in High Speed Mode @50MHz.
Tested this patch with SanDisk Extreme SDHC 8GB Class 10 card.
--- drivers/mmc/core/sd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/core/sd.c +3 -3
@@ -306,6 +306,9 @@ static int mmc_read_switch(struct mmc_ca goto out; } +if (status[13 ] &UHS_SDR50_BUS_SPEED ) + card->sw_caps.hs_max_dtr =50000000 ; +if (card->scr.sda_spec3) { card->sw_caps.sd3_bus_mode = status[13 ];
@@ -348,9 +351,6 @@ static int mmc_read_switch(struct mmc_ca } card->sw_caps.sd3_curr_limit = status[7 ]; - }else { -if (status[13 ] &0x02 ) - card->sw_caps.hs_max_dtr =50000000 ; } out:
Greg Kroah-Hartman
maintainerPATCH 120/127 mmc: Prevent 1.8V switch for SD hosts that dont support UHS modes.
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Cooper <[email protected]>
commit 4188bba0e9e7ba58d231b528df495666f2742b74 upstream.
The driver should not try to switch to 1.8V when the SD 3.0 host controller does not have any UHS capabilities bits set (SDR50, DDR50 or SDR104). See page 72 of "SD Specifications Part A2 SD Host Controller Simplified Specification Version 3.00" under "1.8V Signaling Enable". Instead of setting SDR12 and SDR25 in the host capabilities data structure for all V3.0 host controllers, only set them if SDR104, SDR50 or DDR50 is set in the host capabilities register. This will prevent the switch to 1.8V later.
--- drivers/mmc/host/sdhci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +3 -2
@@ -2515,8 +2515,9 @@ int sdhci_add_host(struct sdhci_host *ho mmc_card_is_removable(mmc)) mmc->caps |=MMC_CAP_NEEDS_POLL ; -/* UHS-I mode(s) supported by the host controller. */ -if (host->version >=SDHCI_SPEC_300 ) +/* Any UHS-I mode in caps implies SDR12 and SDR25 support. */ +if (caps[1 ] & (SDHCI_SUPPORT_SDR104 |SDHCI_SUPPORT_SDR50 | +SDHCI_SUPPORT_DDR50 )) mmc->caps |=MMC_CAP_UHS_SDR12 |MMC_CAP_UHS_SDR25 ;/* SDR104 supports also implies SDR50 support */
Greg Kroah-Hartman
maintainerPATCH 121/127 e1000e: Disable ASPM L1 on 82574
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Boot <[email protected]>
commit d4a4206ebbaf48b55803a7eb34e330530d83a889 upstream.
ASPM on the 82574 causes trouble. Currently the driver disables L0s for this NIC but only disables L1 if the MTU is >1500. This patch simply causes L1 to be disabled regardless of the MTU setting.
--- drivers/net/e1000e/82571.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/e1000e/82571.c +2 -1
@@ -2088,7 +2088,8 @@ struct e1000_info e1000_82574_info = { | FLAG_HAS_AMT | FLAG_HAS_CTRLEXT_ON_LOAD, .flags2 =FLAG2_CHECK_PHY_HANG - | FLAG2_DISABLE_ASPM_L0S, + |FLAG2_DISABLE_ASPM_L0S + | FLAG2_DISABLE_ASPM_L1, .pba = 32, .max_hw_frame_size = DEFAULT_JUMBO, .get_variants = e1000_get_variants_82571,
Greg Kroah-Hartman
maintainerPATCH 122/127 UBI: fix a horrible memory deallocation bug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
commit 78b495c39add820ab66ab897af9bd77a5f2e91f6 upstream
UBI was mistakingly using 'kfree()' instead of 'kmem_cache_free()' when freeing "attach eraseblock" structures in vtbl.c. Thankfully, this happened only when we were doing auto-format, so many systems were unaffected. However, there are still many users affected.
It is strange, but the system did not crash and nothing bad happened when the SLUB memory allocator was used. However, in case of SLOB we observed an crash right away.
This problem was introduced in 2.6.39 by commit "6c1e875 UBI: add slab cache for ubi_scan_leb objects"
--- drivers/mtd/ubi/vtbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/ubi/vtbl.c +2 -2
@@ -356,7 +356,7 @@ retry:*/ err =ubi_scan_add_used (ubi, si, new_seb->pnum, new_seb->ec, vid_hdr,0 ); -kfree (new_seb); +kmem_cache_free (si->scan_leb_slab, new_seb);ubi_free_vid_hdr (ubi, vid_hdr);return err;
@@ -369,7 +369,7 @@ write_error:list_add (&new_seb->u.list, &si->erase); goto retry; } -kfree (new_seb); +kmem_cache_free (si->scan_leb_slab, new_seb); out_free:ubi_free_vid_hdr (ubi, vid_hdr);return err;
Greg Kroah-Hartman
maintainerPATCH 123/127 spi/mpc83xx: fix NULL pdata dereference bug
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kenth Eriksson <[email protected]>
commit 5039a86973cd35bdb2f64d28ee12f13fe2bb5a4c upstream.
Commit 178db7d3, "spi: Fix device unregistration when unregistering the bus master", changed device initialization to be children of the bus master, not children of the bus masters parent device. The pdata pointer used in fsl_spi_chipselect must updated to reflect the changed initialization.
--- drivers/spi/spi_fsl_spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi_fsl_spi.c +3 -1
@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct sstatic void fsl_spi_chipselect (struct spi_device *spi,int value) {struct mpc8xxx_spi *mpc8xxx_spi =spi_master_get_devdata (spi->master); -struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; +struct fsl_spi_platform_data *pdata;bool pol = spi->mode &SPI_CS_HIGH ;struct spi_mpc8xxx_cs *cs = spi->controller_state; + pdata = spi->dev.parent->parent->platform_data; +if (value ==BITBANG_CS_INACTIVE ) {if (pdata->cs_control) pdata->cs_control (spi, !pol);
Greg Kroah-Hartman
maintainerPATCH 124/127 spi/spi-fsl-spi: reference correct pdata in fsl_spi_cs_control
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herton Ronaldo Krzesinski <[email protected]>
commit 067aa4815a9bc12a569d8a06afef50ba5773afbf upstream.
Commit 178db7d3, "spi: Fix device unregistration when unregistering the bus master", changed spi device initialization of dev.parent pointer to be the master's device pointer instead of his parent.
This introduced a bug in spi-fsl-spi, since its usage of spi device pointer was not updated accordingly. This was later fixed by commit 5039a86, "spi/mpc83xx: fix NULL pdata dereference bug", but it missed another spot on fsl_spi_cs_control function where we also need to update usage of spi device pointer. This change address that.
--- drivers/spi/spi_fsl_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi_fsl_spi.c +1 -1
@@ -936,7 +936,7 @@ err:static void fsl_spi_cs_control (struct spi_device *spi,bool on) { -struct device *dev = spi->dev.parent; +struct device *dev = spi->dev.parent->parent;struct mpc8xxx_spi_probe_info *pinfo =to_of_pinfo (dev->platform_data);u16 cs = spi->chip_select;int gpio = pinfo->gpios[cs];
Greg Kroah-Hartman
maintainerPATCH 125/127 sched: Fix ancient race in do_exit()
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yasunori Goto <[email protected]>
commit b5740f4b2cb3503b436925eb2242bc3d75cd3dfe upstream.
try_to_wake_up() has a problem which may change status from TASK_DEAD to TASK_RUNNING in race condition with SMI or guest environment of virtual machine. As a result, exited task is scheduled() again and panic occurs.
Here is the sequence how it occurs:
----------------------------------+-----------------------------
|
CPU A | CPU B
----------------------------------+-----------------------------
TASK A calls exit()....
do_exit()
exit_mm()
down_read(mm->mmap_sem); rwsem_down_failed_common()
set TASK_UNINTERRUPTIBLE
set waiter.task <= task A
list_add to sem->wait_list
:
raw_spin_unlock_irq()
(I/O interruption occured)
__rwsem_do_wake(mmap_sem)
list_del(&waiter->list);
waiter->task = NULL
wake_up_process(task A)
try_to_wake_up()
(task is still
TASK_UNINTERRUPTIBLE)
p->on_rq is still 1.)
ttwu_do_wakeup()
(*A)
:
(I/O interruption handler finished)
if (!waiter.task)
schedule() is not called
due to waiter.task is NULL.
tsk->state = TASK_RUNNING
:
check_preempt_curr();
: task->state = TASK_DEAD
(*B)
<--- set TASK_RUNNING (*C)
schedule()
(exit task is running again)
BUG_ON() is called!
--------------------------------------------------------
The execution time between (*A) and (*B) is usually very short, because the interruption is disabled, and setting TASK_RUNNING at (*C) must be executed before setting TASK_DEAD.
HOWEVER, if SMI is interrupted between (*A) and (*B), (*C) is able to execute AFTER setting TASK_DEAD!
Then, exited task is scheduled again, and BUG_ON() is called....
If the system works on guest system of virtual machine, the time between (*A) and (*B) may be also long due to scheduling of hypervisor, and same phenomenon can occur.
By this patch, do_exit() waits for releasing task->pi_lock which is used in try_to_wake_up(). It guarantees the task becomes TASK_DEAD after waking up.
--- kernel/exit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
kernel/exit.c +16 -0
@@ -1049,6 +1049,22 @@ NORET_TYPE void do_exit(long code)preempt_disable ();exit_rcu (); + +/* +* The setting of TASK_RUNNING by try_to_wake_up() may be delayed +* when the following two conditions become true. +* - There is race condition of mmap_sem (It is acquired by +* exit_mm()), and +* - SMI occurs before setting TASK_RUNINNG. +* (or hypervisor of virtual machine switches to other guest) +* As a result, we may become TASK_RUNNING after becoming TASK_DEAD +* +* To avoid it, we have to wait for releasing tsk->pi_lock which +* is held by try_to_wake_up() +*/ +smp_mb (); +raw_spin_unlock_wait (&tsk->pi_lock); +/* causes final put_task_struct in finish_task_switch(). */ tsk->state =TASK_DEAD ;schedule ();
Greg Kroah-Hartman
maintainerPATCH 126/127 MCE: Fix vm86 handling for 32bit mce handler
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andi Kleen <[email protected]>
commit a129a7c84582629741e5fa6f40026efcd7a65bd4 upstream.
When running on 32bit the mce handler could misinterpret vm86 mode as ring 0. This can affect whether it does recovery or not; it was possible to panic when recovery was actually possible.
Fix this by always forcing vm86 to look like ring 3.
[ Backport to 3.0 notes:
Things changed there slightly:
- move mce_get_rip() up. It fills up m->cs and m->ip values which are evaluated in mce_severity(). Therefore move it up right before the mce_severity call. This seem to be another bug in 3.0?
- Place the backport (fix m->cs in V86 case) to where m->cs gets filled which is mce_get_rip() in 3.0
]
--- arch/x86/kernel/cpu/mcheck/mce.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +8 -1
@@ -451,6 +451,13 @@ static inline void mce_get_rip(struct mcif (regs && (m->mcgstatus & (MCG_STATUS_RIPV |MCG_STATUS_EIPV ))) { m->ip = regs->ip; m->cs = regs->cs; +/* +* When in VM86 mode make the cs look like ring 3 +* always. This is a lie, but it's better than passing +* the additional vm86 bit around everywhere. +*/ +if (v8086_mode (regs)) + m->cs |=3 ; }else { m->ip =0 ; m->cs =0 ;
@@ -988,6 +995,7 @@ void do_machine_check(struct pt_regs *re*/ add_taint (TAINT_MACHINE_CHECK ); +mce_get_rip (&m, regs); severity =mce_severity (&m, tolerant,NULL );/*
@@ -1026,7 +1034,6 @@ void do_machine_check(struct pt_regs *reif (severity ==MCE_AO_SEVERITY &&mce_usable_address (&m))mce_ring_add (m.addr >>PAGE_SHIFT ); -mce_get_rip (&m, regs);mce_log (&m);if (severity > worst) {
Greg Kroah-Hartman
maintainerPATCH 127/127 USB: Fix race condition when removing host controllers
In reply to Greg Kroah-Hartman3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 0d00dc2611abbe6ad244d50569c2ee82ce42846c upstream.
This patch (as1607) fixes a race that can occur if a USB host controller is removed while a process is reading the /sys/kernel/debug/usb/devices file.
The usb_device_read() routine uses the bus->root_hub pointer to determine whether or not the root hub is registered. The is not a valid test, because the pointer is set before the root hub gets registered and remains set even after the root hub is unregistered and deallocated. As a result, usb_device_read() or usb_device_dump() can access freed memory, causing an oops.
The patch changes the test to use the hcd->rh_registered flag, which does get set and cleared at the appropriate times. It also makes sure to hold the usb_bus_list_lock mutex while setting the flag, so that usb_device_read() will become aware of new root hubs as soon as they are registered.
--- drivers/usb/core/devices.c | 2 +- drivers/usb/core/hcd.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/usb/core/devices.c +1 -1
@@ -624,7 +624,7 @@ static ssize_t usb_device_read(struct fi/* print devices for all busses */ list_for_each_entry (bus, &usb_bus_list, bus_list) {/* recurse through all children of the root hub */ -if (!bus->root_hub) +if (!bus_to_hcd (bus)->rh_registered)continue ;usb_lock_device (bus->root_hub); ret = usb_device_dump(&buf, &nbytes, &skip_bytes, ppos,
drivers/usb/core/hcd.c +2 -4
@@ -977,10 +977,7 @@ static int register_root_hub(struct usb_if (retval) {dev_err (parent_dev,"can't register root hub for %s, %d\n" ,dev_name (&usb_dev->dev), retval); - } -mutex_unlock (&usb_bus_list_lock); - -if (retval ==0 ) { + }else {spin_lock_irq (&hcd_root_hub_lock); hcd->rh_registered =1 ;spin_unlock_irq (&hcd_root_hub_lock);
@@ -989,6 +986,7 @@ static int register_root_hub(struct usb_if (HCD_DEAD (hcd))usb_hc_died (hcd);/* This time clean up */ } +mutex_unlock (&usb_bus_list_lock);return retval; }