3.2.46-rc1 review
Subsystems (84)
cover 3.2.46-rc1 review
This is the start of the stable review cycle for the 3.2.46 release. There are 94 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu May 30 12:00:00 UTC 2013. Anything received after that time might be too late.
A combined patch relative to 3.2.45 will be posted as an additional response to this. A shortlog and diffstat can be found below.
Ben.
-------------
Alan Cox (1):
[media] mantis: fix silly crash case
[e1d45ae10aea8e8a403e5d96bf5902ee670007ff]
Alan Stern (2):
USB: UHCI: fix for suspend of virtual HP controller
[997ff893603c6455da4c5e26ba1d0f81adfecdfc]
USB: xHCI: override bogus bulk wMaxPacketSize values
[e4f47e3675e6f1f40906b785b934ce963e9f2eb3]
Alexandre Bounine (1):
rapidio/tsi721: fix bug in MSI interrupt handling
[1ccc819da6fda9bee10ab8b72e9adbb5ad3e4959]
Amitkumar Karwar (1):
mwifiex: fix memory leak issue when driver unload
[f16fdc9d2dc1e5b270e9a08377587e831e0d36ac]
Andrew Gomella (1):
USB: ftdi_sio: Add support for Newport CONEX motor drivers
[7138143972b7c293267c783fc99a194f0ceff7f2]
Aneesh Kumar K.V (1):
mm/THP: use pmd_populate() to update the pmd with pgtable_t pointer
[7c3425123ddfdc5f48e7913ff59d908789712b18]
Bastian Triller (1):
ACPI / video: Add "Asus UL30A" to ACPI video detect blacklist
[c8f6d8351ba8c89d5cd4c562552ec7ec29274e31]
Ben Hutchings (3):
Revert "drm/i915: Fix detection of base of stolen memory"
[not upstream; fix is not needed in 3.2 and was backported wrongly]
perf: net_dropmonitor: Fix symbol-relative addresses
[5a1e99dd2028e00998d42029be86835d8ef4a46e]
perf: net_dropmonitor: Fix trace parameter order
[140c3c6a2bcd2c31e2f7f5a8d59689724776c8e5]
Benjamin Herrenschmidt (1):
net/eth/ibmveth: Fixup retrieval of MAC address
[13f85203e1060da83d9ec1c1c5a63343eaab8de4]
Benjamin LaHaise (1):
ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex
[6368087e851e697679af059b4247aca33a69cef3]
Bing Zhao (1):
mwifiex: clear is_suspended flag when interrupt is received early
[48795424acff7215d5eac0b52793a2c1eb3a6283]
Bob Moore (1):
ACPICA: Fix possible buffer overflow during a field unit read operation
[61388f9e5d93053cf399a356414f31f9b4814c6d]
Brian Behlendorf (1):
drivers/block/brd.c: fix brd_lookup_page() race
[dfd20b2b174d3a9b258ea3b7a35ead33576587b1]
Brian King (1):
powerpc/pseries: Fix partition migration hang in stop_topology_update
[444080d13d05dc38d07dd3bf751d38bce7ab7c72]
Chen Gang (1):
drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
[a5f2b3d6a738e7d4180012fe7b541172f8c8dcea]
Cliff Wickman (1):
mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas
[a9ff785e4437c83d2179161e012f5bdfbd6381f0]
Cong Wang (1):
xfrm6: release dev before returning error
[84c4a9dfbf430861e7588d95ae3ff61535dca351]
Dan Carpenter (2):
ASoC: wm8994: missing break in wm8994_aif3_hw_params()
[4495e46fe18f198366961bb2b324a694ef8a9b44]
USB: cxacru: potential underflow in cxacru_cm_get_array()
[2a0ebf80aa95cc758d4725f74a7016e992606a39]Dan Williams (1):
USB: option: add device IDs for Dell 5804 (Novatel E371) WWAN card
[49c6e370dd6400b84897c4100095089b5c13a061]
Daniel Borkmann (1):
packet: tpacket_v3: do not trigger bug() on wrong header status
[8da3056c04bfc5f69f840ab038a38389e2de8189]
Daniel Drake (1):
mwifiex: fix setting of multicast filter
[ccd384b10420ac81ba3fb9b0a7d18272c7173552]
David Jeffery (1):
autofs - remove autofs dentry mount check
[ce8a5dbdf9e709bdaf4618d7ef8cceb91e8adc69]
Eric Dumazet (2):
ipv6: do not clear pinet6 field
[f77d602124d865c38705df7fa25c03de9c284ad2]
tcp: force a dst refcount when prequeue packet
[093162553c33e9479283e107b4431378271c735d]
Felix Fietkau (1):
ath9k: fix key allocation error handling for powersave keys
[4ef69d0394cba8caa9f75d3f2e53429bfb8b3045]
Gabriel de Perthuis (1):
btrfs: don't stop searching after encountering the wrong item
[03b71c6ca6286625d8f1ed44aabab9b5bf5dac10]
Gleb Natapov (1):
KVM: VMX: fix halt emulation while emulating invalid guest sate
[8d76c49e9ffeee839bc0b7a3278a23f99101263e]
Gregory CLEMENT (1):
ARM: plat-orion: Fix num_resources and id for ge10 and ge11
[2b8b2797142c7951e635c6eec5d1705ee9bc45c5]
Hans Schillstrom (1):
ipvs: ip_vs_sip_fill_param() BUG: bad check of return value
[f7a1dd6e3ad59f0cfd51da29dfdbfd54122c5916]
Hans-Christian Egtvedt (1):
avr32: fix relocation check for signed 18-bit offset
[e68c636d88db3fda74e664ecb1a213ae0d50a7d8]
Hema Prathaban (1):
staging: vt6656: use free_netdev instead of kfree
[0a438d5b381e2bdfd5e02d653bf46fcc878356e3]
Ian Abbott (1):
staging: comedi: prevent auto-unconfig of manually configured devices
[7d3135af399e92cf4c9bbc5f86b6c140aab3b88c]
Imre Deak (1):
wait: fix false timeouts when using wait_event_timeout()
[4c663cfc523a88d97a8309b04a089c27dc57fd7e]
J. Bruce Fields (1):
nfsd4: don't allow owner override on 4.1 CLAIM_FH opens
[9f415eb25574db4b73a9a712a4438e41dc284922]
Jamal Hadi Salim (1):
net_sched: act_ipt forward compat with xtables
[0dcffd09641f3abb21ac5cabc61542ab289d1a3c]
Jeff Layton (2):
cifs: only set ops for inodes in I_NEW state
[c2b93e0699723700f886ce17bb65ffd771195a6d]
sunrpc: clarify comments on rpc_make_runnable
[506026c3ec270e18402f0c9d33fee37482c23861]
Jiri Kosina (1):
random: fix accounting race condition with lockless irq entropy_count update
[10b3a32d292c21ea5b3ad5ca5975e88bb20b8d68]
Jiri Pirko (1):
macvlan: fix passthru mode race between dev removal and rx path
[233c7df0821c4190e2d3f4be0f2ca0ab40a5ed8c]
Johan Hovold (1):
mmc: at91/avr32/atmel-mci: fix DMA-channel leak on module unload
[91cf54feecf815bec0b6a8d6d9dbd0e219f2f2cc]
Joseph Qi (1):
ocfs2: goto out_unlock if ocfs2_get_clusters_nocache() failed in ocfs2_fiemap()
[b4ca2b4b577c3530e34dcfaafccb2cc680ce95d1]
Josh Boyer (1):
if_cablemodem.h: Add parenthesis around ioctl macros
[4f924b2aa4d3cb30f07e57d6b608838edcbc0d88]
Kees Cook (1):
drm/radeon: check incoming cliprects pointer
[fefaedcfb82d2e57c2320acf60604ab03b750cc0]
Konrad Rzeszutek Wilk (1):
xen/vcpu/pvhvm: Fix vcpu hotplugging hanging.
[7f1fc268c47491fd5e63548f6415fc8604e13003]
Lachlan McIlroy (1):
ext4: limit group search loop for non-extent files
[e6155736ad76b2070652745f9e54cdea3f0d8567]
Lan Tianyu (1):
ACPI / EC: Restart transaction even when the IBF flag set
[28fe5c825f8e15744d04c7c1b8df197950923ecd]
Lars-Peter Clausen (1):
mfd: adp5520: Restore mode bits on resume
[c6cc25fda58da8685ecef3f179adc7b99c8253b2]
Leonid Yegoshin (1):
mm compaction: fix of improper cache flush in migration code
[c2cc499c5bcf9040a738f49e8051b42078205748]
Li Fei (1):
x86: Eliminate irq_mis_count counted in arch_irq_stat
[f7b0e1055574ce06ab53391263b4e205bf38daf3]
Libin (1):
sched/debug: Fix sd->*_idx limit range avoiding overflow
[fd9b86d37a600488dbd80fe60cca46b822bff1cd]Martin Michlmayr (1):
Kirkwood: Enable PCIe port 1 on QNAP TS-11x/TS-21x
[99e11334dcb846f9b76fb808196c7f47aa83abb3]
Matt Fleming (1):
x86, efivars: firmware bug workarounds should be in platform code
[a6e4d5a03e9e3587e88aba687d8f225f4f04c792]
Matthew Whitehead (1):
3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA)
[3b54912f9cd167641b91d4a697bd742f70e534fe]
Michael S. Tsirkin (1):
virtio_console: fix uapi header
[6407d75afd08545f2252bb39806ffd3f10c7faac]
Mika Westerberg (1):
i2c: designware: always clear interrupts before enabling them
[2a2d95e9d6d29e726cc294b65391917ed2e32bf4]
Mikulas Patocka (1):
dm bufio: avoid a possible __vmalloc deadlock
[502624bdad3dba45dfaacaf36b7d83e39e74b2d2]
Namhyung Kim (1):
sched/debug: Limit sd->*_idx range on sysctl
[201c373e8e4823700d3160d5c28e1ab18fd1193e]Nithin Sujir (1):
tg3: Skip powering down function 0 on certain serdes devices
[44f3b503c16425c8e9db4bbaa2fc9cd0c9d0ba91]
OGAWA Hirofumi (1):
fat: fix possible overflow for fat_clusters
[7b92d03c3239f43e5b86c9cc9630f026d36ee995]
Oleg Nesterov (1):
usermodehelper: check subprocess_info->path != NULL
[264b83c07a84223f0efd0d1db9ccc66d6f88288f]Oliver Neukum (1):
USB: reset resume quirk needed by a hub
[bac6b03275184c912ad0818c9a0a736847804dca]
Philip Rakity (1):
mmc: core: Fix bit width test failing on old eMMC cards
[836dc2fe89c968c10cada87e0dfae6626f8f9da3]
Philipp Reisner (1):
drbd: fix for deadlock when using automatic split-brain-recovery
[7c689e63a847316c1b2500f86891b0a574ce7e69]
Richard Weinberger (3):
um: Serve io_remap_pfn_range()
[4d94d6d030adfdea4837694d293ec6918d133ab2]
x86,efi: Check max_size only if it is non-zero.
[7791c8423f1f7f4dad94e753bae67461d5b80be8]
x86,efi: Implement efi_no_storage_paranoia parameter
[8c58bf3eec3b8fc8162fe557e9361891c20758f2]
Robert Jennings (1):
powerpc: Bring all threads online prior to migration/hibernation
[120496ac2d2d60aee68d3123a68169502a85f4b5]
Ryusuke Konishi (1):
nilfs2: fix issue of nilfs_set_page_dirty() for page at EOF boundary
[136e8770cd5d1fe38b3c613100dd6dc4db6d4fa6]
Sarah Sharp (1):
xhci: Don't warn on empty ring for suspended devices.
[a83d6755814e4614ba77e15d82796af0f695c6b8]
Schemmel Hans-Christoph (1):
USB: Blacklisted Cinterion's PLxx WWAN Interface
[8ff10bdb14a52e3f25d4ce09e0582a8684c1a6db]
Sergei Shtylyov (2):
3c59x: fix PCI resource management
[4b264a1676e70dc656ba53a8cac690f2d4b65f4e]
3c59x: fix freeing nonexistent resource on driver unload
[c81400be716aa4c76f6ebf339ba94358dbbf6da6]
Sergey Vlasov (1):
efi: Export efi_query_variable_store() for efivars.ko
[3668011d4ad556224f7c012c1e870a6eaa0e59da]
Shlomo Pongratz (1):
iscsi-target: Fix processing of OOO commands
[3eccfdb01da58fbd0f789ae6ca61cee3769e26de]
Shuah Khan (1):
hp_accel: Ignore the error from lis3lv02d_poweron() at resume
[7783819920ca52fc582a2782f654fe6ed373f465]
Stephen Hemminger (1):
bridge: fix race with topology change timer
[83401eb4990ff6af55aeed8f49681558544192e6]
Steven Rostedt (1):
tracing: Fix leaks of filter preds
[60705c89460fdc7227f2d153b68b3f34814738a4]
Teppo Kotilainen (1):
usb: option: Add Telewell TW-LTE 4G
[73c042df6e1bc50544842a04b777b36bbe3630e6]
Terry Barnaby (1):
mmc: atmel-mci: pio hang on block errors
[bdbc5d0c60f3e9de3eeccf1c1a18bdc11dca62cc]
Thomas Gleixner (1):
tick: Cleanup NOHZ per cpu data on cpu down
[4b0c0f294f60abcdd20994a8341a95c8ac5eeb96]
Thommy Jakobsson (1):
B43: Handle DMA RX descriptor underrun
[73b82bf0bfbf58e6ff328d3726934370585f6e78]
Tirupathi Reddy (1):
timer: Don't reinitialize the cpu base lock during CPU_UP_PREPARE
[42a5cf46cd56f46267d2a9fcf2655f4078cd3042]
Tomoya MORINAGA (1):
pch_dma: Use GFP_ATOMIC because called from interrupt context
[5c1ef59168c485318e40ba485c1eba57d81d0faa]
Trond Myklebust (1):
SUNRPC: Prevent an rpc_task wakeup race
[a3c3cac5d31879cd9ae2de7874dc6544ca704aec]
Wang YanQing (2):
ALSA: HDA: Fix Oops caused by dereference NULL pointer
[2195b063f6609e4c6268f291683902f25eaf9aa6]
TTY: Fix tty miss restart after we turn off flow-control
[dab73b4eb9ef924a2b90dab84e539076d82b256f]
Wei Yongjun (3):
dm snapshot: fix error return code in snapshot_ctr
[09e8b813897a0f85bb401435d009228644c81214]
drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe()
[35623715818dfa720cccf99cd280dcbb4b78da23]
hwmon: fix error return code in abituguru_probe()
[ecacb0b17c08fae89f65468727f0e4b8e91da4e1]
Xiao Guangrong (1):
mm: mmu_notifier: re-fix freed page still mapped in secondary MMU
[d34883d4e35c0a994e91dd847a82b4c9e0c31d83]
Documentation/kernel-parameters.txt | 6 ++ Makefile | 4 +- arch/arm/configs/at91sam9g45_defconfig | 1 - arch/arm/mach-kirkwood/ts219-setup.c | 2 +- arch/arm/plat-orion/common.c | 12 +-- arch/avr32/configs/favr-32_defconfig | 1 - arch/avr32/configs/merisc_defconfig | 1 - arch/avr32/kernel/module.c | 2 +- arch/powerpc/include/asm/rtas.h | 2 + arch/powerpc/kernel/rtas.c | 118 +++++++++++++++++++++++++- arch/powerpc/platforms/pseries/suspend.c | 28 +++++- arch/um/include/asm/pgtable.h | 2 + arch/x86/kernel/irq.c | 4 - arch/x86/kvm/vmx.c | 6 ++ arch/x86/platform/efi/efi.c | 43 ++++++++++ arch/x86/xen/enlighten.c | 15 ++++ drivers/acpi/acpica/exfldio.c | 14 ++- drivers/acpi/ec.c | 4 +- drivers/acpi/video_detect.c | 8 ++ drivers/block/brd.c | 4 +- drivers/block/drbd/drbd_receiver.c | 1 - drivers/char/ipmi/ipmi_bt_sm.c | 4 +- drivers/char/ipmi/ipmi_devintf.c | 14 ++- drivers/char/random.c | 24 ++++-- drivers/dma/pch_dma.c | 2 +- drivers/firmware/efivars.c | 18 +--- drivers/gpu/drm/i915/i915_dma.c | 81 +++++++++--------- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- drivers/hwmon/abituguru.c | 16 ++-- drivers/i2c/busses/i2c-designware-core.c | 3 +- drivers/md/dm-bufio.c | 26 +++++- drivers/md/dm-snap.c | 1 + drivers/media/dvb/mantis/mantis_dvb.c | 6 +- drivers/mfd/adp5520.c | 8 +- drivers/mmc/core/mmc.c | 2 +- drivers/mmc/host/Kconfig | 10 --- drivers/mmc/host/atmel-mci.c | 16 ++-- drivers/net/ethernet/3com/3c509.c | 2 + drivers/net/ethernet/3com/3c59x.c | 27 +++--- drivers/net/ethernet/broadcom/tg3.c | 32 +++++-- drivers/net/ethernet/ibm/ibmveth.c | 23 +++-- drivers/net/macvlan.c | 7 +- drivers/net/wireless/ath/ath9k/main.c | 6 +- drivers/net/wireless/b43/dma.c | 19 +++++ drivers/net/wireless/b43/dma.h | 4 +- drivers/net/wireless/b43/main.c | 43 ++++------ drivers/net/wireless/mwifiex/cfg80211.c | 3 - drivers/net/wireless/mwifiex/cmdevt.c | 1 + drivers/net/wireless/mwifiex/main.c | 1 + drivers/net/wireless/mwifiex/sta_ioctl.c | 21 ++--- drivers/platform/x86/hp_accel.c | 3 +- drivers/rapidio/devices/tsi721.c | 11 +++ drivers/rtc/rtc-pcf2123.c | 1 + drivers/staging/comedi/comedi_fops.c | 3 + drivers/staging/vt6656/hostap.c | 2 +- drivers/target/iscsi/iscsi_target_erl1.c | 7 +- drivers/tty/n_tty.c | 8 ++ drivers/usb/atm/cxacru.c | 3 +- drivers/usb/core/quirks.c | 3 + drivers/usb/host/uhci-hub.c | 3 +- drivers/usb/host/xhci-mem.c | 17 ++-- drivers/usb/host/xhci-ring.c | 23 +++-- drivers/usb/serial/ftdi_sio.c | 2 + drivers/usb/serial/ftdi_sio_ids.h | 2 + drivers/usb/serial/option.c | 13 ++- fs/autofs4/expire.c | 9 -- fs/btrfs/ioctl.c | 10 +-- fs/cifs/inode.c | 3 +- fs/ext4/mballoc.c | 6 +- fs/fat/inode.c | 15 +++- fs/nfsd/nfs4proc.c | 15 +++- fs/nilfs2/inode.c | 27 +++++- fs/ocfs2/extent_map.c | 2 +- include/linux/efi.h | 11 ++- include/linux/if_cablemodem.h | 12 +-- include/linux/rculist.h | 17 ++++ include/linux/virtio_console.h | 2 +- include/linux/wait.h | 16 ++-- include/net/sock.h | 12 +++ include/net/tcp.h | 1 + kernel/kmod.c | 5 ++ kernel/sched.c | 35 +++++--- kernel/time/tick-sched.c | 2 +- kernel/timer.c | 2 +- kernel/trace/trace_events_filter.c | 4 + mm/huge_memory.c | 7 +- mm/migrate.c | 2 +- mm/mmu_notifier.c | 80 ++++++++--------- mm/pagewalk.c | 70 +++++++-------- net/bridge/br_stp_timer.c | 2 +- net/core/sock.c | 12 --- net/ipv6/tcp_ipv6.c | 12 +++ net/ipv6/udp.c | 13 ++- net/ipv6/udp_impl.h | 2 + net/ipv6/udplite.c | 2 +- net/ipv6/xfrm6_policy.c | 4 +- net/netfilter/ipvs/ip_vs_pe_sip.c | 6 +- net/packet/af_packet.c | 54 +++++------- net/sched/act_ipt.c | 33 ++++++- net/sunrpc/sched.c | 13 ++- sound/pci/hda/hda_codec.c | 3 + sound/soc/codecs/wm8994.c | 1 + tools/perf/scripts/python/net_dropmonitor.py | 8 +- 104 files changed, 906 insertions(+), 426 deletions(-)
Signature · 2 lines
Ben Hutchings If at first you don't succeed, you're doing about average.
PATCH 1/94 Revert "drm/i915: Fix detection of base of stolen memory"
3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
This reverts commit 53e587aa5ca81497d0ea6e340320ec5778d1f311. Yves-Alexis Perez reported that it broke the driver on two machines with GMA4500 and i965 chips. Only the backported version in 3.2.45 had this effect; the fix in mainline is fine.
Daniel Vetter stated that the fix is not needed in 3.2 anyway.
--- drivers/gpu/drm/i915/i915_dma.c | 81 +++++++++++++++++++-------------------- drivers/gpu/drm/i915/i915_drv.h | 1 - 2 files changed, 40 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +40 -41
@@ -1007,50 +1007,56 @@ intel_teardown_mchbar(struct drm_device *dev)release_resource (&dev_priv->mch_res); } -static unsigned long i915_stolen_to_physical (struct drm_device *dev) +#define PTE_ADDRESS_MASK 0xfffff000 +#define PTE_ADDRESS_MASK_HIGH 0x000000f0/* i915+ */ +#define PTE_MAPPING_TYPE_UNCACHED (0 << 1) +#define PTE_MAPPING_TYPE_DCACHE (1 << 1)/* i830 only */ +#define PTE_MAPPING_TYPE_CACHED (3 << 1) +#define PTE_MAPPING_TYPE_MASK (3 << 1) +#define PTE_VALID (1 << 0) + +/** +* i915_stolen_to_phys - take an offset into stolen memory and turn it into +* a physical one +* @dev: drm device +* @offset: address to translate +* +* Some chip functions require allocations from stolen space and need the +* physical address of the memory in question. +*/ +static unsigned long i915_stolen_to_phys (struct drm_device *dev,u32 offset) {struct drm_i915_private *dev_priv = dev->dev_private;struct pci_dev *pdev = dev_priv->bridge_dev;u32 base; +#if 0 /* On the machines I have tested the Graphics Base of Stolen Memory -* is unreliable, so on those compute the base by subtracting the -* stolen memory from the Top of Low Usable DRAM which is where the -* BIOS places the graphics stolen memory. -* -* On gen2, the layout is slightly different with the Graphics Segment -* immediately following Top of Memory (or Top of Usable DRAM). Note -* it appears that TOUD is only reported by 865g, so we just use the -* top of memory as determined by the e820 probe. -* -* XXX gen2 requires an unavailable symbol and 945gm fails with -* its value of TOLUD. +* is unreliable, so compute the base by subtracting the stolen memory +* from the Top of Low Usable DRAM which is where the BIOS places +* the graphics stolen memory. */ - base =0 ; -if (INTEL_INFO (dev)->gen >=6 ) { -/* Read Base Data of Stolen Memory Register (BDSM) directly. -* Note that there is also a MCHBAR miror at 0x1080c0 or -* we could use device 2:0x5c instead. -*/ -pci_read_config_dword (pdev,0xB0 , &base); - base &= ~4095 ;/* lower bits used for locking register */ - }else if (INTEL_INFO (dev)->gen >3 ||IS_G33 (dev)) { -/* Read Graphics Base of Stolen Memory directly */ +if (INTEL_INFO (dev)->gen >3 ||IS_G33 (dev)) { +/* top 32bits are reserved = 0 */ pci_read_config_dword (pdev,0xA4 , &base); -#if 0 - } else if (IS_GEN3(dev)) { + }else { +/* XXX presume 8xx is the same as i915 */ +pci_bus_read_config_dword (pdev->bus,2 ,0x5C , &base); + } +#else +if (INTEL_INFO (dev)->gen >3 ||IS_G33 (dev)) { +u16 val; +pci_read_config_word (pdev,0xb0 , &val); + base = val >>4 <<20 ; + }else {u8 val; -/* Stolen is immediately below Top of Low Usable DRAM */ pci_read_config_byte (pdev,0x9c , &val); base = val >>3 <<27 ; - base -= dev_priv->mm.gtt->stolen_size; - }else { -/* Stolen is immediately above Top of Memory */ - base = max_low_pfn_mapped <<PAGE_SHIFT ; -#endif } + base -= dev_priv->mm.gtt->stolen_size; +#endif -return base; +return base + offset; }static void i915_warn_stolen (struct drm_device *dev)
@@ -1075,7 +1081,7 @@ static void i915_setup_compression(struct drm_device *dev, int size)if (!compressed_fb) goto err; - cfb_base = dev_priv->mm.stolen_base + compressed_fb->start; + cfb_base =i915_stolen_to_phys (dev, compressed_fb->start);if (!cfb_base) goto err_fb;
@@ -1088,7 +1094,7 @@ static void i915_setup_compression(struct drm_device *dev, int size)if (!compressed_llb) goto err_fb; - ll_base = dev_priv->mm.stolen_base + compressed_llb->start; + ll_base =i915_stolen_to_phys (dev, compressed_llb->start);if (!ll_base) goto err_llb; }
@@ -1107,7 +1113,7 @@ static void i915_setup_compression(struct drm_device *dev, int size) }DRM_DEBUG_KMS ("FBC base 0x%08lx, ll base 0x%08lx, size %dM\n" , - (long )cfb_base, (long )ll_base, size >>20 ); + cfb_base, ll_base, size >>20 );return ; err_llb:
@@ -1181,13 +1187,6 @@ static int i915_load_gem_init(struct drm_device *dev) gtt_size = dev_priv->mm.gtt->gtt_total_entries <<PAGE_SHIFT ; mappable_size = dev_priv->mm.gtt->gtt_mappable_entries <<PAGE_SHIFT ; - dev_priv->mm.stolen_base =i915_stolen_to_physical (dev); -if (dev_priv->mm.stolen_base ==0 ) -return 0 ; - -DRM_DEBUG_KMS ("found %d bytes of stolen memory at %08lx\n" , - dev_priv->mm.gtt->stolen_size, dev_priv->mm.stolen_base); -/* Basic memrange allocator for stolen space */ drm_mm_init (&dev_priv->mm.stolen,0 , prealloc_size);
drivers/gpu/drm/i915/i915_drv.h +0 -1
@@ -581,7 +581,6 @@ typedef struct drm_i915_private {unsigned long gtt_start;unsigned long gtt_mappable_end;unsigned long gtt_end; -unsigned long stolen_base;/* limited to low memory (32-bit) */ struct io_mapping *gtt_mapping;int gtt_mtrr;
PATCH 2/94 mmc: at91/avr32/atmel-mci: fix DMA-channel leak on module unload
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 91cf54feecf815bec0b6a8d6d9dbd0e219f2f2cc upstream.
Fix regression introduced by commit 796211b7953 ("mmc: atmel-mci: add pdc support and runtime capabilities detection") which removed the need for CONFIG_MMC_ATMELMCI_DMA but kept the Kconfig-entry as well as the compile guards around dma_release_channel() in remove(). Consequently, DMA is always enabled (if supported), but the DMA-channel is not released on module unload unless the DMA-config option is selected.
Remove the no longer used CONFIG_MMC_ATMELMCI_DMA option completely.
--- arch/arm/configs/at91sam9g45_defconfig | 1 - arch/avr32/configs/favr-32_defconfig | 1 - arch/avr32/configs/merisc_defconfig | 1 - drivers/mmc/host/Kconfig | 10 ---------- drivers/mmc/host/atmel-mci.c | 2 -- 5 files changed, 15 deletions(-)
arch/arm/configs/at91sam9g45_defconfig +0 -1
@@ -173,7 +173,6 @@ CONFIG_MMC=y # CONFIG_MMC_BLOCK_BOUNCE is not set CONFIG_SDIO_UART=m CONFIG_MMC_ATMELMCI=y -CONFIG_MMC_ATMELMCI_DMA=y CONFIG_LEDS_ATMEL_PWM=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGER_TIMER=y
arch/avr32/configs/favr-32_defconfig +0 -1
@@ -122,7 +122,6 @@ CONFIG_USB_G_SERIAL=m CONFIG_USB_CDC_COMPOSITE=m CONFIG_MMC=y CONFIG_MMC_ATMELMCI=y -CONFIG_MMC_ATMELMCI_DMA=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_ATMEL_PWM=m
arch/avr32/configs/merisc_defconfig +0 -1
@@ -102,7 +102,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_LOGO=y CONFIG_MMC=y CONFIG_MMC_ATMELMCI=y -CONFIG_MMC_ATMELMCI_DMA=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_ATMEL_PWM=y
drivers/mmc/host/Kconfig +0 -10
@@ -297,16 +297,6 @@ config MMC_ATMELMCI endchoice -config MMC_ATMELMCI_DMA - bool "Atmel MCI DMA support" - depends on MMC_ATMELMCI && (AVR32 || ARCH_AT91SAM9G45) && DMA_ENGINE - help - Say Y here to have the Atmel MCI driver use a DMA engine to - do data transfers and thus increase the throughput and - reduce the CPU utilization. - - If unsure, say N. - config MMC_IMX tristate "Motorola i.MX Multimedia Card Interface support" depends on ARCH_MX1
drivers/mmc/host/atmel-mci.c +0 -2
@@ -2167,10 +2167,8 @@ static int __exit atmci_remove(struct platmci_readl (host,ATMCI_SR );clk_disable (host->mck); -#ifdef CONFIG_MMC_ATMELMCI_DMA if (host->dma.chan)dma_release_channel (host->dma.chan); -#endif free_irq (platform_get_irq (pdev,0 ), host);iounmap (host->regs);
PATCH 3/94 mmc: core: Fix bit width test failing on old eMMC cards
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Philip Rakity <[email protected]>
commit 836dc2fe89c968c10cada87e0dfae6626f8f9da3 upstream.
PARTITION_SUPPORT needs to be set before doing the compare on version number so the bit width test does not get invalid data. Before this patch, a Sandisk iNAND eMMC card would detect 1-bit width although the hardware supports 4-bit.
Only affects old emmc devices - pre 4.4 devices.
--- drivers/mmc/core/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/mmc.c +1 -1
@@ -363,13 +363,13 @@ static int mmc_read_ext_csd(struct mmc_c ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT ]; card->ext_csd.raw_trim_mult = ext_csd[EXT_CSD_TRIM_MULT ]; + card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT ];if (card->ext_csd.rev >=4 ) {/* * Enhanced area feature support -- check whether the eMMC * card has the Enhanced area enabled. If so, export enhanced * area offset and size to user by adding sysfs interface. */ - card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT ];if ((ext_csd[EXT_CSD_PARTITION_SUPPORT ] &0x2 ) && (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE ] &0x1 )) { hc_erase_grp_sz =
PATCH 4/94 mfd: adp5520: Restore mode bits on resume
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit c6cc25fda58da8685ecef3f179adc7b99c8253b2 upstream.
The adp5520 unfortunately also clears the BL_EN bit when the nSTNDBY bit is cleared. So we need to make sure to restore it during resume if it was set before suspend.
--- drivers/mfd/adp5520.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mfd/adp5520.c +6 -2
@@ -36,6 +36,7 @@ struct adp5520_chip {struct blocking_notifier_head notifier_list;int irq;unsigned long id; +uint8_t mode; }; static int __adp5520_read(struct i2c_client *client,
@@ -326,7 +327,10 @@ static int adp5520_suspend(struct devicestruct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_clr_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_read (chip->dev,ADP5520_MODE_STATUS , &chip->mode); +/* All other bits are W1C */ + chip->mode &=ADP5520_BL_EN |ADP5520_DIM_EN | ADP5520_nSTNBY; +adp5520_write (chip->dev,ADP5520_MODE_STATUS ,0 );return 0 ; }
@@ -335,7 +339,7 @@ static int adp5520_resume(struct devicestruct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_set_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_write (chip->dev,ADP5520_MODE_STATUS , chip->mode); return 0; }#endif
PATCH 5/94 mmc: atmel-mci: pio hang on block errors
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Terry Barnaby <[email protected]>
commit bdbc5d0c60f3e9de3eeccf1c1a18bdc11dca62cc upstream.
The driver is doing, by default, multi-block reads. When a block error occurs, card/block.c instigates a single block read: "mmcblk0: retrying using single block read". It leaves the sg chain intact and just changes the length attribute for the first sg entry and the overall sg_len parameter. When atmci_read_data_pio is called to read the single block of data it ignores the sg_len and expects to read more than 512 bytes as it sees there are multiple items in the sg list. No more data comes as the controller has only been commanded to get one block.
--- drivers/mmc/host/atmel-mci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/mmc/host/atmel-mci.c +10 -4
@@ -163,6 +163,7 @@ struct atmel_mci {void __iomem *regs;struct scatterlist *sg; +unsigned int sg_len;unsigned int pio_offset;struct atmel_mci_slot *cur_slot;
@@ -751,6 +752,7 @@ static u32 atmci_prepare_data(struct atm data->error = -EINPROGRESS ; host->sg = data->sg; + host->sg_len = data->sg_len; host->data = data; host->data_chan =NULL ;
@@ -1573,7 +1575,8 @@ static void atmci_read_data_pio(struct aif (offset == sg->length) {flush_dcache_page (sg_page (sg)); host->sg = sg =sg_next (sg); -if (!sg) + host->sg_len--; +if (!sg || !host->sg_len) goto done; offset =0 ;
@@ -1586,7 +1589,8 @@ static void atmci_read_data_pio(struct aflush_dcache_page (sg_page (sg)); host->sg = sg =sg_next (sg); -if (!sg) + host->sg_len--; +if (!sg || !host->sg_len) goto done; offset =4 - remaining;
@@ -1640,7 +1644,8 @@ static void atmci_write_data_pio(struct nbytes +=4 ;if (offset == sg->length) { host->sg = sg =sg_next (sg); -if (!sg) + host->sg_len--; +if (!sg || !host->sg_len) goto done; offset =0 ;
@@ -1654,7 +1659,8 @@ static void atmci_write_data_pio(struct nbytes += remaining; host->sg = sg =sg_next (sg); -if (!sg) { + host->sg_len--; +if (!sg || !host->sg_len) {atmci_writel (host,ATMCI_TDR , value); goto done; }
PATCH 6/94 x86: Eliminate irq_mis_count counted in arch_irq_stat
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Li Fei <[email protected]>
commit f7b0e1055574ce06ab53391263b4e205bf38daf3 upstream.
With the current implementation, kstat_cpu(cpu).irqs_sum is also increased in case of irq_mis_count increment.
So there is no need to count irq_mis_count in arch_irq_stat, otherwise irq_mis_count will be counted twice in the sum of /proc/stat.
--- arch/x86/kernel/irq.c | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/kernel/irq.c +0 -4
@@ -160,10 +160,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)u64 arch_irq_stat (void ) {u64 sum =atomic_read (&irq_err_count); - -#ifdef CONFIG_X86_IO_APIC - sum +=atomic_read (&irq_mis_count); -#endif return sum; }
PATCH 7/94 ASoC: wm8994: missing break in wm8994_aif3_hw_params()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 4495e46fe18f198366961bb2b324a694ef8a9b44 upstream.
The missing break here means that we always return early and the function is a no-op.
--- sound/soc/codecs/wm8994.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wm8994.c +1 -0
@@ -2636,6 +2636,7 @@ static int wm8994_aif3_hw_params(structdefault :return 0 ; } +break ;default :return 0 ; }
PATCH 8/94 ath9k: fix key allocation error handling for powersave keys
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
commit 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 upstream.
If no keycache slots are available, ath_key_config can return -ENOSPC. If the key index is not checked for errors, it can lead to logspam that looks like this: "ath: wiphy0: keyreset: keycache entry 228 out of range" This can cause follow-up errors if the invalid keycache index gets used for tx.
--- drivers/net/wireless/ath/ath9k/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/main.c +5 -1
@@ -1793,6 +1793,7 @@ static int ath9k_sta_add(struct ieee8021struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_node *an = (struct ath_node *) sta->drv_priv;struct ieee80211_key_conf ps_key = { }; +int key;ath_node_attach (sc, sta);
@@ -1800,7 +1801,9 @@ static int ath9k_sta_add(struct ieee8021 vif->type != NL80211_IFTYPE_AP_VLAN)return 0 ; - an->ps_key =ath_key_config (common, vif, sta, &ps_key); + key =ath_key_config (common, vif, sta, &ps_key); +if (key >0 ) + an->ps_key = key;return 0 ; }
@@ -1817,6 +1820,7 @@ static void ath9k_del_ps_key(struct ath_return ;ath_key_delete (common, &ps_key); + an->ps_key =0 ; } static int ath9k_sta_remove(struct ieee80211_hw *hw,
PATCH 9/94 nfsd4: don't allow owner override on 4.1 CLAIM_FH opens
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 9f415eb25574db4b73a9a712a4438e41dc284922 upstream.
The Linux client is using CLAIM_FH to implement regular opens, not just recovery cases, so it depends on the server to check permissions correctly.
Therefore the owner override, which may make sense in the delegation recovery case, isn't right in the CLAIM_FH case.
Symptoms: on a client with 49f9a0fafd844c32f2abada047c0b9a5ba0d6255 "NFSv4.1: Enable open-by-filehandle", Bryan noticed this:
touch test.txt
chmod 000 test.txt
echo test > test.txt
succeeding.
--- fs/nfsd/nfs4proc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
fs/nfsd/nfs4proc.c +13 -2
@@ -267,6 +267,7 @@ static __be32 do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) { __be32 status; +int accmode =0 ;/* Only reclaims from previously confirmed clients are valid */ if ((status =nfs4_check_open_reclaim (&open->op_clientid)))
@@ -284,9 +285,19 @@ do_open_fhandle(struct svc_rqst *rqstp, open->op_truncate = (open->op_iattr.ia_valid &ATTR_SIZE ) && (open->op_iattr.ia_size ==0 ); +/* +* In the delegation case, the client is telling us about an +* open that it *already* performed locally, some time ago. We +* should let it succeed now if possible. +* +* In the case of a CLAIM_FH open, on the other hand, the client +* may be counting on us to enforce permissions (the Linux 4.1 +* client uses this for normal opens, for example). +*/ +if (open->op_claim_type ==NFS4_OPEN_CLAIM_DELEG_CUR_FH ) + accmode =NFSD_MAY_OWNER_OVERRIDE ; - status =do_open_permission (rqstp, current_fh, open, -NFSD_MAY_OWNER_OVERRIDE ); + status =do_open_permission (rqstp, current_fh, open, accmode);return status; }
PATCH 10/94 net/eth/ibmveth: Fixup retrieval of MAC address
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Herrenschmidt <[email protected]>
commit 13f85203e1060da83d9ec1c1c5a63343eaab8de4 upstream.
Some ancient pHyp versions used to create a 8 bytes local-mac-address property in the device-tree instead of a 6 bytes one for veth.
The Linux driver code to deal with that is an insane hack which also happens to break with some choices of MAC addresses in qemu by testing for a bit in the address rather than just looking at the size of the property.
Sanitize this by doing the latter instead.
--- drivers/net/ethernet/ibm/ibmveth.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/net/ethernet/ibm/ibmveth.c +10 -13
@@ -1325,7 +1325,7 @@ static const struct net_device_ops ibmvestatic int __devinit ibmveth_probe (struct vio_dev *dev,const struct vio_device_id *id) { -int rc, i; +int rc, i, mac_len;struct net_device *netdev;struct ibmveth_adapter *adapter;unsigned char *mac_addr_p;
@@ -1335,11 +1335,19 @@ static int __devinit ibmveth_probe(struc dev->unit_address); mac_addr_p = (unsigned char *)vio_get_attribute (dev,VETH_MAC_ADDR , -NULL ); + &mac_len);if (!mac_addr_p) {dev_err (&dev->dev,"Can't find VETH_MAC_ADDR attribute\n" );return -EINVAL ; } +/* Workaround for old/broken pHyp */ +if (mac_len ==8 ) + mac_addr_p +=2 ; +else if (mac_len !=6 ) { +dev_err (&dev->dev,"VETH_MAC_ADDR attribute wrong len %d\n" , + mac_len); +return -EINVAL ; + } mcastFilterSize_p = (unsigned int *)vio_get_attribute (dev,VETH_MCAST_FILTER_SIZE ,NULL );
@@ -1364,17 +1372,6 @@ static int __devinit ibmveth_probe(strucnetif_napi_add (netdev, &adapter->napi, ibmveth_poll,16 ); -/* -* Some older boxes running PHYP non-natively have an OF that returns -* a 8-byte local-mac-address field (and the first 2 bytes have to be -* ignored) while newer boxes' OF return a 6-byte field. Note that -* IEEE 1275 specifies that local-mac-address must be a 6-byte field. -* The RPA doc specifies that the first byte must be 10b, so we'll -* just look for it to solve this 8 vs. 6 byte field issue -*/ -if ((*mac_addr_p &0x3 ) !=0x02 ) - mac_addr_p +=2 ; - adapter->mac_addr =0 ;memcpy (&adapter->mac_addr, mac_addr_p,6 );
PATCH 11/94 ext4: limit group search loop for non-extent files
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lachlan McIlroy <[email protected]>
commit e6155736ad76b2070652745f9e54cdea3f0d8567 upstream.
In the case where we are allocating for a non-extent file, we must limit the groups we allocate from to those below 2^32 blocks, and ext4_mb_regular_allocator() attempts to do this initially by putting a cap on ngroups for the subsequent search loop.
However, the initial target group comes in from the allocation context (ac), and it may already be beyond the artificially limited ngroups. In this case, the limit
if (group == ngroups) group = 0;
at the top of the loop is never true, and the loop will run away.
Catch this case inside the loop and reset the search to start at group 0.
[[email protected]: add commit msg & comments]
--- fs/ext4/mballoc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +5 -1
@@ -2027,7 +2027,11 @@ repeat: group = ac->ac_g_ex.fe_group;for (i =0 ; i < ngroups; group++, i++) { -if (group == ngroups) +/* +* Artificially restricted ngroups for non-extent +* files makes group > ngroups possible on first loop. +*/ +if (group >= ngroups) group =0 ;/* This now checks without needing the buddy page */
PATCH 12/94 xen/vcpu/pvhvm: Fix vcpu hotplugging hanging.
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 7f1fc268c47491fd5e63548f6415fc8604e13003 upstream.
If a user did:
echo 0 > /sys/devices/system/cpu/cpu1/online echo 1 > /sys/devices/system/cpu/cpu1/online
we would (this a build with DEBUG enabled) get to:
smpboot: ++++++++++++++++++++=_---CPU UP 1 .. snip..
smpboot: Stack at about ffff880074c0ff44
smpboot: CPU1: has booted.
and hang. The RCU mechanism would kick in an try to IPI the CPU1 but the IPIs (and all other interrupts) would never arrive at the CPU1. At first glance at least. A bit digging in the hypervisor trace shows that (using xenanalyze):
[vla] d4v1 vec 243 injecting
0.043163027 --|x d4v1 intr_window vec 243 src 5(vector) intr f3 ] 0.043163639 --|x d4v1 vmentry cycles 1468 ] 0.043164913 --|x d4v1 vmexit exit_reason PENDING_INTERRUPT eip ffffffff81673254 0.043164913 --|x d4v1 inj_virq vec 243 real [vla] d4v1 vec 243 injecting 0.043164913 --|x d4v1 intr_window vec 243 src 5(vector) intr f3 ] 0.043165526 --|x d4v1 vmentry cycles 1472 ] 0.043166800 --|x d4v1 vmexit exit_reason PENDING_INTERRUPT eip ffffffff81673254 0.043166800 --|x d4v1 inj_virq vec 243 real
[vla] d4v1 vec 243 injecting
there is a pending event (subsequent debugging shows it is the IPI from the VCPU0 when smpboot.c on VCPU1 has done "set_cpu_online(smp_processor_id(), true)") and the guest VCPU1 is interrupted with the callback IPI (0xf3 aka 243) which ends up calling __xen_evtchn_do_upcall.
The __xen_evtchn_do_upcall seems to do *something* but not acknowledge the pending events. And the moment the guest does a 'cli' (that is the ffffffff81673254 in the log above) the hypervisor is invoked again to inject the IPI (0xf3) to tell the guest it has pending interrupts. This repeats itself forever.
The culprit was the per_cpu(xen_vcpu, cpu) pointer. At the bootup we set each per_cpu(xen_vcpu, cpu) to point to the shared_info->vcpu_info[vcpu] but later on use the VCPUOP_register_vcpu_info to register per-CPU structures (xen_vcpu_setup).
This is used to allow events for more than 32 VCPUs and for performance optimizations reasons.
When the user performs the VCPU hotplug we end up calling the the xen_vcpu_setup once more. We make the hypercall which returns -EINVAL as it does not allow multiple registration calls (and already has re-assigned where the events are being set). We pick the fallback case and set per_cpu(xen_vcpu, cpu) to point to the shared_info->vcpu_info[vcpu] (which is a good fallback during bootup). However the hypervisor is still setting events in the register per-cpu structure (per_cpu(xen_vcpu_info, cpu)).
As such when the events are set by the hypervisor (such as timer one), and when we iterate in __xen_evtchn_do_upcall we end up reading stale events from the shared_info->vcpu_info[vcpu] instead of the per_cpu(xen_vcpu_info, cpu) structures. Hence we never acknowledge the events that the hypervisor has set and the hypervisor keeps on reminding us to ack the events which we never do.
The fix is simple. Don't on the second time when xen_vcpu_setup is called over-write the per_cpu(xen_vcpu, cpu) if it points to per_cpu(xen_vcpu_info).
--- arch/x86/xen/enlighten.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/x86/xen/enlighten.c +15 -0
@@ -129,6 +129,21 @@ static void xen_vcpu_setup(int cpu)BUG_ON (HYPERVISOR_shared_info == &xen_dummy_shared_info); +/* +* This path is called twice on PVHVM - first during bootup via +* smp_init -> xen_hvm_cpu_notify, and then if the VCPU is being +* hotplugged: cpu_up -> xen_hvm_cpu_notify. +* As we can only do the VCPUOP_register_vcpu_info once lets +* not over-write its result. +* +* For PV it is called during restore (xen_vcpu_restore) and bootup +* (xen_setup_vcpu_info_placement). The hotplug mechanism does not +* use this function. +*/ +if (xen_hvm_domain ()) { +if (per_cpu (xen_vcpu, cpu) == &per_cpu (xen_vcpu_info, cpu)) +return ; + }if (cpu <MAX_VIRT_CPUS )per_cpu (xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
PATCH 13/94 autofs - remove autofs dentry mount check
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Jeffery <[email protected]>
commit ce8a5dbdf9e709bdaf4618d7ef8cceb91e8adc69 upstream.
When checking if an autofs mount point is busy it isn't sufficient to only check if it's a mount point.
For example, if the mount of an offset mountpoint in a tree is denied for this host by its export and the dentry becomes a process working directory the check incorrectly returns the mount as not in use at expire.
This can happen since the default when mounting within a tree is nostrict, which means ingnore mount fails on mounts within the tree and continue. The nostrict option is meant to allow mounting in this case.
--- fs/autofs4/expire.c | 9 --------- 1 file changed, 9 deletions(-)
fs/autofs4/expire.c +0 -9
@@ -61,15 +61,6 @@ static int autofs4_mount_busy(struct vfs/* This is an autofs submount, we can't expire it */ if (autofs_type_indirect (sbi->type)) goto done; - -/* -* Otherwise it's an offset mount and we need to check -* if we can umount its mount, if there is one. -*/ -if (!d_mountpoint (path.dentry)) { - status =0 ; - goto done; - } }/* Update the expiry counter if fs is busy */
PATCH 14/94 ALSA: HDA: Fix Oops caused by dereference NULL pointer
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wang YanQing <[email protected]>
commit 2195b063f6609e4c6268f291683902f25eaf9aa6 upstream.
The interrupt handler azx_interrupt will call azx_update_rirb, which may call snd_hda_queue_unsol_event, snd_hda_queue_unsol_event will dereference chip->bus pointer.
The problem is we alloc chip->bus in azx_codec_create which will be called after we enable IRQ and enable unsolicited event in azx_probe.
This will cause Oops due dereference NULL pointer. I meet it, good luck:)
[Rearranged the NULL check before the tracepoint and added another
NULL check of bus->workq -- tiwai]
--- sound/pci/hda/hda_codec.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_codec.c +3 -0
@@ -615,6 +615,9 @@ int snd_hda_queue_unsol_event(struct hdastruct hda_bus_unsolicited *unsol;unsigned int wp; +if (!bus || !bus->workq) +return 0 ; +trace_hda_unsol_event (bus, res, res_ex); unsol = bus->unsol;if (!unsol)
PATCH 15/94 iscsi-target: Fix processing of OOO commands
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Shlomo Pongratz <[email protected]>
commit 3eccfdb01da58fbd0f789ae6ca61cee3769e26de upstream.
Fix two issues in OOO commands processing done at iscsit_attach_ooo_cmdsn.
Handle command serial numbers wrap around by using iscsi_sna_lt and not regular comparisson.
The routine iterates until it finds an entry whose serial number is greater than the serial number of the new one, thus the new entry should be inserted before that entry and not after.
--- drivers/target/iscsi/iscsi_target_erl1.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/target/iscsi/iscsi_target_erl1.c +4 -3
@@ -824,7 +824,7 @@ static int iscsit_attach_ooo_cmdsn(/* * CmdSN is greater than the tail of the list. */ -if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn) +if (iscsi_sna_lt (ooo_tail->cmdsn, ooo_cmdsn->cmdsn))list_add_tail (&ooo_cmdsn->ooo_list, &sess->sess_ooo_cmdsn_list);else {
@@ -834,11 +834,12 @@ static int iscsit_attach_ooo_cmdsn(*/ list_for_each_entry (ooo_tmp, &sess->sess_ooo_cmdsn_list, ooo_list) { -if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) +if (iscsi_sna_lt (ooo_tmp->cmdsn, ooo_cmdsn->cmdsn))continue ; +/* Insert before this entry */ list_add (&ooo_cmdsn->ooo_list, - &ooo_tmp->ooo_list); + ooo_tmp->ooo_list.prev);break ; } }
PATCH 16/94 ACPICA: Fix possible buffer overflow during a field unit read operation
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bob Moore <[email protected]>
commit 61388f9e5d93053cf399a356414f31f9b4814c6d upstream.
Can only happen under these conditions: 1) The DSDT version is 1, meaning integers are 32-bits. 2) The field is between 33 and 64 bits long.
It applies cleanly back to ACPICA 20100806+ (Linux v2.6.37+).
--- drivers/acpi/acpica/exfldio.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/acpi/acpica/exfldio.c +13 -1
@@ -702,7 +702,19 @@ acpi_ex_extract_from_field(union acpi_opif ((obj_desc->common_field.start_field_bit_offset ==0 ) && (obj_desc->common_field.bit_length == access_bit_width)) { - status =acpi_ex_field_datum_io (obj_desc,0 , buffer,ACPI_READ ); +if (buffer_length >=sizeof (u64)) { + status = +acpi_ex_field_datum_io (obj_desc,0 , buffer, +ACPI_READ ); + }else { +/* Use raw_datum (u64) to handle buffers < 64 bits */ + + status = +acpi_ex_field_datum_io (obj_desc,0 , &raw_datum, +ACPI_READ ); +ACPI_MEMCPY (buffer, &raw_datum, buffer_length); + } +return_ACPI_STATUS (status); }
PATCH 17/94 B43: Handle DMA RX descriptor underrun
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thommy Jakobsson <[email protected]>
commit 73b82bf0bfbf58e6ff328d3726934370585f6e78 upstream.
Add handling of rx descriptor underflow. This fixes a fault that could happen on slow machines, where data is received faster than the CPU can handle. In such a case the device will use up all rx descriptors and refuse to send any more data before confirming that it is ok. This patch enables necessary interrupt to discover such a situation and will handle them by dropping everything in the ring buffer.
--- drivers/net/wireless/b43/dma.c | 19 +++++++++++++++++ drivers/net/wireless/b43/dma.h | 4 +++- drivers/net/wireless/b43/main.c | 43 ++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 26 deletions(-)
drivers/net/wireless/b43/dma.c +19 -0
@@ -1719,6 +1719,25 @@ drop_recycle_buffer:sync_descbuffer_for_device (ring, dmaaddr, ring->rx_buffersize); } +void b43_dma_handle_rx_overflow (struct b43_dmaring *ring) +{ +int current_slot, previous_slot; + +B43_WARN_ON (ring->tx); + +/* Device has filled all buffers, drop all packets and let TCP +* decrease speed. +* Decrement RX index by one will let the device to see all slots +* as free again +*/ +/* +*TODO: How to increase rx_drop in mac80211? +*/ + current_slot = ring->ops->get_current_rxslot (ring); + previous_slot =prev_slot (ring, current_slot); + ring->ops->set_current_rxslot (ring, previous_slot); +} +void b43_dma_rx (struct b43_dmaring *ring) {const struct b43_dma_ops *ops = ring->ops;
drivers/net/wireless/b43/dma.h +3 -1
@@ -9,7 +9,7 @@/* DMA-Interrupt reasons. */ #define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ | (1 << 14) | (1 << 15)) -#define B43_DMAIRQ_NONFATALMASK (1 << 13) +#define B43_DMAIRQ_RDESC_UFLOW (1 << 13)#define B43_DMAIRQ_RX_DONE (1 << 16)/*** 32-bit DMA Engine. ***/
@@ -295,6 +295,8 @@ int b43_dma_tx(struct b43_wldev *dev,void b43_dma_handle_txstatus (struct b43_wldev *dev,const struct b43_txstatus *status); +void b43_dma_handle_rx_overflow (struct b43_dmaring *ring); +void b43_dma_rx (struct b43_dmaring *ring); void b43_dma_direct_fifo_rx(struct b43_wldev *dev,
drivers/net/wireless/b43/main.c +18 -25
68 lines not on this page · raw message
PATCH 18/94 mwifiex: clear is_suspended flag when interrupt is received early
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bing Zhao <[email protected]>
commit 48795424acff7215d5eac0b52793a2c1eb3a6283 upstream.
When the XO-4 with 8787 wireless is woken up due to wake-on-WLAN mwifiex is often flooded with "not allowed while suspended" messages and the interface is unusable.
[ 202.171609] int: sdio_ireg = 0x1
[ 202.180700] info: mwifiex_process_hs_config: auto cancelling host
sleep since there is interrupt from the firmware
[ 202.201880] event: wakeup device...
[ 202.211452] event: hs_deactivated
[ 202.514638] info: --- Rx: Data packet ---
[ 202.514753] data: 4294957544 BSS(0-0): Data <= kernel
[ 202.514825] PREP_CMD: device in suspended state
[ 202.514839] data: dequeuing the packet ec7248c0 ec4869c0
[ 202.514886] mwifiex_write_data_sync: not allowed while suspended
[ 202.514886] host_to_card, write iomem (1) failed: -1
[ 202.514917] mwifiex_write_data_sync: not allowed while suspended
[ 202.514936] host_to_card, write iomem (2) failed: -1
[ 202.514949] mwifiex_write_data_sync: not allowed while suspended
[ 202.514965] host_to_card, write iomem (3) failed: -1
[ 202.514976] mwifiex_write_data_async failed: 0xFFFFFFFFThis can be readily reproduced when putting the XO-4 in a loop where it goes to sleep due to inactivity, but then wakes up due to an incoming ping. The error is hit within an hour or two.
This issue happens when an interrupt comes in early while host sleep is still activated. Driver handles this case by auto cancelling host sleep. However is_suspended flag is still set which prevents any cmd or data from being sent to firmware. Fix it by clearing is_suspended flag in this path.
--- drivers/net/wireless/mwifiex/cmdevt.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mwifiex/cmdevt.c +1 -0
@@ -1083,6 +1083,7 @@ mwifiex_process_hs_config(struct mwifiex adapter->if_ops.wakeup (adapter); adapter->hs_activated = false; adapter->is_hs_configured = false; + adapter->is_suspended = false;mwifiex_hs_activated_event (mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY ), false); }
PATCH 19/94 mwifiex: fix memory leak issue when driver unload
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Amitkumar Karwar <[email protected]>
commit f16fdc9d2dc1e5b270e9a08377587e831e0d36ac upstream.
After unregister_netdevice() call the request is queued and reg_state is changed to NETREG_UNREGISTERING.
As we check for NETREG_UNREGISTERED state, free_netdev() never gets executed causing memory leak.
Initialize "dev->destructor" to free_netdev() to free device data after unregistration.
--- drivers/net/wireless/mwifiex/cfg80211.c | 3 --- drivers/net/wireless/mwifiex/main.c | 1 + 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +0 -3
@@ -1281,9 +1281,6 @@ int mwifiex_del_virtual_intf(struct wiphif (dev->reg_state ==NETREG_REGISTERED )unregister_netdevice (dev); -if (dev->reg_state ==NETREG_UNREGISTERED ) -free_netdev (dev); -/* Clear the priv in adapter */ priv->netdev =NULL ;
drivers/net/wireless/mwifiex/main.c +1 -0
@@ -581,6 +581,7 @@ void mwifiex_init_priv_params(struct mwi struct net_device *dev) { dev->netdev_ops = &mwifiex_netdev_ops; + dev->destructor = free_netdev;/* Initialize private structure */ priv->current_key_index =0 ; priv->media_connected = false;
PATCH 20/94 mwifiex: fix setting of multicast filter
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Drake <[email protected]>
commit ccd384b10420ac81ba3fb9b0a7d18272c7173552 upstream.
A small bug in this code was causing the ALLMULTI filter to be set when in fact we were just wanting to program a selective multicast list to the hardware.
Fix that bug and remove a redundant if condition in the code that follows.
This fixes wakeup behaviour when multicast WOL is enabled. Previously, all multicast packets would wake up the system. Now, only those that the host intended to receive trigger wakeups.
--- drivers/net/wireless/mwifiex/sta_ioctl.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/net/wireless/mwifiex/sta_ioctl.c +6 -15
@@ -105,7 +105,7 @@ int mwifiex_request_set_multicast_list(s }else {/* Multicast */ priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; -if (mcast_list->mode ==MWIFIEX_MULTICAST_MODE ) { +if (mcast_list->mode ==MWIFIEX_ALL_MULTI_MODE ) {dev_dbg (priv->adapter->dev,"info: Enabling All Multicast!\n" ); priv->curr_pkt_filter |=
@@ -117,20 +117,11 @@ int mwifiex_request_set_multicast_list(sdev_dbg (priv->adapter->dev,"info: Set multicast list=%d\n" , mcast_list->num_multicast_addr); -/* Set multicast addresses to firmware */ -if (old_pkt_filter == priv->curr_pkt_filter) { -/* Send request to firmware */ - ret =mwifiex_send_cmd_async (priv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET,0 , - mcast_list); - }else { -/* Send request to firmware */ - ret =mwifiex_send_cmd_async (priv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET,0 , - mcast_list); - } +/* Send multicast addresses to firmware */ + ret =mwifiex_send_cmd_async (priv, + HostCmd_CMD_MAC_MULTICAST_ADR, + HostCmd_ACT_GEN_SET,0 , + mcast_list); } } }
PATCH 21/94 cifs: only set ops for inodes in I_NEW state
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit c2b93e0699723700f886ce17bb65ffd771195a6d upstream.
It's generally not safe to reset the inode ops once they've been set. In the case where the inode was originally thought to be a directory and then later found to be a DFS referral, this can lead to an oops when we try to trigger an inode op on it after changing the ops to the blank referral operations.
--- fs/cifs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/cifs/inode.c +2 -1
@@ -173,7 +173,8 @@ cifs_fattr_to_inode(struct inode *inode,if (fattr->cf_flags &CIFS_FATTR_DFS_REFERRAL ) inode->i_flags |=S_AUTOMOUNT ; -cifs_set_ops (inode); +if (inode->i_state &I_NEW ) +cifs_set_ops (inode); }void
PATCH 22/94 hp_accel: Ignore the error from lis3lv02d_poweron() at resume
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit 7783819920ca52fc582a2782f654fe6ed373f465 upstream.
The error in lis3lv02_poweron() is harmless in the resume path, so we should ignore it. It is inline with the other usages of lis3lv02_poweron() and matches the 3.0 code for this routine. This patch is in suse git and might have missed making it into the mainline.
opensuse - commit id: 66ccdac87c322cf7af12bddba8c805af640b1cff
--- drivers/platform/x86/hp_accel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/platform/x86/hp_accel.c +2 -1
@@ -362,7 +362,8 @@ static int lis3lv02d_suspend(struct acpistatic int lis3lv02d_resume (struct acpi_device *device) { -return lis3lv02d_poweron (&lis3_dev); +lis3lv02d_poweron (&lis3_dev); +return 0 ; }#else #define lis3lv02d_suspend NULL
PATCH 23/94 KVM: VMX: fix halt emulation while emulating invalid guest sate
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gleb Natapov <[email protected]>
commit 8d76c49e9ffeee839bc0b7a3278a23f99101263e upstream.
The invalid guest state emulation loop does not check halt_request which causes 100% cpu loop while guest is in halt and in invalid state, but more serious issue is that this leaves halt_request set, so random instruction emulated by vm86 #GP exit can be interpreted as halt which causes guest hang. Fix both problems by handling halt_request in emulation loop.
--- arch/x86/kvm/vmx.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/kvm/vmx.c +6 -0
@@ -4882,6 +4882,12 @@ static int handle_invalid_guest_state(stif (err !=EMULATE_DONE )return 0 ; +if (vcpu->arch.halt_request) { + vcpu->arch.halt_request =0 ; + ret =kvm_emulate_halt (vcpu); + goto out; + } +if (signal_pending (current)) goto out;if (need_resched ())
PATCH 24/94 dm snapshot: fix error return code in snapshot_ctr
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 09e8b813897a0f85bb401435d009228644c81214 upstream.
Return -ENOMEM instead of success if unable to allocate pending exception mempool in snapshot_ctr.
--- drivers/md/dm-snap.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-snap.c +1 -0
@@ -1117,6 +1117,7 @@ static int snapshot_ctr(struct dm_target s->pending_pool =mempool_create_slab_pool (MIN_IOS , pending_cache);if (!s->pending_pool) { ti->error ="Could not allocate mempool for pending exceptions" ; + r = -ENOMEM ; goto bad_pending_pool; }
PATCH 25/94 dm bufio: avoid a possible __vmalloc deadlock
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 502624bdad3dba45dfaacaf36b7d83e39e74b2d2 upstream.
This patch uses memalloc_noio_save to avoid a possible deadlock in dm-bufio. (it could happen only with large block size, at most PAGE_SIZE << MAX_ORDER (typically 8MiB).
__vmalloc doesn't fully respect gfp flags. The specified gfp flags are used for allocation of requested pages, structures vmap_area, vmap_block and vm_struct and the radix tree nodes.
However, the kernel pagetables are allocated always with GFP_KERNEL. Thus the allocation of pagetables can recurse back to the I/O layer and cause a deadlock.
This patch uses the function memalloc_noio_save to set per-process PF_MEMALLOC_NOIO flag and the function memalloc_noio_restore to restore it. When this flag is set, all allocations in the process are done with implied GFP_NOIO flag, thus the deadlock can't happen.
This should be backported to stable kernels, but they don't have the PF_MEMALLOC_NOIO flag and memalloc_noio_save/memalloc_noio_restore functions. So, PF_MEMALLOC should be set and restored instead.
--- drivers/md/dm-bufio.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/md/dm-bufio.c +25 -1
@@ -322,6 +322,9 @@ static void __cache_size_refresh(void)static void *alloc_buffer_data (struct dm_bufio_client *c,gfp_t gfp_mask,enum data_mode *data_mode) { +unsigned noio_flag; +void *ptr; +if (c->block_size <=DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT ) { *data_mode =DATA_MODE_SLAB ;return kmem_cache_alloc (DM_BUFIO_CACHE (c), gfp_mask);
@@ -335,7 +338,28 @@ static void *alloc_buffer_data(struct dm } *data_mode =DATA_MODE_VMALLOC ; -return __vmalloc (c->block_size, gfp_mask,PAGE_KERNEL ); + +/* +* __vmalloc allocates the data pages and auxiliary structures with +* gfp_flags that were specified, but pagetables are always allocated +* with GFP_KERNEL, no matter what was specified as gfp_mask. +* +* Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that +* all allocations done by this process (including pagetables) are done +* as if GFP_NOIO was specified. +*/ + +if (gfp_mask & __GFP_NORETRY) { + noio_flag = current->flags &PF_MEMALLOC ; + current->flags |=PF_MEMALLOC ; + } + + ptr =__vmalloc (c->block_size, gfp_mask,PAGE_KERNEL ); + +if (gfp_mask & __GFP_NORETRY) + current->flags = (current->flags & ~PF_MEMALLOC ) | noio_flag; + +return ptr; }/*
PATCH 26/94 tick: Cleanup NOHZ per cpu data on cpu down
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 4b0c0f294f60abcdd20994a8341a95c8ac5eeb96 upstream.
Prarit reported a crash on CPU offline/online. The reason is that on CPU down the NOHZ related per cpu data of the dead cpu is not cleaned up. If at cpu online an interrupt happens before the per cpu tick device is registered the irq_enter() check potentially sees stale data and dereferences a NULL pointer.
Cleanup the data after the cpu is dead.
--- kernel/time/tick-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/tick-sched.c +1 -1
@@ -833,7 +833,7 @@ void tick_cancel_sched_timer(int cpu)hrtimer_cancel (&ts->sched_timer);# endif - ts->nohz_mode = NOHZ_MODE_INACTIVE; + memset(ts, 0, sizeof(*ts)); }#endif
PATCH 27/94 ACPI / EC: Restart transaction even when the IBF flag set
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit 28fe5c825f8e15744d04c7c1b8df197950923ecd upstream.
The EC driver works abnormally with IBF flag always set. IBF means "The host has written a byte of data to the command or data port, but the embedded controller has not yet read it". If IBF is set in the EC status and not cleared, this will cause all subsequent EC requests to fail with a timeout error.
Change the EC driver so that it doesn't refuse to restart a transaction if IBF is set in the status. Also increase the number of transaction restarts to 5, as it turns out that 2 is not sufficient in some cases.
This bug happens on several different machines (Asus V1S, Dell Latitude E6530, Samsung R719, Acer Aspire 5930G, Sony Vaio SR19VN and others).
[rjw: Changelog]
References: https://bugzilla.kernel.org/show_bug.cgi?id=14733
References: https://bugzilla.kernel.org/show_bug.cgi?id=15560
References: https://bugzilla.kernel.org/show_bug.cgi?id=15946
References: https://bugzilla.kernel.org/show_bug.cgi?id=42945
References: https://bugzilla.kernel.org/show_bug.cgi?id=48221
--- drivers/acpi/ec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/acpi/ec.c +1 -3
@@ -217,7 +217,7 @@ static int ec_check_sci_sync(struct acpistatic int ec_poll (struct acpi_ec *ec) {unsigned long flags; -int repeat =2 ;/* number of command restarts */ +int repeat =5 ;/* number of command restarts */ while (repeat--) {unsigned long delay = jiffies +msecs_to_jiffies (ec_delay);
@@ -235,8 +235,6 @@ static int ec_poll(struct acpi_ec *ec) }advance_transaction (ec,acpi_ec_read_status (ec)); }while (time_before (jiffies, delay)); -if (acpi_ec_read_status (ec) &ACPI_EC_FLAG_IBF ) -break ;pr_debug (PREFIX "controller reset, restart transaction\n" );spin_lock_irqsave (&ec->curr_lock, flags);start_transaction (ec);
PATCH 28/94 drm/radeon: check incoming cliprects pointer
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
commit fefaedcfb82d2e57c2320acf60604ab03b750cc0 upstream.
The "boxes" parameter points into userspace memory. It should be verified like any other operation against user memory.
--- drivers/gpu/drm/radeon/r300_cmdbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/r300_cmdbuf.c +1 -1
@@ -74,7 +74,7 @@ static int r300_emit_cliprects(drm_radeoOUT_RING (CP_PACKET0 (R300_RE_CLIPRECT_TL_0 , nr *2 -1 ));for (i =0 ; i < nr; ++i) { -if (DRM_COPY_FROM_USER_UNCHECKED +if (DRM_COPY_FROM_USER (&box, &cmdbuf->boxes[n + i],sizeof (box))) {DRM_ERROR ("copy cliprect faulted\n" );return -EFAULT ;
PATCH 29/94 staging: vt6656: use free_netdev instead of kfree
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hema Prathaban <[email protected]>
commit 0a438d5b381e2bdfd5e02d653bf46fcc878356e3 upstream.
use free_netdev() instead of kfree(pDevice->apdev)
--- drivers/staging/vt6656/hostap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/hostap.c +1 -1
@@ -153,7 +153,7 @@ static int hostap_disable_hostapd(PSDeviDBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "%s: Netdevice %s unregistered\n" , pDevice->dev->name, pDevice->apdev->name); } -kfree (pDevice->apdev); +free_netdev (pDevice->apdev); pDevice->apdev =NULL ; pDevice->bEnable8021x = FALSE; pDevice->bEnableHostWEP = FALSE;
PATCH 30/94 hwmon: fix error return code in abituguru_probe()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit ecacb0b17c08fae89f65468727f0e4b8e91da4e1 upstream.
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/hwmon/abituguru.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/hwmon/abituguru.c +10 -6
@@ -1280,14 +1280,18 @@ static int __devinit abituguru_probe(strpr_info ("found Abit uGuru\n" );/* Register sysfs hooks */ -for (i =0 ; i < sysfs_attr_i; i++) -if (device_create_file (&pdev->dev, - &data->sysfs_attr[i].dev_attr)) +for (i =0 ; i < sysfs_attr_i; i++) { + res =device_create_file (&pdev->dev, + &data->sysfs_attr[i].dev_attr); +if (res) goto abituguru_probe_error; -for (i =0 ; i <ARRAY_SIZE (abituguru_sysfs_attr); i++) -if (device_create_file (&pdev->dev, - &abituguru_sysfs_attr[i].dev_attr)) + } +for (i =0 ; i <ARRAY_SIZE (abituguru_sysfs_attr); i++) { + res =device_create_file (&pdev->dev, + &abituguru_sysfs_attr[i].dev_attr); +if (res) goto abituguru_probe_error; + } data->hwmon_dev =hwmon_device_register (&pdev->dev);if (!IS_ERR (data->hwmon_dev))
PATCH 31/94 Kirkwood: Enable PCIe port 1 on QNAP TS-11x/TS-21x
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Martin Michlmayr <[email protected]>
commit 99e11334dcb846f9b76fb808196c7f47aa83abb3 upstream.
Enable KW_PCIE1 on QNAP TS-11x/TS-21x devices as newer revisions (rev 1.3) have a USB 3.0 chip from Etron on PCIe port 1. Thanks to Marek Vasut for identifying this issue!
--- arch/arm/mach-kirkwood/ts219-setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-kirkwood/ts219-setup.c +1 -1
@@ -124,7 +124,7 @@ static void __init qnap_ts219_init(void)static int __init ts219_pci_init (void ) {if (machine_is_ts219 ()) -kirkwood_pcie_init (KW_PCIE0 ); +kirkwood_pcie_init (KW_PCIE1 |KW_PCIE0 );return 0 ; }
PATCH 32/94 avr32: fix relocation check for signed 18-bit offset
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans-Christian Egtvedt <[email protected]>
commit e68c636d88db3fda74e664ecb1a213ae0d50a7d8 upstream.
Caught by static code analysis by David.
--- arch/avr32/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/avr32/kernel/module.c +1 -1
@@ -264,7 +264,7 @@ int apply_relocate_add(Elf32_Shdr *sechdbreak ;case R_AVR32_GOT18SW :if ((relocation &0xfffe0003 ) !=0 - && (relocation &0xfffc0003 ) !=0xffff0000 ) + && (relocation &0xfffc0000 ) !=0xfffc0000 )return reloc_overflow (module,"R_AVR32_GOT18SW" , relocation); relocation >>=2 ;
PATCH 33/94 powerpc/pseries: Fix partition migration hang in stop_topology_update
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Brian King <[email protected]>
commit 444080d13d05dc38d07dd3bf751d38bce7ab7c72 upstream.
This fixes a hang that was observed during live partition migration. Since stop_topology_update must not be called from an interrupt context, call it earlier in the migration process. The hang observed can be seen below:
WARNING: at kernel/timer.c:1011 Modules linked in: ip6t_LOG xt_tcpudp xt_pkttype ipt_LOG xt_limit ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_raw xt_NOTRACK ipt_REJECT xt_state iptable_raw iptable_filter ip6table_mangle nf_conntrack_netbios_ns nf_conntrack_broadcast nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 ip_tables ip6table_filter ip6_tables x_tables ipv6 fuse loop ibmveth sg ext3 jbd mbcache raid456 async_raid6_recov async_pq raid6_pq async_xor xor async_memcpy async_tx raid10 raid1 raid0 scsi_dh_alua scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc dm_round_robin dm_multipath scsi_dh sd_mod crc_t10dif ibmvfc scsi_transport_fc scsi_tgt scsi_mod dm_snapshot dm_mod NIP: c0000000000c52d8 LR: c00000000004be28 CTR: 0000000000000000 REGS: c00000005ffd77d0 TRAP: 0700 Not tainted (3.2.0-git-00001-g07d106d) MSR: 8000000000021032 <ME,CE,IR,DR> CR: 48000084 XER: 00000001
CFAR: c00000000004be20
TASK = c00000005ec78860[0] 'swapper/3' THREAD: c00000005ec98000 CPU: 3
GPR00: 0000000000000001 c00000005ffd7a50 c000000000fbbc98 c000000000ec8340
GPR04: 00000000282a0020 0000000000000000 0000000000004000 0000000000000101
GPR08: 0000000000000012 c00000005ffd4000 0000000000000020 c000000000f3ba88
GPR12: 0000000000000000 c000000007f40900 0000000000000001 0000000000000004
GPR16: 0000000000000001 0000000000000000 0000000000000000 c000000001022310
GPR20: 0000000000000001 0000000000000000 0000000000200200 c000000001029e14
GPR24: 0000000000000000 0000000000000001 0000000000000040 c00000003f74bc80
GPR28: c00000003f74bc84 c000000000f38038 c000000000f16b58 c000000000ec8340 NIP [c0000000000c52d8] .del_timer_sync+0x28/0x60
LR [c00000000004be28] .stop_topology_update+0x20/0x38
Call Trace:
[c00000005ffd7a50] [c00000005ec78860] 0xc00000005ec78860 (unreliable) [c00000005ffd7ad0] [c00000000004be28] .stop_topology_update+0x20/0x38 [c00000005ffd7b40] [c000000000028378] .__rtas_suspend_last_cpu+0x58/0x260 [c00000005ffd7bf0] [c0000000000fa230] .generic_smp_call_function_interrupt+0x160/0x358 [c00000005ffd7cf0] [c000000000036ec8] .smp_ipi_demux+0x88/0x100 [c00000005ffd7d80] [c00000000005c154] .icp_hv_ipi_action+0x5c/0x80 [c00000005ffd7e00] [c00000000012a088] .handle_irq_event_percpu+0x100/0x318 [c00000005ffd7f00] [c00000000012e774] .handle_percpu_irq+0x84/0xd0 [c00000005ffd7f90] [c000000000022ba8] .call_handle_irq+0x1c/0x2c [c00000005ec9ba20] [c00000000001157c] .do_IRQ+0x22c/0x2a8 [c00000005ec9bae0] [c0000000000054bc] hardware_interrupt_entry+0x18/0x1c
Exception: 501 at .cpu_idle+0x194/0x2f8
LR = .cpu_idle+0x194/0x2f8
[c00000005ec9bdd0] [c000000000017e58] .cpu_idle+0x188/0x2f8 (unreliable) [c00000005ec9be90] [c00000000067ec18] .start_secondary+0x3e4/0x524 [c00000005ec9bf90] [c0000000000093e8] .start_secondary_prolog+0x10/0x14 Instruction dump:ebe1fff8 4e800020 fbe1fff8 7c0802a6 f8010010 7c7f1b78 f821ff81 78290464 80090014 5400019e 7c0000d0 78000fe0 <0b000000> 4800000c 7c210b78 7c421378
--- arch/powerpc/kernel/rtas.c | 5 +++-- arch/powerpc/platforms/pseries/suspend.c | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-)
arch/powerpc/kernel/rtas.c +3 -2
@@ -716,7 +716,6 @@ static int __rtas_suspend_last_cpu(strucint cpu;slb_set_size (SLB_MIN_SIZE ); -stop_topology_update ();printk (KERN_DEBUG "calling ibm,suspend-me on cpu %i\n" ,smp_processor_id ()); while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) &&
@@ -732,7 +731,6 @@ static int __rtas_suspend_last_cpu(struc rc =atomic_read (&data->error);atomic_set (&data->error, rc); -start_topology_update ();pSeries_coalesce_init ();if (wake_when_done) {
@@ -846,6 +844,7 @@ int rtas_ibm_suspend_me(struct rtas_argsatomic_set (&data.error,0 ); data.token =rtas_token ("ibm,suspend-me" ); data.complete = &done; +stop_topology_update ();/* Call function on all CPUs. One of us will make the * rtas call
@@ -858,6 +857,8 @@ int rtas_ibm_suspend_me(struct rtas_argsif (atomic_read (&data.error) !=0 )printk (KERN_ERR "Error doing global join\n" ); +start_topology_update (); + return atomic_read(&data.error); }#else /* CONFIG_PPC_PSERIES */
arch/powerpc/platforms/pseries/suspend.c +5 -1
@@ -24,6 +24,7 @@#include <asm/machdep.h> #include <asm/mmu.h> #include <asm/rtas.h> +#include <asm/topology.h> static u64 stream_id;static struct sys_device suspend_sysdev;
@@ -138,8 +139,11 @@ static ssize_t store_hibernate(struct syssleep (1 ); }while (rc == -EAGAIN ); -if (!rc) +if (!rc) { +stop_topology_update (); rc =pm_suspend (PM_SUSPEND_MEM ); +start_topology_update (); + } stream_id =0 ;
PATCH 34/94 powerpc: Bring all threads online prior to migration/hibernation
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Robert Jennings <[email protected]>
commit 120496ac2d2d60aee68d3123a68169502a85f4b5 upstream.
This patch brings online all threads which are present but not online prior to migration/hibernation. After migration/hibernation those threads are taken back offline.
During migration/hibernation all online CPUs must call H_JOIN, this is required by the hypervisor. Without this patch, threads that are offline (H_CEDE'd) will not be woken to make the H_JOIN call and the OS will be deadlocked (all threads either JOIN'd or CEDE'd).
--- arch/powerpc/include/asm/rtas.h | 2 + arch/powerpc/kernel/rtas.c | 113 ++++++++++++++++++++++++++++++ arch/powerpc/platforms/pseries/suspend.c | 22 ++++++ 3 files changed, 137 insertions(+)
arch/powerpc/include/asm/rtas.h +2 -0
@@ -230,6 +230,8 @@ extern void rtas_progress(char *s, unsigextern void rtas_initialize (void );extern int rtas_suspend_cpu (struct rtas_suspend_me_data *data);extern int rtas_suspend_last_cpu (struct rtas_suspend_me_data *data); +extern int rtas_online_cpus_mask (cpumask_var_t cpus); +extern int rtas_offline_cpus_mask (cpumask_var_t cpus);extern int rtas_ibm_suspend_me (struct rtas_args *);struct rtc_time ;
arch/powerpc/kernel/rtas.c +113 -0
148 lines not on this page · raw message
arch/powerpc/platforms/pseries/suspend.c +22 -0
@@ -16,6 +16,7 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <linux/cpu.h> #include <linux/delay.h> #include <linux/suspend.h> #include <linux/stat.h>
@@ -126,11 +127,15 @@ static ssize_t store_hibernate(struct systruct sysdev_class_attribute *attr, const char *buf, size_t count) { + cpumask_var_t offline_mask;int rc;if (!capable (CAP_SYS_ADMIN ))return -EPERM ; +if (!alloc_cpumask_var (&offline_mask,GFP_TEMPORARY )) +return -ENOMEM ; + stream_id =simple_strtoul (buf,NULL ,16 ); do {
@@ -140,15 +145,32 @@ static ssize_t store_hibernate(struct sy }while (rc == -EAGAIN );if (!rc) { +/* All present CPUs must be online */ +cpumask_andnot (offline_mask, cpu_present_mask, + cpu_online_mask); + rc =rtas_online_cpus_mask (offline_mask); +if (rc) { +pr_err ("%s: Could not bring present CPUs online.\n" , + __func__); + goto out; + } +stop_topology_update (); rc =pm_suspend (PM_SUSPEND_MEM );start_topology_update (); + +/* Take down CPUs not online prior to suspend */ +if (!rtas_offline_cpus_mask (offline_mask)) +pr_warn ("%s: Could not restore CPUs to offline " +"state.\n" , __func__); } stream_id =0 ;if (!rc) rc = count; +out: +free_cpumask_var (offline_mask);return rc; }
PATCH 35/94 timer: Don't reinitialize the cpu base lock during CPU_UP_PREPARE
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tirupathi Reddy <[email protected]>
commit 42a5cf46cd56f46267d2a9fcf2655f4078cd3042 upstream.
An inactive timer's base can refer to a offline cpu's base.
In the current code, cpu_base's lock is blindly reinitialized each time a CPU is brought up. If a CPU is brought online during the period that another thread is trying to modify an inactive timer on that CPU with holding its timer base lock, then the lock will be reinitialized under its feet. This leads to following SPIN_BUG().
<0> BUG: spinlock already unlocked on CPU#3, kworker/u:3/1466
<0> lock: 0xe3ebe000, .magic: dead4ead, .owner: kworker/u:3/1466, .owner_cpu: 1
<4> [<c0013dc4>] (unwind_backtrace+0x0/0x11c) from [<c026e794>] (do_raw_spin_unlock+0x40/0xcc) <4> [<c026e794>] (do_raw_spin_unlock+0x40/0xcc) from [<c076c160>] (_raw_spin_unlock+0x8/0x30) <4> [<c076c160>] (_raw_spin_unlock+0x8/0x30) from [<c009b858>] (mod_timer+0x294/0x310) <4> [<c009b858>] (mod_timer+0x294/0x310) from [<c00a5e04>] (queue_delayed_work_on+0x104/0x120) <4> [<c00a5e04>] (queue_delayed_work_on+0x104/0x120) from [<c04eae00>] (sdhci_msm_bus_voting+0x88/0x9c) <4> [<c04eae00>] (sdhci_msm_bus_voting+0x88/0x9c) from [<c04d8780>] (sdhci_disable+0x40/0x48) <4> [<c04d8780>] (sdhci_disable+0x40/0x48) from [<c04bf300>] (mmc_release_host+0x4c/0xb0) <4> [<c04bf300>] (mmc_release_host+0x4c/0xb0) from [<c04c7aac>] (mmc_sd_detect+0x90/0xfc) <4> [<c04c7aac>] (mmc_sd_detect+0x90/0xfc) from [<c04c2504>] (mmc_rescan+0x7c/0x2c4) <4> [<c04c2504>] (mmc_rescan+0x7c/0x2c4) from [<c00a6a7c>] (process_one_work+0x27c/0x484) <4> [<c00a6a7c>] (process_one_work+0x27c/0x484) from [<c00a6e94>] (worker_thread+0x210/0x3b0) <4> [<c00a6e94>] (worker_thread+0x210/0x3b0) from [<c00aad9c>] (kthread+0x80/0x8c)
<4> [<c00aad9c>] (kthread+0x80/0x8c) from [<c000ea80>] (kernel_thread_exit+0x0/0x8)
As an example, this particular crash occurred when CPU #3 is executing mod_timer() on an inactive timer whose base is refered to offlined CPU #2. The code locked the timer_base corresponding to CPU #2. Before it could proceed, CPU #2 came online and reinitialized the spinlock corresponding to its base. Thus now CPU #3 held a lock which was reinitialized. When CPU #3 finally ended up unlocking the old cpu_base corresponding to CPU #2, we hit the above SPIN_BUG().
CPU #0 CPU #3 CPU #2
------ ------- -------
..... ...... <Offline>
mod_timer() lock_timer_base spin_lock_irqsave(&base->lock)
cpu_up(2) ..... ......
init_timers_cpu()
.... ..... spin_lock_init(&base->lock)
..... spin_unlock_irqrestore(&base->lock) ......
<spin_bug>
Allocation of per_cpu timer vector bases is done only once under "tvec_base_done[]" check. In the current code, spinlock_initialization of base->lock isn't under this check. When a CPU is up each time the base lock is reinitialized. Move base spinlock initialization under the check.
--- kernel/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/timer.c +1 -1
@@ -1630,12 +1630,12 @@ static int __cpuinit init_timers_cpu(int boot_done =1 ; base = &boot_tvec_bases; } +spin_lock_init (&base->lock); tvec_base_done[cpu] =1 ; }else { base =per_cpu (tvec_bases, cpu); } -spin_lock_init (&base->lock);for (j =0 ; j <TVN_SIZE ; j++) {INIT_LIST_HEAD (base->tv5.vec + j);
PATCH 36/94 tg3: Skip powering down function 0 on certain serdes devices
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nithin Sujir <[email protected]>
commit 44f3b503c16425c8e9db4bbaa2fc9cd0c9d0ba91 upstream.
On the 5718, 5719 and 5720 serdes devices, powering down function 0 results in all the other ports being powered down. Add code to skip function 0 power down.
v2:
- Modify tg3_phy_power_bug() function to use a switch instead of a complicated if statement. Suggested by Joe Perches.
[bwh: Backported to 3.2:
s/tg3_asic_rev\(tp\)/GET_ASIC_REV(tp->pci_chip_rev_id)/]
--- drivers/net/ethernet/broadcom/tg3.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +26 -6
@@ -2752,6 +2752,31 @@ static int tg3_5700_link_polarity(structstatic int tg3_setup_phy (struct tg3 *,int );static int tg3_halt_cpu (struct tg3 *,u32 ); +static bool tg3_phy_power_bug (struct tg3 *tp) +{ +switch (GET_ASIC_REV (tp->pci_chip_rev_id)) { +case ASIC_REV_5700 : +case ASIC_REV_5704 : +return true; +case ASIC_REV_5780 : +if (tp->phy_flags &TG3_PHYFLG_MII_SERDES ) +return true; +return false; +case ASIC_REV_5717 : +if (!tp->pci_fn) +return true; +return false; +case ASIC_REV_5719 : +case ASIC_REV_5720 : +if ((tp->phy_flags &TG3_PHYFLG_PHY_SERDES ) && + !tp->pci_fn) +return true; +return false; + } + +return false; +} +static void tg3_power_down_phy (struct tg3 *tp,bool do_low_power) {u32 val;
@@ -2808,12 +2833,7 @@ static void tg3_power_down_phy(struct tg/* The PHY should not be powered down on some chips because * of bugs. */ -if (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5700 || -GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5704 || - (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5780 && - (tp->phy_flags &TG3_PHYFLG_MII_SERDES )) || - (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5717 && - !tp->pci_fn)) +if (tg3_phy_power_bug (tp))return ; if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX ||
PATCH 37/94 USB: xHCI: override bogus bulk wMaxPacketSize values
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit e4f47e3675e6f1f40906b785b934ce963e9f2eb3 upstream.
This patch shortens the logic in xhci_endpoint_init() by moving common calculations involving max_packet and max_burst outside the switch statement, rather than repeating the same code in multiple case-specific statements. It also replaces two usages of max_packet which were clearly intended to be max_burst all along.
More importantly, it compensates for a common bug in high-speed bulk endpoint descriptors. In many devices there is a bulk endpoint having a wMaxPacketSize value smaller than 512, which is forbidden by the USB spec. Some xHCI controllers can't handle this and refuse to accept the endpoint. This patch changes the max_packet value to 512, which allows the controller to use the endpoint properly.
In practice the bogus maxpacket size doesn't matter, because none of the transfers sent via these endpoints are longer than the maxpacket value anyway.
--- drivers/usb/host/xhci-mem.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/usb/host/xhci-mem.c +9 -8
@@ -1353,15 +1353,17 @@ int xhci_endpoint_init(struct xhci_hcd * ep_ctx->ep_info2 |=cpu_to_le32 (xhci_get_endpoint_type (udev, ep));/* Set the max packet size and max burst */ + max_packet =GET_MAX_PACKET (usb_endpoint_maxp (&ep->desc)); + max_burst =0 ;switch (udev->speed) {case USB_SPEED_SUPER : - max_packet =usb_endpoint_maxp (&ep->desc); - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet));/* dig out max burst from ep companion desc */ - max_packet = ep->ss_ep_comp.bMaxBurst; - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_BURST (max_packet)); + max_burst = ep->ss_ep_comp.bMaxBurst;break ;case USB_SPEED_HIGH : +/* Some devices get this wrong */ +if (usb_endpoint_xfer_bulk (&ep->desc)) + max_packet =512 ;/* bits 11:12 specify the number of additional transaction * opportunities per microframe (USB 2.0, section 9.6.6) */
@@ -1369,17 +1371,16 @@ int xhci_endpoint_init(struct xhci_hcd * usb_endpoint_xfer_int(&ep->desc)) { max_burst = (usb_endpoint_maxp (&ep->desc) &0x1800 ) >>11 ; - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_BURST (max_burst)); } -/* Fall through */ +break ;case USB_SPEED_FULL :case USB_SPEED_LOW : - max_packet =GET_MAX_PACKET (usb_endpoint_maxp (&ep->desc)); - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet));break ;default :BUG (); } + ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet) | +MAX_BURST (max_burst)); max_esit_payload =xhci_get_max_esit_payload (xhci, udev, ep); ep_ctx->tx_info =cpu_to_le32 (MAX_ESIT_PAYLOAD_FOR_EP (max_esit_payload));
PATCH 38/94 USB: UHCI: fix for suspend of virtual HP controller
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 997ff893603c6455da4c5e26ba1d0f81adfecdfc upstream.
HP's virtual UHCI host controller takes a long time to suspend (several hundred microseconds), even when no devices are attached. This provokes a warning message from uhci-hcd in the auto-stop case.
To prevent this from happening, this patch adds a test to avoid performing an auto-stop when the wait_for_hp quirk flag is set. The controller will still suspend through the normal runtime PM mechanism. And since that pathway includes a 1-ms delay, the slowness of the virtual hardware won't matter.
--- drivers/usb/host/uhci-hub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/uhci-hub.c +2 -1
@@ -221,7 +221,8 @@ static int uhci_hub_status_data(struct u/* auto-stop if nothing connected for 1 second */ if (any_ports_active (uhci)) uhci->rh_state =UHCI_RH_RUNNING ; -else if (time_after_eq (jiffies, uhci->auto_stop_time)) +else if (time_after_eq (jiffies, uhci->auto_stop_time) && + !uhci->wait_for_hp)suspend_rh (uhci,UHCI_RH_AUTO_STOPPED );break ;
PATCH 39/94 tracing: Fix leaks of filter preds
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 60705c89460fdc7227f2d153b68b3f34814738a4 upstream.
Special preds are created when folding a series of preds that can be done in serial. These are allocated in an ops field of the pred structure. But they were never freed, causing memory leaks.
This was discovered using the kmemleak checker:
unreferenced object 0xffff8800797fd5e0 (size 32):
comm "swapper/0", pid 1, jiffies 4294690605 (age 104.608s) hex dump (first 32 bytes):
00 00 01 00 03 00 05 00 07 00 09 00 0b 00 0d 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff814b52af>] kmemleak_alloc+0x73/0x98
[<ffffffff8111ff84>] kmemleak_alloc_recursive.constprop.42+0x16/0x18
[<ffffffff81120e68>] __kmalloc+0xd7/0x125
[<ffffffff810d47eb>] kcalloc.constprop.24+0x2d/0x2f
[<ffffffff810d4896>] fold_pred_tree_cb+0xa9/0xf4
[<ffffffff810d3781>] walk_pred_tree+0x47/0xcc
[<ffffffff810d5030>] replace_preds.isra.20+0x6f8/0x72f
[<ffffffff810d50b5>] create_filter+0x4e/0x8b
[<ffffffff81b1c30d>] ftrace_test_event_filter+0x5a/0x155
[<ffffffff8100028d>] do_one_initcall+0xa0/0x137
[<ffffffff81afbedf>] kernel_init_freeable+0x14d/0x1dc
[<ffffffff814b24b7>] kernel_init+0xe/0xdb
[<ffffffff814d539c>] ret_from_fork+0x7c/0xb0
[<ffffffffffffffff>] 0xffffffffffffffff--- kernel/trace/trace_events_filter.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_events_filter.c +4 -0
@@ -769,7 +769,11 @@ static int filter_set_pred(struct event_static void __free_preds (struct event_filter *filter) { +int i; +if (filter->preds) { +for (i =0 ; i < filter->n_preds; i++) +kfree (filter->preds[i].ops);kfree (filter->preds); filter->preds =NULL ; }
PATCH 40/94 usermodehelper: check subprocess_info->path != NULL
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 264b83c07a84223f0efd0d1db9ccc66d6f88288f upstream.
argv_split(empty_or_all_spaces) happily succeeds, it simply returns argc == 0 and argv[0] == NULL. Change call_usermodehelper_exec() to check sub_info->path != NULL to avoid the crash.
This is the minimal fix, todo:
- perhaps we should change argv_split() to return NULL or change the callers.
- kill or justify ->path[0] check
- narrow the scope of helper_lock()
--- kernel/kmod.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/kmod.c +5 -0
@@ -467,6 +467,11 @@ int call_usermodehelper_exec(struct subpint retval =0 ;helper_lock (); +if (!sub_info->path) { + retval = -EINVAL ; + goto out; + } +if (sub_info->path[0 ] =='\0' ) goto out;
PATCH 41/94 drivers/char/ipmi: memcpy, need additional 2 bytes to avoid memory overflow
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Chen Gang <[email protected]>
commit a5f2b3d6a738e7d4180012fe7b541172f8c8dcea upstream.
When calling memcpy, read_data and write_data need additional 2 bytes.
write_data:
for checking: "if (size > IPMI_MAX_MSG_LENGTH)"
for operating: "memcpy(bt->write_data + 3, data + 1, size - 1)"
read_data:
for checking: "if (msg_len < 3 || msg_len > IPMI_MAX_MSG_LENGTH)"
for operating: "memcpy(data + 2, bt->read_data + 4, msg_len - 2)"--- drivers/char/ipmi/ipmi_bt_sm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_bt_sm.c +2 -2
@@ -95,9 +95,9 @@ struct si_sm_data {enum bt_states state;unsigned char seq;/* BT sequence number */ struct si_sm_io *io; -unsigned char write_data[IPMI_MAX_MSG_LENGTH ]; +unsigned char write_data[IPMI_MAX_MSG_LENGTH +2 ];/* +2 for memcpy */ int write_count; -unsigned char read_data[IPMI_MAX_MSG_LENGTH ]; +unsigned char read_data[IPMI_MAX_MSG_LENGTH +2 ];/* +2 for memcpy */ int read_count;int truncated;long timeout;/* microseconds countdown */
PATCH 42/94 ipmi: ipmi_devintf: compat_ioctl method fails to take ipmi_mutex
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin LaHaise <[email protected]>
commit 6368087e851e697679af059b4247aca33a69cef3 upstream.
When a 32 bit version of ipmitool is used on a 64 bit kernel, the ipmi_devintf code fails to correctly acquire ipmi_mutex. This results in incomplete data being retrieved in some cases, or other possible failures. Add a wrapper around compat_ipmi_ioctl() to take ipmi_mutex to fix this.
--- drivers/char/ipmi/ipmi_devintf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/char/ipmi/ipmi_devintf.c +13 -1
@@ -838,13 +838,25 @@ static long compat_ipmi_ioctl(struct fil return ipmi_ioctl(filep, cmd, arg); } } + +static long unlocked_compat_ipmi_ioctl (struct file *filep,unsigned int cmd, +unsigned long arg) +{ +int ret; + +mutex_lock (&ipmi_mutex); + ret =compat_ipmi_ioctl (filep, cmd, arg); +mutex_unlock (&ipmi_mutex); + +return ret; +}#endif static const struct file_operations ipmi_fops = { .owner =THIS_MODULE , .unlocked_ioctl = ipmi_unlocked_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = compat_ipmi_ioctl, + .compat_ioctl = unlocked_compat_ipmi_ioctl, #endif .open = ipmi_open, .release = ipmi_release,
PATCH 43/94 USB: reset resume quirk needed by a hub
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit bac6b03275184c912ad0818c9a0a736847804dca upstream.
Werner Fink has reported problems with this hub.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -88,6 +88,9 @@ static const struct usb_device_id usb_qu/* Edirol SD-20 */ { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Alcor Micro Corp. Hub */ + { USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME }, + /* appletouch */ { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
PATCH 44/94 usb: option: Add Telewell TW-LTE 4G
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Teppo Kotilainen <[email protected]>
commit 73c042df6e1bc50544842a04b777b36bbe3630e6 upstream.
Information from driver description files:
diag: VID_19D2&PID_0412&MI_00 nmea: VID_19D2&PID_0412&MI_01 at: VID_19D2&PID_0412&MI_02
modem: VID_19D2&PID_0412&MI_03
net: VID_19D2&PID_0412&MI_04
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -966,6 +966,8 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
PATCH 45/94 USB: Blacklisted Cinterion's PLxx WWAN Interface
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Schemmel Hans-Christoph <[email protected]>
commit 8ff10bdb14a52e3f25d4ce09e0582a8684c1a6db upstream.
/drivers/usb/serial/option.c: Blacklisted Cinterion's PLxx WWAN Interface (USB Interface 4), because it will be handled by QMI WWAN driver. Product IDs renamed.
--- drivers/usb/serial/option.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/usb/serial/option.c +5 -4
@@ -341,8 +341,8 @@ static void option_instat_callback(struc#define CINTERION_PRODUCT_EU3_E 0x0051#define CINTERION_PRODUCT_EU3_P 0x0052#define CINTERION_PRODUCT_PH8 0x0053 -#define CINTERION_PRODUCT_AH6 0x0055 -#define CINTERION_PRODUCT_PLS8 0x0060 +#define CINTERION_PRODUCT_AHXX 0x0055 +#define CINTERION_PRODUCT_PLXX 0x0060/* Olivetti products */ #define OLIVETTI_VENDOR_ID 0x0b3c
@@ -1266,8 +1266,9 @@ static const struct usb_device_id option { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
PATCH 46/94 USB: option: add device IDs for Dell 5804 (Novatel E371) WWAN card
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 49c6e370dd6400b84897c4100095089b5c13a061 upstream.
A rebranded Novatel E371 for AT&T's LTE bands.
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -196,6 +196,7 @@ static void option_instat_callback(struc#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195/* Novatel E362 */ #define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196/* Novatel E362 */ +#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b/* Novatel E371 */ #define KYOCERA_VENDOR_ID 0x0c88#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -771,6 +772,7 @@ static const struct usb_device_id option { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
PATCH 47/94 i2c: designware: always clear interrupts before enabling them
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mika Westerberg <[email protected]>
commit 2a2d95e9d6d29e726cc294b65391917ed2e32bf4 upstream.
If the I2C bus is put to a low power state by an ACPI method it might pull the SDA line low (as its power is removed). Once the bus is put to full power state again, the SDA line is pulled back to high. This transition looks like a STOP condition from the controller point-of-view which sets STOP detected bit in its status register causing the driver to fail subsequent transfers.
Fix this by always clearing all interrupts before we start a transfer.
--- drivers/i2c/busses/i2c-designware-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-core.c +2 -1
@@ -349,7 +349,8 @@ static void i2c_dw_xfer_init(struct dw_i/* Enable the adapter */ dw_writel (dev,1 ,DW_IC_ENABLE ); -/* Enable interrupts */ +/* Clear and enable interrupts */ +i2c_dw_clear_int (dev);dw_writel (dev,DW_IC_INTR_DEFAULT_MASK ,DW_IC_INTR_MASK ); }
PATCH 48/94 USB: ftdi_sio: Add support for Newport CONEX motor drivers
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Gomella, Andrew (NIH/NHLBI) [F]" <[email protected]>
commit 7138143972b7c293267c783fc99a194f0ceff7f2 upstream.
Here are two more devices that use FTDI USB-to-serial chips with new product ID's.
The devices are the Newport Conex-AGP and Conex-CC motor controllers.
(http://www.newport.com/CONEX-AGP-Integrated-Piezo-Motor-Rotation-Stages-/987623/1033/info.aspx)
(http://www.newport.com/CONEX-CC-DC-Servo-Controller-Actuators/934114/1033/info.aspx)
usb-devices command yields:
P: Vendor=104d ProdID=3002 Rev=06.00 S: Manufacturer=Newport S: Product=CONEX-CC
as well as
P: Vendor=104d ProdID=3006 Rev=06.00 S: Manufacturer=Newport S: Product=CONEX-AGP
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 2 ++ 2 files changed, 4 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -197,6 +197,8 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, + { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) }, + { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
drivers/usb/serial/ftdi_sio_ids.h +2 -0
@@ -772,6 +772,8 @@*/ #define NEWPORT_VID 0x104D#define NEWPORT_AGILIS_PID 0x3000 +#define NEWPORT_CONEX_CC_PID 0x3002 +#define NEWPORT_CONEX_AGP_PID 0x3006/* Interbiometrics USB I/O Board */ /* Developed for Interbiometrics by Rudolf Gugler */
PATCH 49/94 btrfs: don't stop searching after encountering the wrong item
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel de Perthuis <[email protected]>
commit 03b71c6ca6286625d8f1ed44aabab9b5bf5dac10 upstream.
The search ioctl skips items that are too large for a result buffer, but inline items of a certain size occuring before any search result is found would trigger an overflow and stop the search entirely.
--- fs/btrfs/ioctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/ioctl.c +5 -5
@@ -1571,7 +1571,11 @@ static noinline int copy_to_sk(struct bt item_off =btrfs_item_ptr_offset (leaf, i); item_len =btrfs_item_size_nr (leaf, i); -if (item_len >BTRFS_SEARCH_ARGS_BUFSIZE ) +btrfs_item_key_to_cpu (leaf, key, i); +if (!key_in_sk (key, sk)) +continue ; + +if (sizeof (sh) + item_len >BTRFS_SEARCH_ARGS_BUFSIZE ) item_len =0 ; if (sizeof(sh) + item_len + *sk_offset >
@@ -1580,10 +1584,6 @@ static noinline int copy_to_sk(struct bt goto overflow; } -btrfs_item_key_to_cpu (leaf, key, i); -if (!key_in_sk (key, sk)) -continue ; - sh.objectid = key->objectid; sh.offset = key->offset; sh.type = key->type;
PATCH 50/94 virtio_console: fix uapi header
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Michael S. Tsirkin" <[email protected]>
commit 6407d75afd08545f2252bb39806ffd3f10c7faac upstream.
uapi should use __u32 not u32.
Fix a macro in virtio_console.h which uses u32.
--- include/linux/virtio_console.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/virtio_console.h +1 -1
@@ -39,7 +39,7 @@#define VIRTIO_CONSOLE_F_SIZE 0/* Does host provide console size? */ #define VIRTIO_CONSOLE_F_MULTIPORT 1/* Does host provide multiple ports? */ -#define VIRTIO_CONSOLE_BAD_ID (~(u32)0) +#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0)struct virtio_console_config {/* colums of the screens */
PATCH 51/94 ARM: plat-orion: Fix num_resources and id for ge10 and ge11
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gregory CLEMENT <[email protected]>
commit 2b8b2797142c7951e635c6eec5d1705ee9bc45c5 upstream.
When platform data were moved from arch/arm/mach-mv78xx0/common.c to arch/arm/plat-orion/common.c with the commit "7e3819d ARM: orion:
Consolidate ethernet platform data", there were few typo made on gigabit Ethernet interface ge10 and ge11. This commit writes back their initial value, which allows to use this interfaces again.
--- arch/arm/plat-orion/common.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/plat-orion/common.c +6 -6
@@ -347,7 +347,7 @@ static struct resource orion_ge10_sharedstatic struct platform_device orion_ge10_shared = { .name =MV643XX_ETH_SHARED_NAME , - .id =1 , + .id =2 , .dev = { .platform_data = &orion_ge10_shared_data, },
@@ -362,8 +362,8 @@ static struct resource orion_ge10_resourstatic struct platform_device orion_ge10 = { .name =MV643XX_ETH_NAME , - .id =1 , - .num_resources =2 , + .id =2 , + .num_resources =1 , .resource = orion_ge10_resources, .dev = { .coherent_dma_mask =DMA_BIT_MASK (32 ),
@@ -401,7 +401,7 @@ static struct resource orion_ge11_sharedstatic struct platform_device orion_ge11_shared = { .name =MV643XX_ETH_SHARED_NAME , - .id =1 , + .id =3 , .dev = { .platform_data = &orion_ge11_shared_data, },
@@ -416,8 +416,8 @@ static struct resource orion_ge11_resourstatic struct platform_device orion_ge11 = { .name =MV643XX_ETH_NAME , - .id =1 , - .num_resources =2 , + .id =3 , + .num_resources =1 , .resource = orion_ge11_resources, .dev = { .coherent_dma_mask =DMA_BIT_MASK (32 ),
PATCH 52/94 USB: cxacru: potential underflow in cxacru_cm_get_array()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 2a0ebf80aa95cc758d4725f74a7016e992606a39 upstream.
The value of "offd" comes off the instance->rcv_buf[] and we used it as the offset into an array. The problem is that we check the upper bound but not for negative values.
--- drivers/usb/atm/cxacru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/atm/cxacru.c +2 -1
@@ -686,7 +686,8 @@ static int cxacru_cm_get_array(struct cx {int ret, len;__le32 *buf; -int offb, offd; +int offb; +unsigned int offd;const int stride =CMD_PACKET_SIZE / (4 *2 ) -1 ;int buflen = ((size -1 ) / stride +1 + size *2 ) *4 ;
PATCH 53/94 TTY: Fix tty miss restart after we turn off flow-control
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wang YanQing <[email protected]>
commit dab73b4eb9ef924a2b90dab84e539076d82b256f upstream.
I meet emacs hang in start if I do the operation below:
1: echo 3 > /proc/sys/vm/drop_caches
2: emacs BigFile
3: Press CTRL-S follow 2 immediately
Then emacs hang on, CTRL-Q can't resume, the terminal hang on, you can do nothing with this terminal except close it.
The reason is before emacs takeover control the tty, we use CTRL-S to XOFF it. Then when emacs takeover the control, it may don't use the flow-control, so emacs hang. This patch fix it.
This patch will fix a kind of strange tty relation hang problem, I believe I meet it with vim in ssh, and also see below bug report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=465823
--- drivers/tty/n_tty.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/tty/n_tty.c +8 -0
@@ -1530,6 +1530,14 @@ static void n_tty_set_termios(struct tty tty->real_raw =0 ; }n_tty_set_room (tty); +/* +* Fix tty hang when I_IXON(tty) is cleared, but the tty +* been stopped by STOP_CHAR(tty) before it. +*/ +if (!I_IXON (tty) && old && (old->c_iflag &IXON ) && !tty->flow_stopped) { +start_tty (tty); + } +/* The termios change make the tty ready for I/O */ wake_up_interruptible (&tty->write_wait);wake_up_interruptible (&tty->read_wait);
PATCH 54/94 sunrpc: clarify comments on rpc_make_runnable
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 506026c3ec270e18402f0c9d33fee37482c23861 upstream.
rpc_make_runnable is not generally called with the queue lock held, unless it's waking up a task that has been sitting on a waitqueue. This is safe when the task has not entered the FSM yet, but the comments don't really spell this out.
--- net/sunrpc/sched.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sunrpc/sched.c +3 -2
@@ -296,8 +296,9 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet/* * Make an RPC task runnable. * -* Note: If the task is ASYNC, this must be called with -* the spinlock held to protect the wait queue operation. +* Note: If the task is ASYNC, and is being made runnable after sitting on an +* rpc_wait_queue, this must be called with the queue spinlock held to protect +* the wait queue operation. */ static void rpc_make_runnable (struct rpc_task *task) {
Re: [54/94] sunrpc: clarify comments on rpc_make_runnable
Quoted 25 lines · On Tue, 28 May 2013 04:49:53 +0100 Ben Hutchings <[email protected]> wrote:
3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit
506026c3ec270e18402f0c9d33fee37482c23861upstream.
rpc_make_runnableis not generally called with the queue lock held, unless it's waking up a task that has been sitting on a waitqueue. This is safe when the task has not entered the FSM yet, but the comments don't really spell this out.Signed-off-by Jeff Layton <[email protected]>Signed-off-by Trond Myklebust <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- net/sunrpc/sched.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/sunrpc/sched.c +0
-0@@ -296,8 +296,9 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet/*
net/sunrpc/sched.c EXPORT_SYMBOL_GPL(__rpc_wait_for_complet · line 304
Quoted 10 lines
net/sunrpc/sched.c +3
-2* Make an RPC task runnable. * -* Note: If the task is ASYNC, this must be called with -* the spinlock held to protect the wait queue operation. +* Note: If the task is ASYNC, and is being made runnable after sitting on an +* rpc_wait_queue, this must be called with the queue spinlock held to protect +* the wait queue operation. */ static void rpc_make_runnable (struct rpc_task *task) {
Just a comment patch, so this is harmless and I have no objection but why pull it into stable? I had always thought stable-kernel-rules.txt discouraged taking patches that don't fix real bugs...
Signature · 1 line
Jeff Layton <[email protected]>
Re: [54/94] sunrpc: clarify comments on rpc_make_runnable
Quoted 34 lines · Jeff Layton
Quoted 31 lines · On Tue, 28 May 2013 04:49:53 +0100 Ben Hutchings <[email protected]> wrote:
3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit
506026c3ec270e18402f0c9d33fee37482c23861upstream.
rpc_make_runnableis not generally called with the queue lock held, unless it's waking up a task that has been sitting on a waitqueue. This is safe when the task has not entered the FSM yet, but the comments don't really spell this out.Signed-off-by Jeff Layton <[email protected]>Signed-off-by Trond Myklebust <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- net/sunrpc/sched.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/sunrpc/sched.c +3
-2@@ -296,8 +296,9 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet/* * Make an RPC task runnable. * -* Note: If the task is ASYNC, this must be called with -* the spinlock held to protect the wait queue operation. +* Note: If the task is ASYNC, and is being made runnable after sitting on an +* rpc_wait_queue, this must be called with the queue spinlock held to protect +* the wait queue operation.
Quoted 8 lines
net/sunrpc/sched.c EXPORT_SYMBOL_GPL(__rpc_wait_for_complet · line 304
Quoted 4 lines
net/sunrpc/sched.c +0
-0*/ static void rpc_make_runnable (struct rpc_task *task) {Just a comment patch, so this is harmless and I have no objection but why pull it into stable? I had always thought stable-kernel-rules.txt discouraged taking patches that don't fix real bugs...
I believe the reason Ben took this patch is actually to provide the correct context for the next one:
a3c3cac5d31879cd9ae2de7874dc6544ca704aec, "SUNRPC: Prevent an rpc_task wakeup race"
So that this is a clean cherry-pick.
(At least this was the reason I picked it for the 3.5 kernel.)
Cheers,
Signature · 1 line
Luis
Re: [54/94] sunrpc: clarify comments on rpc_make_runnable
Quoted 48 lines · On Tue, 28 May 2013 11:41:08 +0100 Luis Henriques…
Quoted 34 lines · Jeff Layton
Quoted 31 lines · On Tue, 28 May 2013 04:49:53 +0100 Ben Hutchings <[email protected]> wrote:
3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit
506026c3ec270e18402f0c9d33fee37482c23861upstream.
rpc_make_runnableis not generally called with the queue lock held, unless it's waking up a task that has been sitting on a waitqueue. This is safe when the task has not entered the FSM yet, but the comments don't really spell this out.Signed-off-by Jeff Layton <[email protected]>Signed-off-by Trond Myklebust <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- net/sunrpc/sched.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/sunrpc/sched.c +3
-2@@ -296,8 +296,9 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet/* * Make an RPC task runnable. * -* Note: If the task is ASYNC, this must be called with -* the spinlock held to protect the wait queue operation. +* Note: If the task is ASYNC, and is being made runnable after sitting on an +* rpc_wait_queue, this must be called with the queue spinlock held to protect +* the wait queue operation. Quoted 8 lines
net/sunrpc/sched.c EXPORT_SYMBOL_GPL(__rpc_wait_for_complet · line 304
Quoted 4 lines
net/sunrpc/sched.c +0
-0*/ static void rpc_make_runnable (struct rpc_task *task) {Just a comment patch, so this is harmless and I have no objection but why pull it into stable? I had always thought stable-kernel-rules.txt discouraged taking patches that don't fix real bugs...
I believe the reason Ben took this patch is actually to provide the correct context for the next one:
Quoted 7 lines
a3c3cac5d31879cd9ae2de7874dc6544ca704aec, "SUNRPC: Prevent anrpc_taskwakeup race"So that this is a clean cherry-pick.
(At least this was the reason I picked it for the 3.5 kernel.)
Cheers,
Ok, that's understandable -- sorry for the noise...
Thanks,
Signature · 1 line
Jeff Layton <[email protected]>
PATCH 55/94 SUNRPC: Prevent an rpc_task wakeup race
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit a3c3cac5d31879cd9ae2de7874dc6544ca704aec upstream.
The lockless RPC_IS_QUEUED() test in __rpc_execute means that we need to be careful about ordering the calls to rpc_test_and_set_running(task) and rpc_clear_queued(task). If we get the order wrong, then we may end up testing the RPC_TASK_RUNNING flag after __rpc_execute() has looped and changed the state of the rpc_task.
--- net/sunrpc/sched.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/sunrpc/sched.c +7 -1
@@ -299,11 +299,17 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_complet* Note: If the task is ASYNC, and is being made runnable after sitting on an * rpc_wait_queue, this must be called with the queue spinlock held to protect * the wait queue operation. +* Note the ordering of rpc_test_and_set_running() and rpc_clear_queued(), +* which is needed to ensure that __rpc_execute() doesn't loop (due to the +* lockless RPC_IS_QUEUED() test) before we've had a chance to test +* the RPC_TASK_RUNNING flag. */ static void rpc_make_runnable (struct rpc_task *task) { +bool need_wakeup = !rpc_test_and_set_running (task); +rpc_clear_queued (task); -if (rpc_test_and_set_running (task)) +if (!need_wakeup)return ;if (RPC_IS_ASYNC (task)) {INIT_WORK (&task->u.tk_work, rpc_async_schedule);
PATCH 56/94 perf: net_dropmonitor: Fix trace parameter order
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 140c3c6a2bcd2c31e2f7f5a8d59689724776c8e5 upstream.
This works much better if we don't treat protocol numbers as addresses.
--- tools/perf/scripts/python/net_dropmonitor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/net_dropmonitor.py +1 -1
@@ -64,7 +64,7 @@ def trace_end(): # called from perf, when it finds a correspoinding event def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, - skbaddr, protocol, location): + skbaddr, location, protocol): slocation = str(location) try: drop_log[slocation] = drop_log[slocation] + 1
PATCH 57/94 perf: net_dropmonitor: Fix symbol-relative addresses
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 5a1e99dd2028e00998d42029be86835d8ef4a46e upstream.
The comparison between traced and symbol addresses is backwards: if the traced address doesn't exactly match a symbol (which we don't expect it to), we'll show the next symbol and the offset to it, whereas we should show the previous symbol and the offset from it.
--- tools/perf/scripts/python/net_dropmonitor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/scripts/python/net_dropmonitor.py +3 -3
@@ -40,9 +40,9 @@ def get_kallsyms_table(): def get_sym(sloc): loc = int(sloc) - for i in kallsyms: - if (i['loc'] >= loc): - return (i['name'], i['loc']-loc) + for i in kallsyms[::-1]: + if loc >= i['loc']: + return (i['name'], loc - i['loc']) return (None, 0) def print_drop_table():
PATCH 58/94 ACPI / video: Add "Asus UL30A" to ACPI video detect blacklist
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Bastian Triller <[email protected]>
commit c8f6d8351ba8c89d5cd4c562552ec7ec29274e31 upstream.
Like on UL30VT, the ACPI video driver can't control backlight correctly on Asus UL30A. Vendor driver (asus-laptop) can work. This patch is to add "Asus UL30A" to ACPI video detect blacklist in order to use asus-laptop for video control on the "Asus UL30A" rather than ACPI video driver.
--- drivers/acpi/video_detect.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/acpi/video_detect.c +8 -0
@@ -164,6 +164,14 @@ static struct dmi_system_id video_detect DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), }, }, + { + .callback = video_detect_force_vendor, + .ident = "Asus UL30A", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), + }, + }, { }, };
PATCH 59/94 fat: fix possible overflow for fat_clusters
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: OGAWA Hirofumi <[email protected]>
commit 7b92d03c3239f43e5b86c9cc9630f026d36ee995 upstream.
Intermediate value of fat_clusters can be overflowed on 32bits arch.
--- fs/fat/inode.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
fs/fat/inode.c +14 -1
@@ -1238,6 +1238,19 @@ static int fat_read_root(struct inode *ireturn 0 ; } +static unsigned long calc_fat_clusters (struct super_block *sb) +{ +struct msdos_sb_info *sbi =MSDOS_SB (sb); + +/* Divide first to avoid overflow */ +if (sbi->fat_bits !=12 ) { +unsigned long ent_per_sec = sb->s_blocksize *8 / sbi->fat_bits; +return ent_per_sec * sbi->fat_length; + } + +return sbi->fat_length * sb->s_blocksize *8 / sbi->fat_bits; +} +/* * Read the super block of an MS-DOS FS. */
@@ -1434,7 +1447,7 @@ int fat_fill_super(struct super_block *s sbi->fat_bits = (total_clusters >MAX_FAT12 ) ?16 :12 ;/* check that FAT table does not overflow */ - fat_clusters = sbi->fat_length * sb->s_blocksize *8 / sbi->fat_bits; + fat_clusters =calc_fat_clusters (sb); total_clusters =min (total_clusters, fat_clusters -FAT_START_ENT );if (total_clusters >MAX_FAT (sb)) {if (!silent)
PATCH 60/94 wait: fix false timeouts when using wait_event_timeout()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Imre Deak <[email protected]>
commit 4c663cfc523a88d97a8309b04a089c27dc57fd7e upstream.
Many callers of the wait_event_timeout() and wait_event_interruptible_timeout() expect that the return value will be positive if the specified condition becomes true before the timeout elapses. However, at the moment this isn't guaranteed. If the wake-up handler is delayed enough, the time remaining until timeout will be calculated as 0 - and passed back as a return value - even if the condition became true before the timeout has passed.
Fix this by returning at least 1 if the condition becomes true. This semantic is in line with what wait_for_condition_timeout() does; see commit bb10ed09 ("sched: fix wait_for_completion_timeout() spurious failure under heavy load").
Daniel said "We have 3 instances of this bug in drm/i915. One case even where we switch between the interruptible and not interruptible wait_event_timeout variants, foolishly presuming they have the same semantics. I very much like this."
One such bug is reported at
https://bugs.freedesktop.org/show_bug.cgi?id=64133
--- include/linux/wait.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
include/linux/wait.h +11 -5
@@ -233,6 +233,8 @@ do { \if (!ret) \break ; \ } \ +if (!ret && (condition)) \ + ret =1 ; \finish_wait (&wq, &__wait); \ }while (0 )
@@ -249,8 +251,9 @@ do { \* wake_up() has to be called after changing any variable that could * change the result of the wait condition. * -* The function returns 0 if the @timeout elapsed, and the remaining -* jiffies if the condition evaluated to true before the timeout elapsed. +* The function returns 0 if the @timeout elapsed, or the remaining +* jiffies (at least 1) if the @condition evaluated to %true before +* the @timeout elapsed. */ #define wait_event_timeout (wq, condition, timeout) \ ({ \
@@ -318,6 +321,8 @@ do { \ ret = -ERESTARTSYS ; \break ; \ } \ +if (!ret && (condition)) \ + ret =1 ; \finish_wait (&wq, &__wait); \ }while (0 )
@@ -334,9 +339,10 @@ do { \* wake_up() has to be called after changing any variable that could * change the result of the wait condition. * -* The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it -* was interrupted by a signal, and the remaining jiffies otherwise -* if the condition evaluated to true before the timeout elapsed. +* Returns: +* 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by +* a signal, or the remaining jiffies (at least 1) if the @condition +* evaluated to %true before the @timeout elapsed. */ #define wait_event_interruptible_timeout (wq, condition, timeout) \ ({ \
PATCH 61/94 mm: mmu_notifier: re-fix freed page still mapped in secondary MMU
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Xiao Guangrong <[email protected]>
commit d34883d4e35c0a994e91dd847a82b4c9e0c31d83 upstream.
Commit 751efd8610d3 ("mmu_notifier_unregister NULL Pointer deref and multiple ->release()") breaks the fix 3ad3d901bbcf ("mm: mmu_notifier:
fix freed page still mapped in secondary MMU").
Since hlist_for_each_entry_rcu() is changed now, we can not revert that patch directly, so this patch reverts the commit and simply fix the bug spotted by that patch
This bug spotted by commit 751efd8610d3 is:
There is a race condition between mmu_notifier_unregister() and __mmu_notifier_release().
Assume two tasks, one calling mmu_notifier_unregister() as a result of a filp_close() ->flush() callout (task A), and the other calling mmu_notifier_release() from an mmput() (task B).
A B
t1 srcu_read_lock()
t2 if (!hlist_unhashed())
t3 srcu_read_unlock()
t4 srcu_read_lock()
t5 hlist_del_init_rcu()
t6 synchronize_srcu()
t7 srcu_read_unlock()
t8 hlist_del_rcu() <--- NULL pointer deref.
This can be fixed by using hlist_del_init_rcu instead of hlist_del_rcu.
The another issue spotted in the commit is "multiple ->release() callouts", we needn't care it too much because it is really rare (e.g, can not happen on kvm since mmu-notify is unregistered after exit_mmap()) and the later call of multiple ->release should be fast since all the pages have already been released by the first call. Anyway, this issue should be fixed in a separate patch.
-stable suggestions: Any version that has commit 751efd8610d3 need to be backported. I find the oldest version has this commit is 3.0-stable.
[bwh: Backported to 3.2: hlist_for_each_entry_rcu() still requires the
struct hlist_node pointer]
--- mm/mmu_notifier.c | 79 ++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 40 deletions(-)
mm/mmu_notifier.c +40 -40
@@ -37,51 +37,48 @@ static struct srcu_struct srcu;void __mmu_notifier_release (struct mm_struct *mm) {struct mmu_notifier *mn; +struct hlist_node *n;int id;/* -* srcu_read_lock() here will block synchronize_srcu() in -* mmu_notifier_unregister() until all registered -* ->release() callouts this function makes have -* returned. +* SRCU here will block mmu_notifier_unregister until +* ->release returns. */ id =srcu_read_lock (&srcu); +hlist_for_each_entry_rcu (mn, n, &mm->mmu_notifier_mm->list, hlist) +/* +* If ->release runs before mmu_notifier_unregister it must be +* handled, as it's the only way for the driver to flush all +* existing sptes and stop the driver from establishing any more +* sptes before all the pages in the mm are freed. +*/ +if (mn->ops->release) + mn->ops->release (mn, mm); +srcu_read_unlock (&srcu, id); +spin_lock (&mm->mmu_notifier_mm->lock);while (unlikely (!hlist_empty (&mm->mmu_notifier_mm->list))) { mn =hlist_entry (mm->mmu_notifier_mm->list.first, struct mmu_notifier, hlist); -/* -* Unlink. This will prevent mmu_notifier_unregister() -* from also making the ->release() callout. +* We arrived before mmu_notifier_unregister so +* mmu_notifier_unregister will do nothing other than to wait +* for ->release to finish and for mmu_notifier_unregister to +* return. */ hlist_del_init_rcu (&mn->hlist); -spin_unlock (&mm->mmu_notifier_mm->lock); - -/* -* Clear sptes. (see 'release' description in mmu_notifier.h) -*/ -if (mn->ops->release) - mn->ops->release (mn, mm); - -spin_lock (&mm->mmu_notifier_mm->lock); }spin_unlock (&mm->mmu_notifier_mm->lock);/* -* All callouts to ->release() which we have done are complete. -* Allow synchronize_srcu() in mmu_notifier_unregister() to complete -*/ -srcu_read_unlock (&srcu, id); - -/* -* mmu_notifier_unregister() may have unlinked a notifier and may -* still be calling out to it. Additionally, other notifiers -* may have been active via vmtruncate() et. al. Block here -* to ensure that all notifier callouts for this mm have been -* completed and the sptes are really cleaned up before returning -* to exit_mmap(). +* synchronize_srcu here prevents mmu_notifier_release from returning to +* exit_mmap (which would proceed with freeing all pages in the mm) +* until the ->release method returns, if it was invoked by +* mmu_notifier_unregister. +* +* The mmu_notifier_mm can't go away from under us because one mm_count +* is held by exit_mmap. */ synchronize_srcu (&srcu); }
@@ -302,31 +299,34 @@ void mmu_notifier_unregister(struct mmu_ {BUG_ON (atomic_read (&mm->mm_count) <=0 ); -spin_lock (&mm->mmu_notifier_mm->lock);if (!hlist_unhashed (&mn->hlist)) { +/* +* SRCU here will force exit_mmap to wait for ->release to +* finish before freeing the pages. +*/ int id; + id =srcu_read_lock (&srcu);/* -* Ensure we synchronize up with __mmu_notifier_release(). +* exit_mmap will block in mmu_notifier_release to guarantee +* that ->release is called before freeing the pages. */ - id =srcu_read_lock (&srcu); - -hlist_del_rcu (&mn->hlist); -spin_unlock (&mm->mmu_notifier_mm->lock); -if (mn->ops->release) mn->ops->release (mn, mm); +srcu_read_unlock (&srcu, id); +spin_lock (&mm->mmu_notifier_mm->lock);/* -* Allow __mmu_notifier_release() to complete. +* Can not use list_del_rcu() since __mmu_notifier_release +* can delete it before we hold the lock. */ -srcu_read_unlock (&srcu, id); - }else +hlist_del_init_rcu (&mn->hlist);spin_unlock (&mm->mmu_notifier_mm->lock); + }/* -* Wait for any running method to finish, including ->release() if it -* was run by __mmu_notifier_release() instead of us. +* Wait for any running method to finish, of course including +* ->release if it was run by mmu_notifier_relase instead of us. */ synchronize_srcu (&srcu);
PATCH 62/94 rapidio/tsi721: fix bug in MSI interrupt handling
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Bounine <[email protected]>
commit 1ccc819da6fda9bee10ab8b72e9adbb5ad3e4959 upstream.
Fix bug in MSI interrupt handling which causes loss of event notifications.
Typical indication of lost MSI interrupts are stalled message and doorbell transfers between RapidIO endpoints. To avoid loss of MSI interrupts all interrupts from the device must be disabled on entering the interrupt handler routine and re-enabled when exiting it. Re-enabling device interrupts will trigger new MSI message(s) if Tsi721 registered new events since entering interrupt handler routine.
This patch is applicable to kernel versions starting from v3.2.
---
drivers/rapidio/devices/tsi721.c +11 -0
@@ -475,6 +475,10 @@ static irqreturn_t tsi721_irqhandler(intu32 intval;u32 ch_inte; +/* For MSI mode disable all device-level interrupts */ +if (priv->flags &TSI721_USING_MSI ) +iowrite32 (0 , priv->regs +TSI721_DEV_INTE ); + dev_int =ioread32 (priv->regs +TSI721_DEV_INT );if (!dev_int)return IRQ_NONE ;
@@ -548,6 +552,13 @@ static irqreturn_t tsi721_irqhandler(inttsi721_pw_handler (mport); } +/* For MSI mode re-enable device-level interrupts */ +if (priv->flags &TSI721_USING_MSI ) { + dev_int =TSI721_DEV_INT_SR2PC_CH |TSI721_DEV_INT_SRIO | +TSI721_DEV_INT_SMSG_CH |TSI721_DEV_INT_BDMA_CH ; +iowrite32 (dev_int, priv->regs +TSI721_DEV_INTE ); + } +return IRQ_HANDLED ; }
PATCH 63/94 mm compaction: fix of improper cache flush in migration code
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Leonid Yegoshin <[email protected]>
commit c2cc499c5bcf9040a738f49e8051b42078205748 upstream.
Page 'new' during MIGRATION can't be flushed with flush_cache_page(). Using flush_cache_page(vma, addr, pfn) is justified only if the page is already placed in process page table, and that is done right after flush_cache_page(). But without it the arch function has no knowledge of process PTE and does nothing.
Besides that, flush_cache_page() flushes an application cache page, but the kernel has a different page virtual address and dirtied it.
Replace it with flush_dcache_page(new) which is the proper usage.
The old page is flushed in try_to_unmap_one() before migration.
This bug takes place in Sead3 board with M14Kc MIPS CPU without cache aliasing (but Harvard arch - separate I and D cache) in tight memory environment (128MB) each 1-3days on SOAK test. It fails in cc1 during kernel build (SIGILL, SIGBUS, SIGSEG) if CONFIG_COMPACTION is switched ON.
--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/migrate.c +1 -1
@@ -147,7 +147,7 @@ static int remove_migration_pte(struct pif (PageHuge (new)) pte =pte_mkhuge (pte);#endif -flush_cache_page (vma, addr,pte_pfn (pte)); +flush_dcache_page (new);set_pte_at (mm, addr, ptep, pte);if (PageHuge (new)) {
PATCH 64/94 mm/THP: use pmd_populate() to update the pmd with pgtable_t pointer
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Aneesh Kumar K.V" <[email protected]>
commit 7c3425123ddfdc5f48e7913ff59d908789712b18 upstream.
We should not use set_pmd_at to update pmd_t with pgtable_t pointer. set_pmd_at is used to set pmd with huge pte entries and architectures like ppc64, clear few flags from the pte when saving a new entry. Without this change we observe bad pte errors like below on ppc64 with THP enabled.
BUG: Bad page map in process ld mm=0xc000001ee39f4780 pte:7fc3f37848000001 pmd:c000001ec0000000
--- mm/huge_memory.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
mm/huge_memory.c +6 -1
@@ -1937,7 +1937,12 @@ static void collapse_huge_page(struct mmpte_unmap (pte);spin_lock (&mm->page_table_lock);BUG_ON (!pmd_none (*pmd)); -set_pmd_at (mm, address, pmd, _pmd); +/* +* We can only use set_pmd_at when establishing +* hugepmds and never for establishing regular pmds that +* points to regular pagetables. Use pmd_populate for that +*/ +pmd_populate (mm, pmd,pmd_pgtable (_pmd));spin_unlock (&mm->page_table_lock);anon_vma_unlock (vma->anon_vma); goto out;
PATCH 65/94 drivers/block/brd.c: fix brd_lookup_page() race
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Brian Behlendorf <[email protected]>
commit dfd20b2b174d3a9b258ea3b7a35ead33576587b1 upstream.
The index on the page must be set before it is inserted in the radix tree. Otherwise there is a small race which can occur during lookup where the page can be found with the incorrect index. This will trigger the BUG_ON() in brd_lookup_page().
--- drivers/block/brd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/brd.c +2 -2
@@ -117,13 +117,13 @@ static struct page *brd_insert_page(struspin_lock (&brd->brd_lock); idx = sector >>PAGE_SECTORS_SHIFT ; + page->index = idx;if (radix_tree_insert (&brd->brd_pages, idx, page)) {__free_page (page); page =radix_tree_lookup (&brd->brd_pages, idx);BUG_ON (!page);BUG_ON (page->index != idx); - }else - page->index = idx; + }spin_unlock (&brd->brd_lock);radix_tree_preload_end ();
PATCH 66/94 nilfs2: fix issue of nilfs_set_page_dirty() for page at EOF boundary
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 136e8770cd5d1fe38b3c613100dd6dc4db6d4fa6 upstream.
nilfs2: fix issue of nilfs_set_page_dirty for page at EOF boundary
DESCRIPTION:
There are use-cases when NILFS2 file system (formatted with block size
lesser than 4 KB) can be remounted in RO mode because of encountering of "broken bmap" issue.
The issue was reported by Anthony Doggett <[email protected]>:
"The machine I've been trialling nilfs on is running Debian Testing,
Linux version 3.2.0-4-686-pae ([email protected]) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.35-2), but I've also reproduced it (identically) with Debian Unstable amd64 and Debian Experimental (using the 3.8-trunk kernel). The problematic partitions were formatted with "mkfs.nilfs2 -b 1024 -B 8192"."
SYMPTOMS:
(1) System log contains error messages likewise:
[63102.496756] nilfs_direct_assign: invalid pointer: 0
[63102.496786] NILFS error (device dm-17): nilfs_bmap_assign: broken bmap (inode number=28)
[63102.496798]
[63102.524403] Remounting filesystem read-only(2) The NILFS2 file system is remounted in RO mode.
REPRODUSING PATH:
(1) Create volume group with name "unencrypted" by means of vgcreate utility.
(2) Run script (prepared by Anthony Doggett <[email protected]>):
----------------[BEGIN SCRIPT]--------------------
VG=unencrypted
lvcreate --size 2G --name ntest $VG
mkfs.nilfs2 -b 1024 -B 8192 /dev/mapper/$VG-ntest
mkdir /var/tmp/n
mkdir /var/tmp/n/ntest
mount /dev/mapper/$VG-ntest /var/tmp/n/ntest
mkdir /var/tmp/n/ntest/thedir
cd /var/tmp/n/ntest/thedir
sleep 2
date
darcs init
sleep 2
dmesg|tail -n 5
date
darcs whatsnew || true
date
sleep 2
dmesg|tail -n 5
----------------[END SCRIPT]--------------------
REPRODUCIBILITY: 100%
INVESTIGATION:
As it was discovered, the issue takes place during segment construction after executing such sequence of user-space operations:
open("_darcs/index", O_RDWR|O_CREAT|O_NOCTTY, 0666) = 7 fstat(7, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 ftruncate(7, 60)
The error message "NILFS error (device dm-17): nilfs_bmap_assign: broken bmap (inode number=28)" takes place because of trying to get block number for third block of the file with logical offset #3072 bytes. As it is possible to see from above output, the file has 60 bytes of the whole size. So, it is enough one block (1 KB in size) allocation for the whole file. Trying to operate with several blocks instead of one takes place because of discovering several dirty buffers for this file in nilfs_segctor_scan_file() method.
The root cause of this issue is in nilfs_set_page_dirty function which is called just before writing to an mmapped page.
When nilfs_page_mkwrite function handles a page at EOF boundary, it fills hole blocks only inside EOF through __block_page_mkwrite().
The __block_page_mkwrite() function calls set_page_dirty() after filling hole blocks, thus nilfs_set_page_dirty function (= a_ops->set_page_dirty) is called. However, the current implementation of nilfs_set_page_dirty() wrongly marks all buffers dirty even for page at EOF boundary.
As a result, buffers outside EOF are inconsistently marked dirty and queued for write even though they are not mapped with nilfs_get_block function.
FIX:
This modifies nilfs_set_page_dirty() not to mark hole blocks dirty.
Thanks to Vyacheslav Dubeyko for his effort on analysis and proposals for this issue.
--- fs/nilfs2/inode.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
fs/nilfs2/inode.c +23 -4
@@ -195,13 +195,32 @@ static int nilfs_writepage(struct page *static int nilfs_set_page_dirty (struct page *page) { -int ret =__set_page_dirty_buffers (page); +int ret =__set_page_dirty_nobuffers (page); -if (ret) { +if (page_has_buffers (page)) {struct inode *inode = page->mapping->host; -unsigned nr_dirty =1 << (PAGE_SHIFT - inode->i_blkbits); +unsigned nr_dirty =0 ; +struct buffer_head *bh, *head; -nilfs_set_file_dirty (inode, nr_dirty); +/* +* This page is locked by callers, and no other thread +* concurrently marks its buffers dirty since they are +* only dirtied through routines in fs/buffer.c in +* which call sites of mark_buffer_dirty are protected +* by page lock. +*/ + bh = head =page_buffers (page); +do { +/* Do not mark hole blocks dirty */ +if (buffer_dirty (bh) || !buffer_mapped (bh)) +continue ; + +set_buffer_dirty (bh); + nr_dirty++; + }while (bh = bh->b_this_page, bh != head); + +if (nr_dirty) +nilfs_set_file_dirty (inode, nr_dirty); }return ret; }
PATCH 67/94 random: fix accounting race condition with lockless irq entropy_count update
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
commit 10b3a32d292c21ea5b3ad5ca5975e88bb20b8d68 upstream.
Commit 902c098a3663 ("random: use lockless techniques in the interrupt path") turned IRQ path from being spinlock protected into lockless cmpxchg-retry update.
That commit removed r->lock serialization between crediting entropy bits from IRQ context and accounting when extracting entropy on userspace read path, but didn't turn the r->entropy_count reads/updates in account() to use cmpxchg as well.
It has been observed, that under certain circumstances this leads to read() on /dev/urandom to return 0 (EOF), as r->entropy_count gets corrupted and becomes negative, which in turn results in propagating 0 all the way from account() to the actual read() call.
Convert the accounting code to be the proper lockless counterpart of what has been partially done by 902c098a3663.
--- drivers/char/random.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/char/random.c +15 -7
@@ -889,16 +889,24 @@ static size_t account(struct entropy_stoif (r->entropy_count /8 < min + reserved) { nbytes =0 ; }else { +int entropy_count, orig; +retry: + entropy_count = orig =ACCESS_ONCE (r->entropy_count);/* If limited, never pull more than available */ -if (r->limit && nbytes + reserved >= r->entropy_count /8 ) - nbytes = r->entropy_count/8 - reserved; +if (r->limit && nbytes + reserved >= entropy_count /8 ) + nbytes = entropy_count/8 - reserved; -if (r->entropy_count /8 >= nbytes + reserved) - r->entropy_count -= nbytes*8 ; -else - r->entropy_count = reserved; +if (entropy_count /8 >= nbytes + reserved) { + entropy_count -= nbytes*8 ; +if (cmpxchg (&r->entropy_count, orig, entropy_count) != orig) + goto retry; + }else { + entropy_count = reserved; +if (cmpxchg (&r->entropy_count, orig, entropy_count) != orig) + goto retry; + } -if (r->entropy_count < random_write_wakeup_thresh) { +if (entropy_count < random_write_wakeup_thresh) {wake_up_interruptible (&random_write_wait);kill_fasync (&fasync,SIGIO ,POLL_OUT ); }
PATCH 68/94 ocfs2: goto out_unlock if ocfs2_get_clusters_nocache() failed in ocfs2_fiemap()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joseph Qi <[email protected]>
commit b4ca2b4b577c3530e34dcfaafccb2cc680ce95d1 upstream.
Last time we found there is lock/unlock bug in ocfs2_file_aio_write, and then we did a thorough search for all lock resources in ocfs2_inode_info, including rw, inode and open lockres and found this bug. My kernel version is 3.0.13, and it is also in the lastest version 3.9. In ocfs2_fiemap, once ocfs2_get_clusters_nocache failed, it should goto out_unlock instead of out, because we need release buffer head, up read alloc sem and unlock inode.
--- fs/ocfs2/extent_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/extent_map.c +1 -1
@@ -791,7 +791,7 @@ int ocfs2_fiemap(struct inode *inode, st &hole_size, &rec, &is_last);if (ret) {mlog_errno (ret); - goto out; + goto out_unlock; }if (rec.e_blkno ==0ULL ) {
PATCH 69/94 mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Cliff Wickman <[email protected]>
commit a9ff785e4437c83d2179161e012f5bdfbd6381f0 upstream.
A panic can be caused by simply cat'ing /proc/<pid>/smaps while an application has a VM_PFNMAP range. It happened in-house when a benchmarker was trying to decipher the memory layout of his program.
/proc/<pid>/smaps and similar walks through a user page table should not be looking at VM_PFNMAP areas.
Certain tests in walk_page_range() (specifically split_huge_page_pmd()) assume that all the mapped PFN's are backed with page structures. And this is not usually true for VM_PFNMAP areas. This can result in panics on kernel page faults when attempting to address those page structures.
There are a half dozen callers of walk_page_range() that walk through a task's entire page table (as N. Horiguchi pointed out). So rather than change all of them, this patch changes just walk_page_range() to ignore VM_PFNMAP areas.
The logic of hugetlb_vma() is moved back into walk_page_range(), as we want to test any vma in the range.
VM_PFNMAP areas are used by:
- graphics memory manager gpu/drm/drm_gem.c - global reference unit sgi-gru/grufile.c - sgi special memory char/mspec.c
- and probably several out-of-tree modules
--- mm/pagewalk.c | 70 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 34 deletions(-)
mm/pagewalk.c +36 -34
@@ -127,28 +127,7 @@ static int walk_hugetlb_range(struct vm_ return 0; } -static struct vm_area_struct *hugetlb_vma (unsigned long addr,struct mm_walk *walk) -{ -struct vm_area_struct *vma; - -/* We don't need vma lookup at all. */ -if (!walk->hugetlb_entry) -return NULL ; - -VM_BUG_ON (!rwsem_is_locked (&walk->mm->mmap_sem)); - vma =find_vma (walk->mm, addr); -if (vma && vma->vm_start <= addr &&is_vm_hugetlb_page (vma)) -return vma; - -return NULL ; -} -#else /* CONFIG_HUGETLB_PAGE */ -static struct vm_area_struct *hugetlb_vma (unsigned long addr,struct mm_walk *walk) -{ -return NULL ; -} -static int walk_hugetlb_range (struct vm_area_struct *vma,unsigned long addr,unsigned long end,struct mm_walk *walk)
@@ -199,30 +178,53 @@ int walk_page_range(unsigned long addr,if (!walk->mm)return -EINVAL ; +VM_BUG_ON (!rwsem_is_locked (&walk->mm->mmap_sem)); + pgd =pgd_offset (walk->mm, addr); do { - struct vm_area_struct *vma; + struct vm_area_struct *vma = NULL; next = pgd_addr_end(addr, end); /* - * handle hugetlb vma individually because pagetable walk for - * the hugetlb page is dependent on the architecture and - * we can't handled it in the same manner as non-huge pages. + * This function was not intended to be vma based. + * But there are vma special cases to be handled: + * - hugetlb vma's + * - VM_PFNMAP vma's */ - vma = hugetlb_vma(addr, walk); + vma = find_vma(walk->mm, addr); if (vma) { - if (vma->vm_end < next) + /* + * There are no page structures backing a VM_PFNMAP + * range, so do not allow split_huge_page_pmd(). + */ + if ((vma->vm_start <= addr) && + (vma->vm_flags & VM_PFNMAP)) { next = vma->vm_end; + pgd = pgd_offset(walk->mm, next); + continue; + } /* - * Hugepage is very tightly coupled with vma, so - * walk through hugetlb entries within a given vma. + * Handle hugetlb vma individually because pagetable + * walk for the hugetlb page is dependent on the + * architecture and we can't handled it in the same + * manner as non-huge pages. */ - err = walk_hugetlb_range(vma, addr, next, walk); - if (err) - break; - pgd = pgd_offset(walk->mm, next); - continue; + if (walk->hugetlb_entry && (vma->vm_start <= addr) && + is_vm_hugetlb_page(vma)) { + if (vma->vm_end < next) + next = vma->vm_end; + /* + * Hugepage is very tightly coupled with vma, + * so walk through hugetlb entries within a + * given vma. + */ + err = walk_hugetlb_range(vma, addr, next, walk); + if (err) + break; + pgd = pgd_offset(walk->mm, next); + continue; + } } if (pgd_none_or_clear_bad(pgd)) {
PATCH 70/94 xhci: Don't warn on empty ring for suspended devices.
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit a83d6755814e4614ba77e15d82796af0f695c6b8 upstream.
When a device attached to the roothub is suspended, the endpoint rings are stopped. The host may generate a completion event with the completion code set to 'Stopped' or 'Stopped Invalid' when the ring is halted. The current xHCI code prints a warning in that case, which can be really annoying if the USB device is coming into and out of suspend.
Remove the unnecessary warning.
--- drivers/usb/host/xhci-ring.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
drivers/usb/host/xhci-ring.c +15 -8
@@ -2463,14 +2463,21 @@ static int handle_tx_event(struct xhci_hcd *xhci,* TD list. */ if (list_empty (&ep_ring->td_list)) { -xhci_warn (xhci,"WARN Event TRB for slot %d ep %d " -"with no TDs queued?\n" , -TRB_TO_SLOT_ID (le32_to_cpu (event->flags)), - ep_index); -xhci_dbg (xhci,"Event TRB with TRB type ID %u\n" , - (le32_to_cpu (event->flags) & -TRB_TYPE_BITMASK )>>10 ); -xhci_print_trb_offsets (xhci, (union xhci_trb *) event); +/* +* A stopped endpoint may generate an extra completion +* event if the device was suspended. Don't print +* warnings. +*/ +if (!(trb_comp_code ==COMP_STOP || + trb_comp_code ==COMP_STOP_INVAL )) { +xhci_warn (xhci,"WARN Event TRB for slot %d ep %d with no TDs queued?\n" , +TRB_TO_SLOT_ID (le32_to_cpu (event->flags)), + ep_index); +xhci_dbg (xhci,"Event TRB with TRB type ID %u\n" , + (le32_to_cpu (event->flags) & +TRB_TYPE_BITMASK )>>10 ); +xhci_print_trb_offsets (xhci, (union xhci_trb *) event); + }if (ep->skip) { ep->skip = false; xhci_dbg(xhci, "td_list is empty while skip "
PATCH 71/94 sched/debug: Limit sd->*_idx range on sysctl
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
commit 201c373e8e4823700d3160d5c28e1ab18fd1193e upstream.
Various sd->*_idx's are used for refering the rq's load average table when selecting a cpu to run. However they can be set to any number with sysctl knobs so that it can crash the kernel if something bad is given. Fix it by limiting them into the actual range.
[bwh: Backported to 3.2:
- Adjust filename
- s/umode_t/mode_t/]
--- kernel/sched.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
kernel/sched.c +22 -13
@@ -6672,16 +6672,25 @@ static void sd_free_ctl_entry(struct ctl *tablep =NULL ; } +static int min_load_idx =0 ; +static int max_load_idx =CPU_LOAD_IDX_MAX ; +static void set_table_entry (struct ctl_table *entry,const char *procname,void *data,int maxlen, -mode_t mode,proc_handler *proc_handler) +mode_t mode,proc_handler *proc_handler, +bool load_idx) { entry->procname = procname; entry->data = data; entry->maxlen = maxlen; entry->mode = mode; entry->proc_handler = proc_handler; + +if (load_idx) { + entry->extra1 = &min_load_idx; + entry->extra2 = &max_load_idx; + } } static struct ctl_table *
@@ -6693,30 +6702,30 @@ sd_alloc_ctl_domain_table(struct sched_dreturn NULL ;set_table_entry (&table[0 ],"min_interval" , &sd->min_interval, -sizeof (long ),0644 , proc_doulongvec_minmax); +sizeof (long ),0644 , proc_doulongvec_minmax, false);set_table_entry (&table[1 ],"max_interval" , &sd->max_interval, -sizeof (long ),0644 , proc_doulongvec_minmax); +sizeof (long ),0644 , proc_doulongvec_minmax, false);set_table_entry (&table[2 ],"busy_idx" , &sd->busy_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[3 ],"idle_idx" , &sd->idle_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[4 ],"newidle_idx" , &sd->newidle_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[5 ],"wake_idx" , &sd->wake_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[6 ],"forkexec_idx" , &sd->forkexec_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[7 ],"busy_factor" , &sd->busy_factor, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[8 ],"imbalance_pct" , &sd->imbalance_pct, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[9 ],"cache_nice_tries" , &sd->cache_nice_tries, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[10 ],"flags" , &sd->flags, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[11 ],"name" , sd->name, -CORENAME_MAX_SIZE ,0444 , proc_dostring); +CORENAME_MAX_SIZE ,0444 , proc_dostring, false);/* &table[12] is terminator */ return table;
PATCH 72/94 sched/debug: Fix sd->*_idx limit range avoiding overflow
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: libin <[email protected]>
commit fd9b86d37a600488dbd80fe60cca46b822bff1cd upstream.
Commit 201c373e8e ("sched/debug: Limit sd->*_idx range on sysctl") was an incomplete bug fix.
This patch fixes sd->*_idx limit range to [0 ~ CPU_LOAD_IDX_MAX-1] avoiding array overflow caused by setting sd->*_idx to CPU_LOAD_IDX_MAX on sysctl.
--- kernel/sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched.c +1 -1
@@ -6673,7 +6673,7 @@ static void sd_free_ctl_entry(struct ctl }static int min_load_idx =0 ; -static int max_load_idx =CPU_LOAD_IDX_MAX ; +static int max_load_idx =CPU_LOAD_IDX_MAX -1 ; static void set_table_entry(struct ctl_table *entry,
PATCH 73/94 ipvs: ip_vs_sip_fill_param() BUG: bad check of return value
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hans Schillstrom <[email protected]>
commit f7a1dd6e3ad59f0cfd51da29dfdbfd54122c5916 upstream.
The reason for this patch is crash in kmemdup caused by returning from get_callid with uniialized matchoff and matchlen.
Removing Zero check of matchlen since it's done by ct_sip_get_header()
BUG: unable to handle kernel paging request at ffff880457b5763f IP: [<ffffffff810df7fc>] kmemdup+0x2e/0x35 PGD 27f6067 PUD 0 Oops: 0000 [#1] PREEMPT SMP Modules linked in: xt_state xt_helper nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle xt_connmark xt_conntrack ip6_tables nf_conntrack_ftp ip_vs_ftp nf_nat xt_tcpudp iptable_mangle xt_mark ip_tables x_tables ip_vs_rr ip_vs_lblcr ip_vs_pe_sip ip_vs nf_conntrack_sip nf_conntrack bonding igb i2c_algo_bit i2c_core CPU 5 Pid: 0, comm: swapper/5 Not tainted 3.9.0-rc5+ #5 /S1200KP RIP: 0010:[<ffffffff810df7fc>] [<ffffffff810df7fc>] kmemdup+0x2e/0x35 RSP: 0018:ffff8803fea03648 EFLAGS: 00010282 RAX: ffff8803d61063e0 RBX: 0000000000000003 RCX: 0000000000000003 RDX: 0000000000000003 RSI: ffff880457b5763f RDI: ffff8803d61063e0 RBP: ffff8803fea03658 R08: 0000000000000008 R09: 0000000000000011 R10: 0000000000000011 R11: 00ffffffff81a8a3 R12: ffff880457b5763f R13: ffff8803d67f786a R14: ffff8803fea03730 R15: ffffffffa0098e90 FS: 0000000000000000(0000) GS:ffff8803fea00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffff880457b5763f CR3: 0000000001a0c000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process swapper/5 (pid: 0, threadinfo ffff8803ee18c000, task ffff8803ee18a480) Stack: ffff8803d822a080 000000000000001c ffff8803fea036c8 ffffffffa000937a ffffffff81f0d8a0 000000038135fdd5 ffff880300000014 ffff880300110000 ffffffff150118ac ffff8803d7e8a000 ffff88031e0118ac 0000000000000000 Call Trace: <IRQ> [<ffffffffa000937a>] ip_vs_sip_fill_param+0x13a/0x187 [ip_vs_pe_sip] [<ffffffffa007b209>] ip_vs_sched_persist+0x2c6/0x9c3 [ip_vs] [<ffffffff8107dc53>] ? __lock_acquire+0x677/0x1697 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d [<ffffffff810649bc>] ? sched_clock_cpu+0x43/0xcf [<ffffffffa007bb1e>] ip_vs_schedule+0x181/0x4ba [ip_vs]
...
--- net/netfilter/ipvs/ip_vs_pe_sip.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
net/netfilter/ipvs/ip_vs_pe_sip.c +1 -5
@@ -37,14 +37,10 @@ static int get_callid(const char *dptr, unsigned int dataoff,if (ret >0 )break ;if (!ret) -return 0 ; +return -EINVAL ; dataoff += *matchoff; } -/* Empty callid is useless */ -if (!*matchlen) -return -EINVAL ; -/* Too large is useless */ if (*matchlen >IP_VS_PEDATA_MAXLEN )return -EINVAL ;
PATCH 74/94 pch_dma: Use GFP_ATOMIC because called from interrupt context
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tomoya MORINAGA <[email protected]>
commit 5c1ef59168c485318e40ba485c1eba57d81d0faa upstream.
pdc_desc_get() is called from pd_prep_slave_sg, and the function is called from interrupt context(e.g. Uart driver "pch_uart.c"). In fact, I saw kernel error message.
So, GFP_ATOMIC must be used not GFP_NOIO.
--- drivers/dma/pch_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/pch_dma.c +1 -1
@@ -489,7 +489,7 @@ static struct pch_dma_desc *pdc_desc_getdev_dbg (chan2dev (&pd_chan->chan),"scanned %d descriptors\n" , i);if (!ret) { - ret =pdc_alloc_desc (&pd_chan->chan,GFP_NOIO ); + ret =pdc_alloc_desc (&pd_chan->chan,GFP_ATOMIC );if (ret) {spin_lock (&pd_chan->lock); pd_chan->descs_allocated++;
PATCH 75/94 drbd: fix for deadlock when using automatic split-brain-recovery
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Philipp Reisner <[email protected]>
commit 7c689e63a847316c1b2500f86891b0a574ce7e69 upstream.
With an automatic after split-brain recovery policy of "after-sb-1pri call-pri-lost-after-sb",
when trying to drbd_set_role() to R_SECONDARY, we run into a deadlock.
This was first recognized and supposedly fixed by
2009-06-10 "Fixed a deadlock when using automatic split brain recovery when both nodes are" replacing drbd_set_role() with drbd_change_state() in that code-path,
but the first hunk of that patch forgets to remove the drbd_set_role().
We apparently only ever tested the "two primaries" case.
--- drivers/block/drbd/drbd_receiver.c | 1 - 1 file changed, 1 deletion(-)
drivers/block/drbd/drbd_receiver.c +0 -1
@@ -2225,7 +2225,6 @@ static int drbd_asb_recover_1p(struct drif (hg ==-1 && mdev->state.role ==R_PRIMARY ) {enum drbd_state_rv rv2; -drbd_set_role (mdev,R_SECONDARY ,0 );/* drbd_change_state() does not sleep while in SS_IN_TRANSIENT_STATE, * we might be here in C_WF_REPORT_PARAMS which is transient. * we do not need to wait for the after state change work either. */
PATCH 76/94 x86, efivars: firmware bug workarounds should be in platform code
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit a6e4d5a03e9e3587e88aba687d8f225f4f04c792 upstream.
Let's not burden ia64 with checks in the common efivars code that we're not writing too much data to the variable store. That kind of thing is an x86 firmware bug, plain and simple.
efi_query_variable_store() provides platforms with a wrapper in which they can perform checks and workarounds for EFI variable storage bugs.
---
arch/x86/platform/efi/efi.c +25 -0
@@ -815,3 +815,28 @@ u64 efi_mem_attributes(unsigned long phy }return 0 ; } + +/* +* Some firmware has serious problems when using more than 50% of the EFI +* variable store, i.e. it triggers bugs that can brick machines. Ensure that +* we never use more than this safe limit. +* +* Return EFI_SUCCESS if it is safe to write 'size' bytes to the variable +* store. +*/ +efi_status_t efi_query_variable_store (u32 attributes,unsigned long size) +{ +efi_status_t status; +u64 storage_size, remaining_size, max_size; + + status = efi.query_variable_info (attributes, &storage_size, + &remaining_size, &max_size); +if (status !=EFI_SUCCESS ) +return status; + +if (!storage_size || size > remaining_size || size > max_size || + (remaining_size - size) < (storage_size /2 )) +return EFI_OUT_OF_RESOURCES ; + +return EFI_SUCCESS ; +}
drivers/firmware/efivars.c +3 -15
@@ -425,24 +425,12 @@ static efi_status_t check_var_size_locked(struct efivars *efivars, u32 attributes, unsigned long size) { - u64 storage_size, remaining_size, max_size; -efi_status_t status; const struct efivar_operations *fops = efivars->ops; -if (!efivars->ops->query_variable_info) +if (!efivars->ops->query_variable_store)return EFI_UNSUPPORTED ; - status = fops->query_variable_info (attributes, &storage_size, - &remaining_size, &max_size); - -if (status !=EFI_SUCCESS ) -return status; - -if (!storage_size || size > remaining_size || size > max_size || - (remaining_size - size) < (storage_size /2 )) -return EFI_OUT_OF_RESOURCES ; - -return status; +return fops->query_variable_store (attributes, size); } static ssize_t
@@ -1456,7 +1444,7 @@ efivars_init(void) ops.get_variable = efi.get_variable; ops.set_variable = efi.set_variable; ops.get_next_variable = efi.get_next_variable; - ops.query_variable_info = efi.query_variable_info; + ops.query_variable_store = efi_query_variable_store; error =register_efivars (&__efivars, &ops, efi_kobj);if (error) goto err_put;
include/linux/efi.h +10 -1
@@ -204,6 +204,7 @@ typedef efi_status_t efi_query_capsule_cunsigned long count, u64 *max_size, int *reset_type); +typedef efi_status_t efi_query_variable_store_t (u32 attributes,unsigned long size);/* * EFI Configuration Table and GUID definitions
@@ -331,6 +332,14 @@ extern void efi_map_pal_code (void);extern void efi_memmap_walk (efi_freemem_callback_t callback,void *arg);extern void efi_gettimeofday (struct timespec *ts);extern void efi_enter_virtual_mode (void );/* switch EFI to virtual mode, if possible */ +#ifdef CONFIG_X86 +extern efi_status_t efi_query_variable_store (u32 attributes,unsigned long size); +#else +static inline efi_status_t efi_query_variable_store (u32 attributes,unsigned long size) +{ +return EFI_SUCCESS ; +} +#endif extern u64 efi_get_iobase (void );extern u32 efi_mem_type (unsigned long phys_addr);extern u64 efi_mem_attributes (unsigned long phys_addr);
@@ -475,7 +484,7 @@ struct efivar_operations {efi_get_variable_t *get_variable;efi_get_next_variable_t *get_next_variable;efi_set_variable_t *set_variable; -efi_query_variable_info_t *query_variable_info; +efi_query_variable_store_t *query_variable_store; };struct efivars {
PATCH 77/94 efi: Export efi_query_variable_store() for efivars.ko
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Vlasov <[email protected]>
commit 3668011d4ad556224f7c012c1e870a6eaa0e59da upstream.
Fixes build with CONFIG_EFI_VARS=m which was broken after the commit "x86, efivars: firmware bug workarounds should be in platform code".
--- arch/x86/platform/efi/efi.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/platform/efi/efi.c +1 -0
@@ -840,3 +840,4 @@ efi_status_t efi_query_variable_store(u3return EFI_SUCCESS ; } +EXPORT_SYMBOL_GPL (efi_query_variable_store);
PATCH 78/94 x86,efi: Check max_size only if it is non-zero.
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 7791c8423f1f7f4dad94e753bae67461d5b80be8 upstream.
Some EFI implementations return always a MaximumVariableSize of 0, check against max_size only if it is non-zero.
My Intel DQ67SW desktop board has such an implementation.
--- arch/x86/platform/efi/efi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/platform/efi/efi.c +6 -1
@@ -834,7 +834,12 @@ efi_status_t efi_query_variable_store(u3if (status !=EFI_SUCCESS )return status; -if (!storage_size || size > remaining_size || size > max_size || +if (!max_size && remaining_size > size) + printk_once(KERN_ERR FW_BUG "Broken EFI implementation" +" is returning MaxVariableSize=0\n" ); + +if (!storage_size || size > remaining_size || + (max_size && size > max_size) || (remaining_size - size) < (storage_size /2 ))return EFI_OUT_OF_RESOURCES ;
PATCH 79/94 x86,efi: Implement efi_no_storage_paranoia parameter
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 8c58bf3eec3b8fc8162fe557e9361891c20758f2 upstream.
Using this parameter one can disable the storage_size/2 check if he is really sure that the UEFI does sane gc and fulfills the spec.
This parameter is useful if a devices uses more than 50% of the storage by default.
The Intel DQSW67 desktop board is such a sucker for exmaple.
--- Documentation/kernel-parameters.txt | 6 ++++++ arch/x86/platform/efi/efi.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +6 -0
@@ -734,6 +734,12 @@ bytes respectively. Such letter suffixes edd= [EDD] Format: {"off" | "on" | "skip[mbr]"} + efi_no_storage_paranoia [EFI; X86] + Using this parameter you can use more than 50% of + your efi variable storage. Use this parameter only if + you are really sure that your UEFI does sane gc and + fulfills the spec otherwise your board may brick. + eisa_irq_edge= [PARISC,HW] See header of drivers/parisc/eisa.c.
arch/x86/platform/efi/efi.c +13 -1
@@ -101,6 +101,15 @@ static int __init setup_add_efi_memmap(c }early_param ("add_efi_memmap" , setup_add_efi_memmap); +static bool efi_no_storage_paranoia; + +static int __init setup_storage_paranoia (char *arg) +{ + efi_no_storage_paranoia = true; +return 0 ; +} +early_param ("efi_no_storage_paranoia" , setup_storage_paranoia); +static efi_status_t virt_efi_get_time (efi_time_t *tm,efi_time_cap_t *tc) {
@@ -839,7 +848,10 @@ efi_status_t efi_query_variable_store(u3 " is returning MaxVariableSize=0\n");if (!storage_size || size > remaining_size || - (max_size && size > max_size) || + (max_size && size > max_size)) +return EFI_OUT_OF_RESOURCES ; + +if (!efi_no_storage_paranoia && (remaining_size - size) < (storage_size /2 ))return EFI_OUT_OF_RESOURCES ;
PATCH 80/94 tcp: force a dst refcount when prequeue packet
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 093162553c33e9479283e107b4431378271c735d ]
Before escaping RCU protected section and adding packet into prequeue, make sure the dst is refcounted.
--- include/net/tcp.h | 1 + 1 file changed, 1 insertion(+)
include/net/tcp.h +1 -0
@@ -931,6 +931,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)if (sysctl_tcp_low_latency || !tp->ucopy.task)return 0 ; +skb_dst_force (skb);__skb_queue_tail (&tp->ucopy.prequeue, skb); tp->ucopy.memory += skb->truesize;if (tp->ucopy.memory > sk->sk_rcvbuf) {
PATCH 81/94 3c509.c: call SET_NETDEV_DEV for all device types (ISA/ISAPnP/EISA)
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Whitehead <[email protected]>
[ Upstream commit 3b54912f9cd167641b91d4a697bd742f70e534fe ]
The venerable 3c509 driver only sets its device parent in one case, the ISAPnP one. It does this with the SET_NETDEV_DEV function. It should register with the device hierarchy in two additional cases: standard (non-PnP) ISA and EISA.
- Currently they appear here:/sys/devices/virtual/net/eth0 (standard ISA)/sys/devices/virtual/net/eth1 (EISA)
- Rather, they should instead be here:/sys/devices/isa/3c509.0/net/eth0 (standard ISA) /sys/devices/pci0000:00/0000:00:07.0/00:04/net/eth1 (EISA)
Tested on ISA and EISA boards.
--- drivers/net/ethernet/3com/3c509.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/3com/3c509.c +2 -0
@@ -309,6 +309,7 @@ static int __devinit el3_isa_match(struct device *pdev,if (!dev)return -ENOMEM ; +SET_NETDEV_DEV (dev, pdev);netdev_boot_setup_check (dev);if (!request_region (ioaddr,EL3_IO_EXTENT ,"3c509-isa" )) {
@@ -704,6 +705,7 @@ static int __init el3_eisa_probe (struct device *device)return -ENOMEM ; } +SET_NETDEV_DEV (dev, device);netdev_boot_setup_check (dev);el3_dev_fill (dev, phys_addr, ioaddr, irq, if_port,EL3_EISA );
PATCH 82/94 net_sched: act_ipt forward compat with xtables
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 0dcffd09641f3abb21ac5cabc61542ab289d1a3c ]
Deal with changes in newer xtables while maintaining backward compatibility. Thanks to Jan Engelhardt for suggestions.
--- net/sched/act_ipt.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
net/sched/act_ipt.c +30 -3
@@ -8,7 +8,7 @@* as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * -* Copyright: Jamal Hadi Salim (2002-4) +* Copyright: Jamal Hadi Salim (2002-13) */ #include <linux/types.h>
@@ -299,17 +299,44 @@ static struct tc_action_ops act_ipt_ops = { .walk = tcf_generic_walker }; -MODULE_AUTHOR ("Jamal Hadi Salim(2002-4)" ); +static struct tc_action_ops act_xt_ops = { + .kind ="xt" , + .hinfo = &ipt_hash_info, + .type =TCA_ACT_IPT , + .capab =TCA_CAP_NONE , + .owner =THIS_MODULE , + .act = tcf_ipt, + .dump = tcf_ipt_dump, + .cleanup = tcf_ipt_cleanup, + .lookup = tcf_hash_search, + .init = tcf_ipt_init, + .walk = tcf_generic_walker +}; + +MODULE_AUTHOR ("Jamal Hadi Salim(2002-13)" );MODULE_DESCRIPTION ("Iptables target actions" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("act_xt" );static int __init ipt_init_module (void ) { -return tcf_register_action (&act_ipt_ops); +int ret1, ret2; + ret1 =tcf_register_action (&act_xt_ops); +if (ret1 <0 ) +printk ("Failed to load xt action\n" ); + ret2 =tcf_register_action (&act_ipt_ops); +if (ret2 <0 ) +printk ("Failed to load ipt action\n" ); + +if (ret1 <0 && ret2 <0 ) +return ret1; +else +return 0 ; } static void __exit ipt_cleanup_module(void) { +tcf_unregister_action (&act_xt_ops);tcf_unregister_action (&act_ipt_ops); }
PATCH 83/94 bridge: fix race with topology change timer
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: stephen hemminger <[email protected]>
[ Upstream commit 83401eb4990ff6af55aeed8f49681558544192e6 ]
A bridge should only send topology change notice if it is not the root bridge. It is possible for message age timer to elect itself as a new root bridge, and still have a topology change timer running but waiting for bridge lock on other CPU.
Solve the race by checking if we are root bridge before continuing. This was the root cause of the cases where br_send_tcn_bpdu would OOPS.
--- net/bridge/br_stp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_stp_timer.c +1 -1
@@ -107,7 +107,7 @@ static void br_tcn_timer_expired(unsigned long arg)br_debug (br,"tcn timer expired\n" );spin_lock (&br->lock); -if (br->dev->flags &IFF_UP ) { +if (!br_is_root_bridge (br) && (br->dev->flags &IFF_UP )) {br_transmit_tcn (br);mod_timer (&br->tcn_timer,jiffies + br->bridge_hello_time);
PATCH 84/94 packet: tpacket_v3: do not trigger bug() on wrong header status
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 8da3056c04bfc5f69f840ab038a38389e2de8189 ]
Jakub reported that it is fairly easy to trigger the BUG() macro from user space with TPACKET_V3's RX_RING by just giving a wrong header status flag. We already had a similar situation in commit 7f5c3e3a80e6654 (``af_packet: remove BUG statement in tpacket_destruct_skb'') where this was the case in the TX_RING side that could be triggered from user space. So really, don't use BUG() or BUG_ON() unless there's really no way out, and i.e. don't use it for consistency checking when there's user space involved, no excuses, especially not if you're slapping the user with WARN + dump_stack + BUG all at once. The two functions are of concern:
prb_retire_current_block() [when block status != TP_STATUS_KERNEL] prb_open_block() [when block_status != TP_STATUS_KERNEL]
Calls to prb_open_block() are guarded by ealier checks if block_status is really TP_STATUS_KERNEL (racy!), but the first one BUG() is easily triggable from user space. System behaves still stable after they are removed. Also remove that yoda condition entirely, since it's already guarded.
--- net/packet/af_packet.c | 54 +++++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 34 deletions(-)
net/packet/af_packet.c +20 -34
@@ -813,37 +813,27 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1,smp_rmb (); -if (likely (TP_STATUS_KERNEL ==BLOCK_STATUS (pbd1))) { - -/* We could have just memset this but we will lose the -* flexibility of making the priv area sticky -*/ -BLOCK_SNUM (pbd1) = pkc1->knxt_seq_num++; -BLOCK_NUM_PKTS (pbd1) =0 ; -BLOCK_LEN (pbd1) =BLK_PLUS_PRIV (pkc1->blk_sizeof_priv); -getnstimeofday (&ts); - h1->ts_first_pkt.ts_sec = ts.tv_sec; - h1->ts_first_pkt.ts_nsec = ts.tv_nsec; - pkc1->pkblk_start = (char *)pbd1; - pkc1->nxt_offset = (char *)(pkc1->pkblk_start + -BLK_PLUS_PRIV (pkc1->blk_sizeof_priv)); -BLOCK_O2FP (pbd1) = (__u32 )BLK_PLUS_PRIV (pkc1->blk_sizeof_priv); -BLOCK_O2PRIV (pbd1) =BLK_HDR_LEN ; - pbd1->version = pkc1->version; - pkc1->prev = pkc1->nxt_offset; - pkc1->pkblk_end = pkc1->pkblk_start + pkc1->kblk_size; -prb_thaw_queue (pkc1); -_prb_refresh_rx_retire_blk_timer (pkc1); - -smp_wmb (); - -return ; - } +/* We could have just memset this but we will lose the +* flexibility of making the priv area sticky +*/ +BLOCK_SNUM (pbd1) = pkc1->knxt_seq_num++; +BLOCK_NUM_PKTS (pbd1) =0 ; +BLOCK_LEN (pbd1) =BLK_PLUS_PRIV (pkc1->blk_sizeof_priv); +getnstimeofday (&ts); + h1->ts_first_pkt.ts_sec = ts.tv_sec; + h1->ts_first_pkt.ts_nsec = ts.tv_nsec; + pkc1->pkblk_start = (char *)pbd1; + pkc1->nxt_offset = (char *)(pkc1->pkblk_start + +BLK_PLUS_PRIV (pkc1->blk_sizeof_priv)); +BLOCK_O2FP (pbd1) = (__u32 )BLK_PLUS_PRIV (pkc1->blk_sizeof_priv); +BLOCK_O2PRIV (pbd1) =BLK_HDR_LEN ; + pbd1->version = pkc1->version; + pkc1->prev = pkc1->nxt_offset; + pkc1->pkblk_end = pkc1->pkblk_start + pkc1->kblk_size; +prb_thaw_queue (pkc1); +_prb_refresh_rx_retire_blk_timer (pkc1); -WARN (1 ,"ERROR block:%p is NOT FREE status:%d kactive_blk_num:%d\n" , - pbd1,BLOCK_STATUS (pbd1), pkc1->kactive_blk_num); -dump_stack (); -BUG (); +smp_wmb (); }/*
@@ -934,10 +924,6 @@ static void prb_retire_current_block(struct tpacket_kbdq_core *pkc,prb_close_block (pkc, pbd, po, status);return ; } - -WARN (1 ,"ERROR-pbd[%d]:%p\n" , pkc->kactive_blk_num, pbd); -dump_stack (); -BUG (); } static int prb_curr_blk_in_use(struct tpacket_kbdq_core *pkc,
PATCH 85/94 3c59x: fix freeing nonexistent resource on driver unload
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
[ Upstream commit c81400be716aa4c76f6ebf339ba94358dbbf6da6 ]
When unloading the driver that drives an EISA board, a message similar to the following one is displayed:
Trying to free nonexistent resource <0000000000013000-000000000001301f>
Then an user is unable to reload the driver because the resource it requested in the previous load hasn't been freed. This happens most probably due to a typo in vortex_eisa_remove() which calls release_region() with 'dev->base_addr' instead of 'edev->base_addr'...
--- drivers/net/ethernet/3com/3c59x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/3com/3c59x.c +1 -1
@@ -951,7 +951,7 @@ static int __devexit vortex_eisa_remove(struct device *device)unregister_netdev (dev);iowrite16 (TotalReset|0x14 , ioaddr +EL3_CMD ); -release_region (dev->base_addr,VORTEX_TOTAL_SIZE ); +release_region (edev->base_addr,VORTEX_TOTAL_SIZE );free_netdev (dev);return 0 ;
PATCH 86/94 3c59x: fix PCI resource management
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Shtylyov <[email protected]>
[ Upstream commit 4b264a1676e70dc656ba53a8cac690f2d4b65f4e ]
The driver wrongly claimed I/O ports at an address returned by pci_iomap() -- even if it was passed an MMIO address. Fix this by claiming/releasing all PCI resources in the PCI driver's probe()/remove() methods instead and get rid of 'must_free_region' flag weirdness (why would Cardbus claim anything for us?).
--- drivers/net/ethernet/3com/3c59x.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/net/ethernet/3com/3c59x.c +13 -12
@@ -632,7 +632,6 @@ struct vortex_private { pm_state_valid:1, /* pci_dev->saved_config_space has sane contents */ open:1, medialock:1, - must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ large_frames:1, /* accept large frames */ handling_irq:1; /* private in_irq indicator *//* {get|set}_wol operations are already serialized by rtnl.
@@ -1012,6 +1011,12 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,if (rc <0 ) goto out; + rc =pci_request_regions (pdev,DRV_NAME ); +if (rc <0 ) { +pci_disable_device (pdev); + goto out; + } + unit = vortex_cards_found;if (global_use_mmio <0 && (unit >=MAX_UNITS || use_mmio[unit] <0 )) {
@@ -1027,6 +1032,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,if (!ioaddr)/* If mapping fails, fall-back to BAR 0... */ ioaddr =pci_iomap (pdev,0 ,0 );if (!ioaddr) { +pci_release_regions (pdev);pci_disable_device (pdev); rc = -ENOMEM ; goto out;
@@ -1036,6 +1042,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev, ent->driver_data, unit);if (rc <0 ) {pci_iounmap (pdev, ioaddr); +pci_release_regions (pdev);pci_disable_device (pdev); goto out; }
@@ -1180,11 +1187,6 @@ static int __devinit vortex_probe1(struct device *gendev,/* PCI-only startup logic */ if (pdev) { -/* EISA resources already marked, so only PCI needs to do this here */ -/* Ignore return value, because Cardbus drivers already allocate for us */ -if (request_region (dev->base_addr, vci->io_size, print_name) !=NULL ) - vp->must_free_region =1 ; -/* enable bus-mastering if necessary */ if (vci->flags &PCI_USES_MASTER )pci_set_master (pdev);
@@ -1222,7 +1224,7 @@ static int __devinit vortex_probe1(struct device *gendev, &vp->rx_ring_dma); retval = -ENOMEM ;if (!vp->rx_ring) - goto free_region; + goto free_device; vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring +RX_RING_SIZE ); vp->tx_ring_dma = vp->rx_ring_dma +sizeof (struct boom_rx_desc ) *RX_RING_SIZE ;
@@ -1487,9 +1489,7 @@ free_ring: +sizeof (struct boom_tx_desc ) *TX_RING_SIZE , vp->rx_ring, vp->rx_ring_dma); -free_region: -if (vp->must_free_region) -release_region (dev->base_addr, vci->io_size); +free_device:free_netdev (dev);pr_err (PFX "vortex_probe1 fails. Returns %d\n" , retval); out:
@@ -3254,8 +3254,9 @@ static void __devexit vortex_remove_one(struct pci_dev *pdev) +sizeof (struct boom_tx_desc ) *TX_RING_SIZE , vp->rx_ring, vp->rx_ring_dma); -if (vp->must_free_region) -release_region (dev->base_addr, vp->io_size); + +pci_release_regions (pdev); +free_netdev (dev); }
PATCH 87/94 if_cablemodem.h: Add parenthesis around ioctl macros
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Josh Boyer <[email protected]>
[ Upstream commit 4f924b2aa4d3cb30f07e57d6b608838edcbc0d88 ]
Protect the SIOCGCM* ioctl macros with parenthesis.
--- include/linux/if_cablemodem.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/linux/if_cablemodem.h +6 -6
@@ -12,11 +12,11 @@*/ /* some useful defines for sb1000.c e cmconfig.c - fv */ -#define SIOCGCMSTATS SIOCDEVPRIVATE+0/* get cable modem stats */ -#define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1/* get cm firmware version */ -#define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2/* get cable modem frequency */ -#define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3/* set cable modem frequency */ -#define SIOCGCMPIDS SIOCDEVPRIVATE+4/* get cable modem PIDs */ -#define SIOCSCMPIDS SIOCDEVPRIVATE+5/* set cable modem PIDs */ +#define SIOCGCMSTATS (SIOCDEVPRIVATE+0)/* get cable modem stats */ +#define SIOCGCMFIRMWARE (SIOCDEVPRIVATE+1)/* get cm firmware version */ +#define SIOCGCMFREQUENCY (SIOCDEVPRIVATE+2)/* get cable modem frequency */ +#define SIOCSCMFREQUENCY (SIOCDEVPRIVATE+3)/* set cable modem frequency */ +#define SIOCGCMPIDS (SIOCDEVPRIVATE+4)/* get cable modem PIDs */ +#define SIOCSCMPIDS (SIOCDEVPRIVATE+5)/* set cable modem PIDs */ #endif
PATCH 88/94 macvlan: fix passthru mode race between dev removal and rx path
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 233c7df0821c4190e2d3f4be0f2ca0ab40a5ed8c, note
that I had to add list_first_or_null_rcu to rculist.h in order to accomodate this fix. ]
Currently, if macvlan in passthru mode is created and data are rxed and you remove this device, following panic happens:
NULL pointer dereference at 0000000000000198
IP: [<ffffffffa0196058>] macvlan_handle_frame+0x153/0x1f7 [macvlan]
I'm using following script to trigger this:
<script>
while [ 1 ]
do
ip link add link e1 name macvtap0 type macvtap mode passthru ip link set e1 up
ip link set macvtap0 up
IFINDEX=ip link |grep macvtap0 | cut -f 1 -d ':' cat /dev/tap$IFINDEX >/dev/null &
ip link del dev macvtap0
done
</script>
I run this script while "ping -f" is running on another machine to send packets to e1 rx.
Reason of the panic is that list_first_entry() is blindly called in macvlan_handle_frame() even if the list was empty. vlan is set to incorrect pointer which leads to the crash.
I'm fixing this by protecting port->vlans list by rcu and by preventing from getting incorrect pointer in case the list is empty.
Introduced by: commit eb06acdc85585f2 "macvlan: Introduce 'passthru' mode to takeover the underlying device"
--- drivers/net/macvlan.c | 7 ++++--- include/linux/rculist.h | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-)
drivers/net/macvlan.c +4 -3
@@ -204,7 +204,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) }if (port->passthru) - vlan = list_first_entry(&port->vlans, struct macvlan_dev, list); + vlan =list_first_or_null_rcu (&port->vlans, + struct macvlan_dev, list);else vlan =macvlan_hash_lookup (port, eth->h_dest);if (vlan ==NULL )
@@ -725,7 +726,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,if (err <0 ) goto destroy_port; -list_add_tail (&vlan->list, &port->vlans); +list_add_tail_rcu (&vlan->list, &port->vlans);netif_stacked_transfer_operstate (lowerdev, dev);return 0 ;
@@ -751,7 +752,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) {struct macvlan_dev *vlan =netdev_priv (dev); -list_del (&vlan->list); +list_del_rcu (&vlan->list);unregister_netdevice_queue (dev, head); }EXPORT_SYMBOL_GPL (macvlan_dellink);
include/linux/rculist.h +17 -0
@@ -242,6 +242,23 @@ static inline void list_splice_init_rcu(struct list_head *list,list_entry_rcu ((ptr)->next, type, member)/** +* list_first_or_null_rcu - get the first element from a list +* @ptr: the list head to take the element from. +* @type: the type of the struct this is embedded in. +* @member: the name of the list_struct within the struct. +* +* Note that if the list is empty, it returns NULL. +* +* This primitive may safely run concurrently with the _rcu list-mutation +* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). + */ +#define list_first_or_null_rcu (ptr, type, member) \ + ({struct list_head *__ptr = (ptr); \ + struct list_head __rcu *__next = list_next_rcu(__ptr); \ + likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \ + }) + +/** * list_for_each_entry_rcu - iterate over rcu list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list.
PATCH 89/94 ipv6: do not clear pinet6 field
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f77d602124d865c38705df7fa25c03de9c284ad2 ]
We have seen multiple NULL dereferences in __inet6_lookup_established()
After analysis, I found that inet6_sk() could be NULL while the check for sk_family == AF_INET6 was true.
Bug was added in linux-2.6.29 when RCU lookups were introduced in UDP and TCP stacks.
Once an IPv6 socket, using SLAB_DESTROY_BY_RCU is inserted in a hash table, we no longer can clear pinet6 field.
This patch extends logic used in commit fcbdf09d9652c891 ("net: fix nulls list corruptions in sk_prot_alloc")
TCP/UDP/UDPLite IPv6 protocols provide their own .clear_sk() method to make sure we do not clear pinet6 field.
At socket clone phase, we do not really care, as cloning the parent (non NULL) pinet6 is not adding a fatal race.
--- include/net/sock.h | 12 ++++++++++++ net/core/sock.c | 12 ------------ net/ipv6/tcp_ipv6.c | 12 ++++++++++++ net/ipv6/udp.c | 13 ++++++++++++- net/ipv6/udp_impl.h | 2 ++ net/ipv6/udplite.c | 2 +- 6 files changed, 39 insertions(+), 14 deletions(-)
include/net/sock.h +12 -0
@@ -734,6 +734,18 @@ struct inet_hashinfo;struct raw_hashinfo ;struct module ; +/* +* caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes +* un-modified. Special care is taken when initializing object to zero. +*/ +static inline void sk_prot_clear_nulls (struct sock *sk,int size) +{ + if (offsetof(struct sock, sk_node.next) != 0) + memset(sk, 0, offsetof(struct sock, sk_node.next)); +memset (&sk->sk_node.pprev,0 , + size - offsetof(struct sock, sk_node.pprev)); +} +/* Networking protocol blocks we attach to sockets. * socket layer -> transport layer interface * transport -> network interface is defined by struct inet_proto
net/core/sock.c +0 -12
@@ -1021,18 +1021,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk)#endif } -/* -* caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes -* un-modified. Special care is taken when initializing object to zero. -*/ -static inline void sk_prot_clear_nulls (struct sock *sk,int size) -{ - if (offsetof(struct sock, sk_node.next) != 0) - memset(sk, 0, offsetof(struct sock, sk_node.next)); -memset (&sk->sk_node.pprev,0 , - size - offsetof(struct sock, sk_node.pprev)); -} -void sk_prot_clear_portaddr_nulls (struct sock *sk,int size) {unsigned long nulls1, nulls2;
net/ipv6/tcp_ipv6.c +12 -0
@@ -2196,6 +2196,17 @@ void tcp6_proc_exit(struct net *net) }#endif +static void tcp_v6_clear_sk (struct sock *sk,int size) +{ +struct inet_sock *inet =inet_sk (sk); + +/* we do not want to clear pinet6 field, because of RCU lookups */ +sk_prot_clear_nulls (sk, offsetof(struct inet_sock , pinet6)); + + size -= offsetof(struct inet_sock , pinet6) +sizeof (inet->pinet6); +memset (&inet->pinet6 +1 ,0 , size); +} +struct proto tcpv6_prot = { .name ="TCPv6" , .owner =THIS_MODULE ,
@@ -2235,6 +2246,7 @@ struct proto tcpv6_prot = { .compat_setsockopt = compat_tcp_setsockopt, .compat_getsockopt = compat_tcp_getsockopt, #endif + .clear_sk = tcp_v6_clear_sk, }; static const struct inet6_protocol tcpv6_protocol = {
net/ipv6/udp.c +12 -1
@@ -1453,6 +1453,17 @@ void udp6_proc_exit(struct net *net) { }#endif /* CONFIG_PROC_FS */ +void udp_v6_clear_sk (struct sock *sk,int size) +{ +struct inet_sock *inet =inet_sk (sk); + +/* we do not want to clear pinet6 field, because of RCU lookups */ +sk_prot_clear_portaddr_nulls (sk, offsetof(struct inet_sock , pinet6)); + + size -= offsetof(struct inet_sock , pinet6) +sizeof (inet->pinet6); +memset (&inet->pinet6 +1 ,0 , size); +} +/* ------------------------------------------------------------------------ */ struct proto udpv6_prot = {
@@ -1483,7 +1494,7 @@ struct proto udpv6_prot = { .compat_setsockopt = compat_udpv6_setsockopt, .compat_getsockopt = compat_udpv6_getsockopt, #endif - .clear_sk = sk_prot_clear_portaddr_nulls, + .clear_sk = udp_v6_clear_sk, }; static struct inet_protosw udpv6_protosw = {
net/ipv6/udp_impl.h +2 -0
@@ -31,6 +31,8 @@ extern int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,extern int udpv6_queue_rcv_skb (struct sock * sk,struct sk_buff *skb);extern void udpv6_destroy_sock (struct sock *sk); +extern void udp_v6_clear_sk (struct sock *sk,int size); +#ifdef CONFIG_PROC_FS extern int udp6_seq_show (struct seq_file *seq,void *v);#endif
net/ipv6/udplite.c +1 -1
@@ -56,7 +56,7 @@ struct proto udplitev6_prot = { .compat_setsockopt = compat_udpv6_setsockopt, .compat_getsockopt = compat_udpv6_getsockopt, #endif - .clear_sk = sk_prot_clear_portaddr_nulls, + .clear_sk = udp_v6_clear_sk, }; static struct inet_protosw udplite6_protosw = {
PATCH 90/94 xfrm6: release dev before returning error
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 84c4a9dfbf430861e7588d95ae3ff61535dca351 ]
We forget to call dev_put() on error path in xfrm6_fill_dst(), its caller doesn't handle this.
--- net/ipv6/xfrm6_policy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/xfrm6_policy.c +3 -1
@@ -96,8 +96,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,dev_hold (dev); xdst->u.rt6.rt6i_idev =in6_dev_get (dev); -if (!xdst->u.rt6.rt6i_idev) +if (!xdst->u.rt6.rt6i_idev) { +dev_put (dev);return -ENODEV ; + } xdst->u.rt6.rt6i_peer = rt->rt6i_peer;if (rt->rt6i_peer)
PATCH 91/94 drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 35623715818dfa720cccf99cd280dcbb4b78da23 upstream.
Fix to return -ENODEV in the chip not found error handling case instead of 0, as done elsewhere in this function.
--- drivers/rtc/rtc-pcf2123.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/rtc-pcf2123.c +1 -0
@@ -264,6 +264,7 @@ static int __devinit pcf2123_probe(strucif (!(rxbuf[0 ] &0x20 )) {dev_err (&spi->dev,"chip not found\n" ); + ret = -ENODEV ; goto kfree_exit; }
PATCH 92/94 mantis: fix silly crash case
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit e1d45ae10aea8e8a403e5d96bf5902ee670007ff upstream.
If we set mantis->fe to NULL on an error its not a good idea to then try passing NULL to the unregister paths and oopsing really.
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=16473
--- drivers/media/dvb/mantis/mantis_dvb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/dvb/mantis/mantis_dvb.c +4 -2
@@ -248,8 +248,10 @@ int __devinit mantis_dvb_init(struct man err5:tasklet_kill (&mantis->tasklet);dvb_net_release (&mantis->dvbnet); -dvb_unregister_frontend (mantis->fe); -dvb_frontend_detach (mantis->fe); +if (mantis->fe) { +dvb_unregister_frontend (mantis->fe); +dvb_frontend_detach (mantis->fe); + } err4: mantis->demux.dmx.remove_frontend (&mantis->demux.dmx, &mantis->fe_mem);
PATCH 93/94 staging: comedi: prevent auto-unconfig of manually configured devices
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 7d3135af399e92cf4c9bbc5f86b6c140aab3b88c upstream.
When a low-level comedi driver auto-configures a device, a struct comedi_dev_file_info is allocated (as well as a struct comedi_device) by comedi_alloc_board_minor(). A pointer to the hardware struct device is stored as a cookie in the struct comedi_dev_file_info. When the low-level comedi driver auto-unconfigures the device, comedi_auto_unconfig() uses the cookie to find the struct comedi_dev_file_info so it can detach the comedi device from the driver, clean it up and free it.
A problem arises if the user manually unconfigures and reconfigures the comedi device using the COMEDI_DEVCONFIG ioctl so that is no longer associated with the original hardware device. The problem is that the cookie is not cleared, so that a call to comedi_auto_unconfig() from the low-level driver will still find it, detach it, clean it up and free it.
Stop this problem occurring by always clearing the hardware_device cookie in the struct comedi_dev_file_info whenever the COMEDI_DEVCONFIG ioctl call is successful.
--- drivers/staging/comedi/comedi_fops.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/comedi/comedi_fops.c +3 -0
@@ -143,6 +143,9 @@ static long comedi_unlocked_ioctl(struct } rc =do_devconfig_ioctl (dev, (struct comedi_devconfig __user *)arg); +if (rc ==0 ) +/* Evade comedi_auto_unconfig(). */ + dev_file_info->hardware_device =NULL ; goto done; }
PATCH 94/94 um: Serve io_remap_pfn_range()
In reply to Ben Hutchings3.2.46-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
commit 4d94d6d030adfdea4837694d293ec6918d133ab2 upstream.
At some places io_remap_pfn_range() is needed.
UML has to serve it like all other archs do.
--- arch/um/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+)
arch/um/include/asm/pgtable.h +2 -0
@@ -69,6 +69,8 @@ extern unsigned long end_iomem;#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) +#define io_remap_pfn_range remap_pfn_range +/* * The i386 can't do page protection for execute, and considers that the same * are read.
This is the combined patch for 3.2.46-rc1 relative to 3.2.45.
Ben.
Signature · 2 lines
Ben Hutchings If at first you don't succeed, you're doing about average.
Documentation/kernel-parameters.txt +6 -0
@@ -734,6 +734,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. edd= [EDD] Format: {"off" | "on" | "skip[mbr]"} + efi_no_storage_paranoia [EFI; X86] + Using this parameter you can use more than 50% of + your efi variable storage. Use this parameter only if + you are really sure that your UEFI does sane gc and + fulfills the spec otherwise your board may brick. + eisa_irq_edge= [PARISC,HW] See header of drivers/parisc/eisa.c.
Makefile +2 -2
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 2 -SUBLEVEL = 45 -EXTRAVERSION = +SUBLEVEL = 46 +EXTRAVERSION = -rc1 NAME = Saber-toothed Squirrel # *DOCUMENTATION*
arch/arm/configs/at91sam9g45_defconfig +0 -1
@@ -173,7 +173,6 @@ CONFIG_MMC=y # CONFIG_MMC_BLOCK_BOUNCE is not set CONFIG_SDIO_UART=m CONFIG_MMC_ATMELMCI=y -CONFIG_MMC_ATMELMCI_DMA=y CONFIG_LEDS_ATMEL_PWM=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGER_TIMER=y
arch/arm/mach-kirkwood/ts219-setup.c +1 -1
@@ -124,7 +124,7 @@ static void __init qnap_ts219_init(void)static int __init ts219_pci_init (void ) {if (machine_is_ts219 ()) -kirkwood_pcie_init (KW_PCIE0 ); +kirkwood_pcie_init (KW_PCIE1 |KW_PCIE0 );return 0 ; }
arch/arm/plat-orion/common.c +6 -6
@@ -347,7 +347,7 @@ static struct resource orion_ge10_shared_resources[] = {static struct platform_device orion_ge10_shared = { .name =MV643XX_ETH_SHARED_NAME , - .id =1 , + .id =2 , .dev = { .platform_data = &orion_ge10_shared_data, },
@@ -362,8 +362,8 @@ static struct resource orion_ge10_resources[] = {static struct platform_device orion_ge10 = { .name =MV643XX_ETH_NAME , - .id =1 , - .num_resources =2 , + .id =2 , + .num_resources =1 , .resource = orion_ge10_resources, .dev = { .coherent_dma_mask =DMA_BIT_MASK (32 ),
@@ -401,7 +401,7 @@ static struct resource orion_ge11_shared_resources[] = {static struct platform_device orion_ge11_shared = { .name =MV643XX_ETH_SHARED_NAME , - .id =1 , + .id =3 , .dev = { .platform_data = &orion_ge11_shared_data, },
@@ -416,8 +416,8 @@ static struct resource orion_ge11_resources[] = {static struct platform_device orion_ge11 = { .name =MV643XX_ETH_NAME , - .id =1 , - .num_resources =2 , + .id =3 , + .num_resources =1 , .resource = orion_ge11_resources, .dev = { .coherent_dma_mask =DMA_BIT_MASK (32 ),
arch/avr32/configs/favr-32_defconfig +0 -1
@@ -122,7 +122,6 @@ CONFIG_USB_G_SERIAL=m CONFIG_USB_CDC_COMPOSITE=m CONFIG_MMC=y CONFIG_MMC_ATMELMCI=y -CONFIG_MMC_ATMELMCI_DMA=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_ATMEL_PWM=m
arch/avr32/configs/merisc_defconfig +0 -1
@@ -102,7 +102,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_LOGO=y CONFIG_MMC=y CONFIG_MMC_ATMELMCI=y -CONFIG_MMC_ATMELMCI_DMA=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_ATMEL_PWM=y
arch/avr32/kernel/module.c +1 -1
@@ -264,7 +264,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,break ;case R_AVR32_GOT18SW :if ((relocation &0xfffe0003 ) !=0 - && (relocation &0xfffc0003 ) !=0xffff0000 ) + && (relocation &0xfffc0000 ) !=0xfffc0000 )return reloc_overflow (module,"R_AVR32_GOT18SW" , relocation); relocation >>=2 ;
arch/powerpc/include/asm/rtas.h +2 -0
@@ -230,6 +230,8 @@ extern void rtas_progress(char *s, unsigned short hex);extern void rtas_initialize (void );extern int rtas_suspend_cpu (struct rtas_suspend_me_data *data);extern int rtas_suspend_last_cpu (struct rtas_suspend_me_data *data); +extern int rtas_online_cpus_mask (cpumask_var_t cpus); +extern int rtas_offline_cpus_mask (cpumask_var_t cpus);extern int rtas_ibm_suspend_me (struct rtas_args *);struct rtc_time ;
arch/powerpc/kernel/rtas.c +116 -2
166 lines not on this page · raw message
arch/powerpc/platforms/pseries/suspend.c +27 -1
@@ -16,6 +16,7 @@* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <linux/cpu.h> #include <linux/delay.h> #include <linux/suspend.h> #include <linux/stat.h>
@@ -24,6 +25,7 @@#include <asm/machdep.h> #include <asm/mmu.h> #include <asm/rtas.h> +#include <asm/topology.h> static u64 stream_id;static struct sys_device suspend_sysdev;
@@ -125,11 +127,15 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,struct sysdev_class_attribute *attr, const char *buf, size_t count) { + cpumask_var_t offline_mask;int rc;if (!capable (CAP_SYS_ADMIN ))return -EPERM ; +if (!alloc_cpumask_var (&offline_mask,GFP_TEMPORARY )) +return -ENOMEM ; + stream_id =simple_strtoul (buf,NULL ,16 ); do {
@@ -138,13 +144,33 @@ static ssize_t store_hibernate(struct sysdev_class *classdev,ssleep (1 ); }while (rc == -EAGAIN ); -if (!rc) +if (!rc) { +/* All present CPUs must be online */ +cpumask_andnot (offline_mask, cpu_present_mask, + cpu_online_mask); + rc =rtas_online_cpus_mask (offline_mask); +if (rc) { +pr_err ("%s: Could not bring present CPUs online.\n" , + __func__); + goto out; + } + +stop_topology_update (); rc =pm_suspend (PM_SUSPEND_MEM ); +start_topology_update (); + +/* Take down CPUs not online prior to suspend */ +if (!rtas_offline_cpus_mask (offline_mask)) +pr_warn ("%s: Could not restore CPUs to offline " +"state.\n" , __func__); + } stream_id =0 ;if (!rc) rc = count; +out: +free_cpumask_var (offline_mask);return rc; }
arch/um/include/asm/pgtable.h +2 -0
@@ -69,6 +69,8 @@ extern unsigned long end_iomem;#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) +#define io_remap_pfn_range remap_pfn_range +/* * The i386 can't do page protection for execute, and considers that the same * are read.
arch/x86/kernel/irq.c +0 -4
@@ -160,10 +160,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)u64 arch_irq_stat (void ) {u64 sum =atomic_read (&irq_err_count); - -#ifdef CONFIG_X86_IO_APIC - sum +=atomic_read (&irq_mis_count); -#endif return sum; }
arch/x86/kvm/vmx.c +6 -0
@@ -4882,6 +4882,12 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)if (err !=EMULATE_DONE )return 0 ; +if (vcpu->arch.halt_request) { + vcpu->arch.halt_request =0 ; + ret =kvm_emulate_halt (vcpu); + goto out; + } +if (signal_pending (current)) goto out;if (need_resched ())
arch/x86/platform/efi/efi.c +43 -0
52 lines not on this page · raw message
arch/x86/xen/enlighten.c +15 -0
@@ -129,6 +129,21 @@ static void xen_vcpu_setup(int cpu)BUG_ON (HYPERVISOR_shared_info == &xen_dummy_shared_info); +/* +* This path is called twice on PVHVM - first during bootup via +* smp_init -> xen_hvm_cpu_notify, and then if the VCPU is being +* hotplugged: cpu_up -> xen_hvm_cpu_notify. +* As we can only do the VCPUOP_register_vcpu_info once lets +* not over-write its result. +* +* For PV it is called during restore (xen_vcpu_restore) and bootup +* (xen_setup_vcpu_info_placement). The hotplug mechanism does not +* use this function. +*/ +if (xen_hvm_domain ()) { +if (per_cpu (xen_vcpu, cpu) == &per_cpu (xen_vcpu_info, cpu)) +return ; + }if (cpu <MAX_VIRT_CPUS )per_cpu (xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
drivers/acpi/acpica/exfldio.c +13 -1
@@ -702,7 +702,19 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,if ((obj_desc->common_field.start_field_bit_offset ==0 ) && (obj_desc->common_field.bit_length == access_bit_width)) { - status =acpi_ex_field_datum_io (obj_desc,0 , buffer,ACPI_READ ); +if (buffer_length >=sizeof (u64)) { + status = +acpi_ex_field_datum_io (obj_desc,0 , buffer, +ACPI_READ ); + }else { +/* Use raw_datum (u64) to handle buffers < 64 bits */ + + status = +acpi_ex_field_datum_io (obj_desc,0 , &raw_datum, +ACPI_READ ); +ACPI_MEMCPY (buffer, &raw_datum, buffer_length); + } +return_ACPI_STATUS (status); }
drivers/acpi/ec.c +1 -3
@@ -217,7 +217,7 @@ static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)static int ec_poll (struct acpi_ec *ec) {unsigned long flags; -int repeat =2 ;/* number of command restarts */ +int repeat =5 ;/* number of command restarts */ while (repeat--) {unsigned long delay = jiffies +msecs_to_jiffies (ec_delay);
@@ -235,8 +235,6 @@ static int ec_poll(struct acpi_ec *ec) }advance_transaction (ec,acpi_ec_read_status (ec)); }while (time_before (jiffies, delay)); -if (acpi_ec_read_status (ec) &ACPI_EC_FLAG_IBF ) -break ;pr_debug (PREFIX "controller reset, restart transaction\n" );spin_lock_irqsave (&ec->curr_lock, flags);start_transaction (ec);
drivers/acpi/video_detect.c +8 -0
@@ -164,6 +164,14 @@ static struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "UL30VT"), }, }, + { + .callback = video_detect_force_vendor, + .ident = "Asus UL30A", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), + }, + }, { }, };
drivers/block/brd.c +2 -2
@@ -117,13 +117,13 @@ static struct page *brd_insert_page(struct brd_device *brd, sector_t sector)spin_lock (&brd->brd_lock); idx = sector >>PAGE_SECTORS_SHIFT ; + page->index = idx;if (radix_tree_insert (&brd->brd_pages, idx, page)) {__free_page (page); page =radix_tree_lookup (&brd->brd_pages, idx);BUG_ON (!page);BUG_ON (page->index != idx); - }else - page->index = idx; + }spin_unlock (&brd->brd_lock);radix_tree_preload_end ();
drivers/block/drbd/drbd_receiver.c +0 -1
@@ -2225,7 +2225,6 @@ static int drbd_asb_recover_1p(struct drbd_conf *mdev) __must_hold(local)if (hg ==-1 && mdev->state.role ==R_PRIMARY ) {enum drbd_state_rv rv2; -drbd_set_role (mdev,R_SECONDARY ,0 );/* drbd_change_state() does not sleep while in SS_IN_TRANSIENT_STATE, * we might be here in C_WF_REPORT_PARAMS which is transient. * we do not need to wait for the after state change work either. */
drivers/char/ipmi/ipmi_bt_sm.c +2 -2
@@ -95,9 +95,9 @@ struct si_sm_data {enum bt_states state;unsigned char seq;/* BT sequence number */ struct si_sm_io *io; -unsigned char write_data[IPMI_MAX_MSG_LENGTH ]; +unsigned char write_data[IPMI_MAX_MSG_LENGTH +2 ];/* +2 for memcpy */ int write_count; -unsigned char read_data[IPMI_MAX_MSG_LENGTH ]; +unsigned char read_data[IPMI_MAX_MSG_LENGTH +2 ];/* +2 for memcpy */ int read_count;int truncated;long timeout;/* microseconds countdown */
drivers/char/ipmi/ipmi_devintf.c +13 -1
@@ -838,13 +838,25 @@ static long compat_ipmi_ioctl(struct file *filep, unsigned int cmd, return ipmi_ioctl(filep, cmd, arg); } } + +static long unlocked_compat_ipmi_ioctl (struct file *filep,unsigned int cmd, +unsigned long arg) +{ +int ret; + +mutex_lock (&ipmi_mutex); + ret =compat_ipmi_ioctl (filep, cmd, arg); +mutex_unlock (&ipmi_mutex); + +return ret; +}#endif static const struct file_operations ipmi_fops = { .owner =THIS_MODULE , .unlocked_ioctl = ipmi_unlocked_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = compat_ipmi_ioctl, + .compat_ioctl = unlocked_compat_ipmi_ioctl, #endif .open = ipmi_open, .release = ipmi_release,
drivers/char/random.c +16 -8
@@ -889,16 +889,24 @@ static size_t account(struct entropy_store *r, size_t nbytes, int min,if (r->entropy_count /8 < min + reserved) { nbytes =0 ; }else { +int entropy_count, orig; +retry: + entropy_count = orig =ACCESS_ONCE (r->entropy_count);/* If limited, never pull more than available */ -if (r->limit && nbytes + reserved >= r->entropy_count /8 ) - nbytes = r->entropy_count/8 - reserved; - -if (r->entropy_count /8 >= nbytes + reserved) - r->entropy_count -= nbytes*8 ; -else - r->entropy_count = reserved; +if (r->limit && nbytes + reserved >= entropy_count /8 ) + nbytes = entropy_count/8 - reserved; + +if (entropy_count /8 >= nbytes + reserved) { + entropy_count -= nbytes*8 ; +if (cmpxchg (&r->entropy_count, orig, entropy_count) != orig) + goto retry; + }else { + entropy_count = reserved; +if (cmpxchg (&r->entropy_count, orig, entropy_count) != orig) + goto retry; + } -if (r->entropy_count < random_write_wakeup_thresh) { +if (entropy_count < random_write_wakeup_thresh) {wake_up_interruptible (&random_write_wait);kill_fasync (&fasync,SIGIO ,POLL_OUT ); }
drivers/dma/pch_dma.c +1 -1
@@ -489,7 +489,7 @@ static struct pch_dma_desc *pdc_desc_get(struct pch_dma_chan *pd_chan)dev_dbg (chan2dev (&pd_chan->chan),"scanned %d descriptors\n" , i);if (!ret) { - ret =pdc_alloc_desc (&pd_chan->chan,GFP_NOIO ); + ret =pdc_alloc_desc (&pd_chan->chan,GFP_ATOMIC );if (ret) {spin_lock (&pd_chan->lock); pd_chan->descs_allocated++;
drivers/firmware/efivars.c +3 -15
@@ -425,24 +425,12 @@ static efi_status_t check_var_size_locked(struct efivars *efivars, u32 attributes, unsigned long size) { - u64 storage_size, remaining_size, max_size; -efi_status_t status; const struct efivar_operations *fops = efivars->ops; -if (!efivars->ops->query_variable_info) +if (!efivars->ops->query_variable_store)return EFI_UNSUPPORTED ; - status = fops->query_variable_info (attributes, &storage_size, - &remaining_size, &max_size); - -if (status !=EFI_SUCCESS ) -return status; - -if (!storage_size || size > remaining_size || size > max_size || - (remaining_size - size) < (storage_size /2 )) -return EFI_OUT_OF_RESOURCES ; - -return status; +return fops->query_variable_store (attributes, size); } static ssize_t
@@ -1456,7 +1444,7 @@ efivars_init(void) ops.get_variable = efi.get_variable; ops.set_variable = efi.set_variable; ops.get_next_variable = efi.get_next_variable; - ops.query_variable_info = efi.query_variable_info; + ops.query_variable_store = efi_query_variable_store; error =register_efivars (&__efivars, &ops, efi_kobj);if (error) goto err_put;
drivers/gpu/drm/i915/i915_dma.c +40 -41
124 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drv.h +0 -1
@@ -581,7 +581,6 @@ typedef struct drm_i915_private {unsigned long gtt_start;unsigned long gtt_mappable_end;unsigned long gtt_end; -unsigned long stolen_base;/* limited to low memory (32-bit) */ struct io_mapping *gtt_mapping;int gtt_mtrr;
drivers/gpu/drm/radeon/r300_cmdbuf.c +1 -1
@@ -74,7 +74,7 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,OUT_RING (CP_PACKET0 (R300_RE_CLIPRECT_TL_0 , nr *2 -1 ));for (i =0 ; i < nr; ++i) { -if (DRM_COPY_FROM_USER_UNCHECKED +if (DRM_COPY_FROM_USER (&box, &cmdbuf->boxes[n + i],sizeof (box))) {DRM_ERROR ("copy cliprect faulted\n" );return -EFAULT ;
drivers/hwmon/abituguru.c +10 -6
@@ -1280,14 +1280,18 @@ static int __devinit abituguru_probe(struct platform_device *pdev)pr_info ("found Abit uGuru\n" );/* Register sysfs hooks */ -for (i =0 ; i < sysfs_attr_i; i++) -if (device_create_file (&pdev->dev, - &data->sysfs_attr[i].dev_attr)) +for (i =0 ; i < sysfs_attr_i; i++) { + res =device_create_file (&pdev->dev, + &data->sysfs_attr[i].dev_attr); +if (res) goto abituguru_probe_error; -for (i =0 ; i <ARRAY_SIZE (abituguru_sysfs_attr); i++) -if (device_create_file (&pdev->dev, - &abituguru_sysfs_attr[i].dev_attr)) + } +for (i =0 ; i <ARRAY_SIZE (abituguru_sysfs_attr); i++) { + res =device_create_file (&pdev->dev, + &abituguru_sysfs_attr[i].dev_attr); +if (res) goto abituguru_probe_error; + } data->hwmon_dev =hwmon_device_register (&pdev->dev);if (!IS_ERR (data->hwmon_dev))
drivers/i2c/busses/i2c-designware-core.c +2 -1
@@ -349,7 +349,8 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)/* Enable the adapter */ dw_writel (dev,1 ,DW_IC_ENABLE ); -/* Enable interrupts */ +/* Clear and enable interrupts */ +i2c_dw_clear_int (dev);dw_writel (dev,DW_IC_INTR_DEFAULT_MASK ,DW_IC_INTR_MASK ); }
drivers/md/dm-bufio.c +25 -1
@@ -322,6 +322,9 @@ static void __cache_size_refresh(void)static void *alloc_buffer_data (struct dm_bufio_client *c,gfp_t gfp_mask,enum data_mode *data_mode) { +unsigned noio_flag; +void *ptr; +if (c->block_size <=DM_BUFIO_BLOCK_SIZE_SLAB_LIMIT ) { *data_mode =DATA_MODE_SLAB ;return kmem_cache_alloc (DM_BUFIO_CACHE (c), gfp_mask);
@@ -335,7 +338,28 @@ static void *alloc_buffer_data(struct dm_bufio_client *c, gfp_t gfp_mask, } *data_mode =DATA_MODE_VMALLOC ; -return __vmalloc (c->block_size, gfp_mask,PAGE_KERNEL ); + +/* +* __vmalloc allocates the data pages and auxiliary structures with +* gfp_flags that were specified, but pagetables are always allocated +* with GFP_KERNEL, no matter what was specified as gfp_mask. +* +* Consequently, we must set per-process flag PF_MEMALLOC_NOIO so that +* all allocations done by this process (including pagetables) are done +* as if GFP_NOIO was specified. +*/ + +if (gfp_mask & __GFP_NORETRY) { + noio_flag = current->flags &PF_MEMALLOC ; + current->flags |=PF_MEMALLOC ; + } + + ptr =__vmalloc (c->block_size, gfp_mask,PAGE_KERNEL ); + +if (gfp_mask & __GFP_NORETRY) + current->flags = (current->flags & ~PF_MEMALLOC ) | noio_flag; + +return ptr; }/*
drivers/md/dm-snap.c +1 -0
@@ -1117,6 +1117,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) s->pending_pool =mempool_create_slab_pool (MIN_IOS , pending_cache);if (!s->pending_pool) { ti->error ="Could not allocate mempool for pending exceptions" ; + r = -ENOMEM ; goto bad_pending_pool; }
drivers/media/dvb/mantis/mantis_dvb.c +4 -2
@@ -248,8 +248,10 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis) err5:tasklet_kill (&mantis->tasklet);dvb_net_release (&mantis->dvbnet); -dvb_unregister_frontend (mantis->fe); -dvb_frontend_detach (mantis->fe); +if (mantis->fe) { +dvb_unregister_frontend (mantis->fe); +dvb_frontend_detach (mantis->fe); + } err4: mantis->demux.dmx.remove_frontend (&mantis->demux.dmx, &mantis->fe_mem);
drivers/mfd/adp5520.c +6 -2
@@ -36,6 +36,7 @@ struct adp5520_chip {struct blocking_notifier_head notifier_list;int irq;unsigned long id; +uint8_t mode; }; static int __adp5520_read(struct i2c_client *client,
@@ -326,7 +327,10 @@ static int adp5520_suspend(struct device *dev)struct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_clr_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_read (chip->dev,ADP5520_MODE_STATUS , &chip->mode); +/* All other bits are W1C */ + chip->mode &=ADP5520_BL_EN |ADP5520_DIM_EN | ADP5520_nSTNBY; +adp5520_write (chip->dev,ADP5520_MODE_STATUS ,0 );return 0 ; }
@@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)struct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_set_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_write (chip->dev,ADP5520_MODE_STATUS , chip->mode); return 0; }#endif
drivers/mmc/core/mmc.c +1 -1
@@ -363,13 +363,13 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT ]; card->ext_csd.raw_trim_mult = ext_csd[EXT_CSD_TRIM_MULT ]; + card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT ];if (card->ext_csd.rev >=4 ) {/* * Enhanced area feature support -- check whether the eMMC * card has the Enhanced area enabled. If so, export enhanced * area offset and size to user by adding sysfs interface. */ - card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT ];if ((ext_csd[EXT_CSD_PARTITION_SUPPORT ] &0x2 ) && (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE ] &0x1 )) { hc_erase_grp_sz =
drivers/mmc/host/Kconfig +0 -10
@@ -297,16 +297,6 @@ config MMC_ATMELMCI endchoice -config MMC_ATMELMCI_DMA - bool "Atmel MCI DMA support" - depends on MMC_ATMELMCI && (AVR32 || ARCH_AT91SAM9G45) && DMA_ENGINE - help - Say Y here to have the Atmel MCI driver use a DMA engine to - do data transfers and thus increase the throughput and - reduce the CPU utilization. - - If unsure, say N. - config MMC_IMX tristate "Motorola i.MX Multimedia Card Interface support" depends on ARCH_MX1
drivers/mmc/host/atmel-mci.c +10 -6
@@ -163,6 +163,7 @@ struct atmel_mci {void __iomem *regs;struct scatterlist *sg; +unsigned int sg_len;unsigned int pio_offset;struct atmel_mci_slot *cur_slot;
@@ -751,6 +752,7 @@ static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data) data->error = -EINPROGRESS ; host->sg = data->sg; + host->sg_len = data->sg_len; host->data = data; host->data_chan =NULL ;
@@ -1573,7 +1575,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)if (offset == sg->length) {flush_dcache_page (sg_page (sg)); host->sg = sg =sg_next (sg); -if (!sg) + host->sg_len--; +if (!sg || !host->sg_len) goto done; offset =0 ;
@@ -1586,7 +1589,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)flush_dcache_page (sg_page (sg)); host->sg = sg =sg_next (sg); -if (!sg) + host->sg_len--; +if (!sg || !host->sg_len) goto done; offset =4 - remaining;
@@ -1640,7 +1644,8 @@ static void atmci_write_data_pio(struct atmel_mci *host) nbytes +=4 ;if (offset == sg->length) { host->sg = sg =sg_next (sg); -if (!sg) + host->sg_len--; +if (!sg || !host->sg_len) goto done; offset =0 ;
@@ -1654,7 +1659,8 @@ static void atmci_write_data_pio(struct atmel_mci *host) nbytes += remaining; host->sg = sg =sg_next (sg); -if (!sg) { + host->sg_len--; +if (!sg || !host->sg_len) {atmci_writel (host,ATMCI_TDR , value); goto done; }
@@ -2167,10 +2173,8 @@ static int __exit atmci_remove(struct platform_device *pdev)atmci_readl (host,ATMCI_SR );clk_disable (host->mck); -#ifdef CONFIG_MMC_ATMELMCI_DMA if (host->dma.chan)dma_release_channel (host->dma.chan); -#endif free_irq (platform_get_irq (pdev,0 ), host);iounmap (host->regs);
drivers/net/ethernet/3com/3c509.c +2 -0
@@ -309,6 +309,7 @@ static int __devinit el3_isa_match(struct device *pdev,if (!dev)return -ENOMEM ; +SET_NETDEV_DEV (dev, pdev);netdev_boot_setup_check (dev);if (!request_region (ioaddr,EL3_IO_EXTENT ,"3c509-isa" )) {
@@ -704,6 +705,7 @@ static int __init el3_eisa_probe (struct device *device)return -ENOMEM ; } +SET_NETDEV_DEV (dev, device);netdev_boot_setup_check (dev);el3_dev_fill (dev, phys_addr, ioaddr, irq, if_port,EL3_EISA );
drivers/net/ethernet/3com/3c59x.c +14 -13
@@ -632,7 +632,6 @@ struct vortex_private { pm_state_valid:1, /* pci_dev->saved_config_space has sane contents */ open:1, medialock:1, - must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ large_frames:1, /* accept large frames */ handling_irq:1; /* private in_irq indicator *//* {get|set}_wol operations are already serialized by rtnl.
@@ -951,7 +950,7 @@ static int __devexit vortex_eisa_remove(struct device *device)unregister_netdev (dev);iowrite16 (TotalReset|0x14 , ioaddr +EL3_CMD ); -release_region (dev->base_addr,VORTEX_TOTAL_SIZE ); +release_region (edev->base_addr,VORTEX_TOTAL_SIZE );free_netdev (dev);return 0 ;
@@ -1012,6 +1011,12 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,if (rc <0 ) goto out; + rc =pci_request_regions (pdev,DRV_NAME ); +if (rc <0 ) { +pci_disable_device (pdev); + goto out; + } + unit = vortex_cards_found;if (global_use_mmio <0 && (unit >=MAX_UNITS || use_mmio[unit] <0 )) {
@@ -1027,6 +1032,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev,if (!ioaddr)/* If mapping fails, fall-back to BAR 0... */ ioaddr =pci_iomap (pdev,0 ,0 );if (!ioaddr) { +pci_release_regions (pdev);pci_disable_device (pdev); rc = -ENOMEM ; goto out;
@@ -1036,6 +1042,7 @@ static int __devinit vortex_init_one(struct pci_dev *pdev, ent->driver_data, unit);if (rc <0 ) {pci_iounmap (pdev, ioaddr); +pci_release_regions (pdev);pci_disable_device (pdev); goto out; }
@@ -1180,11 +1187,6 @@ static int __devinit vortex_probe1(struct device *gendev,/* PCI-only startup logic */ if (pdev) { -/* EISA resources already marked, so only PCI needs to do this here */ -/* Ignore return value, because Cardbus drivers already allocate for us */ -if (request_region (dev->base_addr, vci->io_size, print_name) !=NULL ) - vp->must_free_region =1 ; -/* enable bus-mastering if necessary */ if (vci->flags &PCI_USES_MASTER )pci_set_master (pdev);
@@ -1222,7 +1224,7 @@ static int __devinit vortex_probe1(struct device *gendev, &vp->rx_ring_dma); retval = -ENOMEM ;if (!vp->rx_ring) - goto free_region; + goto free_device; vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring +RX_RING_SIZE ); vp->tx_ring_dma = vp->rx_ring_dma +sizeof (struct boom_rx_desc ) *RX_RING_SIZE ;
@@ -1487,9 +1489,7 @@ free_ring: +sizeof (struct boom_tx_desc ) *TX_RING_SIZE , vp->rx_ring, vp->rx_ring_dma); -free_region: -if (vp->must_free_region) -release_region (dev->base_addr, vci->io_size); +free_device:free_netdev (dev);pr_err (PFX "vortex_probe1 fails. Returns %d\n" , retval); out:
@@ -3254,8 +3254,9 @@ static void __devexit vortex_remove_one(struct pci_dev *pdev) +sizeof (struct boom_tx_desc ) *TX_RING_SIZE , vp->rx_ring, vp->rx_ring_dma); -if (vp->must_free_region) -release_region (dev->base_addr, vp->io_size); + +pci_release_regions (pdev); +free_netdev (dev); }
drivers/net/ethernet/broadcom/tg3.c +26 -6
@@ -2752,6 +2752,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)static int tg3_setup_phy (struct tg3 *,int );static int tg3_halt_cpu (struct tg3 *,u32 ); +static bool tg3_phy_power_bug (struct tg3 *tp) +{ +switch (GET_ASIC_REV (tp->pci_chip_rev_id)) { +case ASIC_REV_5700 : +case ASIC_REV_5704 : +return true; +case ASIC_REV_5780 : +if (tp->phy_flags &TG3_PHYFLG_MII_SERDES ) +return true; +return false; +case ASIC_REV_5717 : +if (!tp->pci_fn) +return true; +return false; +case ASIC_REV_5719 : +case ASIC_REV_5720 : +if ((tp->phy_flags &TG3_PHYFLG_PHY_SERDES ) && + !tp->pci_fn) +return true; +return false; + } + +return false; +} +static void tg3_power_down_phy (struct tg3 *tp,bool do_low_power) {u32 val;
@@ -2808,12 +2833,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)/* The PHY should not be powered down on some chips because * of bugs. */ -if (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5700 || -GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5704 || - (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5780 && - (tp->phy_flags &TG3_PHYFLG_MII_SERDES )) || - (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5717 && - !tp->pci_fn)) +if (tg3_phy_power_bug (tp))return ; if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX ||
drivers/net/ethernet/ibm/ibmveth.c +10 -13
@@ -1325,7 +1325,7 @@ static const struct net_device_ops ibmveth_netdev_ops = {static int __devinit ibmveth_probe (struct vio_dev *dev,const struct vio_device_id *id) { -int rc, i; +int rc, i, mac_len;struct net_device *netdev;struct ibmveth_adapter *adapter;unsigned char *mac_addr_p;
@@ -1335,11 +1335,19 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, dev->unit_address); mac_addr_p = (unsigned char *)vio_get_attribute (dev,VETH_MAC_ADDR , -NULL ); + &mac_len);if (!mac_addr_p) {dev_err (&dev->dev,"Can't find VETH_MAC_ADDR attribute\n" );return -EINVAL ; } +/* Workaround for old/broken pHyp */ +if (mac_len ==8 ) + mac_addr_p +=2 ; +else if (mac_len !=6 ) { +dev_err (&dev->dev,"VETH_MAC_ADDR attribute wrong len %d\n" , + mac_len); +return -EINVAL ; + } mcastFilterSize_p = (unsigned int *)vio_get_attribute (dev,VETH_MCAST_FILTER_SIZE ,NULL );
@@ -1364,17 +1372,6 @@ static int __devinit ibmveth_probe(struct vio_dev *dev,netif_napi_add (netdev, &adapter->napi, ibmveth_poll,16 ); -/* -* Some older boxes running PHYP non-natively have an OF that returns -* a 8-byte local-mac-address field (and the first 2 bytes have to be -* ignored) while newer boxes' OF return a 6-byte field. Note that -* IEEE 1275 specifies that local-mac-address must be a 6-byte field. -* The RPA doc specifies that the first byte must be 10b, so we'll -* just look for it to solve this 8 vs. 6 byte field issue -*/ -if ((*mac_addr_p &0x3 ) !=0x02 ) - mac_addr_p +=2 ; - adapter->mac_addr =0 ;memcpy (&adapter->mac_addr, mac_addr_p,6 );
drivers/net/macvlan.c +4 -3
@@ -204,7 +204,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) }if (port->passthru) - vlan = list_first_entry(&port->vlans, struct macvlan_dev, list); + vlan =list_first_or_null_rcu (&port->vlans, + struct macvlan_dev, list);else vlan =macvlan_hash_lookup (port, eth->h_dest);if (vlan ==NULL )
@@ -725,7 +726,7 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,if (err <0 ) goto destroy_port; -list_add_tail (&vlan->list, &port->vlans); +list_add_tail_rcu (&vlan->list, &port->vlans);netif_stacked_transfer_operstate (lowerdev, dev);return 0 ;
@@ -751,7 +752,7 @@ void macvlan_dellink(struct net_device *dev, struct list_head *head) {struct macvlan_dev *vlan =netdev_priv (dev); -list_del (&vlan->list); +list_del_rcu (&vlan->list);unregister_netdevice_queue (dev, head); }EXPORT_SYMBOL_GPL (macvlan_dellink);
drivers/net/wireless/ath/ath9k/main.c +5 -1
@@ -1793,6 +1793,7 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,struct ath_common *common =ath9k_hw_common (sc->sc_ah);struct ath_node *an = (struct ath_node *) sta->drv_priv;struct ieee80211_key_conf ps_key = { }; +int key;ath_node_attach (sc, sta);
@@ -1800,7 +1801,9 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, vif->type != NL80211_IFTYPE_AP_VLAN)return 0 ; - an->ps_key =ath_key_config (common, vif, sta, &ps_key); + key =ath_key_config (common, vif, sta, &ps_key); +if (key >0 ) + an->ps_key = key;return 0 ; }
@@ -1817,6 +1820,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc,return ;ath_key_delete (common, &ps_key); + an->ps_key =0 ; } static int ath9k_sta_remove(struct ieee80211_hw *hw,
drivers/net/wireless/b43/dma.c +19 -0
@@ -1719,6 +1719,25 @@ drop_recycle_buffer:sync_descbuffer_for_device (ring, dmaaddr, ring->rx_buffersize); } +void b43_dma_handle_rx_overflow (struct b43_dmaring *ring) +{ +int current_slot, previous_slot; + +B43_WARN_ON (ring->tx); + +/* Device has filled all buffers, drop all packets and let TCP +* decrease speed. +* Decrement RX index by one will let the device to see all slots +* as free again +*/ +/* +*TODO: How to increase rx_drop in mac80211? +*/ + current_slot = ring->ops->get_current_rxslot (ring); + previous_slot =prev_slot (ring, current_slot); + ring->ops->set_current_rxslot (ring, previous_slot); +} +void b43_dma_rx (struct b43_dmaring *ring) {const struct b43_dma_ops *ops = ring->ops;
drivers/net/wireless/b43/dma.h +3 -1
@@ -9,7 +9,7 @@/* DMA-Interrupt reasons. */ #define B43_DMAIRQ_FATALMASK ((1 << 10) | (1 << 11) | (1 << 12) \ | (1 << 14) | (1 << 15)) -#define B43_DMAIRQ_NONFATALMASK (1 << 13) +#define B43_DMAIRQ_RDESC_UFLOW (1 << 13)#define B43_DMAIRQ_RX_DONE (1 << 16)/*** 32-bit DMA Engine. ***/
@@ -295,6 +295,8 @@ int b43_dma_tx(struct b43_wldev *dev,void b43_dma_handle_txstatus (struct b43_wldev *dev,const struct b43_txstatus *status); +void b43_dma_handle_rx_overflow (struct b43_dmaring *ring); +void b43_dma_rx (struct b43_dmaring *ring); void b43_dma_direct_fifo_rx(struct b43_wldev *dev,
drivers/net/wireless/b43/main.c +18 -25
68 lines not on this page · raw message
drivers/net/wireless/mwifiex/cfg80211.c +0 -3
@@ -1281,9 +1281,6 @@ int mwifiex_del_virtual_intf(struct wiphy *wiphy, struct net_device *dev)if (dev->reg_state ==NETREG_REGISTERED )unregister_netdevice (dev); -if (dev->reg_state ==NETREG_UNREGISTERED ) -free_netdev (dev); -/* Clear the priv in adapter */ priv->netdev =NULL ;
drivers/net/wireless/mwifiex/cmdevt.c +1 -0
@@ -1083,6 +1083,7 @@ mwifiex_process_hs_config(struct mwifiex_adapter *adapter) adapter->if_ops.wakeup (adapter); adapter->hs_activated = false; adapter->is_hs_configured = false; + adapter->is_suspended = false;mwifiex_hs_activated_event (mwifiex_get_priv (adapter,MWIFIEX_BSS_ROLE_ANY ), false); }
drivers/net/wireless/mwifiex/main.c +1 -0
@@ -581,6 +581,7 @@ void mwifiex_init_priv_params(struct mwifiex_private *priv, struct net_device *dev) { dev->netdev_ops = &mwifiex_netdev_ops; + dev->destructor = free_netdev;/* Initialize private structure */ priv->current_key_index =0 ; priv->media_connected = false;
drivers/net/wireless/mwifiex/sta_ioctl.c +6 -15
@@ -105,7 +105,7 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv, }else {/* Multicast */ priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_PROMISCUOUS_ENABLE; -if (mcast_list->mode ==MWIFIEX_MULTICAST_MODE ) { +if (mcast_list->mode ==MWIFIEX_ALL_MULTI_MODE ) {dev_dbg (priv->adapter->dev,"info: Enabling All Multicast!\n" ); priv->curr_pkt_filter |=
@@ -117,20 +117,11 @@ int mwifiex_request_set_multicast_list(struct mwifiex_private *priv,dev_dbg (priv->adapter->dev,"info: Set multicast list=%d\n" , mcast_list->num_multicast_addr); -/* Set multicast addresses to firmware */ -if (old_pkt_filter == priv->curr_pkt_filter) { -/* Send request to firmware */ - ret =mwifiex_send_cmd_async (priv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET,0 , - mcast_list); - }else { -/* Send request to firmware */ - ret =mwifiex_send_cmd_async (priv, - HostCmd_CMD_MAC_MULTICAST_ADR, - HostCmd_ACT_GEN_SET,0 , - mcast_list); - } +/* Send multicast addresses to firmware */ + ret =mwifiex_send_cmd_async (priv, + HostCmd_CMD_MAC_MULTICAST_ADR, + HostCmd_ACT_GEN_SET,0 , + mcast_list); } } }
drivers/platform/x86/hp_accel.c +2 -1
@@ -362,7 +362,8 @@ static int lis3lv02d_suspend(struct acpi_device *device, pm_message_t state)static int lis3lv02d_resume (struct acpi_device *device) { -return lis3lv02d_poweron (&lis3_dev); +lis3lv02d_poweron (&lis3_dev); +return 0 ; }#else #define lis3lv02d_suspend NULL
drivers/rapidio/devices/tsi721.c +11 -0
@@ -475,6 +475,10 @@ static irqreturn_t tsi721_irqhandler(int irq, void *ptr)u32 intval;u32 ch_inte; +/* For MSI mode disable all device-level interrupts */ +if (priv->flags &TSI721_USING_MSI ) +iowrite32 (0 , priv->regs +TSI721_DEV_INTE ); + dev_int =ioread32 (priv->regs +TSI721_DEV_INT );if (!dev_int)return IRQ_NONE ;
@@ -548,6 +552,13 @@ static irqreturn_t tsi721_irqhandler(int irq, void *ptr)tsi721_pw_handler (mport); } +/* For MSI mode re-enable device-level interrupts */ +if (priv->flags &TSI721_USING_MSI ) { + dev_int =TSI721_DEV_INT_SR2PC_CH |TSI721_DEV_INT_SRIO | +TSI721_DEV_INT_SMSG_CH |TSI721_DEV_INT_BDMA_CH ; +iowrite32 (dev_int, priv->regs +TSI721_DEV_INTE ); + } +return IRQ_HANDLED ; }
drivers/rtc/rtc-pcf2123.c +1 -0
@@ -264,6 +264,7 @@ static int __devinit pcf2123_probe(struct spi_device *spi)if (!(rxbuf[0 ] &0x20 )) {dev_err (&spi->dev,"chip not found\n" ); + ret = -ENODEV ; goto kfree_exit; }
drivers/staging/comedi/comedi_fops.c +3 -0
@@ -143,6 +143,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, } rc =do_devconfig_ioctl (dev, (struct comedi_devconfig __user *)arg); +if (rc ==0 ) +/* Evade comedi_auto_unconfig(). */ + dev_file_info->hardware_device =NULL ; goto done; }
drivers/staging/vt6656/hostap.c +1 -1
@@ -153,7 +153,7 @@ static int hostap_disable_hostapd(PSDevice pDevice, int rtnl_locked)DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO "%s: Netdevice %s unregistered\n" , pDevice->dev->name, pDevice->apdev->name); } -kfree (pDevice->apdev); +free_netdev (pDevice->apdev); pDevice->apdev =NULL ; pDevice->bEnable8021x = FALSE; pDevice->bEnableHostWEP = FALSE;
drivers/target/iscsi/iscsi_target_erl1.c +4 -3
@@ -824,7 +824,7 @@ static int iscsit_attach_ooo_cmdsn(/* * CmdSN is greater than the tail of the list. */ -if (ooo_tail->cmdsn < ooo_cmdsn->cmdsn) +if (iscsi_sna_lt (ooo_tail->cmdsn, ooo_cmdsn->cmdsn))list_add_tail (&ooo_cmdsn->ooo_list, &sess->sess_ooo_cmdsn_list);else {
@@ -834,11 +834,12 @@ static int iscsit_attach_ooo_cmdsn(*/ list_for_each_entry (ooo_tmp, &sess->sess_ooo_cmdsn_list, ooo_list) { -if (ooo_tmp->cmdsn < ooo_cmdsn->cmdsn) +if (iscsi_sna_lt (ooo_tmp->cmdsn, ooo_cmdsn->cmdsn))continue ; +/* Insert before this entry */ list_add (&ooo_cmdsn->ooo_list, - &ooo_tmp->ooo_list); + ooo_tmp->ooo_list.prev);break ; } }
drivers/tty/n_tty.c +8 -0
@@ -1530,6 +1530,14 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old) tty->real_raw =0 ; }n_tty_set_room (tty); +/* +* Fix tty hang when I_IXON(tty) is cleared, but the tty +* been stopped by STOP_CHAR(tty) before it. +*/ +if (!I_IXON (tty) && old && (old->c_iflag &IXON ) && !tty->flow_stopped) { +start_tty (tty); + } +/* The termios change make the tty ready for I/O */ wake_up_interruptible (&tty->write_wait);wake_up_interruptible (&tty->read_wait);
drivers/usb/atm/cxacru.c +2 -1
@@ -686,7 +686,8 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ {int ret, len;__le32 *buf; -int offb, offd; +int offb; +unsigned int offd;const int stride =CMD_PACKET_SIZE / (4 *2 ) -1 ;int buflen = ((size -1 ) / stride +1 + size *2 ) *4 ;
drivers/usb/core/quirks.c +3 -0
@@ -88,6 +88,9 @@ static const struct usb_device_id usb_quirk_list[] = {/* Edirol SD-20 */ { USB_DEVICE(0x0582, 0x0027), .driver_info = USB_QUIRK_RESET_RESUME }, + /* Alcor Micro Corp. Hub */ + { USB_DEVICE(0x058f, 0x9254), .driver_info = USB_QUIRK_RESET_RESUME }, + /* appletouch */ { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
drivers/usb/host/uhci-hub.c +2 -1
@@ -221,7 +221,8 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf)/* auto-stop if nothing connected for 1 second */ if (any_ports_active (uhci)) uhci->rh_state =UHCI_RH_RUNNING ; -else if (time_after_eq (jiffies, uhci->auto_stop_time)) +else if (time_after_eq (jiffies, uhci->auto_stop_time) && + !uhci->wait_for_hp)suspend_rh (uhci,UHCI_RH_AUTO_STOPPED );break ;
drivers/usb/host/xhci-mem.c +9 -8
@@ -1353,15 +1353,17 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, ep_ctx->ep_info2 |=cpu_to_le32 (xhci_get_endpoint_type (udev, ep));/* Set the max packet size and max burst */ + max_packet =GET_MAX_PACKET (usb_endpoint_maxp (&ep->desc)); + max_burst =0 ;switch (udev->speed) {case USB_SPEED_SUPER : - max_packet =usb_endpoint_maxp (&ep->desc); - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet));/* dig out max burst from ep companion desc */ - max_packet = ep->ss_ep_comp.bMaxBurst; - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_BURST (max_packet)); + max_burst = ep->ss_ep_comp.bMaxBurst;break ;case USB_SPEED_HIGH : +/* Some devices get this wrong */ +if (usb_endpoint_xfer_bulk (&ep->desc)) + max_packet =512 ;/* bits 11:12 specify the number of additional transaction * opportunities per microframe (USB 2.0, section 9.6.6) */
@@ -1369,17 +1371,16 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, usb_endpoint_xfer_int(&ep->desc)) { max_burst = (usb_endpoint_maxp (&ep->desc) &0x1800 ) >>11 ; - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_BURST (max_burst)); } -/* Fall through */ +break ;case USB_SPEED_FULL :case USB_SPEED_LOW : - max_packet =GET_MAX_PACKET (usb_endpoint_maxp (&ep->desc)); - ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet));break ;default :BUG (); } + ep_ctx->ep_info2 |=cpu_to_le32 (MAX_PACKET (max_packet) | +MAX_BURST (max_burst)); max_esit_payload =xhci_get_max_esit_payload (xhci, udev, ep); ep_ctx->tx_info =cpu_to_le32 (MAX_ESIT_PAYLOAD_FOR_EP (max_esit_payload));
drivers/usb/host/xhci-ring.c +15 -8
@@ -2376,14 +2376,21 @@ static int handle_tx_event(struct xhci_hcd *xhci,* TD list. */ if (list_empty (&ep_ring->td_list)) { -xhci_warn (xhci,"WARN Event TRB for slot %d ep %d " -"with no TDs queued?\n" , -TRB_TO_SLOT_ID (le32_to_cpu (event->flags)), - ep_index); -xhci_dbg (xhci,"Event TRB with TRB type ID %u\n" , - (le32_to_cpu (event->flags) & -TRB_TYPE_BITMASK )>>10 ); -xhci_print_trb_offsets (xhci, (union xhci_trb *) event); +/* +* A stopped endpoint may generate an extra completion +* event if the device was suspended. Don't print +* warnings. +*/ +if (!(trb_comp_code ==COMP_STOP || + trb_comp_code ==COMP_STOP_INVAL )) { +xhci_warn (xhci,"WARN Event TRB for slot %d ep %d with no TDs queued?\n" , +TRB_TO_SLOT_ID (le32_to_cpu (event->flags)), + ep_index); +xhci_dbg (xhci,"Event TRB with TRB type ID %u\n" , + (le32_to_cpu (event->flags) & +TRB_TYPE_BITMASK )>>10 ); +xhci_print_trb_offsets (xhci, (union xhci_trb *) event); + }if (ep->skip) { ep->skip = false; xhci_dbg(xhci, "td_list is empty while skip "
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -197,6 +197,8 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) }, { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) }, { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) }, + { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_CC_PID) }, + { USB_DEVICE(NEWPORT_VID, NEWPORT_CONEX_AGP_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) }, { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SPROG_II) },
drivers/usb/serial/ftdi_sio_ids.h +2 -0
@@ -772,6 +772,8 @@*/ #define NEWPORT_VID 0x104D#define NEWPORT_AGILIS_PID 0x3000 +#define NEWPORT_CONEX_CC_PID 0x3002 +#define NEWPORT_CONEX_AGP_PID 0x3006/* Interbiometrics USB I/O Board */ /* Developed for Interbiometrics by Rudolf Gugler */
drivers/usb/serial/option.c +9 -4
@@ -196,6 +196,7 @@ static void option_instat_callback(struct urb *urb);#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195/* Novatel E362 */ #define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196/* Novatel E362 */ +#define DELL_PRODUCT_5804_MINICARD_ATT 0x819b/* Novatel E371 */ #define KYOCERA_VENDOR_ID 0x0c88#define KYOCERA_PRODUCT_KPC650 0x17da
@@ -341,8 +342,8 @@ static void option_instat_callback(struct urb *urb);#define CINTERION_PRODUCT_EU3_E 0x0051#define CINTERION_PRODUCT_EU3_P 0x0052#define CINTERION_PRODUCT_PH8 0x0053 -#define CINTERION_PRODUCT_AH6 0x0055 -#define CINTERION_PRODUCT_PLS8 0x0060 +#define CINTERION_PRODUCT_AHXX 0x0055 +#define CINTERION_PRODUCT_PLXX 0x0060/* Olivetti products */ #define OLIVETTI_VENDOR_ID 0x0b3c
@@ -771,6 +772,7 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */ { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5804_MINICARD_ATT, 0xff, 0xff, 0xff) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -966,6 +968,8 @@ static const struct usb_device_id option_ids[] = { .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0330, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0395, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0412, 0xff, 0xff, 0xff), /* Telewell TW-LTE 4G */ + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0414, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0417, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
@@ -1264,8 +1268,9 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) }, + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
fs/autofs4/expire.c +0 -9
@@ -61,15 +61,6 @@ static int autofs4_mount_busy(struct vfsmount *mnt, struct dentry *dentry)/* This is an autofs submount, we can't expire it */ if (autofs_type_indirect (sbi->type)) goto done; - -/* -* Otherwise it's an offset mount and we need to check -* if we can umount its mount, if there is one. -*/ -if (!d_mountpoint (path.dentry)) { - status =0 ; - goto done; - } }/* Update the expiry counter if fs is busy */
fs/btrfs/ioctl.c +5 -5
@@ -1571,7 +1571,11 @@ static noinline int copy_to_sk(struct btrfs_root *root, item_off =btrfs_item_ptr_offset (leaf, i); item_len =btrfs_item_size_nr (leaf, i); -if (item_len >BTRFS_SEARCH_ARGS_BUFSIZE ) +btrfs_item_key_to_cpu (leaf, key, i); +if (!key_in_sk (key, sk)) +continue ; + +if (sizeof (sh) + item_len >BTRFS_SEARCH_ARGS_BUFSIZE ) item_len =0 ; if (sizeof(sh) + item_len + *sk_offset >
@@ -1580,10 +1584,6 @@ static noinline int copy_to_sk(struct btrfs_root *root, goto overflow; } -btrfs_item_key_to_cpu (leaf, key, i); -if (!key_in_sk (key, sk)) -continue ; - sh.objectid = key->objectid; sh.offset = key->offset; sh.type = key->type;
fs/cifs/inode.c +2 -1
@@ -173,7 +173,8 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)if (fattr->cf_flags &CIFS_FATTR_DFS_REFERRAL ) inode->i_flags |=S_AUTOMOUNT ; -cifs_set_ops (inode); +if (inode->i_state &I_NEW ) +cifs_set_ops (inode); }void
fs/ext4/mballoc.c +5 -1
@@ -2027,7 +2027,11 @@ repeat: group = ac->ac_g_ex.fe_group;for (i =0 ; i < ngroups; group++, i++) { -if (group == ngroups) +/* +* Artificially restricted ngroups for non-extent +* files makes group > ngroups possible on first loop. +*/ +if (group >= ngroups) group =0 ;/* This now checks without needing the buddy page */
fs/fat/inode.c +14 -1
@@ -1238,6 +1238,19 @@ static int fat_read_root(struct inode *inode)return 0 ; } +static unsigned long calc_fat_clusters (struct super_block *sb) +{ +struct msdos_sb_info *sbi =MSDOS_SB (sb); + +/* Divide first to avoid overflow */ +if (sbi->fat_bits !=12 ) { +unsigned long ent_per_sec = sb->s_blocksize *8 / sbi->fat_bits; +return ent_per_sec * sbi->fat_length; + } + +return sbi->fat_length * sb->s_blocksize *8 / sbi->fat_bits; +} +/* * Read the super block of an MS-DOS FS. */
@@ -1434,7 +1447,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, sbi->fat_bits = (total_clusters >MAX_FAT12 ) ?16 :12 ;/* check that FAT table does not overflow */ - fat_clusters = sbi->fat_length * sb->s_blocksize *8 / sbi->fat_bits; + fat_clusters =calc_fat_clusters (sb); total_clusters =min (total_clusters, fat_clusters -FAT_START_ENT );if (total_clusters >MAX_FAT (sb)) {if (!silent)
fs/nfsd/nfs4proc.c +13 -2
@@ -267,6 +267,7 @@ static __be32 do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) { __be32 status; +int accmode =0 ;/* Only reclaims from previously confirmed clients are valid */ if ((status =nfs4_check_open_reclaim (&open->op_clientid)))
@@ -284,9 +285,19 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ open->op_truncate = (open->op_iattr.ia_valid &ATTR_SIZE ) && (open->op_iattr.ia_size ==0 ); +/* +* In the delegation case, the client is telling us about an +* open that it *already* performed locally, some time ago. We +* should let it succeed now if possible. +* +* In the case of a CLAIM_FH open, on the other hand, the client +* may be counting on us to enforce permissions (the Linux 4.1 +* client uses this for normal opens, for example). +*/ +if (open->op_claim_type ==NFS4_OPEN_CLAIM_DELEG_CUR_FH ) + accmode =NFSD_MAY_OWNER_OVERRIDE ; - status =do_open_permission (rqstp, current_fh, open, -NFSD_MAY_OWNER_OVERRIDE ); + status =do_open_permission (rqstp, current_fh, open, accmode);return status; }
fs/nilfs2/inode.c +23 -4
@@ -195,13 +195,32 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)static int nilfs_set_page_dirty (struct page *page) { -int ret =__set_page_dirty_buffers (page); +int ret =__set_page_dirty_nobuffers (page); -if (ret) { +if (page_has_buffers (page)) {struct inode *inode = page->mapping->host; -unsigned nr_dirty =1 << (PAGE_SHIFT - inode->i_blkbits); +unsigned nr_dirty =0 ; +struct buffer_head *bh, *head; -nilfs_set_file_dirty (inode, nr_dirty); +/* +* This page is locked by callers, and no other thread +* concurrently marks its buffers dirty since they are +* only dirtied through routines in fs/buffer.c in +* which call sites of mark_buffer_dirty are protected +* by page lock. +*/ + bh = head =page_buffers (page); +do { +/* Do not mark hole blocks dirty */ +if (buffer_dirty (bh) || !buffer_mapped (bh)) +continue ; + +set_buffer_dirty (bh); + nr_dirty++; + }while (bh = bh->b_this_page, bh != head); + +if (nr_dirty) +nilfs_set_file_dirty (inode, nr_dirty); }return ret; }
fs/ocfs2/extent_map.c +1 -1
@@ -791,7 +791,7 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, &hole_size, &rec, &is_last);if (ret) {mlog_errno (ret); - goto out; + goto out_unlock; }if (rec.e_blkno ==0ULL ) {
include/linux/efi.h +10 -1
@@ -204,6 +204,7 @@ typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules,unsigned long count, u64 *max_size, int *reset_type); +typedef efi_status_t efi_query_variable_store_t (u32 attributes,unsigned long size);/* * EFI Configuration Table and GUID definitions
@@ -331,6 +332,14 @@ extern void efi_map_pal_code (void);extern void efi_memmap_walk (efi_freemem_callback_t callback,void *arg);extern void efi_gettimeofday (struct timespec *ts);extern void efi_enter_virtual_mode (void );/* switch EFI to virtual mode, if possible */ +#ifdef CONFIG_X86 +extern efi_status_t efi_query_variable_store (u32 attributes,unsigned long size); +#else +static inline efi_status_t efi_query_variable_store (u32 attributes,unsigned long size) +{ +return EFI_SUCCESS ; +} +#endif extern u64 efi_get_iobase (void );extern u32 efi_mem_type (unsigned long phys_addr);extern u64 efi_mem_attributes (unsigned long phys_addr);
@@ -475,7 +484,7 @@ struct efivar_operations {efi_get_variable_t *get_variable;efi_get_next_variable_t *get_next_variable;efi_set_variable_t *set_variable; -efi_query_variable_info_t *query_variable_info; +efi_query_variable_store_t *query_variable_store; };struct efivars {
include/linux/if_cablemodem.h +6 -6
@@ -12,11 +12,11 @@*/ /* some useful defines for sb1000.c e cmconfig.c - fv */ -#define SIOCGCMSTATS SIOCDEVPRIVATE+0/* get cable modem stats */ -#define SIOCGCMFIRMWARE SIOCDEVPRIVATE+1/* get cm firmware version */ -#define SIOCGCMFREQUENCY SIOCDEVPRIVATE+2/* get cable modem frequency */ -#define SIOCSCMFREQUENCY SIOCDEVPRIVATE+3/* set cable modem frequency */ -#define SIOCGCMPIDS SIOCDEVPRIVATE+4/* get cable modem PIDs */ -#define SIOCSCMPIDS SIOCDEVPRIVATE+5/* set cable modem PIDs */ +#define SIOCGCMSTATS (SIOCDEVPRIVATE+0)/* get cable modem stats */ +#define SIOCGCMFIRMWARE (SIOCDEVPRIVATE+1)/* get cm firmware version */ +#define SIOCGCMFREQUENCY (SIOCDEVPRIVATE+2)/* get cable modem frequency */ +#define SIOCSCMFREQUENCY (SIOCDEVPRIVATE+3)/* set cable modem frequency */ +#define SIOCGCMPIDS (SIOCDEVPRIVATE+4)/* get cable modem PIDs */ +#define SIOCSCMPIDS (SIOCDEVPRIVATE+5)/* set cable modem PIDs */ #endif
include/linux/rculist.h +17 -0
@@ -242,6 +242,23 @@ static inline void list_splice_init_rcu(struct list_head *list,list_entry_rcu ((ptr)->next, type, member)/** +* list_first_or_null_rcu - get the first element from a list +* @ptr: the list head to take the element from. +* @type: the type of the struct this is embedded in. +* @member: the name of the list_struct within the struct. +* +* Note that if the list is empty, it returns NULL. +* +* This primitive may safely run concurrently with the _rcu list-mutation +* primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). + */ +#define list_first_or_null_rcu (ptr, type, member) \ + ({struct list_head *__ptr = (ptr); \ + struct list_head __rcu *__next = list_next_rcu(__ptr); \ + likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \ + }) + +/** * list_for_each_entry_rcu - iterate over rcu list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list.
include/linux/virtio_console.h +1 -1
@@ -39,7 +39,7 @@#define VIRTIO_CONSOLE_F_SIZE 0/* Does host provide console size? */ #define VIRTIO_CONSOLE_F_MULTIPORT 1/* Does host provide multiple ports? */ -#define VIRTIO_CONSOLE_BAD_ID (~(u32)0) +#define VIRTIO_CONSOLE_BAD_ID (~(__u32)0)struct virtio_console_config {/* colums of the screens */
include/linux/wait.h +11 -5
@@ -233,6 +233,8 @@ do { \if (!ret) \break ; \ } \ +if (!ret && (condition)) \ + ret =1 ; \finish_wait (&wq, &__wait); \ }while (0 )
@@ -249,8 +251,9 @@ do { \* wake_up() has to be called after changing any variable that could * change the result of the wait condition. * -* The function returns 0 if the @timeout elapsed, and the remaining -* jiffies if the condition evaluated to true before the timeout elapsed. +* The function returns 0 if the @timeout elapsed, or the remaining +* jiffies (at least 1) if the @condition evaluated to %true before +* the @timeout elapsed. */ #define wait_event_timeout (wq, condition, timeout) \ ({ \
@@ -318,6 +321,8 @@ do { \ ret = -ERESTARTSYS ; \break ; \ } \ +if (!ret && (condition)) \ + ret =1 ; \finish_wait (&wq, &__wait); \ }while (0 )
@@ -334,9 +339,10 @@ do { \* wake_up() has to be called after changing any variable that could * change the result of the wait condition. * -* The function returns 0 if the @timeout elapsed, -ERESTARTSYS if it -* was interrupted by a signal, and the remaining jiffies otherwise -* if the condition evaluated to true before the timeout elapsed. +* Returns: +* 0 if the @timeout elapsed, -%ERESTARTSYS if it was interrupted by +* a signal, or the remaining jiffies (at least 1) if the @condition +* evaluated to %true before the @timeout elapsed. */ #define wait_event_interruptible_timeout (wq, condition, timeout) \ ({ \
include/net/sock.h +12 -0
@@ -734,6 +734,18 @@ struct inet_hashinfo;struct raw_hashinfo ;struct module ; +/* +* caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes +* un-modified. Special care is taken when initializing object to zero. +*/ +static inline void sk_prot_clear_nulls (struct sock *sk,int size) +{ + if (offsetof(struct sock, sk_node.next) != 0) + memset(sk, 0, offsetof(struct sock, sk_node.next)); +memset (&sk->sk_node.pprev,0 , + size - offsetof(struct sock, sk_node.pprev)); +} +/* Networking protocol blocks we attach to sockets. * socket layer -> transport layer interface * transport -> network interface is defined by struct inet_proto
include/net/tcp.h +1 -0
@@ -931,6 +931,7 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)if (sysctl_tcp_low_latency || !tp->ucopy.task)return 0 ; +skb_dst_force (skb);__skb_queue_tail (&tp->ucopy.prequeue, skb); tp->ucopy.memory += skb->truesize;if (tp->ucopy.memory > sk->sk_rcvbuf) {
kernel/kmod.c +5 -0
@@ -467,6 +467,11 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info,int retval =0 ;helper_lock (); +if (!sub_info->path) { + retval = -EINVAL ; + goto out; + } +if (sub_info->path[0 ] =='\0' ) goto out;
kernel/sched.c +22 -13
@@ -6672,16 +6672,25 @@ static void sd_free_ctl_entry(struct ctl_table **tablep) *tablep =NULL ; } +static int min_load_idx =0 ; +static int max_load_idx =CPU_LOAD_IDX_MAX -1 ; +static void set_table_entry (struct ctl_table *entry,const char *procname,void *data,int maxlen, -mode_t mode,proc_handler *proc_handler) +mode_t mode,proc_handler *proc_handler, +bool load_idx) { entry->procname = procname; entry->data = data; entry->maxlen = maxlen; entry->mode = mode; entry->proc_handler = proc_handler; + +if (load_idx) { + entry->extra1 = &min_load_idx; + entry->extra2 = &max_load_idx; + } } static struct ctl_table *
@@ -6693,30 +6702,30 @@ sd_alloc_ctl_domain_table(struct sched_domain *sd)return NULL ;set_table_entry (&table[0 ],"min_interval" , &sd->min_interval, -sizeof (long ),0644 , proc_doulongvec_minmax); +sizeof (long ),0644 , proc_doulongvec_minmax, false);set_table_entry (&table[1 ],"max_interval" , &sd->max_interval, -sizeof (long ),0644 , proc_doulongvec_minmax); +sizeof (long ),0644 , proc_doulongvec_minmax, false);set_table_entry (&table[2 ],"busy_idx" , &sd->busy_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[3 ],"idle_idx" , &sd->idle_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[4 ],"newidle_idx" , &sd->newidle_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[5 ],"wake_idx" , &sd->wake_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[6 ],"forkexec_idx" , &sd->forkexec_idx, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, true);set_table_entry (&table[7 ],"busy_factor" , &sd->busy_factor, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[8 ],"imbalance_pct" , &sd->imbalance_pct, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[9 ],"cache_nice_tries" , &sd->cache_nice_tries, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[10 ],"flags" , &sd->flags, -sizeof (int ),0644 , proc_dointvec_minmax); +sizeof (int ),0644 , proc_dointvec_minmax, false);set_table_entry (&table[11 ],"name" , sd->name, -CORENAME_MAX_SIZE ,0444 , proc_dostring); +CORENAME_MAX_SIZE ,0444 , proc_dostring, false);/* &table[12] is terminator */ return table;
kernel/time/tick-sched.c +1 -1
@@ -833,7 +833,7 @@ void tick_cancel_sched_timer(int cpu)hrtimer_cancel (&ts->sched_timer);# endif - ts->nohz_mode = NOHZ_MODE_INACTIVE; + memset(ts, 0, sizeof(*ts)); }#endif
kernel/timer.c +1 -1
@@ -1630,12 +1630,12 @@ static int __cpuinit init_timers_cpu(int cpu) boot_done =1 ; base = &boot_tvec_bases; } +spin_lock_init (&base->lock); tvec_base_done[cpu] =1 ; }else { base =per_cpu (tvec_bases, cpu); } -spin_lock_init (&base->lock);for (j =0 ; j <TVN_SIZE ; j++) {INIT_LIST_HEAD (base->tv5.vec + j);
kernel/trace/trace_events_filter.c +4 -0
@@ -769,7 +769,11 @@ static int filter_set_pred(struct event_filter *filter,static void __free_preds (struct event_filter *filter) { +int i; +if (filter->preds) { +for (i =0 ; i < filter->n_preds; i++) +kfree (filter->preds[i].ops);kfree (filter->preds); filter->preds =NULL ; }
mm/huge_memory.c +6 -1
@@ -1937,7 +1937,12 @@ static void collapse_huge_page(struct mm_struct *mm,pte_unmap (pte);spin_lock (&mm->page_table_lock);BUG_ON (!pmd_none (*pmd)); -set_pmd_at (mm, address, pmd, _pmd); +/* +* We can only use set_pmd_at when establishing +* hugepmds and never for establishing regular pmds that +* points to regular pagetables. Use pmd_populate for that +*/ +pmd_populate (mm, pmd,pmd_pgtable (_pmd));spin_unlock (&mm->page_table_lock);anon_vma_unlock (vma->anon_vma); goto out;
mm/migrate.c +1 -1
@@ -147,7 +147,7 @@ static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,if (PageHuge (new)) pte =pte_mkhuge (pte);#endif -flush_cache_page (vma, addr,pte_pfn (pte)); +flush_dcache_page (new);set_pte_at (mm, addr, ptep, pte);if (PageHuge (new)) {
mm/mmu_notifier.c +40 -40
122 lines not on this page · raw message
mm/pagewalk.c +36 -34
94 lines not on this page · raw message
net/bridge/br_stp_timer.c +1 -1
@@ -107,7 +107,7 @@ static void br_tcn_timer_expired(unsigned long arg)br_debug (br,"tcn timer expired\n" );spin_lock (&br->lock); -if (br->dev->flags &IFF_UP ) { +if (!br_is_root_bridge (br) && (br->dev->flags &IFF_UP )) {br_transmit_tcn (br);mod_timer (&br->tcn_timer,jiffies + br->bridge_hello_time);
net/core/sock.c +0 -12
@@ -1021,18 +1021,6 @@ static void sock_copy(struct sock *nsk, const struct sock *osk)#endif } -/* -* caches using SLAB_DESTROY_BY_RCU should let .next pointer from nulls nodes -* un-modified. Special care is taken when initializing object to zero. -*/ -static inline void sk_prot_clear_nulls (struct sock *sk,int size) -{ - if (offsetof(struct sock, sk_node.next) != 0) - memset(sk, 0, offsetof(struct sock, sk_node.next)); -memset (&sk->sk_node.pprev,0 , - size - offsetof(struct sock, sk_node.pprev)); -} -void sk_prot_clear_portaddr_nulls (struct sock *sk,int size) {unsigned long nulls1, nulls2;
net/ipv6/tcp_ipv6.c +12 -0
@@ -2196,6 +2196,17 @@ void tcp6_proc_exit(struct net *net) }#endif +static void tcp_v6_clear_sk (struct sock *sk,int size) +{ +struct inet_sock *inet =inet_sk (sk); + +/* we do not want to clear pinet6 field, because of RCU lookups */ +sk_prot_clear_nulls (sk, offsetof(struct inet_sock , pinet6)); + + size -= offsetof(struct inet_sock , pinet6) +sizeof (inet->pinet6); +memset (&inet->pinet6 +1 ,0 , size); +} +struct proto tcpv6_prot = { .name ="TCPv6" , .owner =THIS_MODULE ,
@@ -2235,6 +2246,7 @@ struct proto tcpv6_prot = { .compat_setsockopt = compat_tcp_setsockopt, .compat_getsockopt = compat_tcp_getsockopt, #endif + .clear_sk = tcp_v6_clear_sk, }; static const struct inet6_protocol tcpv6_protocol = {
net/ipv6/udp.c +12 -1
@@ -1453,6 +1453,17 @@ void udp6_proc_exit(struct net *net) { }#endif /* CONFIG_PROC_FS */ +void udp_v6_clear_sk (struct sock *sk,int size) +{ +struct inet_sock *inet =inet_sk (sk); + +/* we do not want to clear pinet6 field, because of RCU lookups */ +sk_prot_clear_portaddr_nulls (sk, offsetof(struct inet_sock , pinet6)); + + size -= offsetof(struct inet_sock , pinet6) +sizeof (inet->pinet6); +memset (&inet->pinet6 +1 ,0 , size); +} +/* ------------------------------------------------------------------------ */ struct proto udpv6_prot = {
@@ -1483,7 +1494,7 @@ struct proto udpv6_prot = { .compat_setsockopt = compat_udpv6_setsockopt, .compat_getsockopt = compat_udpv6_getsockopt, #endif - .clear_sk = sk_prot_clear_portaddr_nulls, + .clear_sk = udp_v6_clear_sk, }; static struct inet_protosw udpv6_protosw = {
net/ipv6/udp_impl.h +2 -0
@@ -31,6 +31,8 @@ extern int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,extern int udpv6_queue_rcv_skb (struct sock * sk,struct sk_buff *skb);extern void udpv6_destroy_sock (struct sock *sk); +extern void udp_v6_clear_sk (struct sock *sk,int size); +#ifdef CONFIG_PROC_FS extern int udp6_seq_show (struct seq_file *seq,void *v);#endif
net/ipv6/udplite.c +1 -1
@@ -56,7 +56,7 @@ struct proto udplitev6_prot = { .compat_setsockopt = compat_udpv6_setsockopt, .compat_getsockopt = compat_udpv6_getsockopt, #endif - .clear_sk = sk_prot_clear_portaddr_nulls, + .clear_sk = udp_v6_clear_sk, }; static struct inet_protosw udplite6_protosw = {
net/ipv6/xfrm6_policy.c +3 -1
@@ -96,8 +96,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,dev_hold (dev); xdst->u.rt6.rt6i_idev =in6_dev_get (dev); -if (!xdst->u.rt6.rt6i_idev) +if (!xdst->u.rt6.rt6i_idev) { +dev_put (dev);return -ENODEV ; + } xdst->u.rt6.rt6i_peer = rt->rt6i_peer;if (rt->rt6i_peer)
net/netfilter/ipvs/ip_vs_pe_sip.c +1 -5
@@ -37,14 +37,10 @@ static int get_callid(const char *dptr, unsigned int dataoff,if (ret >0 )break ;if (!ret) -return 0 ; +return -EINVAL ; dataoff += *matchoff; } -/* Empty callid is useless */ -if (!*matchlen) -return -EINVAL ; -/* Too large is useless */ if (*matchlen >IP_VS_PEDATA_MAXLEN )return -EINVAL ;
net/packet/af_packet.c +20 -34
67 lines not on this page · raw message
net/sched/act_ipt.c +30 -3
@@ -8,7 +8,7 @@* as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * -* Copyright: Jamal Hadi Salim (2002-4) +* Copyright: Jamal Hadi Salim (2002-13) */ #include <linux/types.h>
@@ -299,17 +299,44 @@ static struct tc_action_ops act_ipt_ops = { .walk = tcf_generic_walker }; -MODULE_AUTHOR ("Jamal Hadi Salim(2002-4)" ); +static struct tc_action_ops act_xt_ops = { + .kind ="xt" , + .hinfo = &ipt_hash_info, + .type =TCA_ACT_IPT , + .capab =TCA_CAP_NONE , + .owner =THIS_MODULE , + .act = tcf_ipt, + .dump = tcf_ipt_dump, + .cleanup = tcf_ipt_cleanup, + .lookup = tcf_hash_search, + .init = tcf_ipt_init, + .walk = tcf_generic_walker +}; + +MODULE_AUTHOR ("Jamal Hadi Salim(2002-13)" );MODULE_DESCRIPTION ("Iptables target actions" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("act_xt" );static int __init ipt_init_module (void ) { -return tcf_register_action (&act_ipt_ops); +int ret1, ret2; + ret1 =tcf_register_action (&act_xt_ops); +if (ret1 <0 ) +printk ("Failed to load xt action\n" ); + ret2 =tcf_register_action (&act_ipt_ops); +if (ret2 <0 ) +printk ("Failed to load ipt action\n" ); + +if (ret1 <0 && ret2 <0 ) +return ret1; +else +return 0 ; } static void __exit ipt_cleanup_module(void) { +tcf_unregister_action (&act_xt_ops);tcf_unregister_action (&act_ipt_ops); }
net/sunrpc/sched.c +10 -3
@@ -296,13 +296,20 @@ EXPORT_SYMBOL_GPL(__rpc_wait_for_completion_task);/* * Make an RPC task runnable. * -* Note: If the task is ASYNC, this must be called with -* the spinlock held to protect the wait queue operation. +* Note: If the task is ASYNC, and is being made runnable after sitting on an +* rpc_wait_queue, this must be called with the queue spinlock held to protect +* the wait queue operation. +* Note the ordering of rpc_test_and_set_running() and rpc_clear_queued(), +* which is needed to ensure that __rpc_execute() doesn't loop (due to the +* lockless RPC_IS_QUEUED() test) before we've had a chance to test +* the RPC_TASK_RUNNING flag. */ static void rpc_make_runnable (struct rpc_task *task) { +bool need_wakeup = !rpc_test_and_set_running (task); +rpc_clear_queued (task); -if (rpc_test_and_set_running (task)) +if (!need_wakeup)return ;if (RPC_IS_ASYNC (task)) {INIT_WORK (&task->u.tk_work, rpc_async_schedule);
sound/pci/hda/hda_codec.c +3 -0
@@ -615,6 +615,9 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex)struct hda_bus_unsolicited *unsol;unsigned int wp; +if (!bus || !bus->workq) +return 0 ; +trace_hda_unsol_event (bus, res, res_ex); unsol = bus->unsol;if (!unsol)
sound/soc/codecs/wm8994.c +1 -0
@@ -2636,6 +2636,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,default :return 0 ; } +break ;default :return 0 ; }
tools/perf/scripts/python/net_dropmonitor.py +4 -4
@@ -40,9 +40,9 @@ def get_kallsyms_table(): def get_sym(sloc): loc = int(sloc) - for i in kallsyms: - if (i['loc'] >= loc): - return (i['name'], i['loc']-loc) + for i in kallsyms[::-1]: + if loc >= i['loc']: + return (i['name'], loc - i['loc']) return (None, 0) def print_drop_table():
@@ -64,7 +64,7 @@ def trace_end(): # called from perf, when it finds a correspoinding event def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, - skbaddr, protocol, location): + skbaddr, location, protocol): slocation = str(location) try: drop_log[slocation] = drop_log[slocation] + 1