3.4.92-stable review
Greg Kroah-Hartman
maintainercover 3.4.92-stable review
This is the start of the stable review cycle for the 3.4.92 release. There are 214 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat Jun 7 04:15:47 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.4.92-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.4.92-rc1
Marc Dionne <[email protected]>
HID: logitech: don't use stack based dj_report structures
Joe Lawrence <[email protected]>
PCI/ASPM: Don't touch ASPM if forcibly disabled
Wei Liu <[email protected]>
xen-netfront: reduce gso_max_size to account for max TCP header
Joe Perches <[email protected]>
net: Add net_ratelimited_function and net_<level>_ratelimited macros
Gerald Schaefer <[email protected]>
crypto: s390 - Fix aes-xts parameter corruption
Oliver Hartkopp <[email protected]>
can: sja1000: fix {pre,post}_irq() handling and IRQ handler return value
Johan Hovold <[email protected]>
backlight: atmel-pwm-bl: fix gpio polarity in remove
Brian Norris <[email protected]>
mtd: m25p80: fix allocation size
Herbert Xu <[email protected]>
crypto: s390 - Fix aes-cbc IV corruption
Felix Fietkau <[email protected]>
mac80211: drop spoofed packets in ad-hoc mode
Marcelo Tosatti <[email protected]>
vgacon.c: add cond reschedule points in vgacon_do_font_op
Hauke Mehrtens <[email protected]>
b43: ensue that BCMA is "y" when B43 is "y"
Shane Huang <[email protected]>
i2c-piix4: Add AMD CZ SMBus device ID
Johannes Berg <[email protected]>
cfg80211: check wdev->netdev in connection work
Jiri Kosina <[email protected]>
random: fix accounting race condition with lockless irq entropy_count update
Ben Hutchings <[email protected]>
rapidio/tsi721: Fix interrupt mask when handling MSI
Alexandre Bounine <[email protected]>
rapidio/tsi721: fix bug in MSI interrupt handling
Maxim Mikityanskiy <[email protected]>
msi-wmi: Fix memory leak
Jakub Kicinski <[email protected]>
ixgbe: fix registration order of driver and DCA nofitication
Laxman Dewangan <[email protected]>
i2c: tegra: check the clk_prepare_enable() return value
Samuel Thibault <[email protected]>
speakup: lower default software speech rate
James Ralston <[email protected]>
ata_piix: Add Device IDs for Intel Lynx Point-LP PCH
Linus Walleij <[email protected]>
drivers/rtc/rtc-pl031.c: restore ST variant functionality
Maia Kozheva <[email protected]>
rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter
Jaume Delclòs <[email protected]>
Wireless: rt2x00: Add device id for Sweex LW323 to rt2800usb.c
Xose Vazquez Perez <[email protected]>
wireless: rt2x00: rt{2500,73}usb.c put back duplicate idHaojian Zhuang <[email protected]>
drivers/rtc/rtc-pl031.c: fix the missing operation on enable
Alex Deucher <[email protected]>
drm/radeon: always program the MC on startup
Alex Deucher <[email protected]>
drm/radeon: fix hdmi mode enable on RS600/RS690/RS740
Thomas Hellstrom <[email protected]>
drm/ttm: Fix memory type compatibility check
Chris Wilson <[email protected]>
drm: Pad drm_mode_get_connector to 64-bit boundary
Alex Deucher <[email protected]>
drm/radeon: fix panel scaling with eDP and LVDS bridges
Jani Nikula <[email protected]>
drm/i915: try not to lose backlight CBLV precision
Ondrej Zary <[email protected]>
drm/radeon: Another card with wrong primary dac adj
Jani Nikula <[email protected]>
drm/i915: ensure single initialization and cleanup of backlight device
Chris Wilson <[email protected]>
drm/i915: Workaround incoherence between fences and LLC across multiple CPUs
Alex Deucher <[email protected]>
drm/radeon: cleanup properly if mmio mapping fails
Alex Deucher <[email protected]>
drm/radeon: use frac fb div on RS780/RS880
Egbert Eich <[email protected]>
DRM/i915: Add QUIRK_INVERT_BRIGHTNESS for NCR machines.
Jani Nikula <[email protected]>
drm/i915: add quirk to invert brightness on Packard Bell NCL20
Jani Nikula <[email protected]>
drm/i915: add quirk to invert brightness on eMachines e725
Jani Nikula <[email protected]>
drm/i915: add quirk to invert brightness on eMachines G725
Carsten Emde <[email protected]>
drm/i915: panel: invert brightness acer aspire 5734z
Carsten Emde <[email protected]>
drm/i915: panel: invert brightness via quirk
Carsten Emde <[email protected]>
drm/i915: panel: invert brightness via parameter
Jani Nikula <[email protected]>
drm/i915: add missing \n to UTS_RELEASE in the error_state
Daniel Vetter <[email protected]>
drm/i915: dump UTS_RELEASE into the error_state
Chris Wilson <[email protected]>
drm/i915; Only increment the user-pin-count after successfully pinning the bo
Chris Wilson <[email protected]>
drm/i915: Close race between processing unpin task and queueing the flip
Alex Deucher <[email protected]>
drm/radeon: fix typo in evergreen_mc_resume()
Aaro Koskinen <[email protected]>
drm/nouveau: fix init with agpgart-uninorth
Alex Deucher <[email protected]>
drm/radeon: add connector table for Mac G4 Silver
Alex Deucher <[email protected]>
drm/radeon: add connector table for SAM440ep embedded board
Jerome Glisse <[email protected]>
drm/radeon: fix amd afusion gpu setup aka sumo v2
Alex Deucher <[email protected]>
drm/radeon/dce32+: use fractional fb dividers for high clocks
Alex Deucher <[email protected]>
drm: fix documentation for drm_crtc_set_mode()
Jani Nikula <[email protected]>
drm/i915/sdvo: clean up connectors on intel_sdvo_init() failures
Jason Wang <[email protected]>
drivers: hv: switch to use mb() instead of smp_mb()
Paolo Bonzini <[email protected]>
nbd: fsync and kill block device on shutdown
Ben Hutchings <[email protected]>
x86/efi: Fix dummy variable buffer allocation
Matthew Garrett <[email protected]>
Modify UEFI anti-bricking code
Richard Weinberger <[email protected]>
x86,efi: Implement efi_no_storage_paranoia parameter
Sergey Vlasov <[email protected]>
efi: Export efi_query_variable_store() for efivars.ko
Richard Weinberger <[email protected]>
x86,efi: Check max_size only if it is non-zero.
Matt Fleming <[email protected]>
x86, efivars: firmware bug workarounds should be in platform code
Seiji Aguchi <[email protected]>
efi_pstore: Introducing workqueue updating sysfs
Ben Hutchings <[email protected]>
efivars: Fix check for CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE
Seth Forshee <[email protected]>
efivars: Add module parameter to disable use as a pstore backend
Seth Forshee <[email protected]>
efivars: Allow disabling use as a pstore backend
Ben Hutchings <[email protected]>
efivars: pstore: Do not check size when erasing variable
Josh Boyer <[email protected]>
efi: be more paranoid about available space when creating variables
Josh Boyer <[email protected]>
efivars: Disable external interrupt while holding efivars->lock
Seiji Aguchi <[email protected]>
efi_pstore: Check remaining space with QueryVariableInfo() before writing data
H. Peter Anvin <[email protected]>
x86/Sandy Bridge: mark arrays in __init functions as __initconst
Oleg Nesterov <[email protected]>
ptrace/x86: Partly fix set_task_blockstep()->update_debugctlmsr() logic
Oleg Nesterov <[email protected]>
ptrace/x86: Introduce set_task_blockstep() helper
Radu Caragea <[email protected]>
x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member
Russ Gorby <[email protected]>
n_gsm: replace kfree_skb w/ appropriate dev_* versions
Russ Gorby <[email protected]>
n_gsm: avoid accessing freed memory during CMD_FCOFF condition
samix.lebsir <[email protected]>
char: n_gsm: remove message filtering for contipated DLCI
Frederic Berat <[email protected]>
n_gsm : Flow control handling in Mux driver
Randy Dunlap <[email protected]>
x86: fix build error and kconfig for ia32_emulation and binfmt
Fenghua Yu <[email protected]>
x86/apic: Disable I/O APIC before shutdown of the local APIC
H. Peter Anvin <[email protected]>
x86, build: Pass in additional -mno-mmx, -mno-sse options
H. Peter Anvin <[email protected]>
x86, build, icc: Remove uninitialized_var() from compiler-intel.h
Dirk Behme <[email protected]>
tty: serial: imx: don't reinit clock in imx_setup_ufcr()
Takashi Iwai <[email protected]>
ALSA: hda - Add support for CX20952
Takashi Iwai <[email protected]>
ALSA: hda - Add Conexant CX20755/20756/20757 codec IDs
Takashi Iwai <[email protected]>
ALSA: hda/conexant - Correct vendor IDs for new codecs
Takashi Iwai <[email protected]>
ALSA: hda - Add stereo-dmic fixup for Acer Aspire One 522
David Henningsson <[email protected]>
ALSA: hda - Fix oops caused by recent commit "Fix internal mic for Lenovo Ideapad U300s"
Felix Kaechele <[email protected]>
ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310
David Henningsson <[email protected]>
ALSA: HDA: Add inverted internal mic quirk for Lenovo S205
Alex Hung <[email protected]>
thinkpad-acpi: fix issuing duplicated key events for brightness up/down
Bjorn Helgaas <[email protected]>
PCI: shpchp: Use per-slot workqueues to avoid deadlock
Stanislaw Gruszka <[email protected]>
mac80211: introduce IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL
Bruce Allan <[email protected]>
e1000e: DoS while TSO enabled caused by link partner with small MSS
Alexander Stein <[email protected]>
can: c_can: Set reserved bit in IFx_MASK2 to 1 on write
Konrad Rzeszutek Wilk <[email protected]>
intel_idle: Don't register CPU notifier if we are not running.
Axel Lin <[email protected]>
regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
Axel Lin <[email protected]>
regulator: max8997: Use uV in voltage_map_desc
Krzysztof Mazur <[email protected]>
i915: ensure that VGA plane is disabled
Mauro Carvalho Chehab <[email protected]>
i82975x_edac: Fix dimm label initialization
Jiri Slaby <[email protected]>
MISC: hpilo, remove pci_disable_device
Herton Ronaldo Krzesinski <[email protected]>
floppy: properly handle failure on add_disk loop
Seth Forshee <[email protected]>
Input: synaptics - adjust threshold for treating position values as negative
Matthieu CASTET <[email protected]>
UBI: erase free PEB with bitflip in EC header
Rashika Kheria <[email protected]>
Staging: zram: Fix access of NULL pointer
Sergey Senozhatsky <[email protected]>
zram: allow request end to coincide with disksize
Jiang Liu <[email protected]>
zram: avoid access beyond the zram device
Jiang Liu <[email protected]>
zram: destroy all devices on error recovery path in zram_init()
Jiang Liu <[email protected]>
zram: avoid invalid memory access in zram_exit()
Minchan Kim <[email protected]>
zram: Fix deadlock bug in partial read/write
Joe Thornber <[email protected]>
dm thin: fix discard corruption
Shiva Krishna Merla <[email protected]>
dm mpath: fix race condition between multipath_dtr and pg_init_done
Mikulas Patocka <[email protected]>
dm snapshot: avoid snapshot space leak on crash
Harshula Jayasuriya <[email protected]>
nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file
NeilBrown <[email protected]>
md/raid10: fix "enough" function for detecting if array is failed.
Mikulas Patocka <[email protected]>
dm snapshot: add missing module aliases
Mikulas Patocka <[email protected]>
dm bufio: avoid a possible __vmalloc deadlock
Trond Myklebust <[email protected]>
NFSv4.1: Handle NFS4ERR_DELAY when resetting the NFSv4.1 session
Weston Andros Adamson <[email protected]>
NFSv4.1: Don't decode skipped layoutgets
Trond Myklebust <[email protected]>
NFSv4.1: Fix a race in pNFS layoutcommit
Chuck Lever <[email protected]>
NFS: nfs_getaclargs.acl_len is a size_t
fanchaoting <[email protected]>
nfsd: don't run get_file if nfs4_preprocess_stateid_op return error
Dan Carpenter <[email protected]>
NFSv4.1: integer overflow in decode_cb_sequence_args()
J. Bruce Fields <[email protected]>
nfsd4: fix xdr decoding of large non-write compounds
Andy Adamson <[email protected]>
NFSv4 wait on recovery for async session errors
Mateusz Guzik <[email protected]>
cifs: delay super block destruction until all cifsFileInfo objects are gone
Linus Torvalds <[email protected]>
VFS: make vfs_fstat() use f[get|put]_light()
Steven Rostedt (Red Hat) <[email protected]>
tracing: Keep overwrite in sync between regular and snapshot buffers
Wei Yongjun <[email protected]>
perf: Fix error return code
libin <[email protected]>
sched/debug: Fix sd->*_idx limit range avoiding overflow
Namhyung Kim <[email protected]>
sched/debug: Limit sd->*_idx range on sysctl
Steven Rostedt (Red Hat) <[email protected]>
ftrace: Check module functions being traced on reload
Peter Zijlstra <[email protected]>
perf: Fix perf ring buffer memory ordering
Justin Lecher <[email protected]>
fs: cachefiles: add support for large files in filesystem caching
Geyslan G. Bem <[email protected]>
ecryptfs: Fix memory leakage in keystore.c
Pavel Shilovsky <[email protected]>
CIFS: Fix error handling in cifs_push_mandatory_locks
Steve French <[email protected]>
setfacl removes part of ACL when setting POSIX ACLs to Samba
Horia Geanta <[email protected]>
crypto: caam - add allocation failure handling in SPRINTFCAT macro
Du, Wenkai <[email protected]>
i2c: designware: Mask all interrupts during i2c controller enable
Hans de Goede <[email protected]>
ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX
Marcel Apfelbaum <[email protected]>
PCI: shpchp: Check bridge's secondary (not primary) bus speed
Linus Torvalds <[email protected]>
x86-64, modify_ldt: Make support for 16-bit segments a runtime option
Charles Keepax <[email protected]>
ASoC: wm8962: Update register CLASS_D_CONTROL_1 to be non-volatile
Jianyu Zhan <[email protected]>
percpu: make pcpu_alloc_chunk() use pcpu_mem_free() instead of kfree()
J. Bruce Fields <[email protected]>
nfsd4: remove lockowner when removing lock stateid
J. Bruce Fields <[email protected]>
nfsd4: warn on finding lockowner without stateid's
Kinglong Mee <[email protected]>
NFSD: Call ->set_acl with a NULL ACL structure if no entries
Romain Izard <[email protected]>
trace: module: Maintain a valid user count
Salva Peiró <[email protected]>
media: media-device: fix infoleak in ioctl media_enum_entities()
Tim Chen <[email protected]>
crypto: crypto_wq - Fix late crypto work queue initialization
Geert Uytterhoeven <[email protected]>
Documentation: Update stable address in Chinese and Japanese translations
Ilia Mirkin <[email protected]>
drm/nouveau/acpi: allow non-optimus setups to load vbios from acpi
Ben Hutchings <[email protected]>
rtl8192cu: Fix unbalanced irq enable in error path of rtl92cu_hw_init()
Liu Hua <[email protected]>
ARM: 8012/1: kdump: Avoid overflow when converting pfn to physaddr
Christoph Hellwig <[email protected]>
posix_acl: handle NULL ACL in posix_acl_equiv_mode
Stanislaw Gruszka <[email protected]>
rt2x00: fix beaconing on USB
Daniele Forsi <[email protected]>
USB: Nokia 5300 should be treated as unusual dev
Victor A. Santos <[email protected]>
USB: Nokia 305 should be treated as unusual dev
Daniele Forsi <[email protected]>
usb: storage: shuttle_usbat: fix discs being detected twice
Jean-Jacques Hiblot <[email protected]>
usb: gadget: at91-udc: fix irq and iomem resource retrieval
Alex Deucher <[email protected]>
drm/radeon: fix ATPX detection on non-VGA GPUs
NeilBrown <[email protected]>
md: avoid possible spinning md thread at shutdown.
Viresh Kumar <[email protected]>
hrtimer: Set expiry time before switch_hrtimer_base()
Leon Ma <[email protected]>
hrtimer: Prevent remote enqueue of leftmost timers
Stuart Hayes <[email protected]>
hrtimer: Prevent all reprogramming if hang detected
Grant Likely <[email protected]>
drivercore: deferral race condition fix
Josef Gajdusek <[email protected]>
hwmon: (emc1403) Support full range of known chip revision numbers
Josef Gajdusek <[email protected]>
hwmon: (emc1403) fix inverted store_hyst()
Chen Yucong <[email protected]>
hwpoison, hugetlb: lock_page/unlock_page does not match for handling a free hugepage
Anthony Iliopoulos <[email protected]>
x86, mm, hugetlb: Add missing TLB page invalidation for hugetlb_cow()
Corey Minyard <[email protected]>
ipmi: Reset the KCS timeout when starting error recovery
Bodo Stroesser <[email protected]>
ipmi: Fix a race restarting the timer
Jiri Bohac <[email protected]>
timer: Prevent overflow in apply_slack
Linus Torvalds <[email protected]>
mm: make fixup_user_fault() check the vma access rights too
Bartlomiej Zolnierkiewicz <[email protected]>
pata_at91: fix ata_host_activate() failure handling
Steven Rostedt (Red Hat) <[email protected]>
ftrace/module: Hardcode ftrace_module_init() call into load_module()
Thomas Gleixner <[email protected]>
futex: Prevent attaching to kernel threads
Thomas Gleixner <[email protected]>
futex: Add another early deadlock detection check
Eric Dumazet <[email protected]>
net-gro: reset skb->truesize in napi_reuse_skb()
Alexander Duyck <[email protected]>
skb: Add inline helper for getting the skb end offset from head
Li RongQing <[email protected]>
ipv4: initialise the itag variable in __mkroute_input
Jason Wang <[email protected]>
act_mirred: do not drop packets when fails to mirror it
Sergey Popovich <[email protected]>
ipv4: fib_semantics: increment fib_info_cnt after fib_info allocation
Florian Westphal <[email protected]>
net: ipv4: ip_forward: fix inverted local_df test
Liu Yu <[email protected]>
tcp_cubic: fix the range of delayed_ack
Vlad Yasevich <[email protected]>
Revert "macvlan : fix checksums error when we are in bridge mode"
David Gibson <[email protected]>
rtnetlink: Only supply IFLA_VF_PORTS information when RTEXT_FILTER_VF is set
David Gibson <[email protected]>
rtnetlink: Warn when interface's information won't fit in our packet
Ivan Vecera <[email protected]>
tg3: update rx_jumbo_pending ring param only when jumbo frames are enabled
Mathias Krause <[email protected]>
filter: prevent nla extensions to peek beyond the end of the message
Wang, Xiaoming <[email protected]>
net: ipv4: current group_info should be put after using.
Eric Dumazet <[email protected]>
ipv6: Limit mtu to 65575 bytes
Thomas Richter <[email protected]>
bonding: Remove debug_fs files when module init fails
Florian Westphal <[email protected]>
net: core: don't account for udp header size when computing seglen
Dmitry Petukhov <[email protected]>
l2tp: take PMTU from tunnel UDP socket
Daniel Borkmann <[email protected]>
net: sctp: test if association is dead in sctp_wake_up_waiters
Daniel Borkmann <[email protected]>
net: sctp: wake up all assocs if sndbuf policy is per socket
Oleg Nesterov <[email protected]>
list: introduce list_next_entry() and list_prev_entry()
Alex Deucher <[email protected]>
drm/radeon: call drm_edid_to_eld when we update the edid
Christopher Friedt <[email protected]>
drm/vmwgfx: correct fb_fix_screeninfo.line_length
Bjørn Mork <[email protected]>
usb: option: add and update a number of CMOTech devices
Bjørn Mork <[email protected]>
usb: option: add Alcatel L800MA
Bjørn Mork <[email protected]>
usb: option: add Olivetti Olicard 500
Johan Hovold <[email protected]>
USB: io_ti: fix firmware download on big-endian machines
Johan Hovold <[email protected]>
Revert "USB: serial: add usbid for dell wwan card to sierra.c"
Daniele Palmas <[email protected]>
usb: option driver, add support for Telit UE910v2
Michele Baldessari <[email protected]>
USB: serial: ftdi_sio: add id for Brainboxes serial cards
Tristan Bruns <[email protected]>
USB: cp210x: Add 8281 (Nanotec Plug & Drive)
Michael Ulbricht <[email protected]>
USB: cdc-acm: Remove Motorola/Telit H24 serial interfaces from ACM driver
Mizuma, Masayoshi <[email protected]>
mm/hugetlb.c: add cond_resched_lock() in return_unused_surplus_pages()
Helge Deller <[email protected]>
parisc: fix epoll_pwait syscall on compat kernel
-------------
Diffstat:
Documentation/i2c/busses/i2c-piix4 | 2 +- Documentation/ja_JP/HOWTO | 2 +- Documentation/ja_JP/stable_kernel_rules.txt | 6 +- Documentation/kernel-parameters.txt | 20 ++ Documentation/zh_CN/HOWTO | 2 +- Documentation/zh_CN/stable_kernel_rules.txt | 2 +- Makefile | 4 +- arch/arm/kernel/crash_dump.c | 2 +- arch/parisc/kernel/syscall_table.S | 2 +- arch/s390/crypto/aes_s390.c | 50 +++-- arch/x86/Kconfig | 1 + arch/x86/boot/Makefile | 6 +- arch/x86/boot/compressed/Makefile | 1 + arch/x86/include/asm/hugetlb.h | 1 + arch/x86/kernel/crash.c | 2 +- arch/x86/kernel/ldt.c | 4 +- arch/x86/kernel/reboot.c | 11 +- arch/x86/kernel/setup.c | 4 +- arch/x86/kernel/step.c | 53 +++-- arch/x86/kernel/sys_x86_64.c | 2 +- arch/x86/mm/mmap.c | 6 +- arch/x86/platform/efi/efi.c | 105 ++++++++++ arch/x86/vdso/vdso32-setup.c | 8 + crypto/crypto_wq.c | 2 +- drivers/acpi/blacklist.c | 13 ++ drivers/ata/ata_piix.c | 8 + drivers/ata/pata_at91.c | 11 +- drivers/atm/ambassador.c | 2 +- drivers/atm/idt77252.c | 2 +- drivers/base/dd.c | 17 ++ drivers/block/floppy.c | 11 +- drivers/block/nbd.c | 9 + drivers/char/ipmi/ipmi_kcs_sm.c | 5 +- drivers/char/ipmi/ipmi_si_intf.c | 46 +++-- drivers/char/random.c | 24 ++- drivers/crypto/caam/error.c | 10 +- drivers/edac/i82975x_edac.c | 11 +- drivers/firmware/Kconfig | 18 ++ drivers/firmware/efivars.c | 256 ++++++++++++++++++------- drivers/gpu/drm/drm_crtc_helper.c | 4 +- drivers/gpu/drm/i915/i915_debugfs.c | 6 +- drivers/gpu/drm/i915/i915_drv.h | 4 +- drivers/gpu/drm/i915/i915_gem.c | 23 ++- drivers/gpu/drm/i915/i915_irq.c | 4 +- drivers/gpu/drm/i915/intel_display.c | 114 ++++++++++- drivers/gpu/drm/i915/intel_dp.c | 5 - drivers/gpu/drm/i915/intel_drv.h | 5 +- drivers/gpu/drm/i915/intel_lvds.c | 3 +- drivers/gpu/drm/i915/intel_opregion.c | 2 +- drivers/gpu/drm/i915/intel_panel.c | 31 ++- drivers/gpu/drm/i915/intel_sdvo.c | 22 ++- drivers/gpu/drm/nouveau/nouveau_acpi.c | 3 - drivers/gpu/drm/nouveau/nouveau_bo.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 5 + drivers/gpu/drm/radeon/evergreen.c | 9 +- drivers/gpu/drm/radeon/ni.c | 3 +- drivers/gpu/drm/radeon/r600.c | 3 +- drivers/gpu/drm/radeon/r600_hdmi.c | 4 +- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 7 + drivers/gpu/drm/radeon/radeon_combios.c | 125 +++++++++++- drivers/gpu/drm/radeon/radeon_connectors.c | 34 +++- drivers/gpu/drm/radeon/radeon_display.c | 1 + drivers/gpu/drm/radeon/radeon_kms.c | 4 + drivers/gpu/drm/radeon/radeon_mode.h | 2 + drivers/gpu/drm/radeon/rv770.c | 3 +- drivers/gpu/drm/radeon/si.c | 3 +- drivers/gpu/drm/ttm/ttm_bo.c | 32 ++-- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 5 +- drivers/hid/hid-logitech-dj.c | 38 ++-- drivers/hv/ring_buffer.c | 4 +- drivers/hv/vmbus_drv.c | 2 +- drivers/hwmon/emc1403.c | 4 +- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-designware-core.c | 3 + drivers/i2c/busses/i2c-piix4.c | 3 +- drivers/i2c/busses/i2c-tegra.c | 13 +- drivers/idle/intel_idle.c | 7 +- drivers/input/mouse/synaptics.c | 31 ++- drivers/md/dm-bufio.c | 26 ++- drivers/md/dm-mpath.c | 18 +- drivers/md/dm-snap.c | 73 ++++++- drivers/md/dm-thin.c | 4 +- drivers/md/md.c | 3 +- drivers/md/persistent-data/dm-btree-remove.c | 46 ++--- drivers/md/raid10.c | 8 +- drivers/media/media-device.c | 1 + drivers/misc/hpilo.c | 11 +- drivers/mtd/devices/m25p80.c | 19 +- drivers/mtd/ubi/scan.c | 2 +- drivers/net/bonding/bond_main.c | 1 + drivers/net/can/c_can/c_can.c | 6 +- drivers/net/can/sja1000/sja1000.c | 17 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 3 - drivers/net/ethernet/broadcom/tg3.c | 4 +- drivers/net/ethernet/intel/e1000e/e1000.h | 1 + drivers/net/ethernet/intel/e1000e/netdev.c | 48 +++-- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +- drivers/net/macvlan.c | 3 - drivers/net/wimax/i2400m/usb-rx.c | 2 +- drivers/net/wireless/b43/Kconfig | 4 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2800usb.c | 2 + drivers/net/wireless/rt2x00/rt2x00mac.c | 22 ++- drivers/net/wireless/rt2x00/rt73usb.c | 1 + drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 2 +- drivers/net/xen-netfront.c | 17 +- drivers/pci/hotplug/shpchp.h | 2 +- drivers/pci/hotplug/shpchp_core.c | 26 +-- drivers/pci/hotplug/shpchp_ctrl.c | 10 +- drivers/pci/pcie/aspm.c | 3 + drivers/platform/x86/msi-wmi.c | 4 +- drivers/platform/x86/thinkpad_acpi.c | 2 +- drivers/rapidio/devices/tsi721.c | 11 ++ drivers/regulator/max8997.c | 36 ++-- drivers/regulator/max8998.c | 2 +- drivers/rtc/rtc-pl031.c | 10 +- drivers/staging/octeon/ethernet-tx.c | 2 +- drivers/staging/speakup/speakup_soft.c | 2 +- drivers/staging/zram/zram_drv.c | 38 ++-- drivers/staging/zram/zram_sysfs.c | 6 +- drivers/tty/n_gsm.c | 78 ++++---- drivers/tty/serial/imx.c | 18 +- drivers/usb/class/cdc-acm.c | 28 ++- drivers/usb/gadget/at91_udc.c | 10 - drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/ftdi_sio.c | 33 ++++ drivers/usb/serial/ftdi_sio_ids.h | 37 ++++ drivers/usb/serial/io_ti.c | 50 +++-- drivers/usb/serial/option.c | 83 +++++++- drivers/usb/serial/sierra.c | 1 - drivers/usb/storage/shuttle_usbat.c | 2 +- drivers/usb/storage/unusual_devs.h | 14 ++ drivers/video/backlight/atmel-pwm-bl.c | 3 +- drivers/video/console/vgacon.c | 17 +- fs/cachefiles/rdwr.c | 2 +- fs/cifs/cifsfs.c | 24 +++ fs/cifs/cifsfs.h | 4 + fs/cifs/cifssmb.c | 8 +- fs/cifs/file.c | 8 +- fs/ecryptfs/keystore.c | 3 +- fs/nfs/callback_xdr.c | 6 +- fs/nfs/nfs4proc.c | 23 +-- fs/nfs/nfs4state.c | 14 +- fs/nfs/pnfs.c | 19 +- fs/nfsd/nfs4acl.c | 17 +- fs/nfsd/nfs4proc.c | 8 +- fs/nfsd/nfs4state.c | 15 +- fs/nfsd/nfs4xdr.c | 2 +- fs/nfsd/vfs.c | 5 +- fs/posix_acl.c | 6 + fs/stat.c | 5 +- include/drm/drm_mode.h | 2 + include/linux/compiler-intel.h | 2 - include/linux/efi.h | 16 +- include/linux/ftrace.h | 2 + include/linux/list.h | 16 ++ include/linux/mm_types.h | 1 + include/linux/net.h | 23 +++ include/linux/perf_event.h | 12 +- include/linux/skbuff.h | 12 +- include/net/ip6_route.h | 5 + include/net/mac80211.h | 5 + include/trace/events/module.h | 2 +- include/xen/interface/io/netif.h | 1 + kernel/events/core.c | 4 +- kernel/events/ring_buffer.c | 31 ++- kernel/futex.c | 52 +++-- kernel/hrtimer.c | 30 ++- kernel/module.c | 3 + kernel/sched/core.c | 35 ++-- kernel/timer.c | 2 +- kernel/trace/ftrace.c | 98 ++++++---- kernel/trace/trace.c | 6 +- mm/hugetlb.c | 1 + mm/memory-failure.c | 15 +- mm/memory.c | 5 + mm/percpu.c | 2 +- net/core/dev.c | 1 + net/core/filter.c | 6 +- net/core/rtnetlink.c | 33 ++-- net/core/skbuff.c | 21 +- net/ipv4/fib_semantics.c | 2 +- net/ipv4/ip_forward.c | 4 +- net/ipv4/ping.c | 15 +- net/ipv4/route.c | 2 +- net/ipv4/tcp_cubic.c | 2 +- net/ipv6/route.c | 5 +- net/l2tp/l2tp_ppp.c | 4 +- net/mac80211/rx.c | 3 + net/mac80211/status.c | 6 +- net/sched/act_mirred.c | 11 +- net/sctp/socket.c | 42 +++- net/wireless/sme.c | 3 + sound/pci/hda/patch_conexant.c | 34 +++- sound/soc/codecs/wm8962.c | 15 +- sound/soc/codecs/wm8962.h | 4 + 196 files changed, 2217 insertions(+), 745 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/214 parisc: fix epoll_pwait syscall on compat kernel
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit ab3e55b119c9653b19ea4edffb86f04db867ac98 upstream.
This bug was detected with the libio-epoll-perl debian package where the test case IO-Ppoll-compat.t failed.
--- arch/parisc/kernel/syscall_table.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/kernel/syscall_table.S +1 -1
@@ -395,7 +395,7 @@ ENTRY_COMP(vmsplice) ENTRY_COMP(move_pages) /* 295 */ ENTRY_SAME(getcpu) - ENTRY_SAME(epoll_pwait) + ENTRY_COMP(epoll_pwait) ENTRY_COMP(statfs64) ENTRY_COMP(fstatfs64) ENTRY_COMP(kexec_load) /* 300 */
Greg Kroah-Hartman
maintainerPATCH 2/214 mm/hugetlb.c: add cond_resched_lock() in return_unused_surplus_pages()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Mizuma, Masayoshi" <[email protected]>
commit 7848a4bf51b34f41fcc9bd77e837126d99ae84e3 upstream.
soft lockup in freeing gigantic hugepage fixed in commit 55f67141a892 "mm:
hugetlb: fix softlockup when a large number of hugepages are freed." can happen in return_unused_surplus_pages(), so let's fix it.
--- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+)
mm/hugetlb.c +1 -0
@@ -1082,6 +1082,7 @@ static void return_unused_surplus_pages(while (nr_pages--) {if (!free_pool_huge_page (h, &node_states[N_HIGH_MEMORY ],1 ))break ; +cond_resched_lock (&hugetlb_lock); } }
Greg Kroah-Hartman
maintainerPATCH 3/214 USB: cdc-acm: Remove Motorola/Telit H24 serial interfaces from ACM driver
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ulbricht <[email protected]>
commit 895d240d1db0b2736d779200788e4c4aea28a0c6 upstream.
By specifying NO_UNION_NORMAL the ACM driver does only use the first two USB interfaces (modem data & control). The AT Port, Diagnostic and NMEA interfaces are left to the USB serial driver.
--- drivers/usb/class/cdc-acm.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
drivers/usb/class/cdc-acm.c +21 -7
@@ -1587,13 +1587,27 @@ static const struct usb_device_id acm_id },/* Motorola H24 HSPA module: */ { USB_DEVICE(0x22b8, 0x2d91) }, /* modem */ - { USB_DEVICE(0x22b8, 0x2d92) }, /* modem + diagnostics */ - { USB_DEVICE(0x22b8, 0x2d93) }, /* modem + AT port */ - { USB_DEVICE(0x22b8, 0x2d95) }, /* modem + AT port + diagnostics */ - { USB_DEVICE(0x22b8, 0x2d96) }, /* modem + NMEA */ - { USB_DEVICE(0x22b8, 0x2d97) }, /* modem + diagnostics + NMEA */ - { USB_DEVICE(0x22b8, 0x2d99) }, /* modem + AT port + NMEA */ - { USB_DEVICE(0x22b8, 0x2d9a) }, /* modem + AT port + diagnostics + NMEA */ + { USB_DEVICE(0x22b8, 0x2d92), /* modem + diagnostics */ + .driver_info =NO_UNION_NORMAL ,/* handle only modem interface */ + }, + { USB_DEVICE(0x22b8, 0x2d93), /* modem + AT port */ + .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ + }, + { USB_DEVICE(0x22b8, 0x2d95), /* modem + AT port + diagnostics */ + .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ + }, + { USB_DEVICE(0x22b8, 0x2d96), /* modem + NMEA */ + .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ + }, + { USB_DEVICE(0x22b8, 0x2d97), /* modem + diagnostics + NMEA */ + .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ + }, + { USB_DEVICE(0x22b8, 0x2d99), /* modem + AT port + NMEA */ + .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ + }, + { USB_DEVICE(0x22b8, 0x2d9a), /* modem + AT port + diagnostics + NMEA */ + .driver_info = NO_UNION_NORMAL, /* handle only modem interface */ + }, { USB_DEVICE(0x0572, 0x1329), /* Hummingbird huc56s (Conexant) */ .driver_info = NO_UNION_NORMAL, /* union descriptor misplaced on
Greg Kroah-Hartman
maintainerPATCH 4/214 USB: cp210x: Add 8281 (Nanotec Plug & Drive)
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tristan Bruns <[email protected]>
commit 72b3007951010ce1bbf950e23b19d9839fa905a5 upstream.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -110,6 +110,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ { USB_DEVICE(0x10C4, 0x822B) }, /* Modem EDGE(GSM) Comander 2 */ { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ + { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
Greg Kroah-Hartman
maintainerPATCH 5/214 USB: serial: ftdi_sio: add id for Brainboxes serial cards
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michele Baldessari <[email protected]>
commit efe26e16b1d93ac0085e69178cc18811629e8fc5 upstream.
Custom VID/PIDs for Brainboxes cards as reported in
https://bugzilla.redhat.com/show_bug.cgi?id=1071914
--- drivers/usb/serial/ftdi_sio.c | 33 +++++++++++++++++++++++++++++++++ drivers/usb/serial/ftdi_sio_ids.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+)
drivers/usb/serial/ftdi_sio.c +33 -0
@@ -920,6 +920,39 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_Z3X_PID) },/* Cressi Devices */ { USB_DEVICE(FTDI_VID, FTDI_CRESSI_PID) }, +/* Brainboxes Devices */ + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_001_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_012_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_023_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_034_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_101_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_4_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_5_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_6_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_7_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_8_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_257_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_4_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_313_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_324_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_357_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_606_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_701_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_1_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) }, { }, /* Optional parameter entry */ { } /* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +37 -0
@@ -1326,3 +1326,40 @@* Manufacturer: Cressi */ #define FTDI_CRESSI_PID 0x87d0 + +/* +* Brainboxes devices +*/ +#define BRAINBOXES_VID 0x05d1 +#define BRAINBOXES_VX_001_PID 0x1001/* VX-001 ExpressCard 1 Port RS232 */ +#define BRAINBOXES_VX_012_PID 0x1002/* VX-012 ExpressCard 2 Port RS232 */ +#define BRAINBOXES_VX_023_PID 0x1003/* VX-023 ExpressCard 1 Port RS422/485 */ +#define BRAINBOXES_VX_034_PID 0x1004/* VX-034 ExpressCard 2 Port RS422/485 */ +#define BRAINBOXES_US_101_PID 0x1011/* US-101 1xRS232 */ +#define BRAINBOXES_US_324_PID 0x1013/* US-324 1xRS422/485 1Mbaud */ +#define BRAINBOXES_US_606_1_PID 0x2001/* US-606 6 Port RS232 Serial Port 1 and 2 */ +#define BRAINBOXES_US_606_2_PID 0x2002/* US-606 6 Port RS232 Serial Port 3 and 4 */ +#define BRAINBOXES_US_606_3_PID 0x2003/* US-606 6 Port RS232 Serial Port 4 and 6 */ +#define BRAINBOXES_US_701_1_PID 0x2011/* US-701 4xRS232 1Mbaud Port 1 and 2 */ +#define BRAINBOXES_US_701_2_PID 0x2012/* US-701 4xRS422 1Mbaud Port 3 and 4 */ +#define BRAINBOXES_US_279_1_PID 0x2021/* US-279 8xRS422 1Mbaud Port 1 and 2 */ +#define BRAINBOXES_US_279_2_PID 0x2022/* US-279 8xRS422 1Mbaud Port 3 and 4 */ +#define BRAINBOXES_US_279_3_PID 0x2023/* US-279 8xRS422 1Mbaud Port 5 and 6 */ +#define BRAINBOXES_US_279_4_PID 0x2024/* US-279 8xRS422 1Mbaud Port 7 and 8 */ +#define BRAINBOXES_US_346_1_PID 0x3011/* US-346 4xRS422/485 1Mbaud Port 1 and 2 */ +#define BRAINBOXES_US_346_2_PID 0x3012/* US-346 4xRS422/485 1Mbaud Port 3 and 4 */ +#define BRAINBOXES_US_257_PID 0x5001/* US-257 2xRS232 1Mbaud */ +#define BRAINBOXES_US_313_PID 0x6001/* US-313 2xRS422/485 1Mbaud */ +#define BRAINBOXES_US_357_PID 0x7001/* US_357 1xRS232/422/485 */ +#define BRAINBOXES_US_842_1_PID 0x8001/* US-842 8xRS422/485 1Mbaud Port 1 and 2 */ +#define BRAINBOXES_US_842_2_PID 0x8002/* US-842 8xRS422/485 1Mbaud Port 3 and 4 */ +#define BRAINBOXES_US_842_3_PID 0x8003/* US-842 8xRS422/485 1Mbaud Port 5 and 6 */ +#define BRAINBOXES_US_842_4_PID 0x8004/* US-842 8xRS422/485 1Mbaud Port 7 and 8 */ +#define BRAINBOXES_US_160_1_PID 0x9001/* US-160 16xRS232 1Mbaud Port 1 and 2 */ +#define BRAINBOXES_US_160_2_PID 0x9002/* US-160 16xRS232 1Mbaud Port 3 and 4 */ +#define BRAINBOXES_US_160_3_PID 0x9003/* US-160 16xRS232 1Mbaud Port 5 and 6 */ +#define BRAINBOXES_US_160_4_PID 0x9004/* US-160 16xRS232 1Mbaud Port 7 and 8 */ +#define BRAINBOXES_US_160_5_PID 0x9005/* US-160 16xRS232 1Mbaud Port 9 and 10 */ +#define BRAINBOXES_US_160_6_PID 0x9006/* US-160 16xRS232 1Mbaud Port 11 and 12 */ +#define BRAINBOXES_US_160_7_PID 0x9007/* US-160 16xRS232 1Mbaud Port 13 and 14 */ +#define BRAINBOXES_US_160_8_PID 0x9008/* US-160 16xRS232 1Mbaud Port 15 and 16 */
Greg Kroah-Hartman
maintainerPATCH 6/214 usb: option driver, add support for Telit UE910v2
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Palmas <[email protected]>
commit d6de486bc22255779bd54b0fceb4c240962bf146 upstream.
option driver, added VID/PID for Telit UE910v2 modem
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -243,6 +243,7 @@ static void option_instat_callback(struc#define TELIT_PRODUCT_CC864_DUAL 0x1005#define TELIT_PRODUCT_CC864_SINGLE 0x1006#define TELIT_PRODUCT_DE910_DUAL 0x1010 +#define TELIT_PRODUCT_UE910_V2 0x1012#define TELIT_PRODUCT_LE920 0x1200/* ZTE PRODUCTS */
@@ -1055,6 +1056,7 @@ static const struct usb_device_id option { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
Greg Kroah-Hartman
maintainerPATCH 7/214 Revert "USB: serial: add usbid for dell wwan card to sierra.c"
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 2e01280d2801c72878cf3a7119eac30077b463d5 upstream.
This reverts commit 1ebca9dad5abe8b2ed4dbd186cd657fb47c1f321.
This device was erroneously added to the sierra driver even though it's not a Sierra device and was already handled by the option driver.
--- drivers/usb/serial/sierra.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/sierra.c +0 -1
@@ -305,7 +305,6 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist }, - { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ { } };
Greg Kroah-Hartman
maintainerPATCH 8/214 USB: io_ti: fix firmware download on big-endian machines
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 5509076d1b4485ce9fb07705fcbcd2695907ab5b upstream.
During firmware download the device expects memory addresses in big-endian byte order. As the wIndex parameter which hold the address is sent in little-endian byte order regardless of host byte order, we need to use swab16 rather than cpu_to_be16.
Also make sure to handle the struct ti_i2c_desc size parameter which is returned in little-endian byte order.
--- drivers/usb/serial/io_ti.c | 50 +++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 17 deletions(-)
drivers/usb/serial/io_ti.c +33 -17
@@ -29,6 +29,7 @@#include <linux/spinlock.h> #include <linux/mutex.h> #include <linux/serial.h> +#include <linux/swab.h> #include <linux/kfifo.h> #include <linux/ioctl.h> #include <linux/firmware.h>
@@ -298,7 +299,7 @@ static int read_download_mem(struct usb_ {int status =0 ;__u8 read_length; -__be16 be_start_address; +u16 be_start_address;dbg ("%s - @ %x for %d" , __func__, start_address, length);
@@ -315,10 +316,14 @@ static int read_download_mem(struct usb_dbg ("%s - @ %x for %d" , __func__, start_address, read_length); } - be_start_address =cpu_to_be16 (start_address); +/* +* NOTE: Must use swab as wIndex is sent in little-endian +* byte order regardless of host byte order. +*/ + be_start_address =swab16 ((u16 )start_address); status =ti_vread_sync (dev,UMPC_MEMORY_READ , (__u16 )address_type, - (__force __u16 )be_start_address, + be_start_address, buffer, read_length);if (status) {
@@ -418,7 +423,7 @@ static int write_i2c_mem(struct edgeport {int status =0 ;int write_length; -__be16 be_start_address; +u16 be_start_address;/* We can only send a maximum of 1 aligned byte page at a time */
@@ -434,11 +439,16 @@ static int write_i2c_mem(struct edgeportusb_serial_debug_data (debug, &serial->serial->dev->dev, __func__, write_length, buffer); -/* Write first page */ - be_start_address =cpu_to_be16 (start_address); +/* +* Write first page. +* +* NOTE: Must use swab as wIndex is sent in little-endian byte order +* regardless of host byte order. +*/ + be_start_address =swab16 ((u16 )start_address); status =ti_vsend_sync (serial->serial->dev,UMPC_MEMORY_WRITE , (__u16 )address_type, - (__force __u16 )be_start_address, + be_start_address, buffer, write_length);if (status) {dbg ("%s - ERROR %d" , __func__, status);
@@ -462,11 +472,16 @@ static int write_i2c_mem(struct edgeportusb_serial_debug_data (debug, &serial->serial->dev->dev, __func__, write_length, buffer); -/* Write next page */ - be_start_address =cpu_to_be16 (start_address); +/* +* Write next page. +* +* NOTE: Must use swab as wIndex is sent in little-endian byte +* order regardless of host byte order. +*/ + be_start_address =swab16 ((u16 )start_address); status =ti_vsend_sync (serial->serial->dev,UMPC_MEMORY_WRITE , (__u16 )address_type, - (__force __u16 )be_start_address, + be_start_address, buffer, write_length);if (status) { dev_err(&serial->serial->dev->dev, "%s - ERROR %d\n",
@@ -673,8 +688,8 @@ static int get_descriptor_addr(struct edif (rom_desc->Type == desc_type)return start_address; - start_address = start_address +sizeof (struct ti_i2c_desc ) - + rom_desc->Size; + start_address = start_address +sizeof (struct ti_i2c_desc ) + +le16_to_cpu (rom_desc->Size); }while ((start_address <TI_MAX_I2C_SIZE ) && rom_desc->Type);
@@ -687,7 +702,7 @@ static int valid_csum(struct ti_i2c_desc__u16 i;__u8 cs =0 ; -for (i =0 ; i < rom_desc->Size; i++) +for (i =0 ; i <le16_to_cpu (rom_desc->Size); i++) cs = (__u8)(cs + buffer[i]);if (cs != rom_desc->CheckSum) {
@@ -741,7 +756,7 @@ static int check_i2c_image(struct edgepobreak ;if ((start_address +sizeof (struct ti_i2c_desc ) + - rom_desc->Size) >TI_MAX_I2C_SIZE ) { +le16_to_cpu (rom_desc->Size)) >TI_MAX_I2C_SIZE ) { status = -ENODEV ;dbg ("%s - structure too big, erroring out." , __func__);break ;
@@ -756,7 +771,8 @@ static int check_i2c_image(struct edgepo/* Read the descriptor data */ status =read_rom (serial, start_address +sizeof (struct ti_i2c_desc ), - rom_desc->Size, buffer); +le16_to_cpu (rom_desc->Size), + buffer);if (status)break ;
@@ -765,7 +781,7 @@ static int check_i2c_image(struct edgepobreak ; } start_address = start_address +sizeof (struct ti_i2c_desc ) + - rom_desc->Size; +le16_to_cpu (rom_desc->Size); }while ((rom_desc->Type !=I2C_DESC_TYPE_ION ) && (start_address <TI_MAX_I2C_SIZE ));
@@ -804,7 +820,7 @@ static int get_manuf_info(struct edgepor/* Read the descriptor data */ status =read_rom (serial, start_address+sizeof (struct ti_i2c_desc ), - rom_desc->Size, buffer); +le16_to_cpu (rom_desc->Size), buffer);if (status) goto exit;
Greg Kroah-Hartman
maintainerPATCH 9/214 usb: option: add Olivetti Olicard 500
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 533b3994610f316e5cd61b56d0c4daa15c830f89 upstream.
Device interface layout:
0: ff/ff/ff - serial
1: ff/ff/ff - serial AT+PPP
2: 08/06/50 - storage
3: ff/ff/ff - serial
4: ff/ff/ff - QMI/wwan
--- drivers/usb/serial/option.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/option.c +4 -0
@@ -354,6 +354,7 @@ static void option_instat_callback(struc#define OLIVETTI_PRODUCT_OLICARD100 0xc000#define OLIVETTI_PRODUCT_OLICARD145 0xc003#define OLIVETTI_PRODUCT_OLICARD200 0xc005 +#define OLIVETTI_PRODUCT_OLICARD500 0xc00b/* Celot products */ #define CELOT_VENDOR_ID 0x211f
@@ -1565,6 +1566,9 @@ static const struct usb_device_id option { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), .driver_info = (kernel_ulong_t)&net_intf6_blacklist }, + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist + }, { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
Greg Kroah-Hartman
maintainerPATCH 10/214 usb: option: add Alcatel L800MA
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit dd6b48ecec2ea7d15f28d5e5474388681899a5e1 upstream.
Device interface layout:
0: ff/ff/ff - serial
1: ff/00/00 - serial AT+PPP
2: ff/ff/ff - QMI/wwan
3: 08/06/50 - storage
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -292,6 +292,7 @@ static void option_instat_callback(struc#define ALCATEL_PRODUCT_X060S_X200 0x0000#define ALCATEL_PRODUCT_X220_X500D 0x0017#define ALCATEL_PRODUCT_L100V 0x011e +#define ALCATEL_PRODUCT_L800MA 0x0203#define PIRELLI_VENDOR_ID 0x1266#define PIRELLI_PRODUCT_C100_1 0x1002
@@ -1521,6 +1522,8 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L800MA), + .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
Greg Kroah-Hartman
maintainerPATCH 11/214 usb: option: add and update a number of CMOTech devices
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 34f972d6156fe9eea2ab7bb418c71f9d1d5c8e7b upstream.
A number of older CMOTech modems are based on Qualcomm chips. The blacklisted interfaces are QMI/wwan.
--- drivers/usb/serial/option.c | 74 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 4 deletions(-)
drivers/usb/serial/option.c +70 -4
@@ -234,8 +234,31 @@ static void option_instat_callback(struc#define QUALCOMM_VENDOR_ID 0x05C6#define CMOTECH_VENDOR_ID 0x16d8 -#define CMOTECH_PRODUCT_6008 0x6008 -#define CMOTECH_PRODUCT_6280 0x6280 +#define CMOTECH_PRODUCT_6001 0x6001 +#define CMOTECH_PRODUCT_CMU_300 0x6002 +#define CMOTECH_PRODUCT_6003 0x6003 +#define CMOTECH_PRODUCT_6004 0x6004 +#define CMOTECH_PRODUCT_6005 0x6005 +#define CMOTECH_PRODUCT_CGU_628A 0x6006 +#define CMOTECH_PRODUCT_CHE_628S 0x6007 +#define CMOTECH_PRODUCT_CMU_301 0x6008 +#define CMOTECH_PRODUCT_CHU_628 0x6280 +#define CMOTECH_PRODUCT_CHU_628S 0x6281 +#define CMOTECH_PRODUCT_CDU_680 0x6803 +#define CMOTECH_PRODUCT_CDU_685A 0x6804 +#define CMOTECH_PRODUCT_CHU_720S 0x7001 +#define CMOTECH_PRODUCT_7002 0x7002 +#define CMOTECH_PRODUCT_CHU_629K 0x7003 +#define CMOTECH_PRODUCT_7004 0x7004 +#define CMOTECH_PRODUCT_7005 0x7005 +#define CMOTECH_PRODUCT_CGU_629 0x7006 +#define CMOTECH_PRODUCT_CHU_629S 0x700a +#define CMOTECH_PRODUCT_CHU_720I 0x7211 +#define CMOTECH_PRODUCT_7212 0x7212 +#define CMOTECH_PRODUCT_7213 0x7213 +#define CMOTECH_PRODUCT_7251 0x7251 +#define CMOTECH_PRODUCT_7252 0x7252 +#define CMOTECH_PRODUCT_7253 0x7253#define TELIT_VENDOR_ID 0x1bc7#define TELIT_PRODUCT_UC864E 0x1003
@@ -517,6 +540,10 @@ static const struct option_blacklist_inf .reserved = BIT(1) | BIT(2), }; +static const struct option_blacklist_info net_intf0_blacklist = { + .reserved =BIT (0 ), +}; +static const struct option_blacklist_info net_intf1_blacklist = { .reserved =BIT (1 ), };
@@ -1051,8 +1078,47 @@ static const struct usb_device_id option { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ - { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ - { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6004) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6005) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_628A) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHE_628S), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_301), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628S) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_680) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_685A) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720S), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7002), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629K), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7004), + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7005) }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_629), + .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629S), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720I), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7212), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7213), + .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7251), + .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7252), + .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, + { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7253), + .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) },
Greg Kroah-Hartman
maintainerPATCH 12/214 drm/vmwgfx: correct fb_fix_screeninfo.line_length
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christopher Friedt <[email protected]>
commit aa6de142c901cd2d90ef08db30ae87da214bedcc upstream.
Previously, the vmwgfx_fb driver would allow users to call FBIOSET_VINFO, but it would not adjust the FINFO properly, resulting in distorted screen rendering. The patch corrects that behaviour.
See https://bugs.gentoo.org/show_bug.cgi?id=494794 for examples.
--- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +4 -1
@@ -147,7 +147,7 @@ static int vmw_fb_check_var(struct fb_va }if (!vmw_kms_validate_mode_vram (vmw_priv, - info->fix.line_length, + var->xres * var->bits_per_pixel/8 , var->yoffset + var->yres)) {DRM_ERROR ("Requested geom can not fit in framebuffer\n" );return -EINVAL ;
@@ -162,6 +162,8 @@ static int vmw_fb_set_par(struct fb_infostruct vmw_private *vmw_priv = par->vmw_priv;int ret; + info->fix.line_length = info->var.xres * info->var.bits_per_pixel/8 ; + ret =vmw_kms_write_svga (vmw_priv, info->var.xres, info->var.yres, info->fix.line_length, par->bpp, par->depth);
@@ -177,6 +179,7 @@ static int vmw_fb_set_par(struct fb_infovmw_write (vmw_priv,SVGA_REG_DISPLAY_POSITION_Y , info->var.yoffset);vmw_write (vmw_priv,SVGA_REG_DISPLAY_WIDTH , info->var.xres);vmw_write (vmw_priv,SVGA_REG_DISPLAY_HEIGHT , info->var.yres); +vmw_write (vmw_priv,SVGA_REG_BYTES_PER_LINE , info->fix.line_length);vmw_write (vmw_priv,SVGA_REG_DISPLAY_ID ,SVGA_ID_INVALID ); }
Greg Kroah-Hartman
maintainerPATCH 13/214 drm/radeon: call drm_edid_to_eld when we update the edid
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 16086279353cbfecbb3ead474072dced17b97ddc upstream.
This needs to be done to update some of the fields in the connector structure used by the audio code.
Noticed by several users on irc.
--- drivers/gpu/drm/radeon/radeon_display.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_display.c +1 -0
@@ -750,6 +750,7 @@ int radeon_ddc_get_modes(struct radeon_cif (radeon_connector->edid) {drm_mode_connector_update_edid_property (&radeon_connector->base, radeon_connector->edid); ret =drm_add_edid_modes (&radeon_connector->base, radeon_connector->edid); +drm_edid_to_eld (&radeon_connector->base, radeon_connector->edid);return ret; }drm_mode_connector_update_edid_property (&radeon_connector->base,NULL );
Greg Kroah-Hartman
maintainerPATCH 14/214 list: introduce list_next_entry() and list_prev_entry()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit 008208c6b26f21c2648c250a09c55e737c02c5f8 ]
Add two trivial helpers list_next_entry() and list_prev_entry(), they can have a lot of users including list.h itself. In fact the 1st one is already defined in events/core.c and bnx2x_sp.c, so the patch simply moves the definition to list.h.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | 3 --- include/linux/list.h | 16 ++++++++++++++++ kernel/events/core.c | 3 --- 3 files changed, 16 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +0 -3
@@ -1030,9 +1030,6 @@ static void bnx2x_set_one_vlan_mac_e1h(s ETH_VLAN_FILTER_CLASSIFY, config); } -#define list_next_entry (pos, member) \ - list_entry((pos)->member.next, typeof(*(pos)), member) -/** * bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element *
include/linux/list.h +16 -0
@@ -362,6 +362,22 @@ static inline void list_splice_tail_initlist_entry ((ptr)->next, type, member)/** +* list_next_entry - get the next element in list +* @pos: the type * to cursor +* @member: the name of the list_struct within the struct. + */ +#define list_next_entry (pos, member) \ + list_entry((pos)->member.next, typeof(*(pos)), member) + +/** +* list_prev_entry - get the prev element in list +* @pos: the type * to cursor +* @member: the name of the list_struct within the struct. +*/ +#define list_prev_entry (pos, member) \ + list_entry((pos)->member.prev, typeof(*(pos)), member) + +/** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop cursor. * @head: the head for your list.
kernel/events/core.c +0 -3
@@ -1973,9 +1973,6 @@ static void __perf_event_sync_stat(strucperf_event_update_userpage (next_event); } -#define list_next_entry (pos, member) \ - list_entry(pos->member.next, typeof(*pos), member) -static void perf_event_sync_stat (struct perf_event_context *ctx,struct perf_event_context *next_ctx) {
Greg Kroah-Hartman
maintainerPATCH 15/214 net: sctp: wake up all assocs if sndbuf policy is per socket
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 52c35befb69b005c3fc5afdaae3a5717ad013411 ]
SCTP charges chunks for wmem accounting via skb->truesize in sctp_set_owner_w(), and sctp_wfree() respectively as the reverse operation. If a sender runs out of wmem, it needs to wait via sctp_wait_for_sndbuf(), and gets woken up by a call to __sctp_write_space() mostly via sctp_wfree().
__sctp_write_space() is being called per association. Although we assign sk->sk_write_space() to sctp_write_space(), which is then being done per socket, it is only used if send space is increased per socket option (SO_SNDBUF), as SOCK_USE_WRITE_QUEUE is set and therefore not invoked in sock_wfree().
Commit 4c3a5bdae293 ("sctp: Don't charge for data in sndbuf again when transmitting packet") fixed an issue where in case sctp_packet_transmit() manages to queue up more than sndbuf bytes, sctp_wait_for_sndbuf() will never be woken up again unless it is interrupted by a signal. However, a still remaining issue is that if net.sctp.sndbuf_policy=0, that is accounting per socket, and one-to-many sockets are in use, the reclaimed write space from sctp_wfree() is 'unfairly' handed back on the server to the association that is the lucky one to be woken up again via __sctp_write_space(), while the remaining associations are never be woken up again (unless by a signal).
The effect disappears with net.sctp.sndbuf_policy=1, that is wmem accounting per association, as it guarantees a fair share of wmem among associations.
Therefore, if we have reclaimed memory in case of per socket accounting, wake all related associations to a socket in a fair manner, that is, traverse the socket association list starting from the current neighbour of the association and issue a __sctp_write_space() to everyone until we end up waking ourselves. This guarantees that no association is preferred over another and even if more associations are taken into the one-to-many session, all receivers will get messages from the server and are not stalled forever on high load. This setting still leaves the advantage of per socket accounting in touch as an association can still use up global limits if unused by others.
--- net/sctp/socket.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
net/sctp/socket.c +35 -1
@@ -6369,6 +6369,40 @@ static void __sctp_write_space(struct sc } } +static void sctp_wake_up_waiters (struct sock *sk, +struct sctp_association *asoc) +{ +struct sctp_association *tmp = asoc; + +/* We do accounting for the sndbuf space per association, +* so we only need to wake our own association. +*/ +if (asoc->ep->sndbuf_policy) +return __sctp_write_space (asoc); + +/* Accounting for the sndbuf space is per socket, so we +* need to wake up others, try to be fair and in case of +* other associations, let them have a go first instead +* of just doing a sctp_write_space() call. +* +* Note that we reach sctp_wake_up_waiters() only when +* associations free up queued chunks, thus we are under +* lock and the list of associations on a socket is +* guaranteed not to change. +*/ +for (tmp =list_next_entry (tmp, asocs);1 ; + tmp =list_next_entry (tmp, asocs)) { +/* Manually skip the head element. */ +if (&tmp->asocs == &((sctp_sk (sk))->ep->asocs)) +continue ; +/* Wake up association. */ +__sctp_write_space (tmp); +/* We've reached the end. */ +if (tmp == asoc) +break ; + } +} +/* Do accounting for the sndbuf space. * Decrement the used sndbuf space of the corresponding association by the * data size which was just transmitted(freed).
@@ -6396,7 +6430,7 @@ static void sctp_wfree(struct sk_buff *ssk_mem_uncharge (sk, skb->truesize);sock_wfree (skb); -__sctp_write_space (asoc); +sctp_wake_up_waiters (sk, asoc);sctp_association_put (asoc); }
Greg Kroah-Hartman
maintainerPATCH 16/214 net: sctp: test if association is dead in sctp_wake_up_waiters
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 1e1cdf8ac78793e0875465e98a648df64694a8d0 ]
In function sctp_wake_up_waiters(), we need to involve a test if the association is declared dead. If so, we don't have any reference to a possible sibling association anymore and need to invoke sctp_write_space() instead, and normally walk the socket's associations and notify them of new wmem space. The reason for special casing is that otherwise, we could run into the following issue when a sctp_primitive_SEND() call from sctp_sendmsg() fails, and tries to flush an association's outq, i.e. in the following way:
sctp_association_free()
`-> list_del(&asoc->asocs) <-- poisons list pointer
asoc->base.dead = true
sctp_outq_free(&asoc->outqueue)
`-> __sctp_outq_teardown()
`-> sctp_chunk_free()
`-> consume_skb()
`-> sctp_wfree()
`-> sctp_wake_up_waiters() <-- dereferences poisoned pointers
if asoc->ep->sndbuf_policy=0Therefore, only walk the list in an 'optimized' way if we find that the current association is still active. We could also use list_del_init() in addition when we call sctp_association_free(), but as Vlad suggests, we want to trap such bugs and thus leave it poisoned as is.
Why is it safe to resolve the issue by testing for asoc->base.dead? Parallel calls to sctp_sendmsg() are protected under socket lock, that is lock_sock()/release_sock(). Only within that path under lock held, we're setting skb/chunk owner via sctp_set_owner_w(). Eventually, chunks are freed directly by an association still under that lock. So when traversing association list on destruction time from sctp_wake_up_waiters() via sctp_wfree(), a different CPU can't be running sctp_wfree() while another one calls sctp_association_free() as both happens under the same lock. Therefore, this can also not race with setting/testing against asoc->base.dead as we are guaranteed for this to happen in order, under lock. Further, Vlad says: the times we check asoc->base.dead is when we've cached an association pointer for later processing. In between cache and processing, the association may have been freed and is simply still around due to reference counts. We check asoc->base.dead under a lock, so it should always be safe to check and not race against sctp_association_free(). Stress-testing seems fine now, too.
--- net/sctp/socket.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/sctp/socket.c +6 -0
@@ -6380,6 +6380,12 @@ static void sctp_wake_up_waiters(structif (asoc->ep->sndbuf_policy)return __sctp_write_space (asoc); +/* If association goes down and is just flushing its +* outq, then just normally notify others. +*/ +if (asoc->base.dead) +return sctp_write_space (sk); +/* Accounting for the sndbuf space is per socket, so we * need to wake up others, try to be fair and in case of * other associations, let them have a go first instead
Greg Kroah-Hartman
maintainerPATCH 17/214 l2tp: take PMTU from tunnel UDP socket
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Petukhov <[email protected]>
[ Upstream commit f34c4a35d87949fbb0e0f31eba3c054e9f8199ba ]
When l2tp driver tries to get PMTU for the tunnel destination, it uses the pointer to struct sock that represents PPPoX socket, while it should use the pointer that represents UDP socket of the tunnel.
--- net/l2tp/l2tp_ppp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/l2tp/l2tp_ppp.c +2 -2
@@ -772,9 +772,9 @@ static int pppol2tp_connect(struct socke session->deref = pppol2tp_session_sock_put;/* If PMTU discovery was enabled, use the MTU that was discovered */ - dst =sk_dst_get (sk); + dst =sk_dst_get (tunnel->sock);if (dst !=NULL ) { -u32 pmtu =dst_mtu (__sk_dst_get (sk)); +u32 pmtu =dst_mtu (__sk_dst_get (tunnel->sock));if (pmtu !=0 ) session->mtu = session->mru = pmtu -PPPOL2TP_HEADER_OVERHEAD ;
Greg Kroah-Hartman
maintainerPATCH 18/214 net: core: dont account for udp header size when computing seglen
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 6d39d589bb76ee8a1c6cde6822006ae0053decff ]
In case of tcp, gso_size contains the tcpmss.
For UFO (udp fragmentation offloading) skbs, gso_size is the fragment payload size, i.e. we must not account for udp header size.
Otherwise, when using virtio drivers, a to-be-forwarded UFO GSO packet will be needlessly fragmented in the forward path, because we think its individual segments are too large for the outgoing link.
--- net/core/skbuff.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/core/skbuff.c +7 -5
@@ -3297,12 +3297,14 @@ EXPORT_SYMBOL(__skb_warn_lro_forwarding)unsigned int skb_gso_transport_seglen (const struct sk_buff *skb) {const struct skb_shared_info *shinfo =skb_shinfo (skb); -unsigned int hdr_len;if (likely (shinfo->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ))) - hdr_len =tcp_hdrlen (skb); -else - hdr_len =sizeof (struct udphdr ); -return hdr_len + shinfo->gso_size; +return tcp_hdrlen (skb) + shinfo->gso_size; + +/* UFO sets gso_size to the size of the fragmentation +* payload, i.e. the size of the L4 (UDP) header is already +* accounted for. +*/ +return shinfo->gso_size; }EXPORT_SYMBOL_GPL (skb_gso_transport_seglen);
Greg Kroah-Hartman
maintainerPATCH 19/214 bonding: Remove debug_fs files when module init fails
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Richter <[email protected]>
[ Upstream commit db29868653394937037d71dc3545768302dda643 ]
Remove the bonding debug_fs entries when the module initialization fails. The debug_fs
entries should be removed together with all other already allocated resources.
--- drivers/net/bonding/bond_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bonding/bond_main.c +1 -0
@@ -4930,6 +4930,7 @@ static int __init bonding_init(void) out:return res; err: +bond_destroy_debugfs ();rtnl_link_unregister (&bond_link_ops); err_link:unregister_pernet_subsys (&bond_net_ops);
Greg Kroah-Hartman
maintainerPATCH 20/214 ipv6: Limit mtu to 65575 bytes
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 30f78d8ebf7f514801e71b88a10c948275168518 ]
Francois reported that setting big mtu on loopback device could prevent tcp sessions making progress.
We do not support (yet ?) IPv6 Jumbograms and cook corrupted packets.
We must limit the IPv6 MTU to (65535 + 40) bytes in theory.
Tested:
ifconfig lo mtu 70000
netperf -H ::1
Before patch : Throughput : 0.05 Mbits
After patch : Throughput : 35484 Mbits
--- include/net/ip6_route.h | 5 +++++ net/ipv6/route.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/net/ip6_route.h +5 -0
@@ -34,6 +34,11 @@ struct route_info {#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020 +/* We do not (yet ?) support IPv6 jumbograms (RFC 2675) +* Unlike IPv4, hdr->seg_len doesn't include the IPv6 header +*/ +#define IP6_MAX_MTU (0xFFFF + sizeof(struct ipv6hdr)) +/* * rt6_srcprefs2flags() and rt6_flags2srcprefs() translate * between IPV6_ADDR_PREFERENCES socket option values
net/ipv6/route.c +3 -2
@@ -1092,7 +1092,7 @@ static unsigned int ip6_mtu(const structunsigned int mtu =dst_metric_raw (dst,RTAX_MTU );if (mtu) -return mtu; + goto out; mtu =IPV6_MIN_MTU ;
@@ -1102,7 +1102,8 @@ static unsigned int ip6_mtu(const struct mtu = idev->cnf.mtu6;rcu_read_unlock (); -return mtu; +out: + return min_t(unsigned int, mtu, IP6_MAX_MTU); }static struct dst_entry *icmp6_dst_gc_list;
Greg Kroah-Hartman
maintainerPATCH 21/214 net: ipv4: current group_info should be put after using.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Wang, Xiaoming" <[email protected]>
[ Upstream commit b04c46190219a4f845e46a459e3102137b7f6cac ]
Plug a group_info refcount leak in ping_init. group_info is only needed during initialization and the code failed to release the reference on exit. While here move grabbing the reference to a place where it is actually needed.
--- net/ipv4/ping.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
net/ipv4/ping.c +11 -4
@@ -203,26 +203,33 @@ static int ping_init_sock(struct sock *sstruct net *net =sock_net (sk);gid_t group =current_egid ();gid_t range[2 ]; -struct group_info *group_info =get_current_groups (); -int i, j, count = group_info->ngroups; +struct group_info *group_info; +int i, j, count; +int ret =0 ;inet_get_ping_group_range_net (net, range, range+1 );if (range[0 ] <= group && group <= range[1 ])return 0 ; + group_info =get_current_groups (); + count = group_info->ngroups;for (i =0 ; i < group_info->nblocks; i++) {int cp_count =min_t (int,NGROUPS_PER_BLOCK , count);for (j =0 ; j < cp_count; j++) { group = group_info->blocks[i][j];if (range[0 ] <= group && group <= range[1 ]) -return 0 ; + goto out_release_group; } count -= cp_count; } -return -EACCES ; + ret = -EACCES ; + +out_release_group: +put_group_info (group_info); +return ret; }static void ping_close (struct sock *sk,long timeout)
Greg Kroah-Hartman
maintainerPATCH 22/214 filter: prevent nla extensions to peek beyond the end of the message
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit 05ab8f2647e4221cbdb3856dd7d32bd5407316b3 ]
The BPF_S_ANC_NLATTR and BPF_S_ANC_NLATTR_NEST extensions fail to check for a minimal message length before testing the supplied offset to be within the bounds of the message. This allows the subtraction of the nla header to underflow and therefore -- as the data type is unsigned -- allowing far to big offset and length values for the search of the netlink attribute.
The remainder calculation for the BPF_S_ANC_NLATTR_NEST extension is also wrong. It has the minuend and subtrahend mixed up, therefore calculates a huge length value, allowing to overrun the end of the message while looking for the netlink attribute.
The following three BPF snippets will trigger the bugs when attached to a UNIX datagram socket and parsing a message with length 1, 2 or 3.
,-[ PoC for missing size check in BPF_S_ANC_NLATTR ]--
| ld #0x87654321 | ldx #42 | ld #nla | ret a
`---
,-[ PoC for the same bug in BPF_S_ANC_NLATTR_NEST ]--
| ld #0x87654321 | ldx #42 | ld #nlan | ret a
`---
,-[ PoC for wrong remainder calculation in BPF_S_ANC_NLATTR_NEST ]--
| ; (needs a fake netlink header at offset 0) | ld #0 | ldx #42 | ld #nlan | ret a
`---
Fix the first issue by ensuring the message length fulfills the minimal size constrains of a nla header. Fix the second bug by getting the math for the remainder calculation right.
--- net/core/filter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/core/filter.c +5 -1
@@ -338,11 +338,15 @@ load_b:if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;if (A > skb->len -sizeof (struct nlattr ))return 0 ; nla = (struct nlattr *)&skb->data[A ]; -if (nla->nla_len >A - skb->len) +if (nla->nla_len > skb->len -A )return 0 ; nla =nla_find_nested (nla,X );
Re: [PATCH 3.4 022/214] filter: prevent nla extensions to peek beyond the end of the message
Quoted 64 lines · Greg Kroah-Hartman
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit
05ab8f2647e4221cbdb3856dd7d32bd5407316b3]The
BPF_S_ANC_NLATTRandBPF_S_ANC_NLATTR_NESTextensions fail to check for a minimal message length before testing the supplied offset to be within the bounds of the message. This allows the subtraction of the nla header to underflow and therefore -- as the data type is unsigned -- allowing far to big offset and length values for the search of the netlink attribute.The remainder calculation for the
BPF_S_ANC_NLATTR_NESTextension is also wrong. It has the minuend and subtrahend mixed up, therefore calculates a huge length value, allowing to overrun the end of the message while looking for the netlink attribute.The following three BPF snippets will trigger the bugs when attached to a UNIX datagram socket and parsing a message with length 1, 2 or 3.
,-[ PoC for missing size check in
BPF_S_ANC_NLATTR]--| ld #0x87654321 | ldx #42 | ld #nla | ret a`---
,-[ PoC for the same bug in
BPF_S_ANC_NLATTR_NEST]--| ld #0x87654321 | ldx #42 | ld #nlan | ret a`---
,-[ PoC for wrong remainder calculation in
BPF_S_ANC_NLATTR_NEST]--| ; (needs a fake netlink header at offset 0) | ld #0 | ldx #42 | ld #nlan | ret a`---
Fix the first issue by ensuring the message length fulfills the minimal size constrains of a nla header. Fix the second bug by getting the math for the remainder calculation right.
Fixes 4738c1db15 ("[SKFILTER]: Add SKF_ADF_NLATTR instruction")Fixes d214c7537b ("filter: add SKF_AD_NLATTR_NEST to look for nested..")Cc Patrick McHardy <[email protected]>Cc Pablo Neira Ayuso <[email protected]>Signed-off-by Mathias Krause <[email protected]>Acked-by Daniel Borkmann <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/core/filter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/core/filter.c load_b: · line 344
Quoted 7 lines
net/core/filter.c +4
-0@@ -338,11 +338,15 @@ load_b:if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;
There above code is duplicated this backport. The same comment applies to the 3.2.y backport (I've added Ben to the CC list).
Cheers,
--
Lu�s
Quoted 15 lines
net/core/filter.c +1
-2if (A > skb->len -sizeof (struct nlattr ))return 0 ; nla = (struct nlattr *)&skb->data[A ]; -if (nla->nla_len >A - skb->len) +if (nla->nla_len > skb->len -A )return 0 ; nla =nla_find_nested (nla,X ); --To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3.4 022/214] filter: prevent nla extensions to peek beyond the end of the message
Quoted 66 lines · Luis Henriques
Quoted 65 lines · Greg Kroah-Hartman
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit
05ab8f2647e4221cbdb3856dd7d32bd5407316b3]The
BPF_S_ANC_NLATTRandBPF_S_ANC_NLATTR_NESTextensions fail to check for a minimal message length before testing the supplied offset to be within the bounds of the message. This allows the subtraction of the nla header to underflow and therefore -- as the data type is unsigned -- allowing far to big offset and length values for the search of the netlink attribute.The remainder calculation for the
BPF_S_ANC_NLATTR_NESTextension is also wrong. It has the minuend and subtrahend mixed up, therefore calculates a huge length value, allowing to overrun the end of the message while looking for the netlink attribute.The following three BPF snippets will trigger the bugs when attached to a UNIX datagram socket and parsing a message with length 1, 2 or 3.
,-[ PoC for missing size check in
BPF_S_ANC_NLATTR]--| ld #0x87654321 | ldx #42 | ld #nla | ret a`---
,-[ PoC for the same bug in
BPF_S_ANC_NLATTR_NEST]--| ld #0x87654321 | ldx #42 | ld #nlan | ret a`---
,-[ PoC for wrong remainder calculation in
BPF_S_ANC_NLATTR_NEST]--| ; (needs a fake netlink header at offset 0) | ld #0 | ldx #42 | ld #nlan | ret a`---
Fix the first issue by ensuring the message length fulfills the minimal size constrains of a nla header. Fix the second bug by getting the math for the remainder calculation right.
Fixes 4738c1db15 ("[SKFILTER]: Add SKF_ADF_NLATTR instruction")Fixes d214c7537b ("filter: add SKF_AD_NLATTR_NEST to look for nested..")Cc Patrick McHardy <[email protected]>Cc Pablo Neira Ayuso <[email protected]>Signed-off-by Mathias Krause <[email protected]>Acked-by Daniel Borkmann <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/core/filter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)net/core/filter.c +0
-0@@ -338,11 +338,15 @@ load_b:
Quoted 9 lines
net/core/filter.c load_b: · line 344
Quoted 6 lines
net/core/filter.c +4
-0if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;There above code is duplicated this backport. The same comment applies to the 3.2.y backport (I've added Ben to the CC list).
This seems to be due to a bug in patch <https://bugs.debian.org/717782>.
I had the same problem when initially trying to fix this in 3.14. The first two inserted lines should be 16 lines further up.
Ben.
Signature · 2 lines
Ben Hutchings I say we take off; nuke the site from orbit. It's the only way to be sure.
Re: [PATCH 3.4 022/214] filter: prevent nla extensions to peek beyond the end of the message
Quoted 77 lines · Ben Hutchings
Quoted 66 lines · Luis Henriques
Quoted 65 lines · Greg Kroah-Hartman
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commit
05ab8f2647e4221cbdb3856dd7d32bd5407316b3]The
BPF_S_ANC_NLATTRandBPF_S_ANC_NLATTR_NESTextensions fail to check for a minimal message length before testing the supplied offset to be within the bounds of the message. This allows the subtraction of the nla header to underflow and therefore -- as the data type is unsigned -- allowing far to big offset and length values for the search of the netlink attribute.The remainder calculation for the
BPF_S_ANC_NLATTR_NESTextension is also wrong. It has the minuend and subtrahend mixed up, therefore calculates a huge length value, allowing to overrun the end of the message while looking for the netlink attribute.The following three BPF snippets will trigger the bugs when attached to a UNIX datagram socket and parsing a message with length 1, 2 or 3.
,-[ PoC for missing size check in
BPF_S_ANC_NLATTR]--| ld #0x87654321 | ldx #42 | ld #nla | ret a`---
,-[ PoC for the same bug in
BPF_S_ANC_NLATTR_NEST]--| ld #0x87654321 | ldx #42 | ld #nlan | ret a`---
,-[ PoC for wrong remainder calculation in
BPF_S_ANC_NLATTR_NEST]--| ; (needs a fake netlink header at offset 0) | ld #0 | ldx #42 | ld #nlan | ret a`---
Fix the first issue by ensuring the message length fulfills the minimal size constrains of a nla header. Fix the second bug by getting the math for the remainder calculation right.
Fixes 4738c1db15 ("[SKFILTER]: Add SKF_ADF_NLATTR instruction")Fixes d214c7537b ("filter: add SKF_AD_NLATTR_NEST to look for nested..")Cc Patrick McHardy <[email protected]>Cc Pablo Neira Ayuso <[email protected]>Signed-off-by Mathias Krause <[email protected]>Acked-by Daniel Borkmann <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/core/filter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)net/core/filter.c +0
-0@@ -338,11 +338,15 @@ load_b:Quoted 9 lines
net/core/filter.c load_b: · line 344
Quoted 6 lines
net/core/filter.c +4
-0if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;There above code is duplicated this backport. The same comment applies to the 3.2.y backport (I've added Ben to the CC list).
Quoted 9 lines
This seems to be due to a bug in patch <https://bugs.debian.org/717782>.
I had the same problem when initially trying to fix this in 3.14. The first two inserted lines should be 16 lines further up.Ben.
Signature · 2 lines
Ben Hutchings I say we take off; nuke the site from orbit. It's the only way to be sure.
Awesome! Thank you both for clarifying that.
Cheers,
--
Lu�s
Re: [PATCH 3.4 022/214] filter: prevent nla extensions to peek beyond the end of the message
In reply to Luis HenriquesQuoted 7 lines · Luis Henriques
Quoted 6 lines · Greg Kroah-Hartman
3.4-stable review patch. If anyone has any objections, please let me know. [...]
net/core/filter.c +0
-0@@ -338,11 +338,15 @@ load_b:
Quoted 10 lines
net/core/filter.c load_b: · line 344
Quoted 6 lines
net/core/filter.c +4
-0if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;There above code is duplicated this backport. The same comment applies to the 3.2.y backport (I've added Ben to the CC list).
Good catch! The diff should look more like the the one in the attachment. I guess patch(1) just failed here to find the right place to apply the hunk to.
Thanks,
Mathias
net/core/filter.c +5 -1
@@ -322,6 +322,8 @@ load_b:if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;if (A > skb->len -sizeof (struct nlattr ))return 0 ;
@@ -338,11 +340,13 @@ load_b:if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;if (A > skb->len -sizeof (struct nlattr ))return 0 ; nla = (struct nlattr *)&skb->data[A ]; -if (nla->nla_len >A - skb->len) +if (nla->nla_len > skb->len -A )return 0 ; nla =nla_find_nested (nla,X );
Greg Kroah-Hartman
maintainerRe: [PATCH 3.4 022/214] filter: prevent nla extensions to peek beyond the end of the message
Quoted 44 lines · Mathias Krause
Quoted 7 lines · Luis Henriques
Quoted 6 lines · Greg Kroah-Hartman
3.4-stable review patch. If anyone has any objections, please let me know. [...]
net/core/filter.c +0
-0@@ -338,11 +338,15 @@ load_b:Quoted 10 lines
net/core/filter.c load_b:
Quoted 6 lines
net/core/filter.c +4
-0if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;There above code is duplicated this backport. The same comment applies to the 3.2.y backport (I've added Ben to the CC list).
Good catch! The diff should look more like the the one in the attachment. I guess patch(1) just failed here to find the right place to apply the hunk to.
Thanks,
Mathiasnet/core/filter.c +3
-0@@ -322,6 +322,8 @@ load_b:if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr )) +return 0 ;if (A > skb->len -sizeof (struct nlattr ))return 0 ;@@ -338,11 +340,13 @@ load_b:if (skb_is_nonlinear (skb))return 0 ; +if (skb->len <sizeof (struct nlattr ))
net/core/filter.c load_b: · line 352
Quoted 10 lines
net/core/filter.c +2
-1+return 0 ;if (A > skb->len -sizeof (struct nlattr ))return 0 ; nla = (struct nlattr *)&skb->data[A ]; -if (nla->nla_len >A - skb->len) +if (nla->nla_len > skb->len -A )return 0 ; nla =nla_find_nested (nla,X );
Thanks, I've fixed up the patch in the 3.4-stable queue to match this version instead.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 23/214 tg3: update rx_jumbo_pending ring param only when jumbo frames are enabled
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Vecera <[email protected]>
The patch fixes a problem with dropped jumbo frames after usage of 'ethtool -G ... rx'.
Scenario:
1. ip link set eth0 up
2. ethtool -G eth0 rx N # <- This zeroes rx-jumbo
3. ip link set mtu 9000 dev eth0
The ethtool command set rx_jumbo_pending to zero so any received jumbo packets are dropped and you need to use 'ethtool -G eth0 rx-jumbo N' to workaround the issue.
The patch changes the logic so rx_jumbo_pending value is changed only if jumbo frames are enabled (MTU > 1500).
--- drivers/net/ethernet/broadcom/tg3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +3 -1
@@ -10861,7 +10861,9 @@ static int tg3_set_ringparam(struct net_if (tg3_flag (tp,MAX_RXPEND_64 ) && tp->rx_pending >63 ) tp->rx_pending =63 ; - tp->rx_jumbo_pending = ering->rx_jumbo_pending; + +if (tg3_flag (tp,JUMBO_RING_ENABLE )) + tp->rx_jumbo_pending = ering->rx_jumbo_pending;for (i =0 ; i < tp->irq_max; i++) tp->napi[i].tx_pending = ering->tx_pending;
Greg Kroah-Hartman
maintainerPATCH 24/214 rtnetlink: Warn when interfaces information wont fit in our packet
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gibson <[email protected]>
[ Upstream commit 973462bbde79bb827824c73b59027a0aed5c9ca6 ]
Without IFLA_EXT_MASK specified, the information reported for a single interface in response to RTM_GETLINK is expected to fit within a netlink packet of NLMSG_GOODSIZE.
If it doesn't, however, things will go badly wrong, When listing all interfaces, netlink_dump() will incorrectly treat -EMSGSIZE on the first message in a packet as the end of the listing and omit information for that interface and all subsequent ones. This can cause getifaddrs(3) to enter an infinite loop.
This patch won't fix the problem, but it will WARN_ON() making it easier to track down what's going wrong.
--- net/core/rtnetlink.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
net/core/rtnetlink.c +12 -5
@@ -1059,6 +1059,7 @@ static int rtnl_dump_ifinfo(struct sk_bustruct hlist_node *node;struct nlattr *tb[IFLA_MAX +1 ];u32 ext_filter_mask =0 ; +int err; s_h = cb->args[0 ]; s_idx = cb->args[1 ];
@@ -1079,11 +1080,17 @@ static int rtnl_dump_ifinfo(struct sk_buhlist_for_each_entry_rcu (dev, node, head, index_hlist) {if (idx < s_idx) goto cont; -if (rtnl_fill_ifinfo (skb, dev,RTM_NEWLINK , -NETLINK_CB (cb->skb).pid, - cb->nlh->nlmsg_seq,0 , -NLM_F_MULTI , - ext_filter_mask) <=0 ) + err =rtnl_fill_ifinfo (skb, dev,RTM_NEWLINK , +NETLINK_CB (cb->skb).pid, + cb->nlh->nlmsg_seq,0 , +NLM_F_MULTI , + ext_filter_mask); +/* If we ran out of room on the first message, +* we're in trouble +*/ +WARN_ON ((err == -EMSGSIZE ) && (skb->len ==0 )); + +if (err <=0 ) goto out;nl_dump_check_consistent (cb,nlmsg_hdr (skb));
Greg Kroah-Hartman
maintainerPATCH 25/214 rtnetlink: Only supply IFLA_VF_PORTS information when RTEXT_FILTER_VF is set
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gibson <[email protected]>
[ Upstream commit c53864fd60227de025cb79e05493b13f69843971 ]
Since 115c9b81928360d769a76c632bae62d15206a94a (rtnetlink: Fix problem with buffer allocation), RTM_NEWLINK messages only contain the IFLA_VFINFO_LIST attribute if they were solicited by a GETLINK message containing an IFLA_EXT_MASK attribute with the RTEXT_FILTER_VF flag.
That was done because some user programs broke when they received more data than expected - because IFLA_VFINFO_LIST contains information for each VF it can become large if there are many VFs.
However, the IFLA_VF_PORTS attribute, supplied for devices which implement ndo_get_vf_port (currently the 'enic' driver only), has the same problem. It supplies per-VF information and can therefore become large, but it is not currently conditional on the IFLA_EXT_MASK value.
Worse, it interacts badly with the existing EXT_MASK handling. When IFLA_EXT_MASK is not supplied, the buffer for netlink replies is fixed at NLMSG_GOODSIZE. If the information for IFLA_VF_PORTS exceeds this, then rtnl_fill_ifinfo() returns -EMSGSIZE on the first message in a packet. netlink_dump() will misinterpret this as having finished the listing and omit data for this interface and all subsequent ones. That can cause getifaddrs(3) to enter an infinite loop.
This patch addresses the problem by only supplying IFLA_VF_PORTS when IFLA_EXT_MASK is supplied with the RTEXT_FILTER_VF flag set.
--- net/core/rtnetlink.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
net/core/rtnetlink.c +10 -6
@@ -746,7 +746,8 @@ static inline int rtnl_vfinfo_size(constreturn 0 ; } -static size_t rtnl_port_size (const struct net_device *dev) +static size_t rtnl_port_size (const struct net_device *dev, +u32 ext_filter_mask) {size_t port_size =nla_total_size (4 )/* PORT_VF */ +nla_total_size (PORT_PROFILE_MAX )/* PORT_PROFILE */
@@ -762,7 +763,8 @@ static size_t rtnl_port_size(const strucsize_t port_self_size =nla_total_size (sizeof (struct nlattr )) + port_size; -if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent) +if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent || + !(ext_filter_mask &RTEXT_FILTER_VF ))return 0 ;if (dev_num_vf (dev->dev.parent)) return port_self_size + vf_ports_size +
@@ -793,7 +795,7 @@ static noinline size_t if_nlmsg_size(con +nla_total_size (ext_filter_mask &RTEXT_FILTER_VF ?4 :0 )/* IFLA_NUM_VF */ +rtnl_vfinfo_size (dev, ext_filter_mask)/* IFLA_VFINFO_LIST */ - +rtnl_port_size (dev)/* IFLA_VF_PORTS + IFLA_PORT_SELF */ + +rtnl_port_size (dev, ext_filter_mask)/* IFLA_VF_PORTS + IFLA_PORT_SELF */ +rtnl_link_get_size (dev)/* IFLA_LINKINFO */ +rtnl_link_get_af_size (dev);/* IFLA_AF_SPEC */ }
@@ -853,11 +855,13 @@ static int rtnl_port_self_fill(struct skreturn 0 ; } -static int rtnl_port_fill (struct sk_buff *skb,struct net_device *dev) +static int rtnl_port_fill (struct sk_buff *skb,struct net_device *dev, +u32 ext_filter_mask) {int err; -if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent) +if (!dev->netdev_ops->ndo_get_vf_port || !dev->dev.parent || + !(ext_filter_mask &RTEXT_FILTER_VF ))return 0 ; err =rtnl_port_self_fill (skb, dev);
@@ -1004,7 +1008,7 @@ static int rtnl_fill_ifinfo(struct sk_bunla_nest_end (skb, vfinfo); } -if (rtnl_port_fill (skb, dev)) +if (rtnl_port_fill (skb, dev, ext_filter_mask)) goto nla_put_failure;if (dev->rtnl_link_ops) {
Greg Kroah-Hartman
maintainerPATCH 26/214 Revert "macvlan : fix checksums error when we are in bridge mode"
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vlad Yasevich <[email protected]>
[ Upstream commit f114890cdf84d753f6b41cd0cc44ba51d16313da ]
This reverts commit 12a2856b604476c27d85a5f9a57ae1661fc46019. The commit above doesn't appear to be necessary any more as the checksums appear to be correctly computed/validated.
Additionally the above commit breaks kvm configurations where one VM is using a device that support checksum offload (virtio) and the other VM does not.
In this case, packets leaving virtio device will have CHECKSUM_PARTIAL set. The packets is forwarded to a macvtap that has offload features turned off. Since we use CHECKSUM_UNNECESSARY, the host does does not update the checksum and thus a bad checksum is passed up to the guest.
--- drivers/net/macvlan.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/macvlan.c +0 -3
@@ -237,11 +237,9 @@ static int macvlan_queue_xmit(struct sk_const struct macvlan_dev *vlan =netdev_priv (dev);const struct macvlan_port *port = vlan->port;const struct macvlan_dev *dest; -__u8 ip_summed = skb->ip_summed;if (vlan->mode ==MACVLAN_MODE_BRIDGE ) {const struct ethhdr *eth = (void *)skb->data; - skb->ip_summed =CHECKSUM_UNNECESSARY ;/* send to other bridge ports directly */ if (is_multicast_ether_addr (eth->h_dest)) {
@@ -259,7 +257,6 @@ static int macvlan_queue_xmit(struct sk_ } xmit_world: - skb->ip_summed = ip_summed; skb->dev = vlan->lowerdev;return dev_queue_xmit (skb); }
Greg Kroah-Hartman
maintainerPATCH 27/214 tcp_cubic: fix the range of delayed_ack
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Yu <[email protected]>
[ Upstream commit 0cda345d1b2201dd15591b163e3c92bad5191745 ]
commit b9f47a3aaeab (tcp_cubic: limit delayed_ack ratio to prevent divide error) try to prevent divide error, but there is still a little chance that delayed_ack can reach zero. In case the param cnt get negative value, then ratio+cnt would overflow and may happen to be zero. As a result, min(ratio, ACK_RATIO_LIMIT) will calculate to be zero.
In some old kernels, such as 2.6.32, there is a bug that would pass negative param, which then ultimately leads to this divide error.
commit 5b35e1e6e9c (tcp: fix tcp_trim_head() to adjust segment count with skb MSS) fixed the negative param issue. However, it's safe that we fix the range of delayed_ack as well, to make sure we do not hit a divide by zero.
--- net/ipv4/tcp_cubic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_cubic.c +1 -1
@@ -408,7 +408,7 @@ static void bictcp_acked(struct sock *sk ratio -= ca->delayed_ack >>ACK_RATIO_SHIFT ; ratio += cnt; - ca->delayed_ack =min (ratio,ACK_RATIO_LIMIT ); + ca->delayed_ack =clamp (ratio,1U ,ACK_RATIO_LIMIT ); }/* Some calls are for duplicates without timetamps */
Greg Kroah-Hartman
maintainerPATCH 28/214 net: ipv4: ip_forward: fix inverted local_df test
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit ca6c5d4ad216d5942ae544bbf02503041bd802aa ]
local_df means 'ignore DF bit if set', so if its set we're allowed to perform ip fragmentation.
This wasn't noticed earlier because the output path also drops such skbs (and emits needed icmp error) and because netfilter ip defrag did not set local_df until couple of days ago.
Only difference is that DF-packets-larger-than MTU now discarded earlier (f.e. we avoid pointless netfilter postrouting trip).
While at it, drop the repeated test ip_exceeds_mtu, checking it once is enough...
--- net/ipv4/ip_forward.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ip_forward.c +2 -2
@@ -42,12 +42,12 @@static bool ip_may_fragment (const struct sk_buff *skb) {return unlikely ((ip_hdr (skb)->frag_off &htons (IP_DF )) ==0 ) || - !skb->local_df; + skb->local_df; }static bool ip_exceeds_mtu (const struct sk_buff *skb,unsigned int mtu) { -if (skb->len <= mtu || skb->local_df) +if (skb->len <= mtu)return false;if (skb_is_gso (skb) &&skb_gso_network_seglen (skb) <= mtu)
Greg Kroah-Hartman
maintainerPATCH 29/214 ipv4: fib_semantics: increment fib_info_cnt after fib_info allocation
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Popovich <[email protected]>
[ Upstream commit aeefa1ecfc799b0ea2c4979617f14cecd5cccbfd ]
Increment fib_info_cnt in fib_create_info() right after successfuly alllocating fib_info structure, overwise fib_metrics allocation failure leads to fib_info_cnt incorrectly decremented in free_fib_info(), called on error path from fib_create_info().
--- net/ipv4/fib_semantics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_semantics.c +1 -1
@@ -751,13 +751,13 @@ struct fib_info *fib_create_info(struct fi =kzalloc (sizeof (*fi)+nhs*sizeof (struct fib_nh ),GFP_KERNEL );if (fi ==NULL ) goto failure; + fib_info_cnt++;if (cfg->fc_mx) { fi->fib_metrics =kzalloc (sizeof (u32) *RTAX_MAX ,GFP_KERNEL );if (!fi->fib_metrics) goto failure; }else fi->fib_metrics = (u32 *) dst_default_metrics; - fib_info_cnt++; fi->fib_net =hold_net (net); fi->fib_protocol = cfg->fc_protocol;
Greg Kroah-Hartman
maintainerPATCH 30/214 act_mirred: do not drop packets when fails to mirror it
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit 16c0b164bd24d44db137693a36b428ba28970c62 ]
We drop packet unconditionally when we fail to mirror it. This is not intended in some cases. Consdier for kvm guest, we may mirror the traffic of the bridge to a tap device used by a VM. When kernel fails to mirror the packet in conditions such as when qemu crashes or stop polling the tap, it's hard for the management software to detect such condition and clean the the mirroring before. This would lead all packets to the bridge to be dropped and break the netowrk of other virtual machines.
To solve the issue, the patch does not drop packets when kernel fails to mirror it, and only drop the redirected packets.
--- net/sched/act_mirred.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/sched/act_mirred.c +5 -6
@@ -201,13 +201,12 @@ static int tcf_mirred(struct sk_buff *sk out:if (err) { m->tcf_qstats.overlimits++; -/* should we be asking for packet to be dropped? -* may make sense for redirect case only -*/ - retval =TC_ACT_SHOT ; - }else { +if (m->tcfm_eaction !=TCA_EGRESS_MIRROR ) + retval =TC_ACT_SHOT ; +else + retval = m->tcf_action; + }else retval = m->tcf_action; - }spin_unlock (&m->tcf_lock);return retval;
Greg Kroah-Hartman
maintainerPATCH 31/214 ipv4: initialise the itag variable in __mkroute_input
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li RongQing <[email protected]>
[ Upstream commit fbdc0ad095c0a299e9abf5d8ac8f58374951149a ]
the value of itag is a random value from stack, and may not be initiated by fib_validate_source, which called fib_combine_itag if CONFIG_IP_ROUTE_CLASSID is not set
This will make the cached dst uncertainty
--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
@@ -2129,7 +2129,7 @@ static int __mkroute_input(struct sk_bufstruct in_device *out_dev;unsigned int flags =0 ;__be32 spec_dst; -u32 itag; +u32 itag =0 ;/* get a working reference to the output device */ out_dev =__in_dev_get_rcu (FIB_RES_DEV (*res));
Greg Kroah-Hartman
maintainerPATCH 32/214 skb: Add inline helper for getting the skb end offset from head
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <[email protected]>
[ Upstream commit ec47ea82477404631d49b8e568c71826c9b663ac ]
With the recent changes for how we compute the skb truesize it occurs to me we are probably going to have a lot of calls to skb_end_pointer - skb->head. Instead of running all over the place doing that it would make more sense to just make it a separate inline skb_end_offset(skb) that way we can return the correct value without having gcc having to do all the optimization to cancel out skb->head - skb->head.
--- drivers/atm/ambassador.c | 2 +- drivers/atm/idt77252.c | 2 +- drivers/net/wimax/i2400m/usb-rx.c | 2 +- drivers/staging/octeon/ethernet-tx.c | 2 +- include/linux/skbuff.h | 12 +++++++++++- net/core/skbuff.c | 9 ++++----- 6 files changed, 19 insertions(+), 10 deletions(-)
drivers/atm/ambassador.c +1 -1
@@ -802,7 +802,7 @@ static void fill_rx_pool (amb_dev * dev, }// cast needed as there is no %? for pointer differences PRINTD (DBG_SKB ,"allocated skb at %p, head %p, area %li" , - skb, skb->head, (long ) (skb_end_pointer (skb) - skb->head)); + skb, skb->head, (long )skb_end_offset (skb)); rx.handle =virt_to_bus (skb); rx.host_address =cpu_to_be32 (virt_to_bus (skb->data));if (rx_give (dev, &rx, pool))
drivers/atm/idt77252.c +1 -1
@@ -1258,7 +1258,7 @@ idt77252_rx_raw(struct idt77252_dev *car tail =readl (SAR_REG_RAWCT );pci_dma_sync_single_for_cpu (card->pcidev,IDT77252_PRV_PADDR (queue), -skb_end_pointer (queue) - queue->head -16 , +skb_end_offset (queue) -16 ,PCI_DMA_FROMDEVICE );while (head != tail) {
drivers/net/wimax/i2400m/usb-rx.c +1 -1
@@ -277,7 +277,7 @@ retry:d_printf (1 , dev,"RX: size changed to %d, received %d, " "copied %d, capacity %ld\n" , rx_size, read_size, rx_skb->len, - (long ) (skb_end_pointer (new_skb) - new_skb->head)); + (long )skb_end_offset (new_skb)); goto retry; }/* In most cases, it happens due to the hardware scheduling a
drivers/staging/octeon/ethernet-tx.c +1 -1
@@ -345,7 +345,7 @@ int cvm_oct_xmit(struct sk_buff *skb, st }if (unlikely (skb->truesize != -sizeof (*skb) +skb_end_pointer (skb) - skb->head)) { +sizeof (*skb) +skb_end_offset (skb))) {/* printk("TX buffer truesize has been changed\n"); */
include/linux/skbuff.h +11 -1
@@ -640,11 +640,21 @@ static inline unsigned char *skb_end_poi {return skb->head + skb->end; } + +static inline unsigned int skb_end_offset (const struct sk_buff *skb) +{ +return skb->end; +}#else static inline unsigned char *skb_end_pointer (const struct sk_buff *skb) {return skb->end; } + +static inline unsigned int skb_end_offset (const struct sk_buff *skb) +{ +return skb->end - skb->head; +}#endif /* Internal */
@@ -2574,7 +2584,7 @@ static inline bool skb_is_recycleable(coreturn false; skb_size =SKB_DATA_ALIGN (skb_size +NET_SKB_PAD ); -if (skb_end_pointer (skb) - skb->head < skb_size) +if (skb_end_offset (skb) < skb_size)return false;if (skb_shared (skb) ||skb_cloned (skb))
net/core/skbuff.c +4 -5
@@ -821,7 +821,7 @@ static void copy_skb_header(struct sk_bustruct sk_buff *skb_copy (const struct sk_buff *skb,gfp_t gfp_mask) {int headerlen =skb_headroom (skb); -unsigned int size = (skb_end_pointer (skb) - skb->head) + skb->data_len; +unsigned int size =skb_end_offset (skb) + skb->data_len;struct sk_buff *n =alloc_skb (size, gfp_mask);if (!n)
@@ -922,7 +922,7 @@ int pskb_expand_head(struct sk_buff *skb {int i;u8 *data; -int size = nhead + (skb_end_pointer (skb) - skb->head) + ntail; +int size = nhead +skb_end_offset (skb) + ntail;long off;bool fastpath;
@@ -2721,14 +2721,13 @@ struct sk_buff *skb_segment(struct sk_buif (unlikely (!nskb)) goto err; - hsize =skb_end_pointer (nskb) - nskb->head; + hsize =skb_end_offset (nskb);if (skb_cow_head (nskb, doffset + headroom)) {kfree_skb (nskb); goto err; } - nskb->truesize +=skb_end_pointer (nskb) - nskb->head - - hsize; + nskb->truesize +=skb_end_offset (nskb) - hsize;skb_release_head_state (nskb);__skb_push (nskb, doffset); }else {
Greg Kroah-Hartman
maintainerPATCH 33/214 net-gro: reset skb->truesize in napi_reuse_skb()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e33d0ba8047b049c9262fdb1fcafb93cb52ceceb ]
Recycling skb always had been very tough...
This time it appears GRO layer can accumulate skb->truesize adjustments made by drivers when they attach a fragment to skb.
skb_gro_receive() can only subtract from skb->truesize the used part of a fragment.
I spotted this problem seeing TcpExtPruneCalled and TcpExtTCPRcvCollapsed that were unexpected with a recent kernel, where TCP receive window should be sized properly to accept traffic coming from a driver not overshooting skb->truesize.
--- net/core/dev.c | 1 + 1 file changed, 1 insertion(+)
net/core/dev.c +1 -0
@@ -3574,6 +3574,7 @@ static void napi_reuse_skb(struct napi_s skb->vlan_tci =0 ; skb->dev = napi->dev; skb->skb_iif =0 ; + skb->truesize =SKB_TRUESIZE (skb_end_offset (skb)); napi->skb = skb; }
Greg Kroah-Hartman
maintainerPATCH 34/214 futex: Add another early deadlock detection check
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 866293ee54227584ffcb4a42f69c1f365974ba7f upstream.
Dave Jones trinity syscall fuzzer exposed an issue in the deadlock detection code of rtmutex:
http://lkml.kernel.org/r/[email protected]
That underlying issue has been fixed with a patch to the rtmutex code, but the futex code must not call into rtmutex in that case because
- it can detect that issue early
- it avoids a different and more complex fixup for backing out
If the user space variable got manipulated to 0x80000000 which means no lock holder, but the waiters bit set and an active pi_state in the kernel is found we can figure out the recursive locking issue by looking at the pi_state owner. If that is the current task, then we can safely return -EDEADLK.
The check should have been added in commit 59fa62451 (futex: Handle futex_pi OWNER_DIED take over correctly) already, but I did not see the above issue caused by user space manipulation back then.
--- kernel/futex.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-)
kernel/futex.c +34 -13
@@ -590,7 +590,8 @@ void exit_pi_state_list(struct task_strustatic int lookup_pi_state (u32 uval,struct futex_hash_bucket *hb, -union futex_key *key,struct futex_pi_state **ps) +union futex_key *key,struct futex_pi_state **ps, +struct task_struct *task) {struct futex_pi_state *pi_state =NULL ;struct futex_q *this, *next;
@@ -634,6 +635,16 @@ lookup_pi_state(u32 uval, struct futex_hreturn -EINVAL ; } +/* +* Protect against a corrupted uval. If uval +* is 0x80000000 then pid is 0 and the waiter +* bit is set. So the deadlock check in the +* calling code has failed and we did not fall +* into the check above due to !pid. +*/ +if (task && pi_state->owner == task) +return -EDEADLK ; +atomic_inc (&pi_state->refcount); *ps = pi_state;
@@ -783,7 +794,7 @@ retry:* We dont have the lock. Look up the PI state (or create it if * we are the first waiter): */ - ret =lookup_pi_state (uval, hb, key, ps); + ret =lookup_pi_state (uval, hb, key, ps, task);if (unlikely (ret)) {switch (ret) {
@@ -1193,7 +1204,7 @@ void requeue_pi_wake_futex(struct futex_* * Returns: * 0 - failed to acquire the lock atomicly -* 1 - acquired the lock +* >0 - acquired the lock, return value is vpid of the top_waiter * <0 - error */ static int futex_proxy_trylock_atomic(u32 __user *pifutex,
@@ -1204,7 +1215,7 @@ static int futex_proxy_trylock_atomic(u3 {struct futex_q *top_waiter =NULL ;u32 curval; -int ret; +int ret, vpid;if (get_futex_value_locked (&curval, pifutex))return -EFAULT ;
@@ -1232,11 +1243,13 @@ static int futex_proxy_trylock_atomic(u3* the contended case or if set_waiters is 1. The pi_state is returned * in ps in contended cases. */ + vpid =task_pid_vnr (top_waiter->task); ret =futex_lock_pi_atomic (pifutex, hb2, key2, ps, top_waiter->task, set_waiters); -if (ret ==1 ) +if (ret ==1 ) {requeue_pi_wake_futex (top_waiter, key2, hb2); - +return vpid; + }return ret; }
@@ -1268,7 +1281,6 @@ static int futex_requeue(u32 __user *uadstruct futex_hash_bucket *hb1, *hb2;struct plist_head *head1;struct futex_q *this, *next; -u32 curval2;if (requeue_pi) {/*
@@ -1354,16 +1366,25 @@ retry_private:* At this point the top_waiter has either taken uaddr2 or is * waiting on it. If the former, then the pi_state will not * exist yet, look it up one more time to ensure we have a -* reference to it. +* reference to it. If the lock was taken, ret contains the +* vpid of the top waiter task. */ -if (ret ==1 ) { +if (ret >0 ) {WARN_ON (pi_state); drop_count++; task_count++; - ret =get_futex_value_locked (&curval2, uaddr2); -if (!ret) - ret =lookup_pi_state (curval2, hb2, &key2, - &pi_state); +/* +* If we acquired the lock, then the user +* space value of uaddr2 should be vpid. It +* cannot be changed by the top waiter as it +* is blocked on hb2 lock if it tries to do +* so. If something fiddled with it behind our +* back the pi state lookup might unearth +* it. So we rather use the known value than +* rereading and handing potential crap to +* lookup_pi_state. +*/ + ret =lookup_pi_state (ret, hb2, &key2, &pi_state,NULL ); }switch (ret) {
Greg Kroah-Hartman
maintainerPATCH 35/214 futex: Prevent attaching to kernel threads
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit f0d71b3dcb8332f7971b5f2363632573e6d9486a upstream.
We happily allow userspace to declare a random kernel thread to be the owner of a user space PI futex.
Found while analysing the fallout of Dave Jones syscall fuzzer.
We also should validate the thread group for private futexes and find some fast way to validate whether the "alleged" owner has RW access on the file which backs the SHM, but that's a separate issue.
--- kernel/futex.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/futex.c +5 -0
@@ -662,6 +662,11 @@ lookup_pi_state(u32 uval, struct futex_hif (!p)return -ESRCH ; +if (!p->mm) { +put_task_struct (p); +return -EPERM ; + } +/* * We need to look at the task state flags to figure out, * whether the task is exiting. To protect against the do_exit
Greg Kroah-Hartman
maintainerPATCH 36/214 ftrace/module: Hardcode ftrace_module_init() call into load_module()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit a949ae560a511fe4e3adf48fa44fefded93e5c2b upstream.
A race exists between module loading and enabling of function tracer.
CPU 1 CPU 2 ----- -----
load_module()
module->state = MODULE_STATE_COMING
register_ftrace_function() mutex_lock(&ftrace_lock); ftrace_startup() update_ftrace_function(); ftrace_arch_code_modify_prepare() set_all_module_text_rw(); <enables-ftrace> ftrace_arch_code_modify_post_process() set_all_module_text_ro(); [ here all module text is set to RO, including the module that is loading!! ]
blocking_notifier_call_chain(MODULE_STATE_COMING);
ftrace_init_module() [ tries to modify code, but it's RO, and fails!
ftrace_bug() is called]
When this race happens, ftrace_bug() will produces a nasty warning and all of the function tracing features will be disabled until reboot.
The simple solution is to treate module load the same way the core kernel is treated at boot. To hardcode the ftrace function modification of converting calls to mcount into nops. This is done in init/main.c there's no reason it could not be done in load_module(). This gives a better control of the changes and doesn't tie the state of the module to its notifiers as much. Ftrace is special, it needs to be treated as such.
The reason this would work, is that the ftrace_module_init() would be called while the module is in MODULE_STATE_UNFORMED, which is ignored by the set_all_module_text_ro() call.
--- include/linux/ftrace.h | 2 ++ kernel/module.c | 3 +++ kernel/trace/ftrace.c | 27 ++++----------------------- 3 files changed, 9 insertions(+), 23 deletions(-)
include/linux/ftrace.h +2 -0
@@ -374,6 +374,7 @@ extern int ftrace_make_call(struct dyn_fextern int ftrace_arch_read_dyn_info (char *buf,int size);extern int skip_trace (unsigned long ip); +extern void ftrace_module_init (struct module *mod);extern void ftrace_disable_daemon (void );extern void ftrace_enable_daemon (void );
@@ -383,6 +384,7 @@ static inline int ftrace_force_update(vostatic inline void ftrace_disable_daemon (void ) { }static inline void ftrace_enable_daemon (void ) { }static inline void ftrace_release_mod (struct module *mod) {} +static inline void ftrace_module_init (struct module *mod) {}static inline int register_ftrace_command (struct ftrace_func_command *cmd) {return -EINVAL ;
kernel/module.c +3 -0
@@ -2951,6 +2951,9 @@ static struct module *load_module(void _/* This has to be done once we're sure module name is unique. */ dynamic_debug_setup (info.debug, info.num_debug); +/* Ftrace init must be called in the MODULE_STATE_UNFORMED state */ +ftrace_module_init (mod); +/* Find duplicate symbols */ err =verify_export_symbols (mod);if (err <0 )
kernel/trace/ftrace.c +4 -23
@@ -3880,16 +3880,11 @@ static void ftrace_init_module(struct moftrace_process_locs (mod, start, end); } -static int ftrace_module_notify_enter (struct notifier_block *self, -unsigned long val,void *data) +void ftrace_module_init (struct module *mod) { -struct module *mod = data; - -if (val ==MODULE_STATE_COMING ) -ftrace_init_module (mod, mod->ftrace_callsites, - mod->ftrace_callsites + - mod->num_ftrace_callsites); -return 0 ; +ftrace_init_module (mod, mod->ftrace_callsites, + mod->ftrace_callsites + + mod->num_ftrace_callsites); } static int ftrace_module_notify_exit(struct notifier_block *self,
@@ -3903,11 +3898,6 @@ static int ftrace_module_notify_exit(str return 0; }#else -static int ftrace_module_notify_enter (struct notifier_block *self, -unsigned long val,void *data) -{ -return 0 ; -}static int ftrace_module_notify_exit (struct notifier_block *self,unsigned long val,void *data) {
@@ -3915,11 +3905,6 @@ static int ftrace_module_notify_exit(str }#endif /* CONFIG_MODULES */ -struct notifier_block ftrace_module_enter_nb = { - .notifier_call = ftrace_module_notify_enter, - .priority =INT_MAX ,/* Run before anything that can use kprobes */ -}; -struct notifier_block ftrace_module_exit_nb = { .notifier_call = ftrace_module_notify_exit, .priority =INT_MIN ,/* Run after anything that can remove kprobes */
@@ -3956,10 +3941,6 @@ void __init ftrace_init(void) __start_mcount_loc, __stop_mcount_loc); - ret =register_module_notifier (&ftrace_module_enter_nb); -if (ret) -pr_warning ("Failed to register trace ftrace module enter notifier\n" ); - ret =register_module_notifier (&ftrace_module_exit_nb);if (ret)pr_warning ("Failed to register trace ftrace module exit notifier\n" );
Greg Kroah-Hartman
maintainerPATCH 37/214 pata_at91: fix ata_host_activate() failure handling
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartlomiej Zolnierkiewicz <[email protected]>
commit 27aa64b9d1bd0d23fd692c91763a48309b694311 upstream.
Add missing clk_put() call to ata_host_activate() failure path.
Sergei says,
"Hm, I have once fixed that (see that *if* (!ret)) but looks like a
later commit 477c87e90853d136b188c50c0e4a93d01cad872e (ARM:
at91/pata: use gpio_is_valid to check the gpio) broke it again. :-( Would be good if the changelog did mention that..."
--- drivers/ata/pata_at91.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/ata/pata_at91.c +6 -5
@@ -408,12 +408,13 @@ static int __devinit pata_at91_probe(str host->private_data = info; -return ata_host_activate (host,gpio_is_valid (irq) ?gpio_to_irq (irq) :0 , -gpio_is_valid (irq) ? ata_sff_interrupt :NULL , - irq_flags, &pata_at91_sht); + ret =ata_host_activate (host,gpio_is_valid (irq) ?gpio_to_irq (irq) :0 , +gpio_is_valid (irq) ? ata_sff_interrupt :NULL , + irq_flags, &pata_at91_sht); +if (ret) + goto err_put; -if (!ret) -return 0 ; +return 0 ; err_put:clk_put (info->mck);
Greg Kroah-Hartman
maintainerPATCH 38/214 mm: make fixup_user_fault() check the vma access rights too
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit 1b17844b29ae042576bea588164f2f1e9590a8bc upstream.
fixup_user_fault() is used by the futex code when the direct user access fails, and the futex code wants it to either map in the page in a usable form or return an error. It relied on handle_mm_fault() to map the page, and correctly checked the error return from that, but while that does map the page, it doesn't actually guarantee that the page will be mapped with sufficient permissions to be then accessed.
So do the appropriate tests of the vma access rights by hand.
[ Side note: arguably handle_mm_fault() could just do that itself, but
we have traditionally done it in the caller, because some callers - notably get_user_pages() - have been able to access pages even when they are mapped with PROT_NONE. Maybe we should re-visit that design decision, but in the meantime this is the minimal patch. ]
Found by Dave Jones running his trinity tool.
--- mm/memory.c | 5 +++++ 1 file changed, 5 insertions(+)
mm/memory.c +5 -0
@@ -1872,12 +1872,17 @@ int fixup_user_fault(struct task_struct unsigned long address, unsigned int fault_flags) { struct vm_area_struct *vma; +vm_flags_t vm_flags;int ret; vma =find_extend_vma (mm, address);if (!vma || address < vma->vm_start)return -EFAULT ; + vm_flags = (fault_flags &FAULT_FLAG_WRITE ) ?VM_WRITE :VM_READ ; +if (!(vm_flags & vma->vm_flags)) +return -EFAULT ; + ret =handle_mm_fault (mm, vma, address, fault_flags);if (ret &VM_FAULT_ERROR ) {if (ret &VM_FAULT_OOM )
Greg Kroah-Hartman
maintainerPATCH 39/214 timer: Prevent overflow in apply_slack
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Bohac <[email protected]>
commit 98a01e779f3c66b0b11cd7e64d531c0e41c95762 upstream.
On architectures with sizeof(int) < sizeof (long), the computation of mask inside apply_slack() can be undefined if the computed bit is > 32.
E.g. with: expires = 0xffffe6f5 and slack = 25, we get:
expires_limit = 0x20000000e
bit = 33
mask = (1 << 33) - 1 /* undefined */
On x86, mask becomes 1 and and the slack is not applied properly. On s390, mask is -1, expires is set to 0 and the timer fires immediately.
Use 1UL << bit to solve that issue.
--- kernel/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/timer.c +1 -1
@@ -815,7 +815,7 @@ unsigned long apply_slack(struct timer_l bit =find_last_bit (&mask,BITS_PER_LONG ); - mask = (1 << bit) -1 ; + mask = (1UL << bit) -1 ; expires_limit = expires_limit & ~(mask);
Greg Kroah-Hartman
maintainerPATCH 40/214 ipmi: Fix a race restarting the timer
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bodo Stroesser <[email protected]>
commit 48e8ac2979920ffa39117e2d725afa3a749bfe8d upstream.
With recent changes it is possible for the timer handler to detect an idle interface and not start the timer, but the thread to start an operation at the same time. The thread will not start the timer in that instance, resulting in the timer not running.
Instead, move all timer operations under the lock and start the timer in the thread if it detect non-idle and the timer is not already running. Moving under locks allows the last timeout to be set in both the thread and the timer. 'Timer is not running' means that the timer is not pending and smi_timeout() is not running. So we need a flag to detect this correctly.
Also fix a few other timeout bugs: setting the last timeout when the interrupt has to be disabled and the timer started, and setting the last timeout in check_start_timer_thread possibly racing with the timer
--- drivers/char/ipmi/ipmi_si_intf.c | 46 +++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 18 deletions(-)
drivers/char/ipmi/ipmi_si_intf.c +28 -18
@@ -244,6 +244,9 @@ struct smi_info {/* The timer for this si. */ struct timer_list si_timer; +/* This flag is set, if the timer is running (timer_pending() isn't enough) */ +bool timer_running; +/* The time (in jiffies) the last timeout occurred at. */ unsigned long last_timeout_jiffies;
@@ -427,6 +430,13 @@ static void start_clear_flags(struct smi smi_info->si_state =SI_CLEARING_FLAGS ; } +static void smi_mod_timer (struct smi_info *smi_info,unsigned long new_val) +{ + smi_info->last_timeout_jiffies = jiffies; +mod_timer (&smi_info->si_timer, new_val); + smi_info->timer_running = true; +} +/* * When we have a situtaion where we run out of memory and cannot * allocate messages, we just leave them in the BMC and run the system
@@ -439,8 +449,7 @@ static inline void disable_si_irq(structstart_disable_irq (smi_info); smi_info->interrupt_disabled =1 ;if (!atomic_read (&smi_info->stop_operation)) -mod_timer (&smi_info->si_timer, - jiffies +SI_TIMEOUT_JIFFIES ); +smi_mod_timer (smi_info, jiffies +SI_TIMEOUT_JIFFIES ); } }
@@ -896,15 +905,7 @@ static void sender(void *list_add_tail (&msg->link, &smi_info->xmit_msgs);if (smi_info->si_state ==SI_NORMAL && smi_info->curr_msg ==NULL ) { -/* -* last_timeout_jiffies is updated here to avoid -* smi_timeout() handler passing very large time_diff -* value to smi_event_handler() that causes -* the send command to abort. -*/ - smi_info->last_timeout_jiffies = jiffies; - -mod_timer (&smi_info->si_timer, jiffies +SI_TIMEOUT_JIFFIES ); +smi_mod_timer (smi_info, jiffies +SI_TIMEOUT_JIFFIES );if (smi_info->thread)wake_up_process (smi_info->thread);
@@ -993,6 +994,17 @@ static int ipmi_thread(void *data)spin_lock_irqsave (&(smi_info->si_lock), flags); smi_result =smi_event_handler (smi_info,0 ); + +/* +* If the driver is doing something, there is a possible +* race with the timer. If the timer handler see idle, +* and the thread here sees something else, the timer +* handler won't restart the timer even though it is +* required. So start it here if necessary. +*/ +if (smi_result !=SI_SM_IDLE && !smi_info->timer_running) +smi_mod_timer (smi_info, jiffies +SI_TIMEOUT_JIFFIES ); +spin_unlock_irqrestore (&(smi_info->si_lock), flags); busy_wait =ipmi_thread_busy_wait (smi_result, smi_info, &busy_until);
@@ -1062,10 +1074,6 @@ static void smi_timeout(unsigned long da * SI_USEC_PER_JIFFY); smi_result =smi_event_handler (smi_info, time_diff); -spin_unlock_irqrestore (&(smi_info->si_lock), flags); - - smi_info->last_timeout_jiffies = jiffies_now; -if ((smi_info->irq) && (!smi_info->interrupt_disabled)) {/* Running with interrupts, only do long timeouts. */ timeout = jiffies +SI_TIMEOUT_JIFFIES ;
@@ -1087,7 +1095,10 @@ static void smi_timeout(unsigned long da do_mod_timer:if (smi_result !=SI_SM_IDLE ) -mod_timer (&(smi_info->si_timer), timeout); +smi_mod_timer (smi_info, timeout); +else + smi_info->timer_running = false; +spin_unlock_irqrestore (&(smi_info->si_lock), flags); }static irqreturn_t si_irq_handler (int irq,void *data)
@@ -1135,8 +1146,7 @@ static int smi_start_processing(void/* Set up the timer that drives the interface. */ setup_timer (&new_smi->si_timer, smi_timeout, (long )new_smi); - new_smi->last_timeout_jiffies = jiffies; -mod_timer (&new_smi->si_timer, jiffies +SI_TIMEOUT_JIFFIES ); +smi_mod_timer (new_smi, jiffies +SI_TIMEOUT_JIFFIES );/* * Check if the user forcefully enabled the daemon.
Greg Kroah-Hartman
maintainerPATCH 41/214 ipmi: Reset the KCS timeout when starting error recovery
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Corey Minyard <[email protected]>
commit eb6d78ec213e6938559b801421d64714dafcf4b2 upstream.
The OBF timer in KCS was not reset in one situation when error recovery was started, resulting in an immediate timeout.
--- drivers/char/ipmi/ipmi_kcs_sm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_kcs_sm.c +3 -2
@@ -251,8 +251,9 @@ static inline int check_obf(struct si_smif (!GET_STATUS_OBF (status)) { kcs->obf_timeout -= time;if (kcs->obf_timeout <0 ) { -start_error_recovery (kcs,"OBF not ready in time" ); -return 1 ; + kcs->obf_timeout =OBF_RETRY_TIMEOUT ; +start_error_recovery (kcs,"OBF not ready in time" ); +return 1 ; }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 42/214 x86, mm, hugetlb: Add missing TLB page invalidation for hugetlb_cow()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anthony Iliopoulos <[email protected]>
commit 9844f5462392b53824e8b86726e7c33b5ecbb676 upstream.
The invalidation is required in order to maintain proper semantics under CoW conditions. In scenarios where a process clones several threads, a thread operating on a core whose DTLB entry for a particular hugepage has not been invalidated, will be reading from the hugepage that belongs to the forked child process, even after hugetlb_cow().
The thread will not see the updated page as long as the stale DTLB entry remains cached, the thread attempts to write into the page, the child process exits, or the thread gets migrated to a different processor.
--- arch/x86/include/asm/hugetlb.h | 1 + 1 file changed, 1 insertion(+)
arch/x86/include/asm/hugetlb.h +1 -0
@@ -51,6 +51,7 @@ static inline pte_t huge_ptep_get_and_clstatic inline void huge_ptep_clear_flush (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep) { +ptep_clear_flush (vma, addr, ptep); }static inline int huge_pte_none (pte_t pte)
Greg Kroah-Hartman
maintainerPATCH 43/214 hwpoison, hugetlb: lock_page/unlock_page does not match for handling a free hugepage
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Yucong <[email protected]>
commit b985194c8c0a130ed155b71662e39f7eaea4876f upstream.
For handling a free hugepage in memory failure, the race will happen if another thread hwpoisoned this hugepage concurrently. So we need to check PageHWPoison instead of !PageHWPoison.
If hwpoison_filter(p) returns true or a race happens, then we need to unlock_page(hpage).
--- mm/memory-failure.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
mm/memory-failure.c +8 -7
@@ -1061,15 +1061,16 @@ int memory_failure(unsigned long pfn, inreturn 0 ; }else if (PageHuge (hpage)) {/* -* Check "just unpoisoned", "filter hit", and -* "race with other subpage." +* Check "filter hit" and "race with other subpage." */ lock_page (hpage); -if (!PageHWPoison (hpage) - || (hwpoison_filter (p) &&TestClearPageHWPoison (p)) - || (p != hpage &&TestSetPageHWPoison (hpage))) { -atomic_long_sub (nr_pages, &mce_bad_pages); -return 0 ; +if (PageHWPoison (hpage)) { +if ((hwpoison_filter (p) &&TestClearPageHWPoison (p)) + || (p != hpage &&TestSetPageHWPoison (hpage))) { +atomic_long_sub (nr_pages, &mce_bad_pages); +unlock_page (hpage); +return 0 ; + } }set_page_hwpoison_huge_page (hpage); res =dequeue_hwpoisoned_huge_page (hpage);
Greg Kroah-Hartman
maintainerPATCH 44/214 hwmon: (emc1403) fix inverted store_hyst()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Gajdusek <[email protected]>
commit 17c048fc4bd95efea208a1920f169547d8588f1f upstream.
Attempts to set the hysteresis value to a temperature below the target limit fails with "write error: Numerical result out of range" due to an inverted comparison.
--- drivers/hwmon/emc1403.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/emc1403.c +1 -1
@@ -161,7 +161,7 @@ static ssize_t store_hyst(struct deviceif (retval <0 ) goto fail; - hyst = val - retval *1000 ; + hyst = retval *1000 - val; hyst =DIV_ROUND_CLOSEST (hyst,1000 );if (hyst <0 || hyst >255 ) { retval = -ERANGE ;
Greg Kroah-Hartman
maintainerPATCH 45/214 hwmon: (emc1403) Support full range of known chip revision numbers
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Gajdusek <[email protected]>
commit 3a18e1398fc2dc9c32bbdc50664da3a77959a8d1 upstream.
The datasheet for EMC1413/EMC1414, which is fully compatible to EMC1403/1404 and uses the same chip identification, references revision numbers 0x01, 0x03, and 0x04. Accept the full range of revision numbers from 0x01 to 0x04 to make sure none are missed.
--- drivers/hwmon/emc1403.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/emc1403.c +1 -1
@@ -294,7 +294,7 @@ static int emc1403_detect(struct i2c_cli } id =i2c_smbus_read_byte_data (client,THERMAL_REVISION_REG ); -if (id !=0x01 ) +if (id <0x01 || id >0x04 )return -ENODEV ;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 46/214 drivercore: deferral race condition fix
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Grant Likely <[email protected]>
commit 58b116bce13612e5aa6fcd49ecbd4cf8bb59e835 upstream.
When the kernel is built with CONFIG_PREEMPT it is possible to reach a state when all modules loaded but some driver still stuck in the deferred list and there is a need for external event to kick the deferred queue to probe these drivers.
The issue has been observed on embedded systems with CONFIG_PREEMPT enabled, audio support built as modules and using nfsroot for root filesystem.
The following log fragment shows such sequence when all audio modules were loaded but the sound card is not present since the machine driver has failed to probe due to missing dependency during it's probe. The board is am335x-evmsk (McASP<->tlv320aic3106 codec) with davinci-evm machine driver:
...
[ 12.615118] davinci-mcasp 4803c000.mcasp: davinci_mcasp_probe: ENTER [ 12.719969] davinci_evm sound.3: davinci_evm_probe: ENTER [ 12.725753] davinci_evm sound.3: davinci_evm_probe: snd_soc_register_card [ 12.753846] davinci-mcasp 4803c000.mcasp: davinci_mcasp_probe: snd_soc_register_component [ 12.922051] davinci-mcasp 4803c000.mcasp: davinci_mcasp_probe: snd_soc_register_component DONE [ 12.950839] davinci_evm sound.3: ASoC: platform (null) not registered [ 12.957898] davinci_evm sound.3: davinci_evm_probe: snd_soc_register_card DONE (-517) [ 13.099026] davinci-mcasp 4803c000.mcasp: Kicking the deferred list [ 13.177838] davinci-mcasp 4803c000.mcasp: really_probe: probe_count = 2 [ 13.194130] davinci_evm sound.3: snd_soc_register_card failed (-517) [ 13.346755] davinci_mcasp_driver_init: LEAVE [ 13.377446] platform sound.3: Driver davinci_evm requests probe deferral [ 13.592527] platform sound.3: really_probe: probe_count = 0
In the log the machine driver enters it's probe at 12.719969 (this point it has been removed from the deferred lists). McASP driver already executing it's probing (since 12.615118).
The machine driver tries to construct the sound card (12.950839) but did not found one of the components so it fails. After this McASP driver registers all the ASoC components (the machine driver still in it's probe function after it failed to construct the card) and the deferred work is prepared at 13.099026 (note that this time the machine driver is not in the lists so it is not going to be handled when the work is executing). Lastly the machine driver exit from it's probe and the core places it to the deferred list but there will be no other driver going to load and the deferred queue is not going to be kicked again - till we have external event like connecting USB stick, etc.
The proposed solution is to try the deferred queue once more when the last driver is asking for deferring and we had drivers loaded while this last driver was probing.
This way we can avoid drivers stuck in the deferred queue.
--- drivers/base/dd.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/base/dd.c +17 -0
@@ -51,6 +51,7 @@ static DEFINE_MUTEX(deferred_probe_mutexstatic LIST_HEAD (deferred_probe_pending_list);static LIST_HEAD (deferred_probe_active_list);static struct workqueue_struct *deferred_wq; +static atomic_t deferred_trigger_count =ATOMIC_INIT (0 );/** * deferred_probe_work_func() - Retry probing devices in the active list.
@@ -122,6 +123,17 @@ static bool driver_deferred_probe_enable* This functions moves all devices from the pending list to the active * list and schedules the deferred probe workqueue to process them. It * should be called anytime a driver is successfully bound to a device. +* +* Note, there is a race condition in multi-threaded probe. In the case where +* more than one device is probing at the same time, it is possible for one +* probe to complete successfully while another is about to defer. If the second +* depends on the first, then it will get put on the pending list after the +* trigger event has already occured and will be stuck there. +* +* The atomic 'deferred_trigger_count' is used to determine if a successful +* trigger has occurred in the midst of probing a driver. If the trigger count +* changes in the midst of a probe, then deferred processing should be triggered +* again. */ static void driver_deferred_probe_trigger (void ) {
@@ -134,6 +146,7 @@ static void driver_deferred_probe_trigge* into the active list so they can be retried by the workqueue */ mutex_lock (&deferred_probe_mutex); +atomic_inc (&deferred_trigger_count);list_splice_tail_init (&deferred_probe_pending_list, &deferred_probe_active_list);mutex_unlock (&deferred_probe_mutex);
@@ -252,6 +265,7 @@ static DECLARE_WAIT_QUEUE_HEAD(probe_waistatic int really_probe (struct device *dev,struct device_driver *drv) {int ret =0 ; +int local_trigger_count =atomic_read (&deferred_trigger_count);atomic_inc (&probe_count); pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
@@ -290,6 +304,9 @@ probe_failed:/* Driver requested deferred probing */ dev_info (dev,"Driver %s requests probe deferral\n" , drv->name);driver_deferred_probe_add (dev); +/* Did a trigger occur while probing? Need to re-trigger if yes */ +if (local_trigger_count !=atomic_read (&deferred_trigger_count)) +driver_deferred_probe_trigger (); }else if (ret != -ENODEV && ret != -ENXIO ) {/* driver matched but the probe failed */ printk(KERN_WARNING
Greg Kroah-Hartman
maintainerPATCH 47/214 hrtimer: Prevent all reprogramming if hang detected
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stuart Hayes <[email protected]>
commit 6c6c0d5a1c949d2e084706f9e5fb1fccc175b265 upstream.
If the last hrtimer interrupt detected a hang it sets hang_detected=1 and programs the clock event device with a delay to let the system make progress.
If hang_detected == 1, we prevent reprogramming of the clock event device in hrtimer_reprogram() but not in hrtimer_force_reprogram().
This can lead to the following situation:
hrtimer_interrupt()
hang_detected = 1;
program ce device to Xms from now (hang delay)
We have two timers pending:
T1 expires 50ms from now
T2 expires 5s from now
Now T1 gets canceled, which causes hrtimer_force_reprogram() to be invoked, which in turn programs the clock event device to T2 (5 seconds from now).
Any hrtimer_start after that will not reprogram the hardware due to hang_detected still being set. So we effectivly block all timers until the T2 event fires and cleans up the hang situation.
Add a check for hang_detected to hrtimer_force_reprogram() which prevents the reprogramming of the hang delay in the hardware timer. The subsequent hrtimer_interrupt will resolve all outstanding issues.
[ tglx: Rewrote subject and changelog and fixed up the comment in
hrtimer_force_reprogram() ]
--- kernel/hrtimer.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
kernel/hrtimer.c +17 -0
@@ -567,6 +567,23 @@ hrtimer_force_reprogram(struct hrtimer_c cpu_base->expires_next.tv64 = expires_next.tv64; +/* +* If a hang was detected in the last timer interrupt then we +* leave the hang delay active in the hardware. We want the +* system to make progress. That also prevents the following +* scenario: +* T1 expires 50ms from now +* T2 expires 5s from now +* +* T1 is removed, so this code is called and would reprogram +* the hardware to 5s from now. Any hrtimer_start after that +* will not reprogram the hardware due to hang_detected being +* set. So we'd effectivly block all timers until the T2 event +* fires. +*/ +if (cpu_base->hang_detected) +return ; +if (cpu_base->expires_next.tv64 !=KTIME_MAX )tick_program_event (cpu_base->expires_next,1 ); }
Greg Kroah-Hartman
maintainerPATCH 48/214 hrtimer: Prevent remote enqueue of leftmost timers
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Ma <[email protected]>
commit 012a45e3f4af68e86d85cce060c6c2fed56498b2 upstream.
If a cpu is idle and starts an hrtimer which is not pinned on that same cpu, the nohz code might target the timer to a different cpu.
In the case that we switch the cpu base of the timer we already have a sanity check in place, which determines whether the timer is earlier than the current leftmost timer on the target cpu. In that case we enqueue the timer on the current cpu because we cannot reprogram the clock event device on the target.
If the timers base is already the target CPU we do not have this sanity check in place so we enqueue the timer as the leftmost timer in the target cpus rb tree, but we cannot reprogram the clock event device on the target cpu. So the timer expires late and subsequently prevents the reprogramming of the target cpu clock event device until the previously programmed event fires or a timer with an earlier expiry time gets enqueued on the target cpu itself.
Add the same target check as we have for the switch base case and start the timer on the current cpu if it would become the leftmost timer on the target.
[ tglx: Rewrote subject and changelog ]
--- kernel/hrtimer.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/hrtimer.c +5 -0
@@ -232,6 +232,11 @@ again: goto again; } timer->base = new_base; + }else { +if (cpu != this_cpu &&hrtimer_check_target (timer, new_base)) { + cpu = this_cpu; + goto again; + } }return new_base; }
Greg Kroah-Hartman
maintainerPATCH 49/214 hrtimer: Set expiry time before switch_hrtimer_base()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 84ea7fe37908254c3bd90910921f6e1045c1747a upstream.
switch_hrtimer_base() calls hrtimer_check_target() which ensures that we do not migrate a timer to a remote cpu if the timer expires before the current programmed expiry time on that remote cpu.
But __hrtimer_start_range_ns() calls switch_hrtimer_base() before the new expiry time is set. So the sanity check in hrtimer_check_target() is operating on stale or even uninitialized data.
Update expiry time before calling switch_hrtimer_base().
[ tglx: Rewrote changelog once again ]
--- kernel/hrtimer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/hrtimer.c +4 -4
@@ -985,11 +985,8 @@ int __hrtimer_start_range_ns(struct hrti/* Remove an active timer from the queue: */ ret =remove_hrtimer (timer, base); -/* Switch the timer base, if necessary: */ - new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); -if (mode &HRTIMER_MODE_REL ) { - tim =ktime_add_safe (tim, new_base->get_time ()); + tim =ktime_add_safe (tim, base->get_time ());/* * CONFIG_TIME_LOW_RES is a temporary way for architectures * to signal that they simply return xtime in
@@ -1004,6 +1001,9 @@ int __hrtimer_start_range_ns(struct hrtihrtimer_set_expires_range_ns (timer, tim, delta_ns); +/* Switch the timer base, if necessary: */ + new_base =switch_hrtimer_base (timer, base, mode &HRTIMER_MODE_PINNED ); +timer_stats_hrtimer_set_start_info (timer); leftmost =enqueue_hrtimer (timer, new_base);
Greg Kroah-Hartman
maintainerPATCH 50/214 md: avoid possible spinning md thread at shutdown.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 0f62fb220aa4ebabe8547d3a9ce4a16d3c045f21 upstream.
If an md array with externally managed metadata (e.g. DDF or IMSM) is in use, then we should not set safemode==2 at shutdown because:
1/ this is ineffective: user-space need to be involved in any 'safemode' handling, 2/ The safemode management code doesn't cope with safemode==2 on external metadata
and md_check_recover enters an infinite loop.
Even at shutdown, an infinite-looping process can be problematic, so this could cause shutdown to hang.
--- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/md.c +2 -1
@@ -8167,7 +8167,8 @@ static int md_notify_reboot(struct notifif (mddev_trylock (mddev)) {if (mddev->pers)__md_stop_writes (mddev); - mddev->safemode =2 ; +if (mddev->persistent) + mddev->safemode =2 ;mddev_unlock (mddev); } need_delay =1 ;
Greg Kroah-Hartman
maintainerPATCH 51/214 drm/radeon: fix ATPX detection on non-VGA GPUs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e9a4099a59cc598a44006059dd775c25e422b772 upstream.
Some newer PX laptops have the pci device class set to DISPLAY_OTHER rather than DISPLAY_VGA. This properly detects ATPX on those laptops.
Based on a patch from: Pali Rohár <[email protected]>
--- drivers/gpu/drm/radeon/radeon_atpx_handler.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/radeon_atpx_handler.c +7 -0
@@ -202,6 +202,13 @@ static bool radeon_atpx_detect(void) has_atpx |= (radeon_atpx_pci_probe_handle (pdev) == true); } +/* some newer PX laptops mark the dGPU as a non-VGA display device */ +while ((pdev =pci_get_class (PCI_CLASS_DISPLAY_OTHER <<8 , pdev)) !=NULL ) { + vga_count++; + + has_atpx |= (radeon_atpx_pci_probe_handle (pdev) == true); + } +if (has_atpx && vga_count ==2 ) {acpi_get_name (radeon_atpx_priv.atpx_handle,ACPI_FULL_PATHNAME , &buffer); printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n",
Greg Kroah-Hartman
maintainerPATCH 52/214 usb: gadget: at91-udc: fix irq and iomem resource retrieval
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Jacques Hiblot <[email protected]>
commit 886c7c426d465732ec9d1b2bbdda5642fc2e7e05 upstream.
When using dt resources retrieval (interrupts and reg properties) there is no predefined order for these resources in the platform dev resource table. Also don't expect the number of resource to be always 2.
--- drivers/usb/gadget/at91_udc.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/usb/gadget/at91_udc.c +0 -10
@@ -1741,16 +1741,6 @@ static int __devinit at91udc_probe(strucreturn -ENODEV ; } -if (pdev->num_resources !=2 ) { -DBG ("invalid num_resources\n" ); -return -ENODEV ; - } -if ((pdev->resource[0 ].flags !=IORESOURCE_MEM ) - || (pdev->resource[1 ].flags !=IORESOURCE_IRQ )) { -DBG ("invalid resource type\n" ); -return -ENODEV ; - } - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res)return -ENXIO ;
Greg Kroah-Hartman
maintainerPATCH 53/214 usb: storage: shuttle_usbat: fix discs being detected twice
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Forsi <[email protected]>
commit df602c2d2358f02c6e49cffc5b49b9daa16db033 upstream.
Even if the USB-to-ATAPI converter supported multiple LUNs, this driver would always detect the same physical device or media because it doesn't use srb->device->lun in any way.
Tested with an Hewlett-Packard CD-Writer Plus 8200e.
--- drivers/usb/storage/shuttle_usbat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/shuttle_usbat.c +1 -1
@@ -1846,7 +1846,7 @@ static int usbat_probe(struct usb_interf us->transport_name ="Shuttle USBAT" ; us->transport = usbat_flash_transport; us->transport_reset = usb_stor_CB_reset; - us->max_lun =1 ; + us->max_lun =0 ; result =usb_stor_probe2 (us);return result;
Greg Kroah-Hartman
maintainerPATCH 54/214 USB: Nokia 305 should be treated as unusual dev
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Victor A. Santos" <[email protected]>
commit f0ef5d41792a46a1085dead9dfb0bdb2c574638e upstream.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -226,6 +226,13 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_MAX_SECTORS_64 ), +/* Patch submitted by Victor A. Santos <[email protected]> */ +UNUSUAL_DEV (0x0421 ,0x05af ,0x0742 ,0x0742 , +"Nokia" , +"305" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_MAX_SECTORS_64 ), +/* Patch submitted by Mikhail Zolotaryov <[email protected]> */ UNUSUAL_DEV( 0x0421, 0x06aa, 0x1110, 0x1110, "Nokia",
Greg Kroah-Hartman
maintainerPATCH 55/214 USB: Nokia 5300 should be treated as unusual dev
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Forsi <[email protected]>
commit 6ed07d45d09bc2aa60e27b845543db9972e22a38 upstream.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -226,6 +226,13 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_MAX_SECTORS_64 ), +/* Reported by Daniele Forsi <[email protected]> */ +UNUSUAL_DEV (0x0421 ,0x04b9 ,0x0350 ,0x0350 , +"Nokia" , +"5300" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_MAX_SECTORS_64 ), +/* Patch submitted by Victor A. Santos <[email protected]> */ UNUSUAL_DEV( 0x0421, 0x05af, 0x0742, 0x0742, "Nokia",
Greg Kroah-Hartman
maintainerPATCH 56/214 rt2x00: fix beaconing on USB
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 8834d3608cc516f13e2e510f4057c263f3d2ce42 upstream.
When disable beaconing we clear register with beacon and newer set it back, what make we stop send beacons infinitely.
--- drivers/net/wireless/rt2x00/rt2x00mac.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/net/wireless/rt2x00/rt2x00mac.c +12 -10
@@ -651,20 +651,18 @@ void rt2x00mac_bss_info_changed(struct i bss_conf->bssid);/* -* Update the beacon. This is only required on USB devices. PCI -* devices fetch beacons periodically. -*/ -if (changes &BSS_CHANGED_BEACON &&rt2x00_is_usb (rt2x00dev)) -rt2x00queue_update_beacon (rt2x00dev, vif); - -/* * Start/stop beaconing. */ if (changes &BSS_CHANGED_BEACON_ENABLED ) {if (!bss_conf->enable_beacon && intf->enable_beacon) { -rt2x00queue_clear_beacon (rt2x00dev, vif); rt2x00dev->intf_beaconing--; intf->enable_beacon = false; +/* +* Clear beacon in the H/W for this vif. This is needed +* to disable beaconing on this particular interface +* and keep it running on other interfaces. +*/ +rt2x00queue_clear_beacon (rt2x00dev, vif);if (rt2x00dev->intf_beaconing ==0 ) {/*
@@ -675,11 +673,15 @@ void rt2x00mac_bss_info_changed(struct irt2x00queue_stop_queue (rt2x00dev->bcn);mutex_unlock (&intf->beacon_skb_mutex); } - - }else if (bss_conf->enable_beacon && !intf->enable_beacon) { rt2x00dev->intf_beaconing++; intf->enable_beacon = true; +/* +* Upload beacon to the H/W. This is only required on +* USB devices. PCI devices fetch beacons periodically. +*/ +if (rt2x00_is_usb (rt2x00dev)) +rt2x00queue_update_beacon (rt2x00dev, vif);if (rt2x00dev->intf_beaconing ==1 ) {/*
Greg Kroah-Hartman
maintainerPATCH 57/214 posix_acl: handle NULL ACL in posix_acl_equiv_mode
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit 50c6e282bdf5e8dabf8d7cf7b162545a55645fd9 upstream.
Various filesystems don't bother checking for a NULL ACL in posix_acl_equiv_mode, and thus can dereference a NULL pointer when it gets passed one. This usually happens from the NFS server, as the ACL tools never pass a NULL ACL, but instead of one representing the mode bits.
Instead of adding boilerplat to all filesystems put this check into one place, which will allow us to remove the check from other filesystems as well later on.
--- fs/posix_acl.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/posix_acl.c +6 -0
@@ -155,6 +155,12 @@ posix_acl_equiv_mode(const struct posix_umode_t mode =0 ;int not_equiv =0 ; +/* +* A null ACL can always be presented as mode bits. +*/ +if (!acl) +return 0 ; + FOREACH_ACL_ENTRY(pa, acl, pe) {switch (pa->e_tag) {case ACL_USER_OBJ :
Greg Kroah-Hartman
maintainerPATCH 58/214 ARM: 8012/1: kdump: Avoid overflow when converting pfn to physaddr
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Hua <[email protected]>
commit 8fad87bca7ac9737e413ba5f1656f1114a8c314d upstream.
When we configure CONFIG_ARM_LPAE=y, pfn << PAGE_SHIFT will overflow if pfn >= 0x100000 in copy_oldmem_page. So use __pfn_to_phys for converting.
--- arch/arm/kernel/crash_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/crash_dump.c +1 -1
@@ -39,7 +39,7 @@ ssize_t copy_oldmem_page(unsigned long pif (!csize)return 0 ; - vaddr =ioremap (pfn <<PAGE_SHIFT ,PAGE_SIZE ); + vaddr =ioremap (__pfn_to_phys (pfn),PAGE_SIZE );if (!vaddr)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 59/214 rtl8192cu: Fix unbalanced irq enable in error path of rtl92cu_hw_init()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 3234f5b06fc3094176a86772cc64baf3decc98fc upstream.
--- drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +1 -1
@@ -1001,7 +1001,7 @@ int rtl92cu_hw_init(struct ieee80211_hw err =_rtl92cu_init_mac (hw);if (err) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"init mac failed!\n" ); -return err; + goto exit; } err =rtl92c_download_fw (hw);if (err) {
Greg Kroah-Hartman
maintainerPATCH 60/214 drm/nouveau/acpi: allow non-optimus setups to load vbios from acpi
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Mirkin <[email protected]>
commit a3d0b1218d351c6e6f3cea36abe22236a08cb246 upstream.
There appear to be a crop of new hardware where the vbios is not available from PROM/PRAMIN, but there is a valid _ROM method in ACPI. The data read from PCIROM almost invariably contains invalid instructions (still has the x86 opcodes), which makes this a low-risk way to try to obtain a valid vbios image.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76475
--- drivers/gpu/drm/nouveau/nouveau_acpi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/nouveau/nouveau_acpi.c +0 -3
@@ -375,9 +375,6 @@ bool nouveau_acpi_rom_supported(struct pacpi_status status;acpi_handle dhandle, rom_handle; -if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected) -return false; - dhandle =DEVICE_ACPI_HANDLE (&pdev->dev);if (!dhandle)return false;
Greg Kroah-Hartman
maintainerPATCH 61/214 Documentation: Update stable address in Chinese and Japanese translations
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 98b0f811aade1b7c6e7806c86aa0befd5919d65f upstream.
The English and Korean translations were updated, the Chinese and Japanese weren't.
--- Documentation/ja_JP/HOWTO | 2 +- Documentation/ja_JP/stable_kernel_rules.txt | 6 +++--- Documentation/zh_CN/HOWTO | 2 +- Documentation/zh_CN/stable_kernel_rules.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
Documentation/ja_JP/HOWTO +1 -1
@@ -315,7 +315,7 @@ Andrew Morton が Linux-kernel メーリ もし、2.6.x.y カーネルが存在しない場合には、番号が一番大きい 2.6.x が 最新の安定版カーネルです。 -2.6.x.y は "stable" チーム <[email protected]> でメンテされており、必 +2.6.x.y は "stable" チーム <[email protected]> でメンテされており、必 要に応じてリリースされます。通常のリリース期間は 2週間毎ですが、差し迫っ た問題がなければもう少し長くなることもあります。セキュリティ関連の問題 の場合はこれに対してだいたいの場合、すぐにリリースがされます。
Documentation/ja_JP/stable_kernel_rules.txt +3 -3
@@ -50,16 +50,16 @@ linux-2.6.29/Documentation/stable_kernel -stable ツリーにパッチを送付する手続き- - - 上記の規則に従っているかを確認した後に、[email protected] にパッチ + - 上記の規則に従っているかを確認した後に、[email protected] にパッチ を送る。 - 送信者はパッチがキューに受け付けられた際には ACK を、却下された場合 には NAK を受け取る。この反応は開発者たちのスケジュールによって、数 日かかる場合がある。 - もし受け取られたら、パッチは他の開発者たちと関連するサブシステムの メンテナーによるレビューのために -stable キューに追加される。 - - パッチに [email protected] のアドレスが付加されているときには、それ + - パッチに [email protected] のアドレスが付加されているときには、それ が Linus のツリーに入る時に自動的に stable チームに email される。 - - セキュリティパッチはこのエイリアス ([email protected]) に送られるべ + - セキュリティパッチはこのエイリアス ([email protected]) に送られるべ きではなく、代わりに [email protected] のアドレスに送られる。 レビューサイクル-
Documentation/zh_CN/HOWTO +1 -1
@@ -237,7 +237,7 @@ kernel.org网站的pub/linux/kernel/v2.6 如果没有2.6.x.y版本内核存在,那么最新的2.6.x版本内核就相当于是当前的稳定 版内核。 -2.6.x.y版本由“稳定版”小组(邮件地址<[email protected]>)维护,一般隔周发 +2.6.x.y版本由“稳定版”小组(邮件地址<[email protected]>)维护,一般隔周发 布新版本。 内核源码中的Documentation/stable_kernel_rules.txt文件具体描述了可被稳定
Documentation/zh_CN/stable_kernel_rules.txt +1 -1
@@ -42,7 +42,7 @@ Documentation/stable_kernel_rules.txt � 向稳定版代码树提交补丁的过程: - - 在确认了补丁符合以上的规则后,将补丁发送到[email protected]。 + - 在确认了补丁符合以上的规则后,将补丁发送到[email protected]。 - 如果补丁被接受到队列里,发送者会收到一个ACK回复,如果没有被接受,收 到的是NAK回复。回复需要几天的时间,这取决于开发者的时间安排。 - 被接受的补丁会被加到稳定版本队列里,等待其他开发者的审查。
Greg Kroah-Hartman
maintainerPATCH 62/214 crypto: crypto_wq - Fix late crypto work queue initialization
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Chen <[email protected]>
commit 130fa5bc81b44b6cc1fbdea3abf6db0da22964e0 upstream.
The crypto algorithm modules utilizing the crypto daemon could be used early when the system start up. Using module_init does not guarantee that the daemon's work queue is initialized when the cypto alorithm depending on crypto_wq starts. It is necessary to initialize the crypto work queue earlier at the subsystem init time to make sure that it is initialized
when used.
--- crypto/crypto_wq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/crypto_wq.c +1 -1
@@ -33,7 +33,7 @@ static void __exit crypto_wq_exit(void)destroy_workqueue (kcrypto_wq); } -module_init (crypto_wq_init); +subsys_initcall (crypto_wq_init);module_exit (crypto_wq_exit);MODULE_LICENSE ("GPL" );
Greg Kroah-Hartman
maintainerPATCH 63/214 media: media-device: fix infoleak in ioctl media_enum_entities()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Salva=20Peir=C3=B3?= <[email protected]>
commit e6a623460e5fc960ac3ee9f946d3106233fd28d8 upstream.
This fixes CVE-2014-1739.
--- drivers/media/media-device.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/media-device.c +1 -0
@@ -90,6 +90,7 @@ static long media_device_enum_entities(sstruct media_entity *ent;struct media_entity_desc u_ent; +memset (&u_ent,0 ,sizeof (u_ent));if (copy_from_user (&u_ent.id, &uent->id,sizeof (u_ent.id)))return -EFAULT ;
Greg Kroah-Hartman
maintainerPATCH 64/214 trace: module: Maintain a valid user count
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Izard <[email protected]>
commit 098507ae3ec2331476fb52e85d4040c1cc6d0ef4 upstream.
The replacement of the 'count' variable by two variables 'incs' and 'decs' to resolve some race conditions during module unloading was done in parallel with some cleanup in the trace subsystem, and was integrated as a merge.
Unfortunately, the formula for this replacement was wrong in the tracing code, and the refcount in the traces was not usable as a result.
Use 'count = incs - decs' to compute the user count.
--- include/trace/events/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/module.h +1 -1
@@ -78,7 +78,7 @@ DECLARE_EVENT_CLASS(module_refcnt,TP_fast_assign ( __entry->ip = ip; - __entry->refcnt =__this_cpu_read (mod->refptr->incs) +__this_cpu_read (mod->refptr->decs); + __entry->refcnt =__this_cpu_read (mod->refptr->incs) -__this_cpu_read (mod->refptr->decs);__assign_str (name, mod->name); ),
Greg Kroah-Hartman
maintainerPATCH 65/214 NFSD: Call ->set_acl with a NULL ACL structure if no entries
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kinglong Mee <[email protected]>
commit aa07c713ecfc0522916f3cd57ac628ea6127c0ec upstream.
After setting ACL for directory, I got two problems that caused by the cached zero-length default posix acl.
This patch make sure nfsd4_set_nfs4_acl calls ->set_acl with a NULL ACL structure if there are no entries.
Thanks for Christoph Hellwig's advice.
First problem:
............ hang ...........
Second problem:
[ 1610.167668] ------------[ cut here ]------------ [ 1610.168320] kernel BUG at /root/nfs/linux/fs/nfsd/nfs4acl.c:239! [ 1610.168320] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC [ 1610.168320] Modules linked in: nfsv4(OE) nfs(OE) nfsd(OE)
rpcsec_gss_krb5 fscache ip6t_rpfilter ip6t_REJECT cfg80211 xt_conntrack rfkill ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw auth_rpcgss nfs_acl snd_intel8x0 ppdev lockd snd_ac97_codec ac97_bus snd_pcm snd_timer e1000 pcspkr parport_pc snd parport serio_raw joydev i2c_piix4 sunrpc(OE) microcode soundcore i2c_core ata_generic pata_acpi [last unloaded: nfsd]
[ 1610.168320] CPU: 0 PID: 27397 Comm: nfsd Tainted: G OE 3.15.0-rc1+ #15 [ 1610.168320] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 1610.168320] task: ffff88005ab653d0 ti: ffff88005a944000 task.ti: ffff88005a944000 [ 1610.168320] RIP: 0010:[<ffffffffa034d5ed>] [<ffffffffa034d5ed>] _posix_to_nfsv4_one+0x3cd/0x3d0 [nfsd] [ 1610.168320] RSP: 0018:ffff88005a945b00 EFLAGS: 00010293 [ 1610.168320] RAX: 0000000000000001 RBX: ffff88006700bac0 RCX: 0000000000000000 [ 1610.168320] RDX: 0000000000000000 RSI: ffff880067c83f00 RDI: ffff880068233300 [ 1610.168320] RBP: ffff88005a945b48 R08: ffffffff81c64830 R09: 0000000000000000 [ 1610.168320] R10: ffff88004ea85be0 R11: 000000000000f475 R12: ffff880068233300 [ 1610.168320] R13: 0000000000000003 R14: 0000000000000002 R15: ffff880068233300 [ 1610.168320] FS: 0000000000000000(0000) GS:ffff880077800000(0000) knlGS:0000000000000000 [ 1610.168320] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 1610.168320] CR2: 00007f5bcbd3b0b9 CR3: 0000000001c0f000 CR4: 00000000000006f0 [ 1610.168320] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1610.168320] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1610.168320] Stack: [ 1610.168320] ffffffff00000000 0000000b67c83500 000000076700bac0 0000000000000000 [ 1610.168320] ffff88006700bac0 ffff880068233300 ffff88005a945c08 0000000000000002 [ 1610.168320] 0000000000000000 ffff88005a945b88 ffffffffa034e2d5 000000065a945b68 [ 1610.168320] Call Trace: [ 1610.168320] [<ffffffffa034e2d5>] nfsd4_get_nfs4_acl+0x95/0x150 [nfsd] [ 1610.168320] [<ffffffffa03400d6>] nfsd4_encode_fattr+0x646/0x1e70 [nfsd] [ 1610.168320] [<ffffffff816a6e6e>] ? kmemleak_alloc+0x4e/0xb0 [ 1610.168320] [<ffffffffa0327962>] ? nfsd_setuser_and_check_port+0x52/0x80 [nfsd] [ 1610.168320] [<ffffffff812cd4bb>] ? selinux_cred_prepare+0x1b/0x30 [ 1610.168320] [<ffffffffa0341caa>] nfsd4_encode_getattr+0x5a/0x60 [nfsd] [ 1610.168320] [<ffffffffa0341e07>] nfsd4_encode_operation+0x67/0x110 [nfsd] [ 1610.168320] [<ffffffffa033844d>] nfsd4_proc_compound+0x21d/0x810 [nfsd] [ 1610.168320] [<ffffffffa0324d9b>] nfsd_dispatch+0xbb/0x200 [nfsd] [ 1610.168320] [<ffffffffa00850cd>] svc_process_common+0x46d/0x6d0 [sunrpc] [ 1610.168320] [<ffffffffa0085433>] svc_process+0x103/0x170 [sunrpc] [ 1610.168320] [<ffffffffa032472f>] nfsd+0xbf/0x130 [nfsd] [ 1610.168320] [<ffffffffa0324670>] ? nfsd_destroy+0x80/0x80 [nfsd] [ 1610.168320] [<ffffffff810a5202>] kthread+0xd2/0xf0 [ 1610.168320] [<ffffffff810a5130>] ? insert_kthread_work+0x40/0x40 [ 1610.168320] [<ffffffff816c1ebc>] ret_from_fork+0x7c/0xb0 [ 1610.168320] [<ffffffff810a5130>] ? insert_kthread_work+0x40/0x40 [ 1610.168320] Code: 78 02 e9 e7 fc ff ff 31 c0 31 d2 31 c9 66 89 45 ce 41 8b 04 24 66 89 55 d0 66 89 4d d2 48 8d 04 80 49 8d 5c 84 04 e9 37 fd ff ff <0f> 0b 90 0f 1f 44 00 00 55 8b 56 08 c7 07 00 00 00 00 8b 46 0c [ 1610.168320] RIP [<ffffffffa034d5ed>] _posix_to_nfsv4_one+0x3cd/0x3d0 [nfsd] [ 1610.168320] RSP <ffff88005a945b00> [ 1610.257313] ---[ end trace 838254e3e352285b ]---
--- fs/nfsd/nfs4acl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
fs/nfsd/nfs4acl.c +9 -8
@@ -373,8 +373,10 @@ sort_pacl(struct posix_acl *pacl)* by uid/gid. */ int i, j; -if (pacl->a_count <=4 ) -return ;/* no users or groups */ +/* no users or groups */ +if (!pacl || pacl->a_count <=4 ) +return ; + i =1 ;while (pacl->a_entries[i].e_tag ==ACL_USER ) i++;
@@ -498,13 +500,12 @@ posix_state_to_acl(struct posix_acl_stat/* * ACLs with no ACEs are treated differently in the inheritable -* and effective cases: when there are no inheritable ACEs, we -* set a zero-length default posix acl: +* and effective cases: when there are no inheritable ACEs, +* calls ->set_acl with a NULL ACL structure. */ -if (state->empty && (flags &NFS4_ACL_TYPE_DEFAULT )) { - pacl =posix_acl_alloc (0 ,GFP_KERNEL ); -return pacl ? pacl :ERR_PTR (-ENOMEM ); - } +if (state->empty && (flags &NFS4_ACL_TYPE_DEFAULT )) +return NULL ; +/* * When there are no effective ACEs, the following will end * up setting a 3-element effective posix ACL with all
Greg Kroah-Hartman
maintainerPATCH 66/214 nfsd4: warn on finding lockowner without stateids
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 27b11428b7de097c42f205beabb1764f4365443b upstream.
The current code assumes a one-to-one lockowner<->lock stateid correspondance.
--- fs/nfsd/nfs4state.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/nfsd/nfs4state.c +4 -0
@@ -3918,6 +3918,10 @@ static bool same_lockowner_ino(struct nfif (!same_owner_str (&lo->lo_owner, owner, clid))return false; +if (list_empty (&lo->lo_owner.so_stateids)) { +WARN_ON_ONCE (1 ); +return false; + } lst =list_first_entry (&lo->lo_owner.so_stateids, struct nfs4_ol_stateid, st_perstateowner);return lst->st_file->fi_inode == inode;
Greg Kroah-Hartman
maintainerPATCH 67/214 nfsd4: remove lockowner when removing lock stateid
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit a1b8ff4c97b4375d21b6d6c45d75877303f61b3b upstream.
The nfsv4 state code has always assumed a one-to-one correspondance between lock stateid's and lockowners even if it appears not to in some places.
We may actually change that, but for now when FREE_STATEID releases a lock stateid it also needs to release the parent lockowner.
Symptoms were a subsequent LOCK crashing in find_lockowner_str when it calls same_lockowner_ino on a lockowner that unexpectedly has an empty so_stateids list.
--- fs/nfsd/nfs4state.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +9 -2
@@ -3476,9 +3476,16 @@ out:static __be32 nfsd4_free_lock_stateid (struct nfs4_ol_stateid *stp) { -if (check_for_locks (stp->st_file,lockowner (stp->st_stateowner))) +struct nfs4_lockowner *lo =lockowner (stp->st_stateowner); + +if (check_for_locks (stp->st_file, lo))return nfserr_locks_held; -release_lock_stateid (stp); +/* +* Currently there's a 1-1 lock stateid<->lockowner +* correspondance, and we have to delete the lockowner when we +* delete the lock stateid: +*/ +unhash_lockowner (lo);return nfs_ok; }
Greg Kroah-Hartman
maintainerPATCH 68/214 percpu: make pcpu_alloc_chunk() use pcpu_mem_free() instead of kfree()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jianyu Zhan <[email protected]>
commit 5a838c3b60e3a36ade764cf7751b8f17d7c9c2da upstream.
pcpu_chunk_struct_size = sizeof(struct pcpu_chunk) +
BITS_TO_LONGS(pcpu_unit_pages) * sizeof(unsigned long)
It hardly could be ever bigger than PAGE_SIZE even for large-scale machine, but for consistency with its couterpart pcpu_mem_zalloc(),
use pcpu_mem_free() instead.
Commit b4916cb17c26 ("percpu: make pcpu_free_chunk() use pcpu_mem_free() instead of kfree()") addressed this problem, but missed this one.
tj: commit message updated
--- mm/percpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/percpu.c +1 -1
@@ -612,7 +612,7 @@ static struct pcpu_chunk *pcpu_alloc_chu chunk->map =pcpu_mem_zalloc (PCPU_DFL_MAP_ALLOC *sizeof (chunk->map[0 ]));if (!chunk->map) { -kfree (chunk); +pcpu_mem_free (chunk, pcpu_chunk_struct_size);return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 69/214 ASoC: wm8962: Update register CLASS_D_CONTROL_1 to be non-volatile
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit 44330ab516c15dda8a1e660eeaf0003f84e43e3f upstream.
The register CLASS_D_CONTROL_1 is marked as volatile because it contains a bit, DAC_MUTE, which is also mirrored in the ADC_DAC_CONTROL_1 register. This causes problems for the "Speaker Switch" control, which will report an error if the CODEC is suspended because it relies on a volatile register.
To resolve this issue mark CLASS_D_CONTROL_1 as non-volatile and manually keep the register cache in sync by updating both bits when changing the mute status.
--- sound/soc/codecs/wm8962.c | 15 ++++++++++++--- sound/soc/codecs/wm8962.h | 4 ++++ 2 files changed, 16 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8962.c +12 -3
@@ -153,6 +153,7 @@ static struct reg_default wm8962_reg[] = { 40, 0x0000 }, /* R40 - SPKOUTL volume */ { 41, 0x0000 }, /* R41 - SPKOUTR volume */ + { 49, 0x0010 }, /* R49 - Class D Control 1 */ { 51, 0x0003 }, /* R51 - Class D Control 2 */ { 56, 0x0506 }, /* R56 - Clocking 4 */
@@ -794,7 +795,6 @@ static bool wm8962_volatile_register(strcase WM8962_ALC2 :case WM8962_THERMAL_SHUTDOWN_STATUS :case WM8962_ADDITIONAL_CONTROL_4 : -case WM8962_CLASS_D_CONTROL_1 :case WM8962_DC_SERVO_6 :case WM8962_INTERRUPT_STATUS_1 :case WM8962_INTERRUPT_STATUS_2 :
@@ -2888,13 +2888,22 @@ static int wm8962_set_fll(struct snd_socstatic int wm8962_mute (struct snd_soc_dai *dai,int mute) {struct snd_soc_codec *codec = dai->codec; -int val; +int val, ret;if (mute) - val =WM8962_DAC_MUTE ; + val =WM8962_DAC_MUTE |WM8962_DAC_MUTE_ALT ;else val =0 ; +/** +* The DAC mute bit is mirrored in two registers, update both to keep +* the register cache consistent. +*/ + ret =snd_soc_update_bits (codec,WM8962_CLASS_D_CONTROL_1 , +WM8962_DAC_MUTE_ALT , val); +if (ret <0 ) +return ret; +return snd_soc_update_bits (codec,WM8962_ADC_DAC_CONTROL_1 ,WM8962_DAC_MUTE , val); }
sound/soc/codecs/wm8962.h +4 -0
@@ -1954,6 +1954,10 @@#define WM8962_SPKOUTL_ENA_MASK 0x0040/* SPKOUTL_ENA */ #define WM8962_SPKOUTL_ENA_SHIFT 6/* SPKOUTL_ENA */ #define WM8962_SPKOUTL_ENA_WIDTH 1/* SPKOUTL_ENA */ +#define WM8962_DAC_MUTE_ALT 0x0010/* DAC_MUTE */ +#define WM8962_DAC_MUTE_ALT_MASK 0x0010/* DAC_MUTE */ +#define WM8962_DAC_MUTE_ALT_SHIFT 4/* DAC_MUTE */ +#define WM8962_DAC_MUTE_ALT_WIDTH 1/* DAC_MUTE */ #define WM8962_SPKOUTL_PGA_MUTE 0x0002/* SPKOUTL_PGA_MUTE */ #define WM8962_SPKOUTL_PGA_MUTE_MASK 0x0002/* SPKOUTL_PGA_MUTE */ #define WM8962_SPKOUTL_PGA_MUTE_SHIFT 1/* SPKOUTL_PGA_MUTE */
Greg Kroah-Hartman
maintainerPATCH 70/214 x86-64, modify_ldt: Make support for 16-bit segments a runtime option
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit fa81511bb0bbb2b1aace3695ce869da9762624ff upstream.
Checkin:
b3b42ac2cbae x86-64, modify_ldt: Ban 16-bit segments on 64-bit kernels
disabled 16-bit segments on 64-bit kernels due to an information leak. However, it does seem that people are genuinely using Wine to run old 16-bit Windows programs on Linux.
A proper fix for this ("espfix64") is coming in the upcoming merge window, but as a temporary fix, create a sysctl to allow the administrator to re-enable support for 16-bit segments.
It adds a "/proc/sys/abi/ldt16" sysctl that defaults to zero (off). If you hit this issue and care about your old Windows program more than you care about a kernel stack address information leak, you can do
echo 1 > /proc/sys/abi/ldt16
as root (add it to your startup scripts), and you should be ok.
The sysctl table is only added if you have COMPAT support enabled on x86-64, but I assume anybody who runs old windows binaries very much does that ;)
--- arch/x86/kernel/ldt.c | 4 +++- arch/x86/vdso/vdso32-setup.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/kernel/ldt.c +3 -1
@@ -20,6 +20,8 @@#include <asm/mmu_context.h> #include <asm/syscalls.h> +int sysctl_ldt16 =0 ; +#ifdef CONFIG_SMP static void flush_ldt (void *current_mm) {
@@ -234,7 +236,7 @@ static int write_ldt(void __user *ptr, u* IRET leaking the high bits of the kernel stack address. */ #ifdef CONFIG_X86_64 -if (!ldt_info.seg_32bit) { +if (!ldt_info.seg_32bit && !sysctl_ldt16) { error = -EINVAL ; goto out_unlock; }
arch/x86/vdso/vdso32-setup.c +8 -0
@@ -41,6 +41,7 @@ enum {#ifdef CONFIG_X86_64 #define vdso_enabled sysctl_vsyscall32#define arch_setup_additional_pages syscall32_setup_pages +extern int sysctl_ldt16;#endif /*
@@ -379,6 +380,13 @@ static ctl_table abi_table2[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec + }, + { + .procname = "ldt16", + .data = &sysctl_ldt16, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec }, {} };
Greg Kroah-Hartman
maintainerPATCH 71/214 PCI: shpchp: Check bridges secondary (not primary) bus speed
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Apfelbaum <[email protected]>
commit 93fa9d32670f5592c8e56abc9928fc194e1e72fc upstream.
When a new device is added below a hotplug bridge, the bridge's secondary bus speed and the device's bus speed must match. The shpchp driver previously checked the bridge's *primary* bus speed, not the secondary bus speed.
This caused hot-add errors like:
shpchp 0000:00:03.0: Speed of bus ff and adapter 0 mismatch
Check the secondary bus speed instead.
--- drivers/pci/hotplug/shpchp_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/hotplug/shpchp_ctrl.c +2 -2
@@ -285,8 +285,8 @@ static int board_added(struct slot *p_slreturn WRONG_BUS_FREQUENCY ; } - bsp = ctrl->pci_dev->bus->cur_bus_speed; - msp = ctrl->pci_dev->bus->max_bus_speed; + bsp = ctrl->pci_dev->subordinate->cur_bus_speed; + msp = ctrl->pci_dev->subordinate->max_bus_speed;/* Check if there are other slots or devices on the same bus */ if (!list_empty (&ctrl->pci_dev->subordinate->devices))
Greg Kroah-Hartman
maintainerPATCH 72/214 ACPI / blacklist: Add dmi_enable_osi_linux quirk for Asus EEE PC 1015PX
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit f6e6e1b9fee88c90586787b71dc49bb3ce62bb89 upstream.
Without this this EEE PC exports a non working WMI interface, with this it exports a working "good old" eeepc_laptop interface, fixing brightness control not working as well as rfkill being stuck in a permanent wireless blocked state.
This is not an ideal way to fix this, but various attempts to fix this otherwise have failed, see:
References: https://bugzilla.redhat.com/show_bug.cgi?id=1067181
--- drivers/acpi/blacklist.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/acpi/blacklist.c +13 -0
@@ -327,6 +327,19 @@ static struct dmi_system_id acpi_osi_dmi DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T500"), }, }, +/* +* Without this this EEEpc exports a non working WMI interface, with +* this it exports a working "good old" eeepc_laptop interface, fixing +* both brightness control, and rfkill not working. +*/ + { + .callback = dmi_enable_osi_linux, + .ident = "Asus EEE PC 1015PX", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "1015PX"), + }, + }, {} };
Greg Kroah-Hartman
maintainerPATCH 73/214 i2c: designware: Mask all interrupts during i2c controller enable
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Du, Wenkai" <[email protected]>
commit 47bb27e78867997040a228328f2a631c3c7f2c82 upstream.
There have been "i2c_designware 80860F41:00: controller timed out" errors on a number of Baytrail platforms. The issue is caused by incorrect value in Interrupt Mask Register (DW_IC_INTR_MASK) when i2c core is being enabled. This causes call to __i2c_dw_enable() to immediately start the transfer which leads to timeout. There are 3 failure modes observed:
1. Failure in S0 to S3 resume path
The default value after reset for DW_IC_INTR_MASK is 0x8ff. When we start the first transaction after resuming from system sleep, TX_EMPTY interrupt is already unmasked because of the hardware default.
2. Failure in normal operational path
This failure happens rarely and is hard to reproduce. Debug trace showed that DW_IC_INTR_MASK had value of 0x254 when failure occurred, which meant TX_EMPTY was unmasked.
3. Failure in S3 to S0 suspend path
This failure also happens rarely and is hard to reproduce. Adding debug trace that read DW_IC_INTR_MASK made this failure not reproducible. But from ISR call trace we could conclude TX_EMPTY was unmasked when problem occurred.
The patch masks all interrupts before the controller is enabled to resolve the faulty DW_IC_INTR_MASK conditions.
--- drivers/i2c/busses/i2c-designware-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/i2c/busses/i2c-designware-core.c +3 -0
@@ -346,6 +346,9 @@ static void i2c_dw_xfer_init(struct dw_i ic_con &= ~DW_IC_CON_10BITADDR_MASTER ;dw_writel (dev, ic_con,DW_IC_CON ); +/* enforce disabled interrupts (due to HW issues) */ +i2c_dw_disable_int (dev); +/* Enable the adapter */ dw_writel (dev,1 ,DW_IC_ENABLE );
Greg Kroah-Hartman
maintainerPATCH 74/214 crypto: caam - add allocation failure handling in SPRINTFCAT macro
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horia Geanta <[email protected]>
commit 27c5fb7a84242b66bf1e0b2fe6bf40d19bcc5c04 upstream.
GFP_ATOMIC memory allocation could fail.
In this case, avoid NULL pointer dereference and notify user.
--- drivers/crypto/caam/error.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/crypto/caam/error.c +7 -3
@@ -16,9 +16,13 @@char *tmp; \ \ tmp =kmalloc (sizeof (format) + max_alloc,GFP_ATOMIC ); \ -sprintf (tmp, format, param); \ -strcat (str, tmp); \ -kfree (tmp); \ +if (likely (tmp)) { \ +sprintf (tmp, format, param); \ +strcat (str, tmp); \ +kfree (tmp); \ + }else { \ +strcat (str,"kmalloc failure in SPRINTFCAT" ); \ + } \ }static void report_jump_idx (u32 status,char *outstr)
Greg Kroah-Hartman
maintainerPATCH 75/214 setfacl removes part of ACL when setting POSIX ACLs to Samba
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit b1d93356427be6f050dc55c86eb019d173700af6 upstream.
setfacl over cifs mounts can remove the default ACL when setting the (non-default part of) the ACL and vice versa (we were leaving at 0 rather than setting to -1 the count field for the unaffected half of the ACL. For example notice the setfacl removed the default ACL in this sequence:
steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir ; setfacl -m default:user:test:rwx,user:test:rwx /mnt/test-dir getfacl: Removing leading '/' from absolute path names user::rwx group::r-x other::r-x default:user::rwx default:user:test:rwx default:group::r-x default:mask::rwx default:other::r-x
steven@steven-GA-970A-DS3:~/cifs-2.6$ getfacl /mnt/test-dir getfacl: Removing leading '/' from absolute path names user::rwx user:test:rwx group::r-x mask::rwx other::r-x
--- fs/cifs/cifssmb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/cifs/cifssmb.c +5 -3
@@ -3454,11 +3454,13 @@ static __u16 ACL_to_cifs_posix(char *parreturn 0 ; } cifs_acl->version =cpu_to_le16 (1 ); -if (acl_type ==ACL_TYPE_ACCESS ) +if (acl_type ==ACL_TYPE_ACCESS ) { cifs_acl->access_entry_count =cpu_to_le16 (count); -else if (acl_type ==ACL_TYPE_DEFAULT ) + cifs_acl->default_entry_count =__constant_cpu_to_le16 (0xFFFF ); + }else if (acl_type ==ACL_TYPE_DEFAULT ) { cifs_acl->default_entry_count =cpu_to_le16 (count); -else { + cifs_acl->access_entry_count =__constant_cpu_to_le16 (0xFFFF ); + }else {cFYI (1 ,"unknown ACL type %d" , acl_type);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 76/214 CIFS: Fix error handling in cifs_push_mandatory_locks
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit e2f2886a824ff0a56da1eaa13019fde86aa89fa6 upstream.
--- fs/cifs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/file.c +1 -1
@@ -882,7 +882,7 @@ cifs_push_mandatory_locks(struct cifsFilif (!buf) {mutex_unlock (&cinode->lock_mutex);FreeXid (xid); -return rc; +return -ENOMEM ; }for (i =0 ; i <2 ; i++) {
Greg Kroah-Hartman
maintainerPATCH 77/214 ecryptfs: Fix memory leakage in keystore.c
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Geyslan G. Bem" <[email protected]>
commit 3edc8376c06133e3386265a824869cad03a4efd4 upstream.
In 'decrypt_pki_encrypted_session_key' function:
Initializes 'payload' pointer and releases it on exit.
--- fs/ecryptfs/keystore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ecryptfs/keystore.c +2 -1
@@ -1149,7 +1149,7 @@ decrypt_pki_encrypted_session_key(structstruct ecryptfs_msg_ctx *msg_ctx;struct ecryptfs_message *msg =NULL ;char *auth_tok_sig; -char *payload; +char *payload =NULL ;size_t payload_len;int rc;
@@ -1204,6 +1204,7 @@ decrypt_pki_encrypted_session_key(struct out:if (msg)kfree (msg); +kfree (payload);return rc; }
Greg Kroah-Hartman
maintainerPATCH 78/214 fs: cachefiles: add support for large files in filesystem caching
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Lecher <[email protected]>
commit 98c350cda2c14a343d34ea01a3d9c24fea5ec66d upstream.
Support the caching of large files.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=31182
[bwh: Backported to 3.2:
- Adjust context
- dentry_open() takes dentry and vfsmount pointers, not a path pointer]
--- fs/cachefiles/rdwr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cachefiles/rdwr.c +1 -1
@@ -918,7 +918,7 @@ int cachefiles_write_page(struct fscache* own time */ dget (object->backer);mntget (cache->mnt); - file =dentry_open (object->backer, cache->mnt,O_RDWR , + file =dentry_open (object->backer, cache->mnt,O_RDWR |O_LARGEFILE , cache->cache_cred);if (IS_ERR (file)) { ret =PTR_ERR (file);
Greg Kroah-Hartman
maintainerPATCH 79/214 perf: Fix perf ring buffer memory ordering
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit bf378d341e4873ed928dc3c636252e6895a21f50 upstream.
The PPC64 people noticed a missing memory barrier and crufty old comments in the perf ring buffer code. So update all the comments and add the missing barrier.
When the architecture implements local_t using atomic_long_t there will be double barriers issued; but short of introducing more conditional barrier primitives this is the best we can do.
--- include/linux/perf_event.h | 12 +++++++----- kernel/events/ring_buffer.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-)
include/linux/perf_event.h +7 -5
@@ -391,13 +391,15 @@ struct perf_event_mmap_page {/* * Control data for the mmap() data buffer. * -* User-space reading the @data_head value should issue an rmb(), on -* SMP capable platforms, after reading this value -- see -* perf_event_wakeup(). +* User-space reading the @data_head value should issue an smp_rmb(), +* after reading this value. * * When the mapping is PROT_WRITE the @data_tail value should be -* written by userspace to reflect the last read data. In this case -* the kernel will not over-write unread data. +* written by userspace to reflect the last read data, after issueing +* an smp_mb() to separate the data read from the ->data_tail store. +* In this case the kernel will not over-write unread data. +* +* See perf_output_put_handle() for the data ordering. */ __u64 data_head;/* head in the data section */ __u64 data_tail;/* user-space written tail */
kernel/events/ring_buffer.c +27 -4
@@ -75,10 +75,31 @@ again: goto out;/* -* Publish the known good head. Rely on the full barrier implied -* by atomic_dec_and_test() order the rb->head read and this -* write. +* Since the mmap() consumer (userspace) can run on a different CPU: +* +* kernel user +* +* READ ->data_tail READ ->data_head +* smp_mb() (A) smp_rmb() (C) +* WRITE $data READ $data +* smp_wmb() (B) smp_mb() (D) +* STORE ->data_head WRITE ->data_tail +* +* Where A pairs with D, and B pairs with C. +* +* I don't think A needs to be a full barrier because we won't in fact +* write data until we see the store from userspace. So we simply don't +* issue the data WRITE until we observe it. Be conservative for now. +* +* OTOH, D needs to be a full barrier since it separates the data READ +* from the tail WRITE. +* +* For B a WMB is sufficient since it separates two WRITEs, and for C +* an RMB is sufficient since it separates two READs. +* +* See perf_output_begin(). */ +smp_wmb (); rb->user_page->data_head = head;/*
@@ -142,9 +163,11 @@ int perf_output_begin(struct perf_output* Userspace could choose to issue a mb() before updating the * tail pointer. So that all reads will be completed before the * write is issued. +* +* See perf_output_put_handle(). */ tail =ACCESS_ONCE (rb->user_page->data_tail); -smp_rmb (); +smp_mb (); offset = head =local_read (&rb->head); head += size;if (unlikely (!perf_output_space (rb, tail, offset, head)))
Greg Kroah-Hartman
maintainerPATCH 80/214 ftrace: Check module functions being traced on reload
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 8c4f3c3fa9681dc549cd35419b259496082fef8b upstream.
There's been a nasty bug that would show up and not give much info. The bug displayed the following warning:
WARNING: at kernel/trace/ftrace.c:1529 __ftrace_hash_rec_update+0x1e3/0x230() Pid: 20903, comm: bash Tainted: G O 3.6.11+ #38405.trunk Call Trace: [<ffffffff8103e5ff>] warn_slowpath_common+0x7f/0xc0 [<ffffffff8103e65a>] warn_slowpath_null+0x1a/0x20 [<ffffffff810c2ee3>] __ftrace_hash_rec_update+0x1e3/0x230 [<ffffffff810c4f28>] ftrace_hash_move+0x28/0x1d0 [<ffffffff811401cc>] ? kfree+0x2c/0x110 [<ffffffff810c68ee>] ftrace_regex_release+0x8e/0x150 [<ffffffff81149f1e>] __fput+0xae/0x220 [<ffffffff8114a09e>] ____fput+0xe/0x10 [<ffffffff8105fa22>] task_work_run+0x72/0x90 [<ffffffff810028ec>] do_notify_resume+0x6c/0xc0 [<ffffffff8126596e>] ? trace_hardirqs_on_thunk+0x3a/0x3c [<ffffffff815c0f88>] int_signal+0x12/0x17 ---[ end trace 793179526ee09b2c ]---
It was finally narrowed down to unloading a module that was being traced.
It was actually more than that. When functions are being traced, there's a table of all functions that have a ref count of the number of active tracers attached to that function. When a function trace callback is registered to a function, the function's record ref count is incremented. When it is unregistered, the function's record ref count is decremented. If an inconsistency is detected (ref count goes below zero) the above warning is shown and the function tracing is permanently disabled until reboot.
The ftrace callback ops holds a hash of functions that it filters on (and/or filters off). If the hash is empty, the default means to filter all functions (for the filter_hash) or to disable no functions (for the notrace_hash).
When a module is unloaded, it frees the function records that represent the module functions. These records exist on their own pages, that is function records for one module will not exist on the same page as function records for other modules or even the core kernel.
Now when a module unloads, the records that represents its functions are freed. When the module is loaded again, the records are recreated with a default ref count of zero (unless there's a callback that traces all functions, then they will also be traced, and the ref count will be incremented).
The problem is that if an ftrace callback hash includes functions of the module being unloaded, those hash entries will not be removed. If the module is reloaded in the same location, the hash entries still point to the functions of the module but the module's ref counts do not reflect that.
With the help of Steve and Joern, we found a reproducer:
Using uinput module and uinput_release function.
cd /sys/kernel/debug/tracing
modprobe uinput
echo uinput_release > set_ftrace_filter
echo function > current_tracer
rmmod uinput
modprobe uinput
# check /proc/modules to see if loaded in same addr, otherwise try again echo nop > current_tracer
[BOOM]
The above loads the uinput module, which creates a table of functions that can be traced within the module.
We add uinput_release to the filter_hash to trace just that function.
Enable function tracincg, which increments the ref count of the record associated to uinput_release.
Remove uinput, which frees the records including the one that represents uinput_release.
Load the uinput module again (and make sure it's at the same address). This recreates the function records all with a ref count of zero, including uinput_release.
Disable function tracing, which will decrement the ref count for uinput_release which is now zero because of the module removal and reload, and we have a mismatch (below zero ref count).
The solution is to check all currently tracing ftrace callbacks to see if any are tracing any of the module's functions when a module is loaded (it already does that with callbacks that trace all functions). If a callback happens to have a module function being traced, it increments that records ref count and starts tracing that function.
There may be a strange side effect with this, where tracing module functions on unload and then reloading a new module may have that new module's functions being traced. This may be something that confuses the user, but it's not a big deal. Another approach is to disable all callback hashes on module unload, but this leaves some ftrace callbacks that may not be registered, but can still have hashes tracing the module's function where ftrace doesn't know about it. That situation can cause the same bug. This solution solves that case too. Another benefit of this solution, is it is possible to trace a module's function on unload and load.
--- kernel/trace/ftrace.c | 71 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 9 deletions(-)
kernel/trace/ftrace.c +62 -9
@@ -2080,12 +2080,57 @@ static cycle_t ftrace_update_time;static unsigned long ftrace_update_cnt;unsigned long ftrace_update_tot_cnt; -static int ops_traces_mod (struct ftrace_ops *ops) +static inline int ops_traces_mod (struct ftrace_ops *ops) { -struct ftrace_hash *hash; +/* +* Filter_hash being empty will default to trace module. +* But notrace hash requires a test of individual module functions. +*/ +return ftrace_hash_empty (ops->filter_hash) && +ftrace_hash_empty (ops->notrace_hash); +} + +/* +* Check if the current ops references the record. +* +* If the ops traces all functions, then it was already accounted for. +* If the ops does not trace the current record function, skip it. +* If the ops ignores the function via notrace filter, skip it. +*/ +static inline bool +ops_references_rec (struct ftrace_ops *ops,struct dyn_ftrace *rec) +{ +/* If ops isn't enabled, ignore it */ +if (!(ops->flags &FTRACE_OPS_FL_ENABLED )) +return 0 ; + +/* If ops traces all mods, we already accounted for it */ +if (ops_traces_mod (ops)) +return 0 ; + +/* The function must be in the filter */ +if (!ftrace_hash_empty (ops->filter_hash) && + !ftrace_lookup_ip (ops->filter_hash, rec->ip)) +return 0 ; + +/* If in notrace hash, we ignore it too */ +if (ftrace_lookup_ip (ops->notrace_hash, rec->ip)) +return 0 ; + +return 1 ; +} + +static int referenced_filters (struct dyn_ftrace *rec) +{ +struct ftrace_ops *ops; +int cnt =0 ; - hash = ops->filter_hash; -return ftrace_hash_empty (hash); +for (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { +if (ops_references_rec (ops, rec)) + cnt++; + } + +return cnt; }static int ftrace_update_code (struct module *mod)
@@ -2094,6 +2139,7 @@ static int ftrace_update_code(struct modstruct dyn_ftrace *p;cycle_t start, stop;unsigned long ref =0 ; +bool test = false;int i;/*
@@ -2107,9 +2153,12 @@ static int ftrace_update_code(struct modfor (ops = ftrace_ops_list; ops != &ftrace_list_end; ops = ops->next) { -if (ops->flags &FTRACE_OPS_FL_ENABLED && -ops_traces_mod (ops)) - ref++; +if (ops->flags &FTRACE_OPS_FL_ENABLED ) { +if (ops_traces_mod (ops)) + ref++; +else + test = true; + } } }
@@ -2119,12 +2168,16 @@ static int ftrace_update_code(struct modfor (pg = ftrace_new_pgs; pg; pg = pg->next) {for (i =0 ; i < pg->index; i++) { +int cnt = ref; +/* If something went wrong, bail without enabling anything */ if (unlikely (ftrace_disabled))return -1 ; p = &pg->records[i]; - p->flags = ref; +if (test) + cnt +=referenced_filters (p); + p->flags = cnt;/* * Do the initial record conversion from mcount jump
@@ -2144,7 +2197,7 @@ static int ftrace_update_code(struct mod* conversion puts the module to the correct state, thus * passing the ftrace_make_call check. */ -if (ftrace_start_up && ref) { +if (ftrace_start_up && cnt) {int failed =__ftrace_replace_code (p,1 );if (failed)ftrace_bug (failed, p->ip);
Greg Kroah-Hartman
maintainerPATCH 81/214 sched/debug: Limit sd->*_idx range on sysctl
In reply to Greg Kroah-Hartman3.4-stable 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.
--- kernel/sched/core.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-)
kernel/sched/core.c +22 -13
@@ -5433,16 +5433,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, -umode_t mode,proc_handler *proc_handler) +umode_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 *
@@ -5454,30 +5463,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;
Greg Kroah-Hartman
maintainerPATCH 82/214 sched/debug: Fix sd->*_idx limit range avoiding overflow
In reply to Greg Kroah-Hartman3.4-stable 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/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -5434,7 +5434,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,
Greg Kroah-Hartman
maintainerPATCH 83/214 perf: Fix error return code
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit c481420248c6730246d2a1b1773d5d7007ae0835 upstream.
Fix to return -ENOMEM in the allocation error case instead of 0 (if pmu_bus_running == 1), as done elsewhere in this function.
--- kernel/events/core.c | 1 + 1 file changed, 1 insertion(+)
kernel/events/core.c +1 -0
@@ -5871,6 +5871,7 @@ skip_type:if (pmu->pmu_cpu_context) goto got_cpu_context; + ret = -ENOMEM ; pmu->pmu_cpu_context = alloc_percpu(struct perf_cpu_context);if (!pmu->pmu_cpu_context) goto free_dev;
Greg Kroah-Hartman
maintainerPATCH 84/214 tracing: Keep overwrite in sync between regular and snapshot buffers
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 80902822658aab18330569587cdb69ac1dfdcea8 upstream.
Changing the overwrite mode for the ring buffer via the trace option only sets the normal buffer. But the snapshot buffer could swap with it, and then the snapshot would be in non overwrite mode and the normal buffer would be in overwrite mode, even though the option flag states otherwise.
Keep the two buffers overwrite modes in sync.
--- kernel/trace/trace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/trace/trace.c +5 -1
@@ -2782,8 +2782,12 @@ int set_tracer_flag(unsigned int mask, iif (mask ==TRACE_ITER_RECORD_CMD )trace_event_enable_cmd_record (enabled); -if (mask ==TRACE_ITER_OVERWRITE ) +if (mask ==TRACE_ITER_OVERWRITE ) {ring_buffer_change_overwrite (global_trace.buffer, enabled); +#ifdef CONFIG_TRACER_MAX_TRACE +ring_buffer_change_overwrite (max_tr.buffer, enabled); +#endif + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 85/214 VFS: make vfs_fstat() use f[get|put]_light()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit e994defb7b6813ba6fa7a2a36e86d2455ad1dc35 upstream.
Use the *_light() versions that properly avoid doing the file user count updates when they are unnecessary.
--- fs/stat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/stat.c +3 -2
@@ -57,12 +57,13 @@ EXPORT_SYMBOL(vfs_getattr);int vfs_fstat (unsigned int fd,struct kstat *stat) { -struct file *f =fget_raw (fd); +int fput_needed; +struct file *f =fget_light (fd, &fput_needed);int error = -EBADF ;if (f) { error =vfs_getattr (f->f_path.mnt, f->f_path.dentry, stat); -fput (f); +fput_light (f, fput_needed); }return error; }
Greg Kroah-Hartman
maintainerPATCH 86/214 cifs: delay super block destruction until all cifsFileInfo objects are gone
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Guzik <[email protected]>
commit 24261fc23db950951760d00c188ba63cc756b932 upstream.
cifsFileInfo objects hold references to dentries and it is possible that these will still be around in workqueues when VFS decides to kill super block during unmount.
This results in panics like this one:
BUG: Dentry ffff88001f5e76c0{i=66b4a,n=1M-2} still in use (1) [unmount of cifs cifs]
------------[ cut here ]------------
kernel BUG at fs/dcache.c:943!
[..]
Process umount (pid: 1781, threadinfo ffff88003d6e8000, task ffff880035eeaec0)
[..]
Call Trace:
[<ffffffff811b44f3>] shrink_dcache_for_umount+0x33/0x60
[<ffffffff8119f7fc>] generic_shutdown_super+0x2c/0xe0
[<ffffffff8119f946>] kill_anon_super+0x16/0x30
[<ffffffffa036623a>] cifs_kill_sb+0x1a/0x30 [cifs]
[<ffffffff8119fcc7>] deactivate_locked_super+0x57/0x80
[<ffffffff811a085e>] deactivate_super+0x4e/0x70
[<ffffffff811bb417>] mntput_no_expire+0xd7/0x130
[<ffffffff811bc30c>] sys_umount+0x9c/0x3c0
[<ffffffff81657c19>] system_call_fastpath+0x16/0x1bFix this by making each cifsFileInfo object hold a reference to cifs super block, which implicitly keeps VFS super block around as well.
--- fs/cifs/cifsfs.c | 24 ++++++++++++++++++++++++ fs/cifs/cifsfs.h | 4 ++++ fs/cifs/file.c | 6 +++++- 3 files changed, 33 insertions(+), 1 deletion(-)
fs/cifs/cifsfs.c +24 -0
@@ -87,6 +87,30 @@ extern mempool_t *cifs_mid_poolp;struct workqueue_struct *cifsiod_wq; +/* +* Bumps refcount for cifs super block. +* Note that it should be only called if a referece to VFS super block is +* already held, e.g. in open-type syscalls context. Otherwise it can race with +* atomic_dec_and_test in deactivate_locked_super. +*/ +void +cifs_sb_active (struct super_block *sb) +{ +struct cifs_sb_info *server =CIFS_SB (sb); + +if (atomic_inc_return (&server->active) ==1 ) +atomic_inc (&sb->s_active); +} + +void +cifs_sb_deactive (struct super_block *sb) +{ +struct cifs_sb_info *server =CIFS_SB (sb); + +if (atomic_dec_and_test (&server->active)) +deactivate_super (sb); +} +static int cifs_read_super (struct super_block *sb) {
fs/cifs/cifsfs.h +4 -0
@@ -41,6 +41,10 @@ extern struct file_system_type cifs_fs_textern const struct address_space_operations cifs_addr_ops;extern const struct address_space_operations cifs_addr_ops_smallbuf; +/* Functions related to super block operations */ +extern void cifs_sb_active (struct super_block *sb); +extern void cifs_sb_deactive (struct super_block *sb); +/* Functions related to inodes */ extern const struct inode_operations cifs_dir_inode_ops;extern struct inode *cifs_root_iget (struct super_block *);
fs/cifs/file.c +5 -1
@@ -265,6 +265,8 @@ cifs_new_fileinfo(__u16 fileHandle, strumutex_init (&pCifsFile->fh_mutex);INIT_WORK (&pCifsFile->oplock_break, cifs_oplock_break); +cifs_sb_active (inode->i_sb); +spin_lock (&cifs_file_list_lock);list_add (&pCifsFile->tlist, &(tlink_tcon (tlink)->openFileList));/* if readable file instance put first in list*/
@@ -293,7 +295,8 @@ void cifsFileInfo_put(struct cifsFileInfstruct inode *inode = cifs_file->dentry->d_inode;struct cifs_tcon *tcon =tlink_tcon (cifs_file->tlink);struct cifsInodeInfo *cifsi =CIFS_I (inode); -struct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb); +struct super_block *sb = inode->i_sb; +struct cifs_sb_info *cifs_sb =CIFS_SB (sb);struct cifsLockInfo *li, *tmp;spin_lock (&cifs_file_list_lock);
@@ -345,6 +348,7 @@ void cifsFileInfo_put(struct cifsFileInfcifs_put_tlink (cifs_file->tlink);dput (cifs_file->dentry); +cifs_sb_deactive (sb);kfree (cifs_file); }
Greg Kroah-Hartman
maintainerPATCH 87/214 NFSv4 wait on recovery for async session errors
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Adamson <[email protected]>
commit 4a82fd7c4e78a1b7a224f9ae8bb7e1fd95f670e0 upstream.
When the state manager is processing the NFS4CLNT_DELEGRETURN flag, session draining is off, but DELEGRETURN can still get a session error. The async handler calls nfs4_schedule_session_recovery returns -EAGAIN, and the DELEGRETURN done then restarts the RPC task in the prepare state. With the state manager still processing the NFS4CLNT_DELEGRETURN flag with session draining off, these DELEGRETURNs will cycle with errors filling up the session slots.
This prevents OPEN reclaims (from nfs_delegation_claim_opens) required by the NFS4CLNT_DELEGRETURN state manager processing from completing, hanging the state manager in the __rpc_wait_for_completion_task in nfs4_run_open_task as seen in this kernel thread dump:
kernel: 4.12.32.53-ma D 0000000000000000 0 3393 2 0x00000000
kernel: ffff88013995fb60 0000000000000046 ffff880138cc5400 ffff88013a9df140
kernel: ffff8800000265c0 ffffffff8116eef0 ffff88013fc10080 0000000300000001
kernel: ffff88013a4ad058 ffff88013995ffd8 000000000000fbc8 ffff88013a4ad058
kernel: Call Trace:
kernel: [<ffffffff8116eef0>] ? cache_alloc_refill+0x1c0/0x240
kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
kernel: [<ffffffffa0358152>] rpc_wait_bit_killable+0x42/0xa0 [sunrpc]
kernel: [<ffffffff8152914f>] __wait_on_bit+0x5f/0x90
kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
kernel: [<ffffffff815291f8>] out_of_line_wait_on_bit+0x78/0x90
kernel: [<ffffffff8109b520>] ? wake_bit_function+0x0/0x50
kernel: [<ffffffffa035810d>] __rpc_wait_for_completion_task+0x2d/0x30 [sunrpc]
kernel: [<ffffffffa040d44c>] nfs4_run_open_task+0x11c/0x160 [nfs]
kernel: [<ffffffffa04114e7>] nfs4_open_recover_helper+0x87/0x120 [nfs]
kernel: [<ffffffffa0411646>] nfs4_open_recover+0xc6/0x150 [nfs]
kernel: [<ffffffffa040cc6f>] ? nfs4_open_recoverdata_alloc+0x2f/0x60 [nfs]
kernel: [<ffffffffa0414e1a>] nfs4_open_delegation_recall+0x6a/0xa0 [nfs]
kernel: [<ffffffffa0424020>] nfs_end_delegation_return+0x120/0x2e0 [nfs]
kernel: [<ffffffff8109580f>] ? queue_work+0x1f/0x30
kernel: [<ffffffffa0424347>] nfs_client_return_marked_delegations+0xd7/0x110 [nfs]
kernel: [<ffffffffa04225d8>] nfs4_run_state_manager+0x548/0x620 [nfs]
kernel: [<ffffffffa0422090>] ? nfs4_run_state_manager+0x0/0x620 [nfs]
kernel: [<ffffffff8109b0f6>] kthread+0x96/0xa0
kernel: [<ffffffff8100c20a>] child_rip+0xa/0x20
kernel: [<ffffffff8109b060>] ? kthread+0x0/0xa0
kernel: [<ffffffff8100c200>] ? child_rip+0x0/0x20
The state manager can not therefore process the DELEGRETURN session errors. Change the async handler to wait for recovery on session errors.
[bwh: Backported to 3.2:
- Adjust context
- There's no restart_call label]
--- fs/nfs/nfs4proc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfs/nfs4proc.c +1 -2
@@ -3910,8 +3910,7 @@ nfs4_async_handle_error(struct rpc_taskdprintk ("%s ERROR %d, Reset session\n" , __func__, task->tk_status);nfs4_schedule_session_recovery (clp->cl_session); - task->tk_status =0 ; -return -EAGAIN ; + goto wait_on_recovery;#endif /* CONFIG_NFS_V4_1 */ case -NFS4ERR_DELAY :nfs_inc_server_stats (server,NFSIOS_DELAY );
Greg Kroah-Hartman
maintainerPATCH 88/214 nfsd4: fix xdr decoding of large non-write compounds
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 365da4adebb1c012febf81019ad3dc5bb52e2a13 upstream.
This fixes a regression from 247500820ebd02ad87525db5d9b199e5b66f6636 "nfsd4: fix decoding of compounds across page boundaries". The previous code was correct: argp->pagelist is initialized in nfs4svc_deocde_compoundargs to rqstp->rq_arg.pages, and is therefore a pointer to the page *after* the page we are currently decoding.
The reason that patch nevertheless fixed a problem with decoding compounds containing write was a bug in the write decoding introduced by 5a80a54d21c96590d013378d8c5f65f879451ab4 "nfsd4: reorganize write decoding", after which write decoding no longer adhered to the rule that argp->pagelist point to the next page.
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -161,8 +161,8 @@ static __be32 *read_buf(struct nfsd4_com*/ memcpy (p, argp->p, avail);/* step to next page */ - argp->pagelist++; argp->p =page_address (argp->pagelist[0 ]); + argp->pagelist++;if (argp->pagelen <PAGE_SIZE ) { argp->end = argp->p + (argp->pagelen>>2 ); argp->pagelen =0 ;
Greg Kroah-Hartman
maintainerPATCH 89/214 NFSv4.1: integer overflow in decode_cb_sequence_args()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 0439f31c35d1da0b28988b308ea455e38e6a350d upstream.
This seems like it could overflow on 32 bits. Use kmalloc_array() which has overflow protection built in.
--- fs/nfs/callback_xdr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/nfs/callback_xdr.c +3 -3
@@ -455,9 +455,9 @@ static __be32 decode_cb_sequence_args(st args->csa_nrclists =ntohl (*p++); args->csa_rclists =NULL ;if (args->csa_nrclists) { - args->csa_rclists =kmalloc (args->csa_nrclists * -sizeof (*args->csa_rclists), -GFP_KERNEL ); + args->csa_rclists =kmalloc_array (args->csa_nrclists, +sizeof (*args->csa_rclists), +GFP_KERNEL );if (unlikely (args->csa_rclists ==NULL )) goto out;
Greg Kroah-Hartman
maintainerPATCH 90/214 nfsd: dont run get_file if nfs4_preprocess_stateid_op return error
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: fanchaoting <[email protected]>
commit b022032e195ffca83d7002d6b84297d796ed443b upstream.
we should return error status directly when nfs4_preprocess_stateid_op return error.
--- fs/nfsd/nfs4proc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/nfsd/nfs4proc.c +4 -4
@@ -904,14 +904,14 @@ nfsd4_write(struct svc_rqst *rqstp, strunfs4_lock_state (); status =nfs4_preprocess_stateid_op (cstate, stateid,WR_STATE , &filp); -if (filp) -get_file (filp); -nfs4_unlock_state (); -if (status) { +nfs4_unlock_state ();dprintk ("NFSD: nfsd4_write: couldn't process stateid!\n" );return status; } +if (filp) +get_file (filp); +nfs4_unlock_state (); cnt = write->wr_buflen; write->wr_how_written = write->wr_stable_how;
Greg Kroah-Hartman
maintainerPATCH 91/214 NFS: nfs_getaclargs.acl_len is a size_t
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit 56d08fef2369d5ca9ad2e1fc697f5379fd8af751 upstream.
Squelch compiler warnings:
fs/nfs/nfs4proc.c: In function ‘__nfs4_get_acl_uncached’:fs/nfs/nfs4proc.c:3811:14: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]fs/nfs/nfs4proc.c:3818:15: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
Introduced by commit bf118a34 "NFSv4: include bitmap in nfsv4 get acl data", Dec 7, 2011.
--- fs/nfs/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +2 -1
@@ -3724,7 +3724,8 @@ static ssize_t __nfs4_get_acl_uncached(s .rpc_argp = &args, .rpc_resp = &res, }; -int ret = -ENOMEM , npages, i, acl_len =0 ; +int ret = -ENOMEM , npages, i; +size_t acl_len =0 ; npages = (buflen +PAGE_SIZE -1 ) >>PAGE_SHIFT ;/* As long as we're doing a round trip to the server anyway,
Greg Kroah-Hartman
maintainerPATCH 92/214 NFSv4.1: Fix a race in pNFS layoutcommit
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit a073dbff359f4741013ae4b8395f5364c5e00b48 upstream.
We need to clear the NFS_LSEG_LAYOUTCOMMIT bits atomically with the NFS_INO_LAYOUTCOMMIT bit, otherwise we may end up with situations where the two are out of sync.
The first half of the problem is to ensure that pnfs_layoutcommit_inode clears the NFS_LSEG_LAYOUTCOMMIT bit through pnfs_list_write_lseg. We still need to keep the reference to those segments until the RPC call is finished, so in order to make it clear _where_ those references come from, we add a helper pnfs_list_write_lseg_done() that cleans up after pnfs_list_write_lseg.
--- fs/nfs/nfs4proc.c | 14 -------------- fs/nfs/pnfs.c | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 15 deletions(-)
fs/nfs/nfs4proc.c +0 -14
@@ -6297,22 +6297,8 @@ nfs4_layoutcommit_done(struct rpc_task *static void nfs4_layoutcommit_release (void *calldata) {struct nfs4_layoutcommit_data *data = calldata; -struct pnfs_layout_segment *lseg, *tmp; -unsigned long *bitlock = &NFS_I (data->args.inode)->flags;pnfs_cleanup_layoutcommit (data); -/* Matched by references in pnfs_set_layoutcommit */ -list_for_each_entry_safe (lseg, tmp, &data->lseg_list, pls_lc_list) { -list_del_init (&lseg->pls_lc_list); -if (test_and_clear_bit (NFS_LSEG_LAYOUTCOMMIT , - &lseg->pls_flags)) -put_lseg (lseg); - } - -clear_bit_unlock (NFS_INO_LAYOUTCOMMITTING , bitlock); -smp_mb__after_clear_bit (); -wake_up_bit (bitlock,NFS_INO_LAYOUTCOMMITTING ); -put_rpccred (data->cred);kfree (data); }
fs/nfs/pnfs.c +18 -1
@@ -1381,11 +1381,27 @@ static void pnfs_list_write_lseg(structlist_for_each_entry (lseg, &NFS_I (inode)->layout->plh_segs, pls_list) {if (lseg->pls_range.iomode ==IOMODE_RW && -test_bit (NFS_LSEG_LAYOUTCOMMIT , &lseg->pls_flags)) +test_and_clear_bit (NFS_LSEG_LAYOUTCOMMIT , &lseg->pls_flags))list_add (&lseg->pls_lc_list, listp); } } +static void pnfs_list_write_lseg_done (struct inode *inode,struct list_head *listp) +{ +struct pnfs_layout_segment *lseg, *tmp; +unsigned long *bitlock = &NFS_I (inode)->flags; + +/* Matched by references in pnfs_set_layoutcommit */ +list_for_each_entry_safe (lseg, tmp, listp, pls_lc_list) { +list_del_init (&lseg->pls_lc_list); +put_lseg (lseg); + } + +clear_bit_unlock (NFS_INO_LAYOUTCOMMITTING , bitlock); +smp_mb__after_clear_bit (); +wake_up_bit (bitlock,NFS_INO_LAYOUTCOMMITTING ); +} +void pnfs_set_lo_fail (struct pnfs_layout_segment *lseg) {if (lseg->pls_range.iomode ==IOMODE_RW ) {
@@ -1434,6 +1450,7 @@ void pnfs_cleanup_layoutcommit(struct nfif (nfss->pnfs_curr_ld->cleanup_layoutcommit) nfss->pnfs_curr_ld->cleanup_layoutcommit (data); +pnfs_list_write_lseg_done (data->args.inode, &data->lseg_list); }/*
Greg Kroah-Hartman
maintainerPATCH 93/214 NFSv4.1: Dont decode skipped layoutgets
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Weston Andros Adamson <[email protected]>
commit 085b7a45c63d3da5be155faab9249a5cab224561 upstream.
layoutget's prepare hook can call rpc_exit with status = NFS4_OK (0). Because of this, nfs4_proc_layoutget can't depend on a 0 status to mean that the RPC was successfully sent, received and parsed.
To fix this, use the result's len member to see if parsing took place.
This fixes the following OOPS -- calling xdr_init_decode() with a buffer length 0 doesn't set the stream's 'p' member and ends up using uninitialized memory in filelayout_decode_layout.
BUG: unable to handle kernel paging request at 0000000000008050 IP: [<ffffffff81282e78>] memcpy+0x18/0x120 PGD 0 Oops: 0000 [#1] SMP last sysfs file: /sys/devices/pci0000:00/0000:00:11.0/0000:02:01.0/irq CPU 1 Modules linked in: nfs_layout_nfsv41_files nfs lockd fscache auth_rpcgss nfs_acl autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 nf_defrag_ipv4 iptable_filter ip_tables ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack ip6table_filter ip6_tables ipv6 dm_mirror dm_region_hash dm_log dm_mod ppdev parport_pc parport snd_ens1371 snd_rawmidi snd_ac97_codec ac97_bus snd_seq snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc e1000 microcode vmware_balloon i2c_piix4 i2c_core sg shpchp ext4 mbcache jbd2 sr_mod cdrom sd_mod crc_t10dif pata_acpi ata_generic ata_piix mptspi mptscsih mptbase scsi_transport_spi [last unloaded: speedstep_lib]
Pid: 1665, comm: flush-0:22 Not tainted 2.6.32-356-test-2 #2 VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform
RIP: 0010:[<ffffffff81282e78>] [<ffffffff81282e78>] memcpy+0x18/0x120 RSP: 0018:ffff88003dfab588 EFLAGS: 00010206 RAX: ffff88003dc42000 RBX: ffff88003dfab610 RCX: 0000000000000009 RDX: 000000003f807ff0 RSI: 0000000000008050 RDI: ffff88003dc42000 RBP: ffff88003dfab5b0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000080 R12: 0000000000000024 R13: ffff88003dc42000 R14: ffff88003f808030 R15: ffff88003dfab6a0 FS: 0000000000000000(0000) GS:ffff880003420000(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 0000000000008050 CR3: 000000003bc92000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process flush-0:22 (pid: 1665, threadinfo ffff88003dfaa000, task ffff880037f77540) Stack: ffffffffa0398ac1 ffff8800397c5940 ffff88003dfab610 ffff88003dfab6a0 <d> ffff88003dfab5d0 ffff88003dfab680 ffffffffa01c150b ffffea0000d82e70 <d> 000000508116713b 0000000000000000 0000000000000000 0000000000000000 Call Trace: [<ffffffffa0398ac1>] ? xdr_inline_decode+0xb1/0x120 [sunrpc] [<ffffffffa01c150b>] filelayout_decode_layout+0xeb/0x350 [nfs_layout_nfsv41_files] [<ffffffffa01c17fc>] filelayout_alloc_lseg+0x8c/0x3c0 [nfs_layout_nfsv41_files] [<ffffffff8150e6ce>] ? __wait_on_bit+0x7e/0x90
--- fs/nfs/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/nfs4proc.c +2 -1
@@ -6084,7 +6084,8 @@ int nfs4_proc_layoutget(struct nfs4_layo status =nfs4_wait_for_completion_rpc_task (task);if (status ==0 ) status = task->tk_status; -if (status ==0 ) +/* if layoutp->len is 0, nfs4_layoutget_prepare called rpc_exit */ +if (status ==0 && lgp->res.layoutp->len) status =pnfs_layout_process (lgp);rpc_put_task (task);dprintk ("<-- %s status=%d\n" , __func__, status);
Greg Kroah-Hartman
maintainerPATCH 94/214 NFSv4.1: Handle NFS4ERR_DELAY when resetting the NFSv4.1 session
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
commit c489ee290bdbbace6bb63ebe6ebd4dd605819495 upstream.
NFS4ERR_DELAY is a legal reply when we call DESTROY_SESSION. It usually means that the server is busy handling an unfinished RPC request. Just sleep for a second and then retry.
We also need to be able to handle the NFS4ERR_BACK_CHAN_BUSY return value. If the NFS server has outstanding callbacks, we just want to similarly sleep & retry.
--- fs/nfs/nfs4state.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
fs/nfs/nfs4state.c +12 -2
@@ -1651,8 +1651,18 @@ static int nfs4_reset_session(struct nfsnfs4_begin_drain_session (clp); status =nfs4_proc_destroy_session (clp->cl_session); -if (status && status != -NFS4ERR_BADSESSION && - status != -NFS4ERR_DEADSESSION ) { +switch (status) { +case 0 : +case -NFS4ERR_BADSESSION : +case -NFS4ERR_DEADSESSION : +break ; +case -NFS4ERR_BACK_CHAN_BUSY : +case -NFS4ERR_DELAY : +set_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state); + status =0 ; +ssleep (1 ); + goto out; +default : status =nfs4_recovery_handle_error (clp, status); goto out; }
Greg Kroah-Hartman
maintainerPATCH 95/214 dm bufio: avoid a possible __vmalloc deadlock
In reply to Greg Kroah-Hartman3.4-stable 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 | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/md/dm-bufio.c +25 -1
@@ -321,6 +321,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);
@@ -334,7 +337,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; }/*
Greg Kroah-Hartman
maintainerPATCH 96/214 dm snapshot: add missing module aliases
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 23cb21092eb9dcec9d3604b68d95192b79915890 upstream.
Add module aliases so that autoloading works correctly if the user tries to activate "snapshot-origin" or "snapshot-merge" targets.
Reference: https://bugzilla.redhat.com/889973
--- drivers/md/dm-snap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm-snap.c +2 -0
@@ -2323,3 +2323,5 @@ module_exit(dm_snapshot_exit);MODULE_DESCRIPTION (DM_NAME " snapshot target" );MODULE_AUTHOR ("Joe Thornber" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("dm-snapshot-origin" ); +MODULE_ALIAS ("dm-snapshot-merge" );
Greg Kroah-Hartman
maintainerPATCH 97/214 md/raid10: fix "enough" function for detecting if array is failed.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 80b4812407c6b1f66a4f2430e69747a13f010839 upstream.
The 'enough' function is written to work with 'near' arrays only in that is implicitly assumes that the offset from one 'group' of devices to the next is the same as the number of copies. In reality it is the number of 'near' copies.
So change it to make this number explicit.
This bug makes it possible to run arrays without enough drives present, which is dangerous.
It is appropriate for an -stable kernel, but will almost certainly need to be modified for some of them.
--- drivers/md/raid10.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/md/raid10.c +5 -3
@@ -1419,14 +1419,16 @@ static int enough(struct r10conf *conf,do {int n = conf->copies;int cnt =0 ; +int this = first;while (n--) { -if (conf->mirrors[first].rdev && - first != ignore) +if (conf->mirrors[this].rdev && + this != ignore) cnt++; - first = (first+1 ) % conf->raid_disks; + this = (this+1 ) % conf->raid_disks; }if (cnt ==0 )return 0 ; + first = (first + conf->near_copies) % conf->raid_disks; }while (first !=0 );return 1 ; }
Greg Kroah-Hartman
maintainerPATCH 98/214 nfsd: nfsd_open: when dentry_open returns an error do not propagate as struct file
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshula Jayasuriya <[email protected]>
commit e4daf1ffbe6cc3b12aab4d604e627829e93e9914 upstream.
The following call chain:
------------------------------------------------------------nfs4_get_vfs_file
- nfsd_open
- dentry_open
- do_dentry_open
- __get_file_write_access
- get_write_access
- return atomic_inc_unless_negative(&inode->i_writecount) ? 0 : -ETXTBSY;
------------------------------------------------------------
can result in the following state:
------------------------------------------------------------
struct nfs4_file {
...
fi_fds = {0xffff880c1fa65c80, 0xffffffffffffffe6, 0x0},
fi_access = {{
counter = 0x1
}, {
counter = 0x0
}},...
------------------------------------------------------------
1) First time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is NULL, hence nfsd_open() is called where we get status set to an error and fp->fi_fds[O_WRONLY] to -ETXTBSY. Thus we do not reach nfs4_file_get_access() and fi_access[O_WRONLY] is not incremented.
2) Second time around, in nfs4_get_vfs_file() fp->fi_fds[O_WRONLY] is NOT NULL (-ETXTBSY), so nfsd_open() is NOT called, but nfs4_file_get_access() IS called and fi_access[O_WRONLY] is incremented. Thus we leave a landmine in the form of the nfs4_file data structure in an incorrect state.
3) Eventually, when __nfs4_file_put_access() is called it finds fi_access[O_WRONLY] being non-zero, it decrements it and calls nfs4_file_put_fd() which tries to fput -ETXTBSY.
------------------------------------------------------------
...
[exception RIP: fput+0x9]
RIP: ffffffff81177fa9 RSP: ffff88062e365c90 RFLAGS: 00010282
RAX: ffff880c2b3d99cc RBX: ffff880c2b3d9978 RCX: 0000000000000002
RDX: dead000000100101 RSI: 0000000000000001 RDI: ffffffffffffffe6
RBP: ffff88062e365c90 R8: ffff88041fe797d8 R9: ffff88062e365d58
R10: 0000000000000008 R11: 0000000000000000 R12: 0000000000000001
R13: 0000000000000007 R14: 0000000000000000 R15: 0000000000000000
ORIG_RAX: ffffffffffffffff CS: 0010 SS: 0018 #9 [ffff88062e365c98] __nfs4_file_put_access at ffffffffa0562334 [nfsd]
#10 [ffff88062e365cc8] nfs4_file_put_access at ffffffffa05623ab [nfsd] #11 [ffff88062e365ce8] free_generic_stateid at ffffffffa056634d [nfsd] #12 [ffff88062e365d18] release_open_stateid at ffffffffa0566e4b [nfsd] #13 [ffff88062e365d38] nfsd4_close at ffffffffa0567401 [nfsd] #14 [ffff88062e365d88] nfsd4_proc_compound at ffffffffa0557f28 [nfsd] #15 [ffff88062e365dd8] nfsd_dispatch at ffffffffa054543e [nfsd] #16 [ffff88062e365e18] svc_process_common at ffffffffa04ba5a4 [sunrpc] #17 [ffff88062e365e98] svc_process at ffffffffa04babe0 [sunrpc] #18 [ffff88062e365eb8] nfsd at ffffffffa0545b62 [nfsd]
#19 [ffff88062e365ee8] kthread at ffffffff81090886
#20 [ffff88062e365f48] kernel_thread at ffffffff8100c14a
------------------------------------------------------------
--- fs/nfsd/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/vfs.c +3 -2
@@ -828,9 +828,10 @@ nfsd_open(struct svc_rqst *rqstp, struct } *filp =dentry_open (dget (dentry),mntget (fhp->fh_export->ex_path.mnt), flags,current_cred ()); -if (IS_ERR (*filp)) +if (IS_ERR (*filp)) { host_err =PTR_ERR (*filp); -else { + *filp =NULL ; + }else { host_err =ima_file_check (*filp, may_flags);if (may_flags &NFSD_MAY_64BIT_COOKIE )
Greg Kroah-Hartman
maintainerPATCH 99/214 dm snapshot: avoid snapshot space leak on crash
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 230c83afdd9cd384348475bea1e14b80b3b6b1b8 upstream.
There is a possible leak of snapshot space in case of crash.
The reason for space leaking is that chunks in the snapshot device are allocated sequentially, but they are finished (and stored in the metadata) out of order, depending on the order in which copying finished.
For example, supposed that the metadata contains the following records SUPERBLOCK
METADATA (blocks 0 ... 250)
DATA 0
DATA 1
DATA 2
...
DATA 250
Now suppose that you allocate 10 new data blocks 251-260. Suppose that copying of these blocks finish out of order (block 260 finished first and the block 251 finished last). Now, the snapshot device looks like this:
SUPERBLOCK
METADATA (blocks 0 ... 250, 260, 259, 258, 257, 256)
DATA 0
DATA 1
DATA 2
...
DATA 250
DATA 251
DATA 252
DATA 253
DATA 254
DATA 255
METADATA (blocks 255, 254, 253, 252, 251)
DATA 256
DATA 257
DATA 258
DATA 259
DATA 260
Now, if the machine crashes after writing the first metadata block but before writing the second metadata block, the space for areas DATA 250-255 is leaked, it contains no valid data and it will never be used in the future.
This patch makes dm-snapshot complete exceptions in the same order they were allocated, thus fixing this bug.
Note: when backporting this patch to the stable kernel, change the version field in the following way:
* if version in the stable kernel is {1, 11, 1}, change it to {1, 12, 0}
* if version in the stable kernel is {1, 10, 0} or {1, 10, 1}, change it to {1, 10, 2}
Userspace reads the version to determine if the bug was fixed, so the version change is needed.
--- drivers/md/dm-snap.c | 71 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 7 deletions(-)
drivers/md/dm-snap.c +64 -7
@@ -66,6 +66,18 @@ struct dm_snapshot {atomic_t pending_exceptions_count; +/* Protected by "lock" */ +sector_t exception_start_sequence; + +/* Protected by kcopyd single-threaded callback */ +sector_t exception_complete_sequence; + +/* +* A list of pending exceptions that completed out of order. +* Protected by kcopyd single-threaded callback. +*/ +struct list_head out_of_order_list; +mempool_t *pending_pool;struct dm_exception_table pending;
@@ -171,6 +183,14 @@ struct dm_snap_pending_exception {*/ int started; +/* There was copying error. */ +int copy_error; + +/* A sequence number, it is used for in-order completion. */ +sector_t exception_sequence; + +struct list_head out_of_order_entry; +/* * For writing a complete chunk, bypassing the copy. */
@@ -1090,6 +1110,9 @@ static int snapshot_ctr(struct dm_target s->valid =1 ; s->active =0 ;atomic_set (&s->pending_exceptions_count,0 ); + s->exception_start_sequence =0 ; + s->exception_complete_sequence =0 ; +INIT_LIST_HEAD (&s->out_of_order_list);init_rwsem (&s->lock);INIT_LIST_HEAD (&s->list);spin_lock_init (&s->pe_lock);
@@ -1448,6 +1471,19 @@ static void commit_callback(void *contexpending_complete (pe, success); } +static void complete_exception (struct dm_snap_pending_exception *pe) +{ +struct dm_snapshot *s = pe->snap; + +if (unlikely (pe->copy_error)) +pending_complete (pe,0 ); + +else +/* Update the metadata if we are persistent */ + s->store->type->commit_exception (s->store, &pe->e, + commit_callback, pe); +} +/* * Called when the copy I/O has finished. kcopyd actually runs * this code so don't block.
@@ -1457,13 +1493,32 @@ static void copy_callback(int read_err,struct dm_snap_pending_exception *pe = context;struct dm_snapshot *s = pe->snap; -if (read_err || write_err) -pending_complete (pe,0 ); + pe->copy_error = read_err || write_err; -else -/* Update the metadata if we are persistent */ - s->store->type->commit_exception (s->store, &pe->e, - commit_callback, pe); +if (pe->exception_sequence == s->exception_complete_sequence) { + s->exception_complete_sequence++; +complete_exception (pe); + +while (!list_empty (&s->out_of_order_list)) { + pe =list_entry (s->out_of_order_list.next, + struct dm_snap_pending_exception, out_of_order_entry); +if (pe->exception_sequence != s->exception_complete_sequence) +break ; + s->exception_complete_sequence++; +list_del (&pe->out_of_order_entry); +complete_exception (pe); + } + }else { +struct list_head *lh; +struct dm_snap_pending_exception *pe2; + +list_for_each_prev (lh, &s->out_of_order_list) { + pe2 = list_entry(lh, struct dm_snap_pending_exception, out_of_order_entry); +if (pe2->exception_sequence < pe->exception_sequence) +break ; + } +list_add (&pe->out_of_order_entry, lh); + } }/*
@@ -1558,6 +1613,8 @@ __find_pending_exception(struct dm_snapsreturn NULL ; } + pe->exception_sequence = s->exception_start_sequence++; +dm_insert_exception (&s->pending, &pe->e);return pe;
@@ -2200,7 +2257,7 @@ static struct target_type origin_targetstatic struct target_type snapshot_target = { .name ="snapshot" , - .version = {1 ,10 ,0 }, + .version = {1 ,10 ,2 }, .module =THIS_MODULE , .ctr = snapshot_ctr, .dtr = snapshot_dtr,
Greg Kroah-Hartman
maintainerPATCH 100/214 dm mpath: fix race condition between multipath_dtr and pg_init_done
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shiva Krishna Merla <[email protected]>
commit 954a73d5d3073df2231820c718fdd2f18b0fe4c9 upstream.
Whenever multipath_dtr() is happening we must prevent queueing any further path activation work. Implement this by adding a new 'pg_init_disabled' flag to the multipath structure that denotes future path activation work should be skipped if it is set. By disabling pg_init and then re-enabling in flush_multipath_work() we also avoid the potential for pg_init to be initiated while suspending an mpath device.
Without this patch a race condition exists that may result in a kernel panic:
1) If after pg_init_done() decrements pg_init_in_progress to 0, a call to wait_for_pg_init_completion() assumes there are no more pending path management commands.
2) If pg_init_required is set by pg_init_done(), due to retryable mode_select errors, then process_queued_ios() will again queue the path activation work.
3) If free_multipath() completes before activate_path() work is called a NULL pointer dereference like the following can be seen when accessing members of the recently destructed multipath:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000090 RIP: 0010:[<ffffffffa003db1b>] [<ffffffffa003db1b>] activate_path+0x1b/0x30 [dm_multipath] [<ffffffff81090ac0>] worker_thread+0x170/0x2a0 [<ffffffff81096c80>] ? autoremove_wake_function+0x0/0x40
[bwh: Backported to 3.2:
- Adjust context
- Bump version to 1.3.2 not 1.6.0]
--- drivers/md/dm-mpath.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/md/dm-mpath.c +15 -3
@@ -84,6 +84,7 @@ struct multipath {unsigned queue_io;/* Must we queue all I/O? */ unsigned queue_if_no_path;/* Queue I/O if last path fails? */ unsigned saved_queue_if_no_path;/* Saved state during suspension */ + unsigned pg_init_disabled:1; /* pg_init is not currently allowed */unsigned pg_init_retries;/* Number of times to retry pg_init */ unsigned pg_init_count;/* Number of times pg_init called */ unsigned pg_init_delay_msecs;/* Number of msecs before pg_init retry */
@@ -493,7 +494,8 @@ static void process_queued_ios(struct wo (!pgpath && !m->queue_if_no_path)) must_queue =0 ; -if (m->pg_init_required && !m->pg_init_in_progress && pgpath) +if (m->pg_init_required && !m->pg_init_in_progress && pgpath && + !m->pg_init_disabled)__pg_init_all_paths (m); out:
@@ -907,10 +909,20 @@ static void multipath_wait_for_pg_init_cstatic void flush_multipath_work (struct multipath *m) { +unsigned long flags; + +spin_lock_irqsave (&m->lock, flags); + m->pg_init_disabled =1 ; +spin_unlock_irqrestore (&m->lock, flags); +flush_workqueue (kmpath_handlerd);multipath_wait_for_pg_init_completion (m);flush_workqueue (kmultipathd);flush_work_sync (&m->trigger_event); + +spin_lock_irqsave (&m->lock, flags); + m->pg_init_disabled =0 ; +spin_unlock_irqrestore (&m->lock, flags); }static void multipath_dtr (struct dm_target *ti)
@@ -1129,7 +1141,7 @@ static int pg_init_limit_reached(structspin_lock_irqsave (&m->lock, flags); -if (m->pg_init_count <= m->pg_init_retries) +if (m->pg_init_count <= m->pg_init_retries && !m->pg_init_disabled) m->pg_init_required =1 ;else limit_reached =1 ;
@@ -1644,7 +1656,7 @@ out:*---------------------------------------------------------------*/ static struct target_type multipath_target = { .name ="multipath" , - .version = {1 ,3 ,0 }, + .version = {1 ,3 ,2 }, .module =THIS_MODULE , .ctr = multipath_ctr, .dtr = multipath_dtr,
Greg Kroah-Hartman
maintainerPATCH 101/214 dm thin: fix discard corruption
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit f046f89a99ccfd9408b94c653374ff3065c7edb3 upstream.
Fix a bug in dm_btree_remove that could leave leaf values with incorrect reference counts. The effect of this was that removal of a shared block could result in the space maps thinking the block was no longer used. More concretely, if you have a thin device and a snapshot of it, sending a discard to a shared region of the thin could corrupt the snapshot.
Thinp uses a 2-level nested btree to store it's mappings. This first level is indexed by thin device, and the second level by logical block.
Often when we're removing an entry in this mapping tree we need to rebalance nodes, which can involve shadowing them, possibly creating a copy if the block is shared. If we do create a copy then children of that node need to have their reference counts incremented. In this way reference counts percolate down the tree as shared trees diverge.
The rebalance functions were incrementing the children at the appropriate time, but they were always assuming the children were internal nodes. This meant the leaf values (in our case packed block/flags entries) were not being incremented.
--- drivers/md/dm-thin.c | 4 +- drivers/md/persistent-data/dm-btree-remove.c | 46 ++++++++++++++------------- 2 files changed, 26 insertions(+), 24 deletions(-)
drivers/md/dm-thin.c +2 -2
@@ -2472,7 +2472,7 @@ static struct target_type pool_target = .name = "thin-pool", .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | DM_TARGET_IMMUTABLE, - .version = {1, 1, 0}, + .version = {1, 1, 1}, .module = THIS_MODULE, .ctr = pool_ctr, .dtr = pool_dtr,
@@ -2752,7 +2752,7 @@ static void thin_io_hints(struct dm_targstatic struct target_type thin_target = { .name ="thin" , - .version = {1 ,1 ,0 }, + .version = {1 ,1 ,1 }, .module =THIS_MODULE , .ctr = thin_ctr, .dtr = thin_dtr,
drivers/md/persistent-data/dm-btree-remove.c +24 -22
121 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 102/214 zram: Fix deadlock bug in partial read/write
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit 7e5a5104c6af709a8d97d5f4711e7c917761d464 upstream.
Now zram allocates new page with GFP_KERNEL in zram I/O path if IO is partial. Unfortunately, It may cause deadlock with reclaim path like below.
write_page from fsfs_lockallocation(GFP_KERNEL)
reclaim
pageout
write_page from fs fs_lock <-- deadlock
This patch fixes it by using GFP_NOIO. In read path, we reorganize code flow so that kmap_atomic is called after the GFP_NOIO allocation.
--- drivers/staging/zram/zram_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/zram/zram_drv.c +2 -2
@@ -235,7 +235,7 @@ static int zram_bvec_read(struct zram *zif (is_partial_io (bvec)) {/* Use a temporary buffer to decompress the page */ - uncmem =kmalloc (PAGE_SIZE ,GFP_KERNEL ); + uncmem =kmalloc (PAGE_SIZE ,GFP_NOIO );if (!uncmem) {pr_info ("Error allocating temp memory!\n" );return -ENOMEM ;
@@ -330,7 +330,7 @@ static int zram_bvec_write(struct zram ** This is a partial IO. We need to read the full page * before to write the changes. */ - uncmem =kmalloc (PAGE_SIZE ,GFP_KERNEL ); + uncmem =kmalloc (PAGE_SIZE ,GFP_NOIO );if (!uncmem) {pr_info ("Error allocating temp memory!\n" ); ret = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 103/214 zram: avoid invalid memory access in zram_exit()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit 6030ea9b35971a4200062f010341ab832e878ac9 upstream.
Memory for zram->disk object may have already been freed after returning from destroy_device(zram), then it's unsafe for zram_reset_device(zram) to access zram->disk again.
We can't solve this bug by flipping the order of destroy_device(zram) and zram_reset_device(zram), that will cause deadlock issues to the zram sysfs handler.
So fix it by holding an extra reference to zram->disk before calling destroy_device(zram).
--- drivers/staging/zram/zram_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/staging/zram/zram_drv.c +2 -0
@@ -841,9 +841,11 @@ static void __exit zram_exit(void)for (i =0 ; i < num_devices; i++) { zram = &zram_devices[i]; +get_disk (zram->disk);destroy_device (zram);if (zram->init_done)zram_reset_device (zram); +put_disk (zram->disk); }unregister_blkdev (zram_major,"zram" );
Greg Kroah-Hartman
maintainerPATCH 104/214 zram: destroy all devices on error recovery path in zram_init()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit 39a9b8ac9333e4268ecff7da6c9d1ab3823ff243 upstream.
On error recovery path of zram_init(), it leaks the zram device object causing the failure. So change create_device() to free allocated resources on error path.
--- drivers/staging/zram/zram_drv.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/staging/zram/zram_drv.c +9 -6
@@ -703,7 +703,7 @@ static const struct block_device_operatistatic int create_device (struct zram *zram,int device_id) { -int ret =0 ; +int ret = -ENOMEM ;init_rwsem (&zram->lock);init_rwsem (&zram->init_lock);
@@ -713,7 +713,6 @@ static int create_device(struct zram *zrif (!zram->queue) {pr_err ("Error allocating disk queue for device %d\n" , device_id); - ret = -ENOMEM ; goto out; }
@@ -723,11 +722,9 @@ static int create_device(struct zram *zr/* gendisk structure */ zram->disk =alloc_disk (1 );if (!zram->disk) { -blk_cleanup_queue (zram->queue);pr_warning ("Error allocating disk structure for device %d\n" , device_id); - ret = -ENOMEM ; - goto out; + goto out_free_queue; } zram->disk->major = zram_major;
@@ -756,11 +753,17 @@ static int create_device(struct zram *zr &zram_disk_attr_group);if (ret <0 ) {pr_warning ("Error creating sysfs group" ); - goto out; + goto out_free_disk; } zram->init_done =0 ; +return 0 ; +out_free_disk: +del_gendisk (zram->disk); +put_disk (zram->disk); +out_free_queue: +blk_cleanup_queue (zram->queue); out:return ret; }
Greg Kroah-Hartman
maintainerPATCH 105/214 zram: avoid access beyond the zram device
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit 12a7ad3b810e77137d0caf97a6dd97591e075b30 upstream.
Function valid_io_request() should verify the entire request are within the zram device address range. Otherwise it may cause invalid memory access when accessing/modifying zram->meta->table[index] because the 'index' is out of range. Then it may access non-exist memory, randomly modify memory belong to other subsystems, which is hard to track down.
--- drivers/staging/zram/zram_drv.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/staging/zram/zram_drv.c +12 -5
@@ -535,13 +535,20 @@ out:*/ static inline int valid_io_request (struct zram *zram,struct bio *bio) { -if (unlikely ( - (bio->bi_sector >= (zram->disksize >>SECTOR_SHIFT )) || - (bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK -1 )) || - (bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE -1 )))) { +u64 start, end, bound; +/* unaligned request */ +if (unlikely (bio->bi_sector & (ZRAM_SECTOR_PER_LOGICAL_BLOCK -1 ))) +return 0 ; +if (unlikely (bio->bi_size & (ZRAM_LOGICAL_BLOCK_SIZE -1 ))) +return 0 ; + + start = bio->bi_sector; + end = start + (bio->bi_size >>SECTOR_SHIFT ); + bound = zram->disksize >>SECTOR_SHIFT ; +/* out of range range */ +if (unlikely (start >= bound || end >= bound || start > end))return 0 ; - }/* I/O request is valid */ return 1 ;
Greg Kroah-Hartman
maintainerPATCH 106/214 zram: allow request end to coincide with disksize
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
commit 75c7caf5a052ffd8db3312fa7864ee2d142890c4 upstream.
Pass valid_io_request() checks if request end coincides with disksize (end equals bound), only fail if we attempt to read beyond the bound.
mkfs.ext2 produces numerous errors:
[ 2164.632747] quiet_error: 1 callbacks suppressed [ 2164.633260] Buffer I/O error on device zram0, logical block 153599 [ 2164.633265] lost page write due to I/O error on zram0
--- drivers/staging/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/zram/zram_drv.c +1 -1
@@ -547,7 +547,7 @@ static inline int valid_io_request(struc end = start + (bio->bi_size >>SECTOR_SHIFT ); bound = zram->disksize >>SECTOR_SHIFT ;/* out of range range */ -if (unlikely (start >= bound || end >= bound || start > end)) +if (unlikely (start >= bound || end > bound || start > end))return 0 ;/* I/O request is valid */
Greg Kroah-Hartman
maintainerPATCH 107/214 Staging: zram: Fix access of NULL pointer
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rashika Kheria <[email protected]>
commit 46a51c80216cb891f271ad021f59009f34677499 upstream.
This patch fixes the bug in reset_store caused by accessing NULL pointer.
The bdev gets its value from bdget_disk() which could fail when memory pressure is severe and hence can return NULL because allocation of inode in bdget could fail.
Hence, this patch introduces a check for bdev to prevent reference to a NULL pointer in the later part of the code. It also removes unnecessary check of bdev for fsync_bdev().
--- drivers/staging/zram/zram_sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/zram/zram_sysfs.c +4 -2
@@ -95,6 +95,9 @@ static ssize_t reset_store(struct device zram =dev_to_zram (dev); bdev =bdget_disk (zram->disk,0 ); +if (!bdev) +return -ENOMEM ; +/* Do not reset an active device! */ if (bdev->bd_holders)return -EBUSY ;
@@ -107,8 +110,7 @@ static ssize_t reset_store(struct devicereturn -EINVAL ;/* Make sure all pending I/O is finished */ -if (bdev) -fsync_bdev (bdev); +fsync_bdev (bdev);down_write (&zram->init_lock);if (zram->init_done)
Greg Kroah-Hartman
maintainerPATCH 108/214 UBI: erase free PEB with bitflip in EC header
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu CASTET <[email protected]>
commit 193819cf2e6e395b1e1be2d36785dc5563a6edca upstream.
Without this patch, these PEB are not scrubbed until we put data in them. Bitflip can accumulate latter and we can loose the EC header (but VID header should be intact and allow to recover data).
--- drivers/mtd/ubi/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/scan.c +1 -1
@@ -997,7 +997,7 @@ static int process_eb(struct ubi_devicereturn err; goto adjust_mean_ec;case UBI_IO_FF : -if (ec_err) +if (ec_err || bitflips) err =add_to_list (si, pnum, ec,1 , &si->erase);else err =add_to_list (si, pnum, ec,0 , &si->free);
Greg Kroah-Hartman
maintainerPATCH 109/214 Input: synaptics - adjust threshold for treating position values as negative
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit 824efd37415961d38821ecbd9694e213fb2e8b32 upstream.
Commit c039450 (Input: synaptics - handle out of bounds values from the hardware) caused any hardware reported values over 7167 to be treated as a wrapped-around negative value. It turns out that some firmware uses the value 8176 to indicate a finger near the edge of the touchpad whose actual position cannot be determined. This value now gets treated as negative, which can cause pointer jumps and broken edge scrolling on these machines.
I only know of one touchpad which reports negative values, and this hardware never reports any value lower than -8 (i.e. 8184). Moving the threshold for treating a value as negative up to 8176 should work fine then for any hardware we currently know about, and since we're dealing with unspecified behavior it's probably the best we can do. The special 8176 value is also likely to result in sudden jumps in position, so let's also clamp this to the maximum specified value for the axis.
https://bugzilla.kernel.org/show_bug.cgi?id=46371
--- drivers/input/mouse/synaptics.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
drivers/input/mouse/synaptics.c +23 -8
@@ -53,14 +53,19 @@#define ABS_POS_BITS 13/* -* Any position values from the hardware above the following limits are -* treated as "wrapped around negative" values that have been truncated to -* the 13-bit reporting range of the hardware. These are just reasonable -* guesses and can be adjusted if hardware is found that operates outside -* of these parameters. +* These values should represent the absolute maximum value that will +* be reported for a positive position value. Some Synaptics firmware +* uses this value to indicate a finger near the edge of the touchpad +* whose precise position cannot be determined. +* +* At least one touchpad is known to report positions in excess of this +* value which are actually negative values truncated to the 13-bit +* reporting range. These values have never been observed to be lower +* than 8184 (i.e. -8), so we treat all values greater than 8176 as +* negative and any other value as positive. */ -#define X_MAX_POSITIVE (((1 << ABS_POS_BITS) + XMAX) / 2) -#define Y_MAX_POSITIVE (((1 << ABS_POS_BITS) + YMAX) / 2) +#define X_MAX_POSITIVE 8176 +#define Y_MAX_POSITIVE 8176/* * Synaptics touchpads report the y coordinate from bottom to top, which is
@@ -583,11 +588,21 @@ static int synaptics_parse_hw_state(cons hw->right = (buf[0 ] &0x02 ) ?1 :0 ; } -/* Convert wrap-around values to negative */ +/* +* Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE +* is used by some firmware to indicate a finger at the edge of +* the touchpad whose precise position cannot be determined, so +* convert these values to the maximum axis value. +*/ if (hw->x >X_MAX_POSITIVE ) hw->x -=1 <<ABS_POS_BITS ; +else if (hw->x ==X_MAX_POSITIVE ) + hw->x =XMAX ; +if (hw->y >Y_MAX_POSITIVE ) hw->y -=1 <<ABS_POS_BITS ; +else if (hw->y ==Y_MAX_POSITIVE ) + hw->y =YMAX ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 110/214 floppy: properly handle failure on add_disk loop
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herton Ronaldo Krzesinski <[email protected]>
commit d60e7ec18c3fb2cbf90969ccd42889eb2d03aef9 upstream.
On floppy initialization, if something failed inside the loop we call add_disk, there was no cleanup of previous iterations in the error handling.
--- drivers/block/floppy.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/block/floppy.c +10 -1
@@ -4306,7 +4306,7 @@ static int __init floppy_init(void) err =platform_device_register (&floppy_device[drive]);if (err) - goto out_flush_work; + goto out_remove_drives; err =device_create_file (&floppy_device[drive].dev, &dev_attr_cmos);
@@ -4324,6 +4324,15 @@ static int __init floppy_init(void) out_unreg_platform_dev:platform_device_unregister (&floppy_device[drive]); +out_remove_drives: +while (drive--) { +if ((allowed_drive_mask & (1 << drive)) && + fdc_state[FDC (drive)].version !=FDC_NONE ) { +del_gendisk (disks[drive]); +device_remove_file (&floppy_device[drive].dev, &dev_attr_cmos); +platform_device_unregister (&floppy_device[drive]); + } + } out_flush_work:flush_work_sync (&floppy_work);if (atomic_read (&usage_count))
Greg Kroah-Hartman
maintainerPATCH 111/214 MISC: hpilo, remove pci_disable_device
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit bcdee04ea7ae0406ae69094f6df1aacb66a69a0b upstream.
pci_disable_device(pdev) used to be in pci remove function. But this PCI device has two functions with interrupt lines connected to a single pin. The other one is a USB host controller. So when we disable the PIN there e.g. by rmmod hpilo, the controller stops working. It is because the interrupt link is disabled in ACPI since it is not refcounted yet. See acpi_pci_link_free_irq called from acpi_pci_irq_disable.
It is not the best solution whatsoever, but as a workaround until the ACPI irq link refcounting is sorted out this should fix the reported errors.
References: https://lkml.org/lkml/2008/11/4/535
--- drivers/misc/hpilo.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/misc/hpilo.c +9 -2
@@ -735,7 +735,14 @@ static void ilo_remove(struct pci_dev *pfree_irq (pdev->irq, ilo_hw);ilo_unmap_device (pdev, ilo_hw);pci_release_regions (pdev); -pci_disable_device (pdev); +/* +* pci_disable_device(pdev) used to be here. But this PCI device has +* two functions with interrupt lines connected to a single pin. The +* other one is a USB host controller. So when we disable the PIN here +* e.g. by rmmod hpilo, the controller stops working. It is because +* the interrupt link is disabled in ACPI since it is not refcounted +* yet. See acpi_pci_link_free_irq called from acpi_pci_irq_disable. +*/ kfree (ilo_hw); ilo_hwdev[(minor /MAX_CCB )] =0 ; }
@@ -820,7 +827,7 @@ unmap: free_regions:pci_release_regions (pdev); disable: -pci_disable_device (pdev); +/* pci_disable_device(pdev); see comment in ilo_remove */ free:kfree (ilo_hw); out:
Greg Kroah-Hartman
maintainerPATCH 112/214 i82975x_edac: Fix dimm label initialization
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mauro Carvalho Chehab <[email protected]>
commit 479696840239e0cc43efb3c917bdcad2174d2215 upstream.
The driver has only 4 hardcoded labels, but allows much more memory. Fix it by removing the hardcoded logic, using snprintf() instead.
[ 19.833972] general protection fault: 0000 [#1] SMP [ 19.837733] Modules linked in: i82975x_edac(+) edac_core firewire_ohci firewire_core crc_itu_t nouveau mxm_wmi wmi video i2c_algo_bit drm_kms_helper ttm drm i2c_core [ 19.837733] CPU 0 [ 19.837733] Pid: 390, comm: udevd Not tainted 3.6.1-1.fc17.x86_64.debug #1 Dell Inc. Precision WorkStation 390 /0MY510 [ 19.837733] RIP: 0010:[<ffffffff813463a8>] [<ffffffff813463a8>] strncpy+0x18/0x30 [ 19.837733] RSP: 0018:ffff880078535b68 EFLAGS: 00010202 [ 19.837733] RAX: ffff880069fa9708 RBX: ffff880078588000 RCX: ffff880069fa9708 [ 19.837733] RDX: 000000000000001f RSI: 5f706f5f63616465 RDI: ffff880069fa9708 [ 19.837733] RBP: ffff880078535b68 R08: ffff880069fa9727 R09: 000000000000fffe [ 19.837733] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000003 [ 19.837733] R13: 0000000000000000 R14: ffff880069fa9290 R15: ffff880079624a80 [ 19.837733] FS: 00007f3de01ee840(0000) GS:ffff88007c400000(0000) knlGS:0000000000000000 [ 19.837733] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 19.837733] CR2: 00007f3de00b9000 CR3: 0000000078dbc000 CR4: 00000000000007f0 [ 19.837733] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 19.837733] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 [ 19.837733] Process udevd (pid: 390, threadinfo ffff880078534000, task ffff880079642450) [ 19.837733] Stack: [ 19.837733] ffff880078535c18 ffffffffa017c6b8 00040000816d627f ffff880079624a88 [ 19.837733] ffffc90004cd6000 ffff880079624520 ffff88007ac21148 0000000000000000 [ 19.837733] 0000000000000000 0004000000000000 feda000078535bc8 ffffffff810d696d [ 19.837733] Call Trace: [ 19.837733] [<ffffffffa017c6b8>] i82975x_init_one+0x2e6/0x3e6 [i82975x_edac]
...
Fix bug reported at:
https://bugzilla.redhat.com/show_bug.cgi?id=848149 And, very likely: https://bbs.archlinux.org/viewtopic.php?id=148033 https://bugzilla.kernel.org/show_bug.cgi?id=47171
[bwh: Backported to 3.2:
- Adjust context
- Use csrow->channels[chan].label not csrow->channels[chan]->dimm->label]
--- drivers/edac/i82975x_edac.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/edac/i82975x_edac.c +4 -7
@@ -363,10 +363,6 @@ static enum dev_type i82975x_dram_type(vstatic void i82975x_init_csrows (struct mem_ctl_info *mci,struct pci_dev *pdev,void __iomem *mch_window) { -static const char *labels[4 ] = { -"DIMM A1" ,"DIMM A2" , -"DIMM B1" ,"DIMM B2" - };struct csrow_info *csrow;unsigned long last_cumul_size;u8 value;
@@ -407,9 +403,10 @@ static void i82975x_init_csrows(struct m* [0-3] for dual-channel; i.e. csrow->nr_channels = 2 */ for (chan =0 ; chan < csrow->nr_channels; chan++) -strncpy (csrow->channels[chan].label, - labels[(index >>1 ) + (chan *2 )], -EDAC_MC_LABEL_LEN ); + +snprintf (csrow->channels[chan].label,EDAC_MC_LABEL_LEN ,"DIMM %c%d" , + (chan ==0 ) ?'A' :'B' , + index);if (cumul_size == last_cumul_size)continue ;/* not populated */
Greg Kroah-Hartman
maintainerPATCH 113/214 i915: ensure that VGA plane is disabled
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Mazur <[email protected]>
commit 0fde901f1ddd2ce0e380a6444f1fb7ca555859e9 upstream.
Some broken systems (like HP nc6120) in some cases, usually after LID close/open, enable VGA plane, making display unusable (black screen on LVDS, some strange mode on VGA output). We used to disable VGA plane only once at startup. Now we also check, if VGA plane is still disabled while changing mode, and fix that if something changed it.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57434
[bwh: Backported to 3.2: intel_modeset_setup_hw_state() does not
exist, so call i915_redisable_vga() directly from intel_lid_notify()]
--- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++ drivers/gpu/drm/i915/intel_lvds.c | 1 + 3 files changed, 19 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -1397,6 +1397,7 @@ static inline void intel_unregister_dsm_#endif /* CONFIG_ACPI */ /* modesetting */ +extern void i915_redisable_vga (struct drm_device *dev);extern void intel_modeset_init (struct drm_device *dev);extern void intel_modeset_gem_init (struct drm_device *dev);extern void intel_modeset_cleanup (struct drm_device *dev);
drivers/gpu/drm/i915/intel_display.c +17 -0
@@ -9254,6 +9254,23 @@ static void i915_disable_vga(struct drm_POSTING_READ (vga_reg); } +void i915_redisable_vga (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; +u32 vga_reg; + +if (HAS_PCH_SPLIT (dev)) + vga_reg =CPU_VGACNTRL ; +else + vga_reg =VGACNTRL ; + +if (I915_READ (vga_reg) !=VGA_DISP_DISABLE ) { +DRM_DEBUG_KMS ("Something enabled VGA plane, disabling it\n" ); +I915_WRITE (vga_reg,VGA_DISP_DISABLE ); +POSTING_READ (vga_reg); + } +} +void intel_modeset_init (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_lvds.c +1 -0
@@ -535,6 +535,7 @@ static int intel_lid_notify(struct notifmutex_lock (&dev->mode_config.mutex);drm_helper_resume_force_mode (dev); +i915_redisable_vga (dev);mutex_unlock (&dev->mode_config.mutex);return NOTIFY_OK ;
Greg Kroah-Hartman
maintainerPATCH 114/214 regulator: max8997: Use uV in voltage_map_desc
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit bc3b7756b5ff66828acf7bc24f148d28b8d61108 upstream.
Current code does integer division (min_vol = min_uV / 1000) before pass min_vol to max8997_get_voltage_proper_val().
So it is possible min_vol is truncated to a smaller value.
For example, if the request min_uV is 800900 for ldo.min_vol = 800900 / 1000 = 800 (mV)
Then max8997_get_voltage_proper_val returns 800 mV for this case which is lower than the requested voltage.
Use uV rather than mV in voltage_map_desc to prevent truncation by integer division.
[bwh: Backported to 3.2:
- Adjust context
- voltage_map_desc also has an n_bits field]
--- drivers/regulator/max8997.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-)
drivers/regulator/max8997.c +17 -19
@@ -71,26 +71,26 @@ struct voltage_map_desc {unsigned int n_bits; }; -/* Voltage maps in mV */ +/* Voltage maps in uV */ static const struct voltage_map_desc ldo_voltage_map_desc = { - .min =800 , .max =3950 , .step =50 , .n_bits =6 , + .min =800000 , .max =3950000 , .step =50000 , .n_bits =6 , };/* LDO1 ~ 18, 21 all */ static const struct voltage_map_desc buck1245_voltage_map_desc = { - .min =650 , .max =2225 , .step =25 , .n_bits =6 , + .min =650000 , .max =2225000 , .step =25000 , .n_bits =6 , };/* Buck1, 2, 4, 5 */ static const struct voltage_map_desc buck37_voltage_map_desc = { - .min =750 , .max =3900 , .step =50 , .n_bits =6 , + .min =750000 , .max =3900000 , .step =50000 , .n_bits =6 , };/* Buck3, 7 */ -/* current map in mA */ +/* current map in uA */ static const struct voltage_map_desc charger_current_map_desc = { - .min =200 , .max =950 , .step =50 , .n_bits =4 , + .min =200000 , .max =950000 , .step =50000 , .n_bits =4 , };static const struct voltage_map_desc topoff_current_map_desc = { - .min =50 , .max =200 , .step =10 , .n_bits =4 , + .min =50000 , .max =200000 , .step =10000 , .n_bits =4 , };static const struct voltage_map_desc *reg_voltage_map[] = {
@@ -194,7 +194,7 @@ static int max8997_list_voltage(struct rif (val > desc->max)return -EINVAL ; -return val *1000 ; +return val; } static int max8997_get_enable_register(struct regulator_dev *rdev,
@@ -496,7 +496,6 @@ static int max8997_set_voltage_ldobuck(s {struct max8997_data *max8997 =rdev_get_drvdata (rdev);struct i2c_client *i2c = max8997->iodev->i2c; -int min_vol = min_uV /1000 , max_vol = max_uV /1000 ;const struct voltage_map_desc *desc;int rid =rdev_get_id (rdev);int reg, shift =0 , mask, ret;
@@ -522,7 +521,7 @@ static int max8997_set_voltage_ldobuck(s desc = reg_voltage_map[rid]; - i =max8997_get_voltage_proper_val (desc, min_vol, max_vol); + i =max8997_get_voltage_proper_val (desc, min_uV, max_uV);if (i <0 )return i;
@@ -541,7 +540,7 @@ static int max8997_set_voltage_ldobuck(s/* If the voltage is increasing */ if (org < i)udelay (DIV_ROUND_UP (desc->step * (i - org), - max8997->ramp_delay)); + max8997->ramp_delay *1000 )); }return ret;
@@ -640,7 +639,6 @@ static int max8997_set_voltage_buck(struconst struct voltage_map_desc *desc;int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;bool gpio_dvs_mode = false; -int min_vol = min_uV /1000 , max_vol = max_uV /1000 ;if (rid <MAX8997_BUCK1 || rid >MAX8997_BUCK7 )return -EINVAL ;
@@ -665,7 +663,7 @@ static int max8997_set_voltage_buck(stru selector); desc = reg_voltage_map[rid]; - new_val =max8997_get_voltage_proper_val (desc, min_vol, max_vol); + new_val =max8997_get_voltage_proper_val (desc, min_uV, max_uV);if (new_val <0 )return new_val;
@@ -997,8 +995,8 @@ static __devinit int max8997_pmic_probe( max8997->buck1_vol[i] = ret =max8997_get_voltage_proper_val ( &buck1245_voltage_map_desc, - pdata->buck1_voltage[i] /1000 , - pdata->buck1_voltage[i] /1000 + + pdata->buck1_voltage[i], + pdata->buck1_voltage[i] + buck1245_voltage_map_desc.step);if (ret <0 ) goto err_alloc;
@@ -1006,8 +1004,8 @@ static __devinit int max8997_pmic_probe( max8997->buck2_vol[i] = ret =max8997_get_voltage_proper_val ( &buck1245_voltage_map_desc, - pdata->buck2_voltage[i] /1000 , - pdata->buck2_voltage[i] /1000 + + pdata->buck2_voltage[i], + pdata->buck2_voltage[i] + buck1245_voltage_map_desc.step);if (ret <0 ) goto err_alloc;
@@ -1015,8 +1013,8 @@ static __devinit int max8997_pmic_probe( max8997->buck5_vol[i] = ret =max8997_get_voltage_proper_val ( &buck1245_voltage_map_desc, - pdata->buck5_voltage[i] /1000 , - pdata->buck5_voltage[i] /1000 + + pdata->buck5_voltage[i], + pdata->buck5_voltage[i] + buck1245_voltage_map_desc.step);if (ret <0 ) goto err_alloc;
Greg Kroah-Hartman
maintainerPATCH 115/214 regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit e8d9897ff064b1683c11c15ea1296a67a45d77b0 upstream.
commit 81d0a6ae7befb24c06f4aa4856af7f8d1f612171 upstream.
Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time.
--- drivers/regulator/max8998.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max8998.c +1 -1
@@ -492,7 +492,7 @@ buck2_exit: difference = desc->min + desc->step*i - previous_vol/1000 ;if (difference >0 ) -udelay (difference / ((val &0x0f ) +1 )); +udelay (DIV_ROUND_UP (difference, (val &0x0f ) +1 ));return ret; }
Greg Kroah-Hartman
maintainerPATCH 116/214 intel_idle: Dont register CPU notifier if we are not running.
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Rzeszutek Wilk <[email protected]>
commit 6f8c2e7933679f54b6478945dc72e59ef9a3d5e0 upstream.
The 'intel_idle_probe' probes the CPU and sets the CPU notifier. But if later on during the module initialization we fail (say in cpuidle_register_driver), we stop loading, but we neglect to unregister the CPU notifier. This means that during CPU hotplug events the system will fail:
calling intel_idle_init+0x0/0x326 @ 1intel_idle: MWAIT substates: 0x1120intel_idle: v0.4 model 0x2Aintel_idle: lapic_timer_reliable_states 0xffffffffintel_idle: intel_idle yielding to none
initcall intel_idle_init+0x0/0x326 returned -19 after 14 usecs
... some time later, offlining and onlining a CPU:
cpu 3 spinlock event irq 62
BUG: unable to ] __cpuidle_register_device+0x1c/0x120 PGD 99b8b067 PUD 99b95067 PMD 0 Oops: 0000 [#1] SMP Modules linked in: xen_evtchn nouveau mxm_wmi wmi radeon ttm i915 fbcon tileblit font atl1c bitblit softcursor drm_kms_helper video xen_blkfront xen_netfront fb_sys_fops sysimgblt sysfillrect syscopyarea xenfs xen_privcmd mperf CPU 0 Pid: 2302, comm: udevd Not tainted 3.8.0-rc3upstream-00249-g09ad159 #1 MSI MS-7680/H61M-P23 (MS-7680) RIP: e030:[<ffffffff814d956c>] [<ffffffff814d956c>] __cpuidle_register_device+0x1c/0x120 RSP: e02b:ffff88009dacfcb8 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff880105380000 RCX: 000000000000001c RDX: 0000000000000000 RSI: 0000000000000055 RDI: ffff880105380000 RBP: ffff88009dacfce8 R08: ffffffff81a4f048 R09: 0000000000000008 R10: 0000000000000008 R11: 0000000000000000 R12: ffff880105380000 R13: 00000000ffffffdd R14: 0000000000000000 R15: ffffffff81a523d0 FS: 00007f37bd83b7a0(0000) GS:ffff880105200000(0000) knlGS:0000000000000000 CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000008 CR3: 00000000a09ea000 CR4: 0000000000042660 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process udevd (pid: 2302, threadinfo ffff88009dace000, task ffff88009afb47f0) Stack: ffffffff8107f2d0 ffffffff810c2fb7 ffff88009dacfce8 00000000ffffffea ffff880105380000 00000000ffffffdd ffff88009dacfd08 ffffffff814d9882 0000000000000003 ffff880105380000 ffff88009dacfd28 ffffffff81340afd Call Trace: [<ffffffff8107f2d0>] ? collect_cpu_info_local+0x30/0x30 [<ffffffff810c2fb7>] ? __might_sleep+0xe7/0x100 [<ffffffff814d9882>] cpuidle_register_device+0x32/0x70 [<ffffffff81340afd>] intel_idle_cpu_init+0xad/0x110 [<ffffffff81340bc8>] cpu_hotplug_notify+0x68/0x80 [<ffffffff8166023d>] notifier_call_chain+0x4d/0x70 [<ffffffff810bc369>] __raw_notifier_call_chain+0x9/0x10 [<ffffffff81094a4b>] __cpu_notify+0x1b/0x30 [<ffffffff81652cf7>] _cpu_up+0x103/0x14b [<ffffffff81652e18>] cpu_up+0xd9/0xec [<ffffffff8164a254>] store_online+0x94/0xd0 [<ffffffff814122fb>] dev_attr_store+0x1b/0x20 [<ffffffff81216404>] sysfs_write_file+0xf4/0x170 [<ffffffff811a1024>] vfs_write+0xb4/0x130 [<ffffffff811a17ea>] sys_write+0x5a/0xa0 [<ffffffff816643a9>] system_call_fastpath+0x16/0x1b Code: 03 18 00 c9 c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 48 83 ec 30 48 89 5d e8 4c 89 65 f0 48 89 fb 4c 89 6d f8 e8 84 08 00 00 <48> 8b 78 08 49 89 c4 e8 f8 7f c1 ff 89 c2 b8 ea ff ff ff 84 d2 RIP [<ffffffff814d956c>] __cpuidle_register_device+0x1c/0x120 RSP <ffff88009dacfcb8>
This patch fixes that by moving the CPU notifier registration as the last item to be done by the module.
--- drivers/idle/intel_idle.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/idle/intel_idle.c +4 -3
@@ -443,10 +443,8 @@ static int intel_idle_probe(void)if (boot_cpu_has (X86_FEATURE_ARAT ))/* Always Reliable APIC Timer */ lapic_timer_reliable_states =LAPIC_TIMER_ALWAYS_RELIABLE ; -else { +else on_each_cpu (__setup_broadcast_timer, (void *)true,1 ); -register_cpu_notifier (&setup_broadcast_notifier); - }pr_debug (PREFIX "v" INTEL_IDLE_VERSION " model 0x%X\n" , boot_cpu_data.x86_model);
@@ -612,6 +610,9 @@ static int __init intel_idle_init(void) } } +if (lapic_timer_reliable_states !=LAPIC_TIMER_ALWAYS_RELIABLE ) +register_cpu_notifier (&setup_broadcast_notifier); +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 117/214 can: c_can: Set reserved bit in IFx_MASK2 to 1 on write
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Stein <[email protected]>
commit 2bd3bc4e8472424f1a6009825397639a8968920a upstream.
According to C_CAN documentation, the reserved bit in IFx_MASK2 register is fixed 1.
--- drivers/net/can/c_can/c_can.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/can/c_can/c_can.c +5 -1
@@ -446,8 +446,12 @@ static void c_can_setup_receive_object(s priv->write_reg (priv, &priv->regs->ifregs[iface].mask1,IFX_WRITE_LOW_16BIT (mask)); + +/* According to C_CAN documentation, the reserved bit +* in IFx_MASK2 register is fixed 1 +*/ priv->write_reg (priv, &priv->regs->ifregs[iface].mask2, -IFX_WRITE_HIGH_16BIT (mask)); +IFX_WRITE_HIGH_16BIT (mask) |BIT (13 )); priv->write_reg (priv, &priv->regs->ifregs[iface].arb1,IFX_WRITE_LOW_16BIT (id));
Greg Kroah-Hartman
maintainerPATCH 118/214 e1000e: DoS while TSO enabled caused by link partner with small MSS
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bruce Allan <[email protected]>
commit d821a4c4d11ad160925dab2bb009b8444beff484 upstream.
With a low enough MSS on the link partner and TSO enabled locally, the networking stack can periodically send a very large (e.g. 64KB) TCP message for which the driver will attempt to use more Tx descriptors than are available by default in the Tx ring. This is due to a workaround in the code that imposes a limit of only 4 MSS-sized segments per descriptor which appears to be a carry-over from the older e1000 driver and may be applicable only to some older PCI or PCIx parts which are not supported in e1000e. When the driver gets a message that is too large to fit across the configured number of Tx descriptors, it stops the upper stack from queueing any more and gets stuck in this state. After a timeout, the upper stack assumes the adapter is hung and calls the driver to reset it.
Remove the unnecessary limitation of using up to only 4 MSS-sized segments per Tx descriptor, and put in a hard failure test to catch when attempting to check for message sizes larger than would fit in the whole Tx ring. Refactor the remaining logic that limits the size of data per Tx descriptor from a seemingly arbitrary 8KB to a limit based on the dynamic size of the Tx packet buffer as described in the hardware specification.
Also, fix the logic in the check for space in the Tx ring for the next largest possible packet after the current one has been successfully queued for transmit, and use the appropriate defines for default ring sizes in e1000_probe instead of magic values.
This issue goes back to the introduction of e1000e in 2.6.24 when it was split off from e1000.
--- drivers/net/ethernet/intel/e1000e/e1000.h | 1 drivers/net/ethernet/intel/e1000e/netdev.c | 48 +++++++++++++---------------- 2 files changed, 24 insertions(+), 25 deletions(-)
drivers/net/ethernet/intel/e1000e/e1000.h +1 -0
@@ -309,6 +309,7 @@ struct e1000_adapter {*/ struct e1000_ring *tx_ring/* One per active queue */ ____cacheline_aligned_in_smp ; +u32 tx_fifo_limit;struct napi_struct napi;
drivers/net/ethernet/intel/e1000e/netdev.c +23 -25
112 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 119/214 mac80211: introduce IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit 5b632fe85ec82e5c43740b52e74c66df50a37db3 upstream.
Commit f0425beda4d404a6e751439b562100b902ba9c98 "mac80211: retry sending failed BAR frames later instead of tearing down aggr" caused regression on rt2x00 hardware (connection hangs). This regression was fixed by commit be03d4a45c09ee5100d3aaaedd087f19bc20d01 "rt2x00: Don't let mac80211 send a BAR when an AMPDU subframe fails". But the latter commit caused yet another problem reported in
https://bugzilla.kernel.org/show_bug.cgi?id=42828#c22
After long discussion in this thread:
http://mid.gmane.org/[email protected]
and testing various alternative solutions, which failed on one or other setup, we have no other good fix for the issues like just revert both mentioned earlier commits.
To do not affect other hardware which benefit from commit f0425beda4d404a6e751439b562100b902ba9c98, instead of reverting it, introduce flag that when used will restore mac80211 behaviour before the commit.
--- include/net/mac80211.h | 5 +++++ net/mac80211/status.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-)
include/net/mac80211.h +5 -0
@@ -1174,6 +1174,10 @@ enum sta_notify_cmd {* @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while * being idle (i.e. mac80211 doesn't have to go idle-off during the * the scan). +* +* @IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL: On this hardware TX BA session +* should be tear down once BAR frame will not be acked. +* */ enum ieee80211_hw_flags {IEEE80211_HW_HAS_RATE_CONTROL =1 <<0 ,
@@ -1201,6 +1205,7 @@ enum ieee80211_hw_flags {IEEE80211_HW_AP_LINK_PS =1 <<22 ,IEEE80211_HW_TX_AMPDU_SETUP_IN_HW =1 <<23 ,IEEE80211_HW_SCAN_WHILE_IDLE =1 <<24 , + IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL = 1<<26, };/**
net/mac80211/status.c +5 -1
@@ -432,7 +432,11 @@ void ieee80211_tx_status(struct ieee8021 IEEE80211_BAR_CTRL_TID_INFO_MASK) >>IEEE80211_BAR_CTRL_TID_INFO_SHIFT ; -ieee80211_set_bar_pending (sta, tid, ssn); +if (local->hw.flags & +IEEE80211_HW_TEARDOWN_AGGR_ON_BAR_FAIL ) +ieee80211_stop_tx_ba_session (&sta->sta, tid); +else +ieee80211_set_bar_pending (sta, tid, ssn); } }
Greg Kroah-Hartman
maintainerPATCH 120/214 PCI: shpchp: Use per-slot workqueues to avoid deadlock
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjorn Helgaas <[email protected]>
commit f652e7d2916fe2fcf9e7d709aa5b7476b431e2dd upstream.
When we have an SHPC-capable bridge with a second SHPC-capable bridge below it, pushing the upstream bridge's attention button causes a deadlock.
The deadlock happens because we use the shpchp_wq workqueue to run shpchp_pushbutton_thread(), which uses shpchp_disable_slot() to remove devices below the upstream bridge. When we remove the downstream bridge, we call shpc_remove(), the shpchp driver's .remove() method. That calls flush_workqueue(shpchp_wq), which deadlocks because the shpchp_pushbutton_thread() work item is still running.
This patch avoids the deadlock by creating a workqueue for every slot and removing the single shared workqueue.
Here's the call path that leads to the deadlock:
shpchp_queue_pushbutton_work
queue_work(shpchp_wq) # shpchp_pushbutton_thread
...
shpchp_pushbutton_thread
shpchp_disable_slot
remove_board
shpchp_unconfigure_device
pci_stop_and_remove_bus_device
...
shpc_remove # shpchp driver .remove method
hpc_release_ctlr
cleanup_slots
flush_workqueue(shpchp_wq)
This change is based on code inspection, since we don't have hardware with this topology.
--- drivers/pci/hotplug/shpchp.h | 2 +- drivers/pci/hotplug/shpchp_core.c | 26 ++++++++++++++------------ drivers/pci/hotplug/shpchp_ctrl.c | 6 +++--- 3 files changed, 18 insertions(+), 16 deletions(-)
drivers/pci/hotplug/shpchp.h +1 -1
@@ -46,7 +46,6 @@extern bool shpchp_poll_mode;extern int shpchp_poll_time;extern bool shpchp_debug; -extern struct workqueue_struct *shpchp_wq; #define dbg(format, arg...) \ do { \
@@ -90,6 +89,7 @@ struct slot {struct list_head slot_list;struct delayed_work work;/* work for button event */ struct mutex lock; +struct workqueue_struct *wq;u8 hp_slot; };
drivers/pci/hotplug/shpchp_core.c +14 -12
@@ -39,7 +39,6 @@bool shpchp_debug;bool shpchp_poll_mode;int shpchp_poll_time; -struct workqueue_struct *shpchp_wq;#define DRIVER_VERSION "0.4"#define DRIVER_AUTHOR "Dan Zink <[email protected]>, Greg Kroah-Hartman <[email protected]>, Dely Sy <[email protected]>"
@@ -122,6 +121,14 @@ static int init_slots(struct controller slot->device = ctrl->slot_device_offset + i; slot->hpc_ops = ctrl->hpc_ops; slot->number = ctrl->first_slot + (ctrl->slot_num_inc * i); + +snprintf (name,sizeof (name),"shpchp-%d" , slot->number); + slot->wq =alloc_workqueue (name,0 ,0 ); +if (!slot->wq) { + retval = -ENOMEM ; + goto error_info; + } +mutex_init (&slot->lock);INIT_DELAYED_WORK (&slot->work, shpchp_queue_pushbutton_work);
@@ -141,7 +148,7 @@ static int init_slots(struct controllerif (retval) {ctrl_err (ctrl,"pci_hp_register failed with error %d\n" , retval); - goto error_info; + goto error_slotwq; }get_power_status (hotplug_slot, &info->power_status);
@@ -153,6 +160,8 @@ static int init_slots(struct controller }return 0 ; +error_slotwq: +destroy_workqueue (slot->wq); error_info:kfree (info); error_hpslot:
@@ -173,7 +182,7 @@ void cleanup_slots(struct controller *ct slot = list_entry(tmp, struct slot, slot_list);list_del (&slot->slot_list);cancel_delayed_work (&slot->work); -flush_workqueue (shpchp_wq); +destroy_workqueue (slot->wq);pci_hp_deregister (slot->hotplug_slot); } }
@@ -356,18 +365,12 @@ static struct pci_driver shpc_driver = {static int __init shpcd_init (void ) { -int retval =0 ; - - shpchp_wq =alloc_ordered_workqueue ("shpchp" ,0 ); -if (!shpchp_wq) -return -ENOMEM ; +int retval; retval =pci_register_driver (&shpc_driver);dbg ("%s: pci_register_driver = %d\n" , __func__, retval);info (DRIVER_DESC " version: " DRIVER_VERSION "\n" ); -if (retval) { -destroy_workqueue (shpchp_wq); - } +return retval; }
@@ -375,7 +378,6 @@ static void __exit shpcd_cleanup(void) {dbg ("unload_shpchpd()\n" );pci_unregister_driver (&shpc_driver); -destroy_workqueue (shpchp_wq);info (DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n" ); }
drivers/pci/hotplug/shpchp_ctrl.c +3 -3
@@ -51,7 +51,7 @@ static int queue_interrupt_event(struct info->p_slot = p_slot;INIT_WORK (&info->work, interrupt_event_handler); -queue_work (shpchp_wq, &info->work); +queue_work (p_slot->wq, &info->work);return 0 ; }
@@ -456,7 +456,7 @@ void shpchp_queue_pushbutton_work(structkfree (info); goto out; } -queue_work (shpchp_wq, &info->work); +queue_work (p_slot->wq, &info->work); out:mutex_unlock (&p_slot->lock); }
@@ -504,7 +504,7 @@ static void handle_button_press_event(st p_slot->hpc_ops->green_led_blink (p_slot); p_slot->hpc_ops->set_attention_status (p_slot,0 ); -queue_delayed_work (shpchp_wq, &p_slot->work,5 *HZ ); +queue_delayed_work (p_slot->wq, &p_slot->work,5 *HZ );break ;case BLINKINGOFF_STATE :case BLINKINGON_STATE :
Greg Kroah-Hartman
maintainerPATCH 121/214 thinkpad-acpi: fix issuing duplicated key events for brightness up/down
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Hung <[email protected]>
commit ff413195e830541afeae469fc866ecd0319abd7e upstream.
The tp_features.bright_acpimode will not be set correctly for brightness control because ACPI_VIDEO_HID will not be located in ACPI. As a result, a duplicated key event will always be sent. acpi_video_backlight_support() is sufficient to detect standard ACPI brightness control.
--- drivers/platform/x86/thinkpad_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/thinkpad_acpi.c +1 -1
@@ -3402,7 +3402,7 @@ static int __init hotkey_init(struct ibm/* Do not issue duplicate brightness change events to * userspace. tpacpi_detect_brightness_capabilities() must have * been called before this point */ -if (tp_features.bright_acpimode &&acpi_video_backlight_support ()) { +if (acpi_video_backlight_support ()) {pr_info ("This ThinkPad has standard ACPI backlight " "brightness control, supported by the ACPI " "video driver\n" );
Greg Kroah-Hartman
maintainerPATCH 122/214 ALSA: HDA: Add inverted internal mic quirk for Lenovo S205
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit b3c5dce81584391af8b6dedb0647e65c17aab3a2 upstream.
The Lenovo Ideapad S205 has an internal mic where the right channel is phase inverted.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -4477,6 +4477,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x21ce ,"Lenovo T420" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21cf ,"Lenovo T520" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ), + SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), {} };
Greg Kroah-Hartman
maintainerPATCH 123/214 ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kaechele <[email protected]>
commit e4db0952e542090c605fd41d31d761f1b4624f4a upstream.
The Lenovo IdeaPad U310 has an internal mic where the right channel is phase inverted.
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -4477,6 +4477,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x21ce ,"Lenovo T420" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x21cf ,"Lenovo T520" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ), +SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), {} };
Greg Kroah-Hartman
maintainerPATCH 124/214 ALSA: hda - Fix oops caused by recent commit "Fix internal mic for Lenovo Ideapad U300s"
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit 83b0c6ba999643ee8ad6329f26e1cdc870e1a920 upstream.
Make sure we don't dereference the "quirk" pointer when it is null.
--- sound/pci/hda/patch_conexant.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/pci/hda/patch_conexant.c +3 -1
@@ -4430,7 +4430,9 @@ static void apply_fixup(struct hda_codecstruct conexant_spec *spec = codec->spec; quirk =snd_pci_quirk_lookup (codec->bus->pci, quirk); -if (quirk && table[quirk->value]) { +if (!quirk) +return ; +if (table[quirk->value]) {snd_printdd (KERN_INFO "hda_codec: applying pincfg for %s\n" , quirk->name);apply_pincfg (codec, table[quirk->value]);
Greg Kroah-Hartman
maintainerPATCH 125/214 ALSA: hda - Add stereo-dmic fixup for Acer Aspire One 522
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 63a077e27648b4043b1ca1b4e29f0c42d99616b6 upstream.
Acer Aspire One 522 has the infamous digital mic unit that needs the phase inversion fixup for stereo.
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=715737
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -4473,6 +4473,7 @@ static const struct snd_pci_quirk cxt505 };static const struct snd_pci_quirk cxt5066_fixups[] = { +SND_PCI_QUIRK (0x1025 ,0x0543 ,"Acer Aspire One 522" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x20f2 ,"Lenovo T400" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x215e ,"Lenovo T410" ,CXT_PINCFG_LENOVO_TP410 ),SND_PCI_QUIRK (0x17aa ,0x215f ,"Lenovo T510" ,CXT_PINCFG_LENOVO_TP410 ),
Greg Kroah-Hartman
maintainerPATCH 126/214 ALSA: hda/conexant - Correct vendor IDs for new codecs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 2d825fd82eb765412a558a56e193b77117d56699 upstream.
Never trust datasheet...
--- sound/pci/hda/patch_conexant.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
sound/pci/hda/patch_conexant.c +9 -6
@@ -4572,10 +4572,6 @@ static int patch_conexant_auto(struct hd*/ static const struct hda_codec_preset snd_hda_preset_conexant[] = { - { .id =0x14f11510 , .name ="CX20751/2" , - .patch = patch_conexant_auto }, - { .id =0x14f11511 , .name ="CX20753/4" , - .patch = patch_conexant_auto }, { .id =0x14f15045 , .name ="CX20549 (Venice)" , .patch = patch_cxt5045 }, { .id =0x14f15047 , .name ="CX20551 (Waikiki)" ,
@@ -4610,11 +4606,15 @@ static const struct hda_codec_preset snd .patch = patch_conexant_auto }, { .id = 0x14f150b9, .name = "CX20665", .patch = patch_conexant_auto }, + { .id = 0x14f1510f, .name = "CX20751/2", + .patch = patch_conexant_auto }, + { .id = 0x14f15110, .name = "CX20751/2", + .patch = patch_conexant_auto }, + { .id = 0x14f15111, .name = "CX20753/4", + .patch = patch_conexant_auto }, {}/* terminator */ }; -MODULE_ALIAS ("snd-hda-codec-id:14f11510" ); -MODULE_ALIAS ("snd-hda-codec-id:14f11511" );MODULE_ALIAS ("snd-hda-codec-id:14f15045" );MODULE_ALIAS ("snd-hda-codec-id:14f15047" );MODULE_ALIAS ("snd-hda-codec-id:14f15051" );
@@ -4632,6 +4632,9 @@ MODULE_ALIAS("snd-hda-codec-id:14f150ab"MODULE_ALIAS ("snd-hda-codec-id:14f150ac" );MODULE_ALIAS ("snd-hda-codec-id:14f150b8" );MODULE_ALIAS ("snd-hda-codec-id:14f150b9" ); +MODULE_ALIAS ("snd-hda-codec-id:14f1510f" ); +MODULE_ALIAS ("snd-hda-codec-id:14f15110" ); +MODULE_ALIAS ("snd-hda-codec-id:14f15111" );MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Conexant HD-audio codec" );
Greg Kroah-Hartman
maintainerPATCH 127/214 ALSA: hda - Add Conexant CX20755/20756/20757 codec IDs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 42c364ace52ae6b4699105b39f2559c256b6cd4c upstream.
These are just compatible with other CX2075x codecs.
--- sound/pci/hda/patch_conexant.c | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/pci/hda/patch_conexant.c +9 -0
@@ -4612,6 +4612,12 @@ static const struct hda_codec_preset snd .patch = patch_conexant_auto }, { .id = 0x14f15111, .name = "CX20753/4", .patch = patch_conexant_auto }, + { .id = 0x14f15113, .name = "CX20755", + .patch = patch_conexant_auto }, + { .id = 0x14f15114, .name = "CX20756", + .patch = patch_conexant_auto }, + { .id = 0x14f15115, .name = "CX20757", + .patch = patch_conexant_auto }, {}/* terminator */ };
@@ -4635,6 +4641,9 @@ MODULE_ALIAS("snd-hda-codec-id:14f150b9"MODULE_ALIAS ("snd-hda-codec-id:14f1510f" );MODULE_ALIAS ("snd-hda-codec-id:14f15110" );MODULE_ALIAS ("snd-hda-codec-id:14f15111" ); +MODULE_ALIAS ("snd-hda-codec-id:14f15113" ); +MODULE_ALIAS ("snd-hda-codec-id:14f15114" ); +MODULE_ALIAS ("snd-hda-codec-id:14f15115" );MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Conexant HD-audio codec" );
Greg Kroah-Hartman
maintainerPATCH 128/214 ALSA: hda - Add support for CX20952
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 8f42d7698751a45cd9f7134a5da49bc5b6206179 upstream.
It's a superset of the existing CX2075x codecs, so we can reuse the existing parser code.
--- sound/pci/hda/patch_conexant.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/patch_conexant.c +3 -0
@@ -4618,6 +4618,8 @@ static const struct hda_codec_preset snd .patch = patch_conexant_auto }, { .id = 0x14f15115, .name = "CX20757", .patch = patch_conexant_auto }, + { .id = 0x14f151d7, .name = "CX20952", + .patch = patch_conexant_auto }, {}/* terminator */ };
@@ -4644,6 +4646,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15111"MODULE_ALIAS ("snd-hda-codec-id:14f15113" );MODULE_ALIAS ("snd-hda-codec-id:14f15114" );MODULE_ALIAS ("snd-hda-codec-id:14f15115" ); +MODULE_ALIAS ("snd-hda-codec-id:14f151d7" );MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Conexant HD-audio codec" );
Greg Kroah-Hartman
maintainerPATCH 129/214 tty: serial: imx: dont reinit clock in imx_setup_ufcr()
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dirk Behme <[email protected]>
commit 7be0670f7b9198382938a03ff3db7f47ef6b4780 upstream.
Remove the clock configuration from imx_setup_ufcr(). This isn't needed here and will cause garbage output if done.
To be be sure that we only touch the bits we want (TXTL and RXTL) we have to mask out all other bits of the UFCR register. Add one non-existing bit macro for this, too (bit 6, DCEDTE on i.MX6).
[bwh: Backported to 3.2: deleted code in imx_setup_ufcr() refers to
sport->clk not sport->clk_per]
--- drivers/tty/serial/imx.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/tty/serial/imx.c +4 -14
@@ -131,6 +131,7 @@#define UCR4_OREN (1<<1)/* Receiver overrun interrupt enable */ #define UCR4_DREN (1<<0)/* Recv data ready interrupt enable */ #define UFCR_RXTL_SHF 0/* Receiver trigger level shift */ +#define UFCR_DCEDTE (1<<6)/* DCE/DTE mode select */ #define UFCR_RFDIV (7<<7)/* Reference freq divider mask */ #define UFCR_RFDIV_REG (x) (((x) < 7 ? 6 - (x) : 6) << 7)#define UFCR_TXTL_SHF 10/* Transmitter trigger level shift */
@@ -666,22 +667,11 @@ static void imx_break_ctl(struct uart_postatic int imx_setup_ufcr (struct imx_port *sport,unsigned int mode) {unsigned int val; -unsigned int ufcr_rfdiv; - -/* set receiver / transmitter trigger level. -* RFDIV is set such way to satisfy requested uartclk value -*/ - val =TXTL <<10 |RXTL ; - ufcr_rfdiv = (clk_get_rate (sport->clk) + sport->port.uartclk /2 ) - / sport->port.uartclk; - -if (!ufcr_rfdiv) - ufcr_rfdiv =1 ; - - val |=UFCR_RFDIV_REG (ufcr_rfdiv); +/* set receiver / transmitter trigger level */ + val =readl (sport->port.membase +UFCR ) & (UFCR_RFDIV |UFCR_DCEDTE ); + val |=TXTL <<UFCR_TXTL_SHF |RXTL ;writel (val, sport->port.membase +UFCR ); -return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 130/214 x86, build, icc: Remove uninitialized_var() from compiler-intel.h
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 503cf95c061a0551eb684da364509297efbe55d9 upstream.
When compiling with icc, <linux/compiler-gcc.h> ends up included because the icc environment defines __GNUC__. Thus, we neither need nor want to have this macro defined in both compiler-gcc.h and compiler-intel.h, and the fact that they are inconsistent just makes the compiler spew warnings.
--- include/linux/compiler-intel.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/compiler-intel.h +0 -2
@@ -27,5 +27,3 @@#define __must_be_array (a) 0#endif - -#define uninitialized_var (x) x
Greg Kroah-Hartman
maintainerPATCH 131/214 x86, build: Pass in additional -mno-mmx, -mno-sse options
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 8b3b005d675726e38bc504d2e35a991e55819155 upstream.
In checkin
5551a34e5aea x86-64, build: Always pass in -mno-sse
we unconditionally added -mno-sse to the main build, to keep newer compilers from generating SSE instructions from autovectorization. However, this did not extend to the special environments (arch/x86/boot, arch/x86/boot/compressed, and arch/x86/realmode/rm). Add -mno-sse to the compiler command line for these environments, and add -mno-mmx to all the environments as well, as we don't want a compiler to generate MMX code either.
This patch also removes a $(cc-option) call for -m32, since we have long since stopped supporting compilers too old for the -m32 option, and in fact hardcode it in other places in the Makefiles.
[bwh: Backported to 3.2:
- Drop changes to arch/x86/Makefile, which sets these flags earlier
- Adjust context
- Drop changes to arch/x86/realmode/rm/Makefile which doesn't exist]
--- arch/x86/boot/Makefile | 6 +++--- arch/x86/boot/compressed/Makefile | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
arch/x86/boot/Makefile +3 -3
@@ -52,18 +52,18 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE # How to compile the 16-bit code. Note we always compile for -march=i386, # that way we can complain to the user if the CPU is insufficient. -KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ +KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \ -DDISABLE_BRANCH_PROFILING \ -Wall -Wstrict-prototypes \ -march=i386 -mregparm=3 \ -include $(srctree)/$(src)/code16gcc.h \ -fno-strict-aliasing -fomit-frame-pointer \ + -mno-mmx -mno-sse \ $(call cc-option, -ffreestanding) \ $(call cc-option, -fno-toplevel-reorder,\ - $(call cc-option, -fno-unit-at-a-time)) \ + $(call cc-option, -fno-unit-at-a-time)) \ $(call cc-option, -fno-stack-protector) \ $(call cc-option, -mpreferred-stack-boundary=2) -KBUILD_CFLAGS += $(call cc-option, -m32) KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ GCOV_PROFILE := n
arch/x86/boot/compressed/Makefile +1 -0
@@ -12,6 +12,7 @@ KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFIL cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small KBUILD_CFLAGS += $(cflags-y) +KBUILD_CFLAGS += -mno-mmx -mno-sse KBUILD_CFLAGS += $(call cc-option,-ffreestanding) KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
Greg Kroah-Hartman
maintainerPATCH 132/214 x86/apic: Disable I/O APIC before shutdown of the local APIC
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenghua Yu <[email protected]>
commit 522e66464467543c0d88d023336eec4df03ad40b upstream.
In reboot and crash path, when we shut down the local APIC, the I/O APIC is still active. This may cause issues because external interrupts can still come in and disturb the local APIC during shutdown process.
To quiet external interrupts, disable I/O APIC before shutdown local APIC.
--- arch/x86/kernel/crash.c | 2 +- arch/x86/kernel/reboot.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-)
arch/x86/kernel/crash.c +1 -1
@@ -95,10 +95,10 @@ void native_machine_crash_shutdown(struccpu_emergency_vmxoff ();cpu_emergency_svm_disable (); -lapic_shutdown ();#if defined(CONFIG_X86_IO_APIC )disable_IO_APIC ();#endif +lapic_shutdown ();#ifdef CONFIG_HPET_TIMER hpet_disable ();#endif
arch/x86/kernel/reboot.c +7 -4
@@ -668,6 +668,13 @@ void native_machine_shutdown(void)/* The boot cpu is always logical cpu 0 */ int reboot_cpu_id =0 ; +#endif + +#ifdef CONFIG_X86_IO_APIC +disable_IO_APIC (); +#endif + +#ifdef CONFIG_SMP #ifdef CONFIG_X86_32 /* See if there has been given a command line override */
@@ -691,10 +698,6 @@ void native_machine_shutdown(void)lapic_shutdown (); -#ifdef CONFIG_X86_IO_APIC -disable_IO_APIC (); -#endif -#ifdef CONFIG_HPET_TIMER hpet_disable ();#endif
Greg Kroah-Hartman
maintainerPATCH 133/214 x86: fix build error and kconfig for ia32_emulation and binfmt
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
commit d1603990ea626668c78527376d9ec084d634202d upstream.
Fix kconfig warning and build errors on x86_64 by selecting BINFMT_ELF when COMPAT_BINFMT_ELF is being selected.
warning: (IA32_EMULATION) selects COMPAT_BINFMT_ELF which has unmet direct dependencies (COMPAT && BINFMT_ELF)
fs/built-in.o: In function `elf_core_dump':
compat_binfmt_elf.c:(.text+0x3e093): undefined reference to elf_core_extra_phdrs' compat_binfmt_elf.c:(.text+0x3ebcd): undefined reference to elf_core_extra_data_size' compat_binfmt_elf.c:(.text+0x3eddd): undefined reference to elf_core_write_extra_phdrs' compat_binfmt_elf.c:(.text+0x3f004): undefined reference to elf_core_write_extra_data'
[ hpa: This was sent to me for -next but it is a low risk build fix ]
--- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -2157,6 +2157,7 @@ source "fs/Kconfig.binfmt" config IA32_EMULATION bool "IA32 Emulation" depends on X86_64 + select BINFMT_ELF select COMPAT_BINFMT_ELF ---help--- Include code to run legacy 32-bit programs under a
Greg Kroah-Hartman
maintainerPATCH 134/214 n_gsm : Flow control handling in Mux driver
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Berat <[email protected]>
commit c01af4fec2c8f303d6b3354d44308d9e6bef8026 upstream.
- Correcting handling of FCon/FCoff in order to respect 27.010 spec
- Consider FCon/off will overide all dlci flow control except for dlci0 as we must be able to send control frames.
- Dlci constipated handling according to FC, RTC and RTR values.
- Modifying gsm_dlci_data_kick and gsm_dlci_data_sweep according to dlci constipated value
--- drivers/tty/n_gsm.c | 79 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 22 deletions(-)
drivers/tty/n_gsm.c +57 -22
@@ -673,6 +673,8 @@ static struct gsm_msg *gsm_data_alloc(st* * The tty device has called us to indicate that room has appeared in * the transmit queue. Ram more data into the pipe if we have any +* If we have been flow-stopped by a CMD_FCOFF, then we can only +* send messages on DLCI0 until CMD_FCON * * FIXME: lock against link layer control transmissions */
@@ -680,15 +682,19 @@ static struct gsm_msg *gsm_data_alloc(ststatic void gsm_data_kick (struct gsm_mux *gsm) {struct gsm_msg *msg = gsm->tx_head; +struct gsm_msg *free_msg;int len;int skip_sof =0 ; -/* FIXME: We need to apply this solely to data messages */ -if (gsm->constipated) -return ; - -while (gsm->tx_head !=NULL ) { - msg = gsm->tx_head; +while (msg) { +if (gsm->constipated && msg->addr) { + msg = msg->next; +continue ; + } +if (gsm->dlci[msg->addr]->constipated) { + msg = msg->next; +continue ; + }if (gsm->encoding !=0 ) { gsm->txframe[0 ] =GSM1_SOF ; len = gsm_stuff_frame(msg->data,
@@ -711,15 +717,19 @@ static void gsm_data_kick(struct gsm_mux len - skip_sof) < 0)break ;/* FIXME: Can eliminate one SOF in many more cases */ - gsm->tx_head = msg->next; -if (gsm->tx_head ==NULL ) - gsm->tx_tail =NULL ; gsm->tx_bytes -= msg->len; -kfree (msg);/* For a burst of frames skip the extra SOF within the burst */ skip_sof =1 ; + +if (gsm->tx_head == msg) + gsm->tx_head = msg->next; + free_msg = msg; + msg = msg->next; +kfree (free_msg); } +if (!gsm->tx_head) + gsm->tx_tail =NULL ; }/**
@@ -738,6 +748,8 @@ static void __gsm_data_queue(struct gsm_u8 *dp = msg->data;u8 *fcs = dp + msg->len; +WARN_ONCE (dlci->constipated,"%s: queueing from a constipated DLCI" , + __func__);/* Fill in the header */ if (gsm->encoding ==0 ) {if (msg->len <128 )
@@ -947,6 +959,9 @@ static void gsm_dlci_data_sweep(struct gbreak ; dlci = gsm->dlci[i];if (dlci ==NULL || dlci->constipated) { +if (dlci && (debug &0x20 )) +pr_info ("%s: DLCI %d is constipated" , + __func__, i); i++;continue ; }
@@ -976,6 +991,13 @@ static void gsm_dlci_data_kick(struct gsunsigned long flags;int sweep; +if (dlci->constipated) { +if (debug &0x20 ) +pr_info ("%s: DLCI %d is constipated" , + __func__, dlci->addr); +return ; + } +spin_lock_irqsave (&dlci->gsm->tx_lock, flags);/* If we have nothing running then we need to fire up */ sweep = (dlci->gsm->tx_bytes <TX_THRESH_LO );
@@ -1033,6 +1055,7 @@ static void gsm_process_modem(struct tty {int mlines =0 ;u8 brk =0 ; +int fc;/* The modem status command can either contain one octet (v.24 signals) or two octets (v.24 signals + break signals). The length field will
@@ -1044,19 +1067,27 @@ static void gsm_process_modem(struct ttyelse { brk = modem &0x7f ; modem = (modem >>7 ) &0x7f ; - }; + }/* Flow control/ready to communicate */ -if (modem &MDM_FC ) { + fc = (modem &MDM_FC ) || !(modem &MDM_RTR ); +if (fc && !dlci->constipated) { +if (debug &0x20 ) +pr_info ("%s: DLCI %d START constipated (tx_bytes=%d)" , + __func__, dlci->addr, dlci->gsm->tx_bytes);/* Need to throttle our output on this device */ dlci->constipated =1 ; - } -if (modem &MDM_RTC ) { - mlines |=TIOCM_DSR |TIOCM_DTR ; + }else if (!fc && dlci->constipated) { +if (debug &0x20 ) +pr_info ("%s: DLCI %d END constipated (tx_bytes=%d)" , + __func__, dlci->addr, dlci->gsm->tx_bytes); dlci->constipated =0 ;gsm_dlci_data_kick (dlci); } +/* Map modem bits */ +if (modem &MDM_RTC ) + mlines |=TIOCM_DSR |TIOCM_DTR ;if (modem &MDM_RTR ) mlines |=TIOCM_RTS |TIOCM_CTS ;if (modem &MDM_IC )
@@ -1225,19 +1256,23 @@ static void gsm_control_message(struct ggsm_control_reply (gsm,CMD_TEST , data, clen);break ;case CMD_FCON : -/* Modem wants us to STFU */ - gsm->constipated =1 ; -gsm_control_reply (gsm,CMD_FCON ,NULL ,0 ); -break ; -case CMD_FCOFF :/* Modem can accept data again */ +if (debug &0x20 ) +pr_info ("%s: GSM END constipation" , __func__); gsm->constipated =0 ; -gsm_control_reply (gsm,CMD_FCOFF ,NULL ,0 ); +gsm_control_reply (gsm,CMD_FCON ,NULL ,0 );/* Kick the link in case it is idling */ spin_lock_irqsave (&gsm->tx_lock, flags);gsm_data_kick (gsm);spin_unlock_irqrestore (&gsm->tx_lock, flags);break ; +case CMD_FCOFF : +/* Modem wants us to STFU */ +if (debug &0x20 ) +pr_info ("%s: GSM START constipation" , __func__); + gsm->constipated =1 ; +gsm_control_reply (gsm,CMD_FCOFF ,NULL ,0 ); +break ;case CMD_MSC :/* Out of band modem line change indicator for a DLCI */ gsm_control_modem (gsm, data, clen);
@@ -2306,7 +2341,7 @@ static void gsmld_receive_buf(struct tty gsm->error (gsm, *dp, flags);break ;default : -WARN_ONCE ("%s: unknown flag %d\n" , +WARN_ONCE (1 ,"%s: unknown flag %d\n" ,tty_name (tty, buf), flags);break ; }
Greg Kroah-Hartman
maintainerPATCH 135/214 char: n_gsm: remove message filtering for contipated DLCI
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "samix.lebsir" <[email protected]>
commit 10c6c383e43565c9c6ec07ff8eb2825f8091bdf0 upstream.
The design of uplink flow control in the mux driver is
that for constipated channels data will backup into the per-channel fifos, and any messages that make it to the outbound message queue will still go out.
Code was added to also stop messages that were in the outbound queue but this requires filtering through all the messages on the queue for stopped dlcis and changes some of the mux logic unneccessarily.
The message fiiltering was removed to be in line w/ the original design as the message filtering does not provide any solution. Extra debug messages used during investigation were also removed.
--- drivers/tty/n_gsm.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/tty/n_gsm.c +1 -24
@@ -691,10 +691,6 @@ static void gsm_data_kick(struct gsm_mux msg = msg->next;continue ; } -if (gsm->dlci[msg->addr]->constipated) { - msg = msg->next; -continue ; - }if (gsm->encoding !=0 ) { gsm->txframe[0 ] =GSM1_SOF ; len = gsm_stuff_frame(msg->data,
@@ -748,8 +744,6 @@ static void __gsm_data_queue(struct gsm_u8 *dp = msg->data;u8 *fcs = dp + msg->len; -WARN_ONCE (dlci->constipated,"%s: queueing from a constipated DLCI" , - __func__);/* Fill in the header */ if (gsm->encoding ==0 ) {if (msg->len <128 )
@@ -959,9 +953,6 @@ static void gsm_dlci_data_sweep(struct gbreak ; dlci = gsm->dlci[i];if (dlci ==NULL || dlci->constipated) { -if (dlci && (debug &0x20 )) -pr_info ("%s: DLCI %d is constipated" , - __func__, i); i++;continue ; }
@@ -991,12 +982,8 @@ static void gsm_dlci_data_kick(struct gsunsigned long flags;int sweep; -if (dlci->constipated) { -if (debug &0x20 ) -pr_info ("%s: DLCI %d is constipated" , - __func__, dlci->addr); +if (dlci->constipated)return ; - }spin_lock_irqsave (&dlci->gsm->tx_lock, flags);/* If we have nothing running then we need to fire up */
@@ -1072,15 +1059,9 @@ static void gsm_process_modem(struct tty/* Flow control/ready to communicate */ fc = (modem &MDM_FC ) || !(modem &MDM_RTR );if (fc && !dlci->constipated) { -if (debug &0x20 ) -pr_info ("%s: DLCI %d START constipated (tx_bytes=%d)" , - __func__, dlci->addr, dlci->gsm->tx_bytes);/* Need to throttle our output on this device */ dlci->constipated =1 ; }else if (!fc && dlci->constipated) { -if (debug &0x20 ) -pr_info ("%s: DLCI %d END constipated (tx_bytes=%d)" , - __func__, dlci->addr, dlci->gsm->tx_bytes); dlci->constipated =0 ;gsm_dlci_data_kick (dlci); }
@@ -1257,8 +1238,6 @@ static void gsm_control_message(struct gbreak ;case CMD_FCON :/* Modem can accept data again */ -if (debug &0x20 ) -pr_info ("%s: GSM END constipation" , __func__); gsm->constipated =0 ;gsm_control_reply (gsm,CMD_FCON ,NULL ,0 );/* Kick the link in case it is idling */
@@ -1268,8 +1247,6 @@ static void gsm_control_message(struct gbreak ;case CMD_FCOFF :/* Modem wants us to STFU */ -if (debug &0x20 ) -pr_info ("%s: GSM START constipation" , __func__); gsm->constipated =1 ;gsm_control_reply (gsm,CMD_FCOFF ,NULL ,0 );break ;
Greg Kroah-Hartman
maintainerPATCH 136/214 n_gsm: avoid accessing freed memory during CMD_FCOFF condition
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russ Gorby <[email protected]>
commit b4338e1efc339986cf6c0a3652906e914a86e2d3 upstream.
gsm_data_kick was recently modified to allow messages on the tx queue bound for DLCI0 to flow even during FCOFF conditions. Unfortunately we introduced a bug discovered by code inspection where subsequent list traversers can access freed memory if the DLCI0 messages were not all at the head of the list.
Replaced singly linked tx list w/ a list_head and used provided interfaces for traversing and deleting members.
--- drivers/tty/n_gsm.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
drivers/tty/n_gsm.c +13 -27
@@ -108,7 +108,7 @@ struct gsm_mux_net {*/ struct gsm_msg { -struct gsm_msg *next; +struct list_head list;u8 addr;/* DLCI address + flags */ u8 ctrl;/* Control byte + flags */ unsigned int len;/* Length of data block (can be zero) */
@@ -245,8 +245,7 @@ struct gsm_mux {unsigned int tx_bytes;/* TX data outstanding */ #define TX_THRESH_HI 8192#define TX_THRESH_LO 2048 -struct gsm_msg *tx_head;/* Pending data packets */ -struct gsm_msg *tx_tail; +struct list_head tx_list;/* Pending data packets */ /* Control messages */ struct timer_list t2_timer;/* Retransmit timer for commands */
@@ -663,7 +662,7 @@ static struct gsm_msg *gsm_data_alloc(st m->len = len; m->addr = addr; m->ctrl = ctrl; - m->next =NULL ; +INIT_LIST_HEAD (&m->list);return m; }
@@ -681,16 +680,13 @@ static struct gsm_msg *gsm_data_alloc(ststatic void gsm_data_kick (struct gsm_mux *gsm) { -struct gsm_msg *msg = gsm->tx_head; -struct gsm_msg *free_msg; +struct gsm_msg *msg, *nmsg;int len;int skip_sof =0 ; -while (msg) { -if (gsm->constipated && msg->addr) { - msg = msg->next; +list_for_each_entry_safe (msg, nmsg, &gsm->tx_list, list) { +if (gsm->constipated && msg->addr)continue ; - }if (gsm->encoding !=0 ) { gsm->txframe[0 ] =GSM1_SOF ; len = gsm_stuff_frame(msg->data,
@@ -718,14 +714,9 @@ static void gsm_data_kick(struct gsm_muxburst */ skip_sof =1 ; -if (gsm->tx_head == msg) - gsm->tx_head = msg->next; - free_msg = msg; - msg = msg->next; -kfree (free_msg); +list_del (&msg->list); +kfree (msg); } -if (!gsm->tx_head) - gsm->tx_tail =NULL ; }/**
@@ -774,11 +765,7 @@ static void __gsm_data_queue(struct gsm_ msg->data = dp;/* Add to the actual output queue */ -if (gsm->tx_tail) - gsm->tx_tail->next = msg; -else - gsm->tx_head = msg; - gsm->tx_tail = msg; +list_add_tail (&msg->list, &gsm->tx_list); gsm->tx_bytes += msg->len;gsm_data_kick (gsm); }
@@ -2052,7 +2039,7 @@ void gsm_cleanup_mux(struct gsm_mux *gsm {int i;struct gsm_dlci *dlci = gsm->dlci[0 ]; -struct gsm_msg *txq; +struct gsm_msg *txq, *utxq;struct gsm_control *gc; gsm->dead =1 ;
@@ -2087,11 +2074,9 @@ void gsm_cleanup_mux(struct gsm_mux *gsmif (gsm->dlci[i])gsm_dlci_release (gsm->dlci[i]);/* Now wipe the queues */ -for (txq = gsm->tx_head; txq !=NULL ; txq = gsm->tx_head) { - gsm->tx_head = txq->next; +list_for_each_entry_safe (txq, ntxq, &gsm->tx_list, list)kfree (txq); - } - gsm->tx_tail =NULL ; +INIT_LIST_HEAD (&gsm->tx_list); }EXPORT_SYMBOL_GPL (gsm_cleanup_mux);
@@ -2202,6 +2187,7 @@ struct gsm_mux *gsm_alloc_mux(void) }spin_lock_init (&gsm->lock);kref_init (&gsm->ref); +INIT_LIST_HEAD (&gsm->tx_list); gsm->t1 =T1 ; gsm->t2 =T2 ;
Greg Kroah-Hartman
maintainerPATCH 137/214 n_gsm: replace kfree_skb w/ appropriate dev_* versions
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russ Gorby <[email protected]>
commit 329e56780e514a7ab607bcb51a52ab0dc2669414 upstream.
Drivers are supposed to use the dev_* versions of the kfree_skb interfaces. In a couple of cases we were called with IRQs disabled as well which kfree_skb() does not expect.
Replaced kfree_skb calls w/ dev_kfree_skb and dev_kfree_skb_any
--- drivers/tty/n_gsm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/n_gsm.c +4 -4
@@ -879,7 +879,7 @@ static int gsm_dlci_data_output_framed(sif (len > gsm->mtu) {if (dlci->adaption ==3 ) {/* Over long frame, bin it */ -kfree_skb (dlci->skb); +dev_kfree_skb_any (dlci->skb); dlci->skb =NULL ;return 0 ; }
@@ -908,7 +908,7 @@ static int gsm_dlci_data_output_framed(sskb_pull (dlci->skb, len);__gsm_data_queue (dlci, msg);if (last) { -kfree_skb (dlci->skb); +dev_kfree_skb_any (dlci->skb); dlci->skb =NULL ; }return size;
@@ -1688,7 +1688,7 @@ static void gsm_dlci_free(struct kref *r dlci->gsm->dlci[dlci->addr] =NULL ;kfifo_free (dlci->fifo);while ((dlci->skb =skb_dequeue (&dlci->skb_list))) -kfree_skb (dlci->skb); +dev_kfree_skb (dlci->skb);kfree (dlci); }
@@ -2039,7 +2039,7 @@ void gsm_cleanup_mux(struct gsm_mux *gsm {int i;struct gsm_dlci *dlci = gsm->dlci[0 ]; -struct gsm_msg *txq, *utxq; +struct gsm_msg *txq, *ntxq;struct gsm_control *gc; gsm->dead =1 ;
Greg Kroah-Hartman
maintainerPATCH 138/214 x86 get_unmapped_area: Access mmap_legacy_base through mm_struct member
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Radu Caragea <[email protected]>
commit 41aacc1eea645c99edbe8fbcf78a97dc9b862adc upstream.
This is the updated version of df54d6fa5427 ("x86 get_unmapped_area():
use proper mmap base for bottom-up direction") that only randomizes the mmap base address once.
--- arch/x86/kernel/sys_x86_64.c | 2 +- arch/x86/mm/mmap.c | 6 ++++-- include/linux/mm_types.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/sys_x86_64.c +1 -1
@@ -115,7 +115,7 @@ static void find_start_end(unsigned long *begin = new_begin; } }else { - *begin =TASK_UNMAPPED_BASE ; + *begin = current->mm->mmap_legacy_base; *end =TASK_SIZE ; } }
arch/x86/mm/mmap.c +4 -2
@@ -112,12 +112,14 @@ static unsigned long mmap_legacy_base(vo*/ void arch_pick_mmap_layout (struct mm_struct *mm) { + mm->mmap_legacy_base =mmap_legacy_base (); + mm->mmap_base =mmap_base (); +if (mmap_is_legacy ()) { - mm->mmap_base =mmap_legacy_base (); + mm->mmap_base = mm->mmap_legacy_base; mm->get_unmapped_area = arch_get_unmapped_area; mm->unmap_area = arch_unmap_area; }else { - mm->mmap_base =mmap_base (); mm->get_unmapped_area = arch_get_unmapped_area_topdown; mm->unmap_area = arch_unmap_area_topdown; }
include/linux/mm_types.h +1 -0
@@ -306,6 +306,7 @@ struct mm_struct {void (*unmap_area) (struct mm_struct *mm,unsigned long addr);#endif unsigned long mmap_base;/* base of mmap area */ +unsigned long mmap_legacy_base;/* base of mmap area in bottom-up allocations */ unsigned long task_size;/* size of task vm space */ unsigned long cached_hole_size;/* if non-zero, the largest hole below free_area_cache */ unsigned long free_area_cache;/* first hole of size cached_hole_size or larger */
Greg Kroah-Hartman
maintainerPATCH 139/214 ptrace/x86: Introduce set_task_blockstep() helper
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 848e8f5f0ad3169560c516fff6471be65f76e69f upstream.
No functional changes, preparation for the next fix and for uprobes single-step fixes.
Move the code playing with TIF_BLOCKSTEP/DEBUGCTLMSR_BTF into the new helper, set_task_blockstep().
--- arch/x86/kernel/step.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-)
arch/x86/kernel/step.c +21 -20
@@ -157,6 +157,21 @@ static int enable_single_step(struct tasreturn 1 ; } +static void set_task_blockstep (struct task_struct *task,bool on) +{ +unsigned long debugctl; + + debugctl =get_debugctlmsr (); +if (on) { + debugctl |=DEBUGCTLMSR_BTF ; +set_tsk_thread_flag (task,TIF_BLOCKSTEP ); + }else { + debugctl &= ~DEBUGCTLMSR_BTF ; +clear_tsk_thread_flag (task,TIF_BLOCKSTEP ); + } +update_debugctlmsr (debugctl); +} +/* * Enable single or block step. */
@@ -169,19 +184,10 @@ static void enable_step(struct task_stru* So no one should try to use debugger block stepping in a program * that uses user-mode single stepping itself. */ -if (enable_single_step (child) && block) { -unsigned long debugctl =get_debugctlmsr (); - - debugctl |=DEBUGCTLMSR_BTF ; -update_debugctlmsr (debugctl); -set_tsk_thread_flag (child,TIF_BLOCKSTEP ); - }else if (test_tsk_thread_flag (child,TIF_BLOCKSTEP )) { -unsigned long debugctl =get_debugctlmsr (); - - debugctl &= ~DEBUGCTLMSR_BTF ; -update_debugctlmsr (debugctl); -clear_tsk_thread_flag (child,TIF_BLOCKSTEP ); - } +if (enable_single_step (child) && block) +set_task_blockstep (child, true); +else if (test_tsk_thread_flag (child,TIF_BLOCKSTEP )) +set_task_blockstep (child, false); }void user_enable_single_step (struct task_struct *child)
@@ -199,13 +205,8 @@ void user_disable_single_step(struct tas/* * Make sure block stepping (BTF) is disabled. */ -if (test_tsk_thread_flag (child,TIF_BLOCKSTEP )) { -unsigned long debugctl =get_debugctlmsr (); - - debugctl &= ~DEBUGCTLMSR_BTF ; -update_debugctlmsr (debugctl); -clear_tsk_thread_flag (child,TIF_BLOCKSTEP ); - } +if (test_tsk_thread_flag (child,TIF_BLOCKSTEP )) +set_task_blockstep (child, false);/* Always clear TIF_SINGLESTEP... */ clear_tsk_thread_flag (child,TIF_SINGLESTEP );
Greg Kroah-Hartman
maintainerPATCH 140/214 ptrace/x86: Partly fix set_task_blockstep()->update_debugctlmsr() logic
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 95cf00fa5d5e2a200a2c044c84bde8389a237e02 upstream.
Afaics the usage of update_debugctlmsr() and TIF_BLOCKSTEP in step.c was always very wrong.
1. update_debugctlmsr() was simply unneeded. The child sleeps TASK_TRACED, __switch_to_xtra(next_p => child) should notice TIF_BLOCKSTEP and set/clear DEBUGCTLMSR_BTF after resume if needed.
2. It is wrong. The state of DEBUGCTLMSR_BTF bit in CPU register should always match the state of current's TIF_BLOCKSTEP bit.
3. Even get_debugctlmsr() + update_debugctlmsr() itself does not look right. Irq can change other bits in MSR_IA32_DEBUGCTLMSR register or the caller can be preempted in between.
4. It is not safe to play with TIF_BLOCKSTEP if task != current. DEBUGCTLMSR_BTF and TIF_BLOCKSTEP should always match each other if the task is running. The tracee is stopped but it can be SIGKILL'ed right before set/clear_tsk_thread_flag().
However, now that uprobes uses user_enable_single_step(current) we can't simply remove update_debugctlmsr(). So this patch adds the additional "task == current" check and disables irqs to avoid the race with interrupts/preemption.
Unfortunately this patch doesn't solve the last problem, we need another fix. Probably we should teach ptrace_stop() to set/clear single/block stepping after resume.
And afaics there is yet another problem: perf can play with MSR_IA32_DEBUGCTLMSR from nmi, this obviously means that even __switch_to_xtra() has problems.
--- arch/x86/kernel/step.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/x86/kernel/step.c +13 -1
@@ -161,6 +161,16 @@ static void set_task_blockstep(struct ta {unsigned long debugctl; +/* +* Ensure irq/preemption can't change debugctl in between. +* Note also that both TIF_BLOCKSTEP and debugctl should +* be changed atomically wrt preemption. +* FIXME: this means that set/clear TIF_BLOCKSTEP is simply +* wrong if task != current, SIGKILL can wakeup the stopped +* tracee and set/clear can play with the running task, this +* can confuse the next __switch_to_xtra(). +*/ +local_irq_disable (); debugctl =get_debugctlmsr ();if (on) { debugctl |=DEBUGCTLMSR_BTF ;
@@ -169,7 +179,9 @@ static void set_task_blockstep(struct ta debugctl &= ~DEBUGCTLMSR_BTF ;clear_tsk_thread_flag (task,TIF_BLOCKSTEP ); } -update_debugctlmsr (debugctl); +if (task == current) +update_debugctlmsr (debugctl); +local_irq_enable (); }/*
Greg Kroah-Hartman
maintainerPATCH 141/214 x86/Sandy Bridge: mark arrays in __init functions as __initconst
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 91c90db1aa92a50fa1d7f289502b49ddb46a90d3 upstream.
commit ab3cd8670e0b3fcde7f029e1503ed3c5138e9571 upstream.
Mark static arrays as __initconst so they get removed when the init sections are flushed.
--- arch/x86/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/setup.c +2 -2
@@ -625,7 +625,7 @@ static bool __init snb_gfx_workaround_ne#ifdef CONFIG_PCI int i;u16 vendor, devid; -static const u16 snb_ids[] = { +static const __initconst u16 snb_ids[] = {0x0102 ,0x0112 , 0x0122,
@@ -658,7 +658,7 @@ static bool __init snb_gfx_workaround_ne*/ static void __init trim_snb_memory (void ) { -static const unsigned long bad_pages[] = { +static const __initconst unsigned long bad_pages[] = {0x20050000 ,0x20110000 ,0x20130000 ,
Greg Kroah-Hartman
maintainerPATCH 142/214 efi_pstore: Check remaining space with QueryVariableInfo() before writing data
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Aguchi <[email protected]>
commit d80a361d779a9f19498943d1ca84243209cd5647 upstream.
[Issue]
As discussed in a thread below, Running out of space in EFI isn't a well-tested scenario. And we wouldn't expect all firmware to handle it gracefully.
http://marc.info/?l=linux-kernel&m=134305325801789&w=2
On the other hand, current efi_pstore doesn't check a remaining space of storage at writing time. Therefore, efi_pstore may not work if it tries to write a large amount of data.
[Patch Description]
To avoid handling the situation above, this patch checks if there is a space enough to log with QueryVariableInfo() before writing data.
--- drivers/firmware/efivars.c | 18 ++++++++++++++++++ include/linux/efi.h | 1 + 2 files changed, 19 insertions(+)
drivers/firmware/efivars.c +18 -0
@@ -710,12 +710,29 @@ static int efi_pstore_write(enum pstore_struct efivars *efivars = psi->data;struct efivar_entry *entry, *found =NULL ;int i, ret =0 ; +u64 storage_space, remaining_space, max_variable_size; +efi_status_t status =EFI_NOT_FOUND ;sprintf (stub_name,"dump-type%u-%u-" , type, part);sprintf (name,"%s%lu" , stub_name,get_seconds ());spin_lock (&efivars->lock); +/* +* Check if there is a space enough to log. +* size: a size of logging data +* DUMP_NAME_LEN * 2: a maximum size of variable name +*/ + status = efivars->ops->query_variable_info (PSTORE_EFI_ATTRIBUTES , + &storage_space, + &remaining_space, + &max_variable_size); +if (status || remaining_space < size +DUMP_NAME_LEN *2 ) { +spin_unlock (&efivars->lock); + *id = part; +return -ENOSPC ; + } +for (i =0 ; i <DUMP_NAME_LEN ; i++) efi_name[i] = stub_name[i];
@@ -1324,6 +1341,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; error =register_efivars (&__efivars, &ops, efi_kobj);if (error) goto err_put;
include/linux/efi.h +1 -0
@@ -652,6 +652,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; };struct efivars {
Greg Kroah-Hartman
maintainerPATCH 143/214 efivars: Disable external interrupt while holding efivars->lock
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Boyer <[email protected]>
commit 81fa4e581d9283f7992a0d8c534bb141eb840a14 upstream.
[Problem]
There is a scenario which efi_pstore fails to log messages in a panic case.
- CPUA holds an efi_var->lock in either efivarfs parts or efi_pstore with interrupt enabled.
- CPUB panics and sends IPI to CPUA in smp_send_stop().
- CPUA stops with holding the lock.
- CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC) but it returns without logging messages.
[Patch Description]
This patch disables an external interruption while holding efivars->lock as follows.
In efi_pstore_write() and get_var_data(), spin_lock/spin_unlock is replaced by spin_lock_irqsave/spin_unlock_irqrestore because they may be called in an interrupt context.
In other functions, they are replaced by spin_lock_irq/spin_unlock_irq. because they are all called from a process context.
By applying this patch, we can avoid the problem above with a following senario.
- CPUA holds an efi_var->lock with interrupt disabled.
- CPUB panics and sends IPI to CPUA in smp_send_stop().
- CPUA receives the IPI after releasing the lock because it is disabling interrupt while holding the lock.
- CPUB waits for one sec until CPUA releases the lock.
- CPUB kicks efi_pstore_write() via kmsg_dump(KSMG_DUMP_PANIC) And it can hold the lock successfully.
[bwh: Backported to 3.2:
- Drop efivarfs changes
- Adjust context
- Drop change to efi_pstore_erase(), which is implemented using efi_pstore_write() here]
--- drivers/firmware/efivars.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-)
drivers/firmware/efivars.c +23 -21
@@ -396,10 +396,11 @@ static efi_status_t get_var_data(struct efivars *efivars, struct efi_variable *var) { efi_status_t status; +unsigned long flags; -spin_lock (&efivars->lock); +spin_lock_irqsave (&efivars->lock, flags); status =get_var_data_locked (efivars, var); -spin_unlock (&efivars->lock); +spin_unlock_irqrestore (&efivars->lock, flags);if (status !=EFI_SUCCESS ) { printk(KERN_WARNING "efivars: get_variable() failed 0x%lx!\n",
@@ -528,14 +529,14 @@ efivar_store_raw(struct efivar_entry *enreturn -EINVAL ; } -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); status = efivars->ops->set_variable (new_var->VariableName, &new_var->VendorGuid, new_var->Attributes, new_var->DataSize, new_var->Data); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);if (status !=EFI_SUCCESS ) { printk(KERN_WARNING "efivars: set_variable() failed: status=%lx\n",
@@ -646,7 +647,7 @@ static int efi_pstore_open(struct pstore {struct efivars *efivars = psi->data; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock); efivars->walk_entry =list_first_entry (&efivars->list, struct efivar_entry, list);return 0 ;
@@ -656,7 +657,7 @@ static int efi_pstore_close(struct pstor {struct efivars *efivars = psi->data; -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return 0 ; }
@@ -712,11 +713,12 @@ static int efi_pstore_write(enum pstore_int i, ret =0 ;u64 storage_space, remaining_space, max_variable_size;efi_status_t status =EFI_NOT_FOUND ; +unsigned long flags;sprintf (stub_name,"dump-type%u-%u-" , type, part);sprintf (name,"%s%lu" , stub_name,get_seconds ()); -spin_lock (&efivars->lock); +spin_lock_irqsave (&efivars->lock, flags);/* * Check if there is a space enough to log.
@@ -728,7 +730,7 @@ static int efi_pstore_write(enum pstore_ &remaining_space, &max_variable_size);if (status || remaining_space < size +DUMP_NAME_LEN *2 ) { -spin_unlock (&efivars->lock); +spin_unlock_irqrestore (&efivars->lock, flags); *id = part;return -ENOSPC ; }
@@ -769,7 +771,7 @@ static int efi_pstore_write(enum pstore_ efivars->ops->set_variable (efi_name, &vendor,PSTORE_EFI_ATTRIBUTES , size, psi->buf); -spin_unlock (&efivars->lock); +spin_unlock_irqrestore (&efivars->lock, flags);if (found)efivar_unregister (found);
@@ -853,7 +855,7 @@ static ssize_t efivar_create(struct filereturn -EINVAL ; } -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);/* * Does this variable already exist?
@@ -871,7 +873,7 @@ static ssize_t efivar_create(struct file } }if (found) { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EINVAL ; }
@@ -885,10 +887,10 @@ static ssize_t efivar_create(struct fileif (status !=EFI_SUCCESS ) {printk (KERN_WARNING "efivars: set_variable() failed: status=%lx\n" , status); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EIO ; } -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);/* Create the entry in sysfs. Locking is not required here */ status = efivar_create_sysfs_entry(efivars,
@@ -916,7 +918,7 @@ static ssize_t efivar_delete(struct fileif (!capable (CAP_SYS_ADMIN ))return -EACCES ; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);/* * Does this variable already exist?
@@ -934,7 +936,7 @@ static ssize_t efivar_delete(struct file } }if (!found) { -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EINVAL ; }/* force the Attributes/DataSize to 0 to ensure deletion */
@@ -950,12 +952,12 @@ static ssize_t efivar_delete(struct fileif (status !=EFI_SUCCESS ) {printk (KERN_WARNING "efivars: set_variable() failed: status=%lx\n" , status); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return -EIO ; }list_del (&search_efivar->list);/* We need to release this lock before unregistering. */ -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);efivar_unregister (search_efivar);/* It's dead Jim.... */
@@ -1110,9 +1112,9 @@ efivar_create_sysfs_entry(struct efivarskfree (short_name); short_name =NULL ; -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);list_add (&new_efivar->list, &efivars->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);return 0 ; }
@@ -1181,9 +1183,9 @@ void unregister_efivars(struct efivars *struct efivar_entry *entry, *n;list_for_each_entry_safe (entry, n, &efivars->list, list) { -spin_lock (&efivars->lock); +spin_lock_irq (&efivars->lock);list_del (&entry->list); -spin_unlock (&efivars->lock); +spin_unlock_irq (&efivars->lock);efivar_unregister (entry); }if (efivars->new_var)
Greg Kroah-Hartman
maintainerPATCH 144/214 efi: be more paranoid about available space when creating variables
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Boyer <[email protected]>
commit 68d929862e29a8b52a7f2f2f86a0600423b093cd upstream.
UEFI variables are typically stored in flash. For various reasons, avaiable space is typically not reclaimed immediately upon the deletion of a variable - instead, the system will garbage collect during initialisation after a reboot.
Some systems appear to handle this garbage collection extremely poorly, failing if more than 50% of the system flash is in use. This can result in the machine refusing to boot. The safest thing to do for the moment is to forbid writes if they'd end up using more than half of the storage space. We can make this more finegrained later if we come up with a method for identifying the broken machines.
[bwh: Backported to 3.2:
- Drop efivarfs changes and unused check_var_size()
- Add error codes to include/linux/efi.h, added upstream by commit 5d9db883761a ('efi: Add support for a UEFI variable filesystem')
- Add efi_status_to_err(), added upstream by commit 7253eaba7b17 ('efivarfs: Return an error if we fail to read a variable')]
--- drivers/firmware/efivars.c | 88 +++++++++++++++++++++++++++++++++++++++------ include/linux/efi.h | 5 ++ 2 files changed, 82 insertions(+), 11 deletions(-)
drivers/firmware/efivars.c +77 -11
@@ -409,6 +409,30 @@ get_var_data(struct efivars *efivars, streturn status; } +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) +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; +} +static ssize_t efivar_guid_read (struct efivar_entry *entry,char *buf) {
@@ -530,11 +554,16 @@ efivar_store_raw(struct efivar_entry *en }spin_lock_irq (&efivars->lock); - status = efivars->ops->set_variable (new_var->VariableName, - &new_var->VendorGuid, - new_var->Attributes, - new_var->DataSize, - new_var->Data); + + status =check_var_size_locked (efivars, new_var->Attributes, + new_var->DataSize +utf16_strsize (new_var->VariableName,1024 )); + +if (status ==EFI_SUCCESS || status ==EFI_UNSUPPORTED ) + status = efivars->ops->set_variable (new_var->VariableName, + &new_var->VendorGuid, + new_var->Attributes, + new_var->DataSize, + new_var->Data);spin_unlock_irq (&efivars->lock);
@@ -641,6 +670,36 @@ efivar_unregister(struct efivar_entry *vkobject_put (&var->kobj); } +static int efi_status_to_err (efi_status_t status) +{ +int err; + +switch (status) { +case EFI_INVALID_PARAMETER : + err = -EINVAL ; +break ; +case EFI_OUT_OF_RESOURCES : + err = -ENOSPC ; +break ; +case EFI_DEVICE_ERROR : + err = -EIO ; +break ; +case EFI_WRITE_PROTECTED : + err = -EROFS ; +break ; +case EFI_SECURITY_VIOLATION : + err = -EACCES ; +break ; +case EFI_NOT_FOUND : + err = -ENOENT ; +break ; +default : + err = -EINVAL ; + } + +return err; +} +#ifdef CONFIG_PSTORE static int efi_pstore_open (struct pstore_info *psi)
@@ -711,7 +770,6 @@ static int efi_pstore_write(enum pstore_struct efivars *efivars = psi->data;struct efivar_entry *entry, *found =NULL ;int i, ret =0 ; -u64 storage_space, remaining_space, max_variable_size;efi_status_t status =EFI_NOT_FOUND ;unsigned long flags;
@@ -725,11 +783,11 @@ static int efi_pstore_write(enum pstore_* size: a size of logging data * DUMP_NAME_LEN * 2: a maximum size of variable name */ - status = efivars->ops->query_variable_info (PSTORE_EFI_ATTRIBUTES , - &storage_space, - &remaining_space, - &max_variable_size); -if (status || remaining_space < size +DUMP_NAME_LEN *2 ) { + + status =check_var_size_locked (efivars,PSTORE_EFI_ATTRIBUTES , + size +DUMP_NAME_LEN *2 ); + +if (status) {spin_unlock_irqrestore (&efivars->lock, flags); *id = part;return -ENOSPC ;
@@ -877,6 +935,14 @@ static ssize_t efivar_create(struct filereturn -EINVAL ; } + status =check_var_size_locked (efivars, new_var->Attributes, + new_var->DataSize +utf16_strsize (new_var->VariableName,1024 )); + +if (status && status !=EFI_UNSUPPORTED ) { +spin_unlock_irq (&efivars->lock); +return efi_status_to_err (status); + } +/* now *really* create the variable via EFI */ status = efivars->ops->set_variable(new_var->VariableName, &new_var->VendorGuid,
include/linux/efi.h +5 -0
@@ -29,7 +29,12 @@#define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1)))#define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1)))#define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1))) +#define EFI_NOT_READY ( 6 | (1UL << (BITS_PER_LONG-1))) +#define EFI_DEVICE_ERROR ( 7 | (1UL << (BITS_PER_LONG-1))) +#define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1))) +#define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1)))#define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1))) +#define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1)))typedef unsigned long efi_status_t ;typedef u8 efi_bool_t ;
Greg Kroah-Hartman
maintainerPATCH 145/214 efivars: pstore: Do not check size when erasing variable
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 80a19debc2f2d398cfa57fae97bc99826748a602 upstream.
In 3.2, unlike mainline, efi_pstore_erase() calls efi_pstore_write() with a size of 0, as the underlying EFI interface treats a size of 0 as meaning deletion.
This was not taken into account in my backport of commit d80a361d779a 'efi_pstore: Check remaining space with QueryVariableInfo() before writing data'. The size check should be omitted when erasing.
--- drivers/firmware/efivars.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/firmware/efivars.c +13 -11
@@ -778,19 +778,21 @@ static int efi_pstore_write(enum pstore_spin_lock_irqsave (&efivars->lock, flags); -/* -* Check if there is a space enough to log. -* size: a size of logging data -* DUMP_NAME_LEN * 2: a maximum size of variable name -*/ +if (size) { +/* +* Check if there is a space enough to log. +* size: a size of logging data +* DUMP_NAME_LEN * 2: a maximum size of variable name +*/ - status =check_var_size_locked (efivars,PSTORE_EFI_ATTRIBUTES , - size +DUMP_NAME_LEN *2 ); + status =check_var_size_locked (efivars,PSTORE_EFI_ATTRIBUTES , + size +DUMP_NAME_LEN *2 ); -if (status) { -spin_unlock_irqrestore (&efivars->lock, flags); - *id = part; -return -ENOSPC ; +if (status) { +spin_unlock_irqrestore (&efivars->lock, flags); + *id = part; +return -ENOSPC ; + } }for (i =0 ; i <DUMP_NAME_LEN ; i++)
Greg Kroah-Hartman
maintainerPATCH 146/214 efivars: Allow disabling use as a pstore backend
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit ed9dc8ce7a1c8115dba9483a9b51df8b63a2e0ef upstream.
Add a new option, CONFIG_EFI_VARS_PSTORE, which can be set to N to avoid using efivars as a backend to pstore, as some users may want to compile out the code completely.
Set the default to Y to maintain backwards compatability, since this feature has always been enabled until now.
--- drivers/firmware/Kconfig | 9 ++++++ drivers/firmware/efivars.c | 63 ++++++++++++++------------------------------- 2 files changed, 29 insertions(+), 43 deletions(-)
drivers/firmware/Kconfig +9 -0
@@ -53,6 +53,15 @@ config EFI_VARS Subsequent efibootmgr releases may be found at: <http://linux.dell.com/efibootmgr> +config EFI_VARS_PSTORE + bool "Register efivars backend for pstore" + depends on EFI_VARS && PSTORE + default y + help + Say Y here to enable use efivars as a backend to pstore. This + will allow writing console messages, crash dumps, or anything + else supported by pstore to EFI variables. + config EFI_PCDP bool "Console device selection via EFI PCDP or HCDP table" depends on ACPI && EFI && IA64
drivers/firmware/efivars.c +20 -43
93 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 147/214 efivars: Add module parameter to disable use as a pstore backend
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit ec0971ba5372a4dfa753f232449d23a8fd98490e upstream.
We know that with some firmware implementations writing too much data to UEFI variables can lead to bricking machines. Recent changes attempt to address this issue, but for some it may still be prudent to avoid writing large amounts of data until the solution has been proven on a wide variety of hardware.
Crash dumps or other data from pstore can potentially be a large data source. Add a pstore_module parameter to efivars to allow disabling its use as a backend for pstore. Also add a config option, CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE, to allow setting the default value of this paramter to true (i.e. disabled by default).
--- drivers/firmware/Kconfig | 9 +++++++++ drivers/firmware/efivars.c | 8 +++++++- 2 files changed, 16 insertions(+), 1 deletion(-)
drivers/firmware/Kconfig +9 -0
@@ -62,6 +62,15 @@ config EFI_VARS_PSTORE will allow writing console messages, crash dumps, or anything else supported by pstore to EFI variables. +config EFI_VARS_PSTORE_DEFAULT_DISABLE + bool "Disable using efivars as a pstore backend by default" + depends on EFI_VARS_PSTORE + default n + help + Saying Y here will disable the use of efivars as a storage + backend for pstore by default. This setting can be overridden + using the efivars module's pstore_disable parameter. + config EFI_PCDP bool "Console device selection via EFI PCDP or HCDP table" depends on ACPI && EFI && IA64
drivers/firmware/efivars.c +7 -1
@@ -92,6 +92,11 @@ MODULE_VERSION(EFIVARS_VERSION);#define DUMP_NAME_LEN 52 +static bool efivars_pstore_disable = +IS_ENABLED (EFI_VARS_PSTORE_DEFAULT_DISABLE ); + +module_param_named (pstore_disable, efivars_pstore_disable, bool,0644 ); +/* * The maximum size of VariableName + Data = 1024 * Therefore, it's reasonable to save that much
@@ -1350,7 +1355,8 @@ int register_efivars(struct efivars *efiif (error)unregister_efivars (efivars); -efivar_pstore_register (efivars); +if (!efivars_pstore_disable) +efivar_pstore_register (efivars); out:kfree (variable_name);
Greg Kroah-Hartman
maintainerPATCH 148/214 efivars: Fix check for CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit ca0ba26fbbd2d81c43085df49ce0abfe34535a90 upstream.
The 'CONFIG_' prefix is not implicit in IS_ENABLED().
--- drivers/firmware/efivars.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efivars.c +1 -1
@@ -93,7 +93,7 @@ MODULE_VERSION(EFIVARS_VERSION);#define DUMP_NAME_LEN 52static bool efivars_pstore_disable = -IS_ENABLED (EFI_VARS_PSTORE_DEFAULT_DISABLE ); +IS_ENABLED (CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE );module_param_named (pstore_disable, efivars_pstore_disable, bool,0644 );
Greg Kroah-Hartman
maintainerPATCH 149/214 efi_pstore: Introducing workqueue updating sysfs
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seiji Aguchi <[email protected]>
commit a93bc0c6e07ed9bac44700280e65e2945d864fd4 upstream.
[Problem]efi_pstore creates sysfs entries, which enable users to access to NVRAM, in a write callback. If a kernel panic happens in an interrupt context, it may fail because it could sleep due to dynamic memory allocations during creating sysfs entries.
[Patch Description]
This patch removes sysfs operations from a write callback by introducing a workqueue updating sysfs entries which is scheduled after the write callback is called.
Also, the workqueue is kicked in a just oops case.
A system will go down in other cases such as panic, clean shutdown and emergency restart. And we don't need to create sysfs entries because there is no chance for users to access to them.
efi_pstore will be robust against a kernel panic in an interrupt context with this patch.
[xr: Backported to 3.4:
- Adjust contest
- Remove repeated definition of helper function variable_is_present]
--- drivers/firmware/efivars.c | 61 +++++++++++++++++++++++++++++++++++++++++---- include/linux/efi.h | 3 +- 2 files changed, 58 insertions(+), 6 deletions(-)
drivers/firmware/efivars.c +56 -5
@@ -154,6 +154,13 @@ efivar_create_sysfs_entry(struct efivars efi_char16_t *variable_name, efi_guid_t *vendor_guid); +/* +* Prototype for workqueue functions updating sysfs entry +*/ + +static void efivar_update_sysfs_entries (struct work_struct *); +static DECLARE_WORK(efivar_work, efivar_update_sysfs_entries); +/* Return the number of unicode characters in data */ static unsigned long utf16_strnlen (efi_char16_t *s,size_t maxlength)
@@ -839,11 +846,8 @@ static int efi_pstore_write(enum pstore_if (found)efivar_unregister (found); -if (size) - ret =efivar_create_sysfs_entry (efivars, -utf16_strsize (efi_name, -DUMP_NAME_LEN *2 ), - efi_name, &vendor); +if (reason ==KMSG_DUMP_OOPS ) +schedule_work (&efivar_work); *id = part;return ret;
@@ -1044,6 +1048,53 @@ static bool variable_is_present(efi_charreturn found; } +static void efivar_update_sysfs_entries (struct work_struct *work) +{ +struct efivars *efivars = &__efivars; +efi_guid_t vendor; +efi_char16_t *variable_name; +unsigned long variable_name_size =1024 ; +efi_status_t status =EFI_NOT_FOUND ; +bool found; + +/* Add new sysfs entries */ +while (1 ) { + variable_name =kzalloc (variable_name_size,GFP_KERNEL ); +if (!variable_name) { +pr_err ("efivars: Memory allocation failed.\n" ); +return ; + } + +spin_lock_irq (&efivars->lock); + found = false; +while (1 ) { + variable_name_size =1024 ; + status = efivars->ops->get_next_variable ( + &variable_name_size, + variable_name, + &vendor); +if (status !=EFI_SUCCESS ) { +break ; + }else { +if (!variable_is_present (variable_name, + &vendor)) { + found = true; +break ; + } + } + } +spin_unlock_irq (&efivars->lock); + +if (!found) { +kfree (variable_name); +break ; + }else +efivar_create_sysfs_entry (efivars, + variable_name_size, + variable_name, &vendor); + } +} +/* * Returns the size of variable_name, in bytes, including the * terminating NULL character, or variable_name_size if no NULL
include/linux/efi.h +2 -1
@@ -666,7 +666,8 @@ struct efivars {* 1) ->list - adds, removals, reads, writes * 2) ops.[gs]et_variable() calls. * It must not be held when creating sysfs entries or calling kmalloc. -* ops.get_next_variable() is only called from register_efivars(), +* ops.get_next_variable() is only called from register_efivars() +* or efivar_update_sysfs_entries(), * which is protected by the BKL, so that path is safe. */ spinlock_t lock;
Greg Kroah-Hartman
maintainerPATCH 150/214 x86, efivars: firmware bug workarounds should be in platform code
In reply to Greg Kroah-Hartman3.4-stable 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 +++++++++++++++++++++++++ drivers/firmware/efivars.c | 18 +++--------------- include/linux/efi.h | 9 ++++++++- 3 files changed, 36 insertions(+), 16 deletions(-)
arch/x86/platform/efi/efi.c +25 -0
@@ -960,3 +960,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
@@ -1445,7 +1433,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 +8 -1
@@ -262,6 +262,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
@@ -503,8 +504,14 @@ extern void efi_gettimeofday (struct timextern void efi_enter_virtual_mode (void );/* switch EFI to virtual mode, if possible */ #ifdef CONFIG_X86 extern void efi_free_boot_services (void ); +extern efi_status_t efi_query_variable_store (u32 attributes,unsigned long size);#else static inline void efi_free_boot_services (void ) {} + +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);
@@ -657,7 +664,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 {
Greg Kroah-Hartman
maintainerPATCH 151/214 x86,efi: Check max_size only if it is non-zero.
In reply to Greg Kroah-Hartman3.4-stable 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
@@ -979,7 +979,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 ;
Greg Kroah-Hartman
maintainerPATCH 152/214 efi: Export efi_query_variable_store() for efivars.ko
In reply to Greg Kroah-Hartman3.4-stable 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
@@ -990,3 +990,4 @@ efi_status_t efi_query_variable_store(u3return EFI_SUCCESS ; } +EXPORT_SYMBOL_GPL (efi_query_variable_store);
Greg Kroah-Hartman
maintainerPATCH 153/214 x86,efi: Implement efi_no_storage_paranoia parameter
In reply to Greg Kroah-Hartman3.4-stable 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
@@ -773,6 +773,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
@@ -102,6 +102,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) {
@@ -984,7 +993,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 ;
Greg Kroah-Hartman
maintainerPATCH 154/214 Modify UEFI anti-bricking code
In reply to Greg Kroah-Hartman3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Garrett <[email protected]>
commit f8b8404337de4e2466e2e1139ea68b1f8295974f upstream.
This patch reworks the UEFI anti-bricking code, including an effective reversion of cc5a080c and 31ff2f20. It turns out that calling QueryVariableInfo() from boot services results in some firmware implementations jumping to physical addresses even after entering virtual mode, so until we have 1:1 mappings for UEFI runtime space this isn't going to work so well.
Reverting these gets us back to the situation where we'd refuse to create variables on some systems because they classify deleted variables as "used" until the firmware triggers a garbage collection run, which they won't do until they reach a lower threshold. This results in it being impossible to install a bootloader, which is unhelpful.
Feedback from Samsung indicates that the firmware doesn't need more than 5KB of storage space for its own purposes, so that seems like a reasonable threshold. However, there's still no guarantee that a platform will attempt garbage collection merely because it drops below this threshold. It seems that this is often only triggered if an attempt to write generates a genuine EFI_OUT_OF_RESOURCES error. We can force that by attempting to create a variable larger than the remaining space. This should fail, but if it somehow succeeds we can then immediately delete it.
I've tested this on the UEFI machines I have available, but I don't have a Samsung and so can't verify that it avoids the bricking problem.
--- arch/x86/platform/efi/efi.c | 79 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 11 deletions(-)
arch/x86/platform/efi/efi.c +68 -11
@@ -50,6 +50,13 @@#define EFI_DEBUG 1 +#define EFI_MIN_RESERVE 5120 + +#define EFI_DUMMY_GUID \ + EFI_GUID(0x4424ac57, 0xbe4b, 0x47dd, 0x9e, 0x97, 0xed, 0x50, 0xf0, 0x9f, 0x92, 0xa9) + +static efi_char16_t efi_dummy_name[6 ] = {'D' ,'U' ,'M' ,'M' ,'Y' ,0 }; +struct efi __read_mostly efi = { .mps =EFI_INVALID_TABLE_ADDR , .acpi =EFI_INVALID_TABLE_ADDR ,
@@ -932,6 +939,13 @@ void __init efi_enter_virtual_mode(void)runtime_code_page_mkexec ();kfree (new_memmap); + +/* clean DUMMY object */ + efi.set_variable (efi_dummy_name, &EFI_DUMMY_GUID , +EFI_VARIABLE_NON_VOLATILE | +EFI_VARIABLE_BOOTSERVICE_ACCESS | +EFI_VARIABLE_RUNTIME_ACCESS , +0 ,NULL ); }/*
@@ -983,22 +997,65 @@ efi_status_t efi_query_variable_store(u3efi_status_t status;u64 storage_size, remaining_size, max_size; +if (!(attributes &EFI_VARIABLE_NON_VOLATILE )) +return 0 ; + status = efi.query_variable_info (attributes, &storage_size, &remaining_size, &max_size);if (status !=EFI_SUCCESS )return status; -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)) -return EFI_OUT_OF_RESOURCES ; - -if (!efi_no_storage_paranoia && - (remaining_size - size) < (storage_size /2 )) -return EFI_OUT_OF_RESOURCES ; +/* +* Some firmware implementations refuse to boot if there's insufficient +* space in the variable store. We account for that by refusing the +* write if permitting it would reduce the available space to under +* 5KB. This figure was provided by Samsung, so should be safe. +*/ +if ((remaining_size - size <EFI_MIN_RESERVE ) && + !efi_no_storage_paranoia) { + +/* +* Triggering garbage collection may require that the firmware +* generate a real EFI_OUT_OF_RESOURCES error. We can force +* that by attempting to use more space than is available. +*/ +unsigned long dummy_size = remaining_size +1024 ; +void *dummy =kmalloc (dummy_size,GFP_ATOMIC ); + + status = efi.set_variable (efi_dummy_name, &EFI_DUMMY_GUID , +EFI_VARIABLE_NON_VOLATILE | +EFI_VARIABLE_BOOTSERVICE_ACCESS | +EFI_VARIABLE_RUNTIME_ACCESS , + dummy_size, dummy); + +if (status ==EFI_SUCCESS ) { +/* +* This should have failed, so if it didn't make sure +* that we delete it... +*/ + efi.set_variable (efi_dummy_name, &EFI_DUMMY_GUID , +EFI_VARIABLE_NON_VOLATILE | +EFI_VARIABLE_BOOTSERVICE_ACCESS | +EFI_VARIABLE_RUNTIME_ACCESS , +0 , dummy); + } + +/* +* The runtime code may now have triggered a garbage collection +* run, so check the variable info again +*/ + status = efi.query_variable_info (attributes, &storage_size, + &remaining_size, &max_size); + +if (status !=EFI_SUCCESS ) +return status; + +/* +* There still isn't enough room, so return an error +*/ +if (remaining_size - size <EFI_MIN_RESERVE ) +return EFI_OUT_OF_RESOURCES ; + }return EFI_SUCCESS ; }