3.6.11.7-rc1-stable review
Subsystems (64)
Steven Rostedt
reviewercover 3.6.11.7-rc1-stable review
Note, this will be the last release that I maintain for the 3.6 stable tree.
This is the start of the stable review cycle for 3.6.11.7-rc1 release. There are 88 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Aug 16, 2013. Anything received after that time might be too late.
Aaron Lu (1):
libata-acpi: add back ACPI based hotplug functionality
[44521527be36172864e6e7a6fba4b66e9aa48e40]
Al Viro (1):
ext3,ext4: don't mess with dir_file->f_pos in htree_dirblock_to_tree()
[64cb927371cd2ec43758d8a094a003d27bc3d0dc]Alex Deucher (1):
drm/radeon: prevent crash in the ring space allocation
[fd5d93a0015ce1a7db881382022b2fcdfdc61760]
Anders Hammarquist (1):
USB: serial: ti_usb_3410_5052: new device id for Abbot strip port cable
[35a2fbc941accd0e9f1bfadd669311786118d874]
Anderson Lizardo (1):
Bluetooth: Fix crash in l2cap_build_cmd() with small MTU
[300b962e5244a1ea010df7e88595faa0085b461d]
Andy Lutomirski (2):
net: Unbreak compat_sys_{send,recv}msg
[a7526eb5d06b0084ef12d7b168d008fcf516caab]
net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg
[1be374a0518a288147c6a7398792583200a67261]
Artem Bityutskiy (2):
UBIFS: fix a horrid bug
[605c912bb843c024b1ed173dc427cd5c08e5d54d]
UBIFS: prepare to fix a horrid bug
[33f1a63ae84dfd9ad298cf275b8f1887043ced36]
Axel Lin (1):
drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq
[29ecd78c0fd6ee05f2c6b07b23823a6ae43c13ff]
Bart Van Assche (1):
timer: Fix jiffies wrap behavior of round_jiffies_common()
[9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1]
Bartlomiej Zolnierkiewicz (1):
drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()
[da331ba8e9c5de72a27e50f71105395bba6eebe0]
Ben Hutchings (2):
genirq: Fix can_request_irq() for IRQs without an action
[2779db8d37d4b542d9ca2575f5f178dbeaca6c86]
sd: Fix parsing of 'temporary ' cache mode prefix
[2ee3e26c673e75c05ef8b914f54fadee3d7b9c88]
Chris Metcalf (1):
tilepro: work around module link error with gcc 4.7
[3cb3f839d306443f3d1e79b0bde1a2ad2c12b555]
Christian Lamparter (1):
carl9170: fix frame drop and WARN due to minstrel_ht change
[5f34608fa2acbfef5a06d0072a978c9943c28a2d]
Clemens Ladisch (1):
ALSA: usb-audio: work around Android accessory firmware bug
[342cda29343a6272c630f94ed56810a76740251b]
Daniel Borkmann (2):
packet: packet_getname_spkt: make sure string is always 0-terminated
[2dc85bf323515e59e15dfa858d1472bb25cad0fe]
net: sctp: fix NULL pointer dereference in socket destruction
[1abd165ed757db1afdefaac0a4bc8a70f97d258c]
Eric Dumazet (5):
net: force a reload of first item in hlist_nulls_for_each_entry_rcu
[c87a124a5d5e8cf8e21c4363c3372bcaf53ea190]
ip_tunnel: fix kernel panic with icmp_dest_unreach
[a622260254ee481747cceaaa8609985b29a31565]
tcp: xps: fix reordering issues
[547669d483e5783d722772af1483fa474da7caf9]
ipv6: fix possible crashes in ip6_cork_release()
[284041ef21fdf2e0d216ab6b787bc9072b4eb58a]
tcp: fix tcp_md5_hash_skb_data()
[54d27fcb338bd9c42d1dfc5a39e18f6f9d373c2e]
Federico Vaga (1):
net/core/sock.c: add missing VSOCK string in af_family_*_key_strings
[456db6a4d495f40777da6f1f32f62f13026f52db]
Ferruh Yigit (1):
Input: cyttsp - fix memcpy size param
[d2983cdb480157f637df07723f28aaa657b1080d]
Gao feng (1):
ipv6: assign rt6_info to inet6_ifaddr in init_loopback
[534c877928a16ae5f9776436a497109639bf67dc]
George Cherian (1):
usb: host: xhci-plat: release mem region while removing module
[5388a3a5faba8dfa69e5f06c3a415d373c1a4316]
Giuseppe CAVALLARO (1):
net: phy: fix a bug when verify the EEE support
[9a9c56cb34e65000d1f0a4b7553399bfcf7c5a52]
Greg Kroah-Hartman (1):
MAINTAINERS: add stable_kernel_rules.txt to stable maintainer information
[7b175c46720f8e6b92801bb634c93d1016f80c62]
Guillaume Nault (2):
l2tp: Fix sendmsg() return value
[a6f79d0f26704214b5b702bbac525cb72997f984]
l2tp: Fix PPP header erasure and memory leak
[55b92b7a11690bc377b5d373872a6b650ae88e64]
Herbert Xu (1):
crypto: algboss - Hold ref count on larval
[939e17799619e31331d2433041196529515a86a6]
J. Bruce Fields (1):
nfsd4: fix decoding of compounds across page boundaries
[247500820ebd02ad87525db5d9b199e5b66f6636]
Jan Kara (2):
ext4: fix overflow when counting used blocks on 32-bit architectures
[8af8eecc1331dbf5e8c662022272cf667e213da5]
ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
[a60697f411eb365fb09e639e6f183fe33d1eb796]
Jason Wang (1):
drivers: hv: switch to use mb() instead of smp_mb()
[35848f68b07df3f917cb13fc3c134718669f569b]
Jerome Glisse (1):
drm/radeon: update lockup tracking when scheduling in empty ring
[8444d5c69549aa0f0b574cc608742d4669e1cc01]
Jiang Liu (1):
PCI: Fix refcount issue in pci_create_root_bus() error recovery path
[343df771e671d821478dd3ef525a0610b808dbf8]
Jiri Pirko (2):
team: move add to port list before port enablement
[72df935d985c1575ed44ad2c8c653b28147993fa]
team: check return value of team_get_port_by_index_rcu() for NULL
[76c455decbbad31de21c727edb184a963f42b40b]
Joachim Eastwood (1):
pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status
[e39506b466edcda2a7e9d0174d7987ae654137b7]
Jonathan Salwan (1):
drivers/cdrom/cdrom.c: use kzalloc() for failing hardware
[542db01579fbb7ea7d1f7bb9ddcef1559df660b2]
Junxiao Bi (1):
ocfs2: xattr: fix inlined xattr reflink
[ef962df057aaafd714f5c22ba3de1be459571fdf]
Jörn Engel (1):
target/iscsi: don't corrupt bh_count in iscsit_stop_time2retain_timer()
[574780fd5e6ec52bd43e0bdb777a19e4c4c6aa9c]
Kees Cook (3):
crypto: sanitize argument for format string
[1c8fca1d92e14859159a82b8a380d220139b7344]
block: do not pass disk names as format strings
[ffc8b30866879ed9ba62bd0a86fecdbd51cd3d19]
charger-manager: Ensure event is not used as format string
[3594f4c0d7bc51e3a7e6d73c44e368ae079e42f3]
Lai Jiangshan (1):
clk: remove notifier from list before freeing it
[72b5322f11ff0abf6a52b3007486656578d2c982]
Larry Finger (1):
rtlwifi: rtl8192cu: Fix duplicate if test
[10d0b9030a3f86e1e26c710c7580524d7787d688]
Laszlo Ersek (1):
xen/time: remove blocked time accounting from xen "clockchip"
[0b0c002c340e78173789f8afaa508070d838cf3d]
Li Zefan (1):
cgroup: fix umount vs cgroup_event_remove() race
[1c8158eeae0f37d0eee9f1fbe68080df6a408df2]
Lv Zheng (1):
ACPICA: Do not use extended sleep registers unless HW-reduced bit is set
[7cec7048fe22e3e92389da2cd67098f6c4284e7f]
Mathias Nyman (1):
xhci: check for failed dma pool allocation
[025f880cb2e4d7218d0422d4b07bea1a68959c38]
Michal Kubecek (1):
ipv4: fix redirect handling for TCP packets
[f96ef988cc603487c03a6de07807b06cbe641829]
Mikulas Patocka (1):
hpfs: better test for errors
[3ebacb05044f82c5f0bb456a894eb9dc57d0ed90]
Nandita Dukkipati (1):
tcp: bug fix in proportional rate reduction.
[35f079ebbc860dcd1cca70890c9c8d59c1145525]
Neil Horman (2):
iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
[03bbcb2e7e292838bb0244f5a7816d194c911d62]
sctp: fully initialize sctp_outq in sctp_outq_init
[c5c7774d7eb4397891edca9ebdf750ba90977a69]
Nikolay Martynov (1):
iwlwifi: dvm: fix chain noise calibration
[b28b6dfe580ab1ab8bf08b908fd69e299b877103]
Oleg Nesterov (1):
hw_breakpoint: Use cpu_possible_mask in {reserve,release}_bp_slot()
[c790b0ad23f427c7522ffed264706238c57c007e]
Paul Clements (1):
nbd: correct disconnect behavior
[c378f70adbc1bbecd9e6db145019f14b2f688c7c]
Paul Moore (1):
netlabel: improve domain mapping validation
[6b21e1b77d1a3d58ebfd513264c885695e8a0ba5]
Peter Zijlstra (2):
perf: Fix mmap() accounting hole
[9bb5d40cd93c9dd4be74834b1dcb1ba03629716b]
perf: Fix perf mmap bugs
[26cb63ad11e04047a64309362674bcbbd6a6f246]
Randy Dunlap (1):
x86: fix build error and kconfig for ia32_emulation and binfmt
[d1603990ea626668c78527376d9ec084d634202d]
Roland Dreier (1):
tcm_qla2xxx: Fix residual for underrun commands that fail
[b5aff3d2747bea08b386edd070941a45611ffe51]
Shane Huang (1):
ahci: remove pmp link online check in FBS EH
[912b9ac683b112615d5605686f1dc086402ce9f7]
Simon Baatz (2):
ARM: 7772/1: Fix missing flush_kernel_dcache_page() for noMMU
[63384fd0b1509acf522a8a8fcede09087eedb7df]
ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page
[1bc39742aab09248169ef9d3727c9def3528b3f3]
Stephane Eranian (1):
perf: Disable monitoring on setuid processes for regular users
[2976b10f05bd7f6dab9f9e7524451ddfed656a89]
Steve French (2):
Handle big endianness in NTLM (ntlmv2) authentication
[fdf96a907c1fbb93c633e2b7ede3b8df26d6a4c0]
use sensible file nlink values if unprovided
[6658b9f70ebca5fc0795b1d6d733996af1e2caa7]
Sujith Manoharan (1):
ath9k_htc: Handle IDLE state transition properly
[075163bbb0f51174359947e1bce84f5edb23f21e]
Takashi Iwai (1):
ALSA: usb-audio: Fix invalid volume resolution for Logitech HD Webcam c310
[36691e1be6ec551eef4a5225f126a281f8c051c2]
Theodore Ts'o (3):
ext4: don't allow ext4_free_blocks() to fail due to ENOMEM
[e7676a704ee0a1ef71a6b23760b5a8f6896cb1a1]
jbd2: fix theoretical race in jbd2__journal_restart
[39c04153fda8c32e85b51c96eb5511a326ad7609]
jbd2: move superblock checksum calculation to jbd2_write_superblock()
[fe52d17cdd343ac43c85cf72940a58865b9d3bfb]
Tyler Hicks (1):
libceph: Fix NULL pointer dereference in auth client code
[2cb33cac622afde897aa02d3dcd9fbba8bae839e]
UCHINO Satoshi (1):
usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed
[d68c277b501889b3a50c179d1c3d704db7947b83]
Wanpeng Li (1):
mm/memory-hotplug: fix lowmem count overflow when offline pages
[cea27eb2a202959783f81254c48c250ddd80e129]
Wei Yongjun (1):
gianfar: add missing iounmap() on error in gianfar_ptp_probe()
[e5f5e380e0f3bb11f04ca5bc66a551e58e0ad26e]
Yoshihiro Shimoda (1):
net: sh_eth: fix incorrect RX length error if R8A7740
[dd019897358b815f7828dab90b51d51df4d3658d]
Zefan Li (2):
dlci: validate the net device in dlci_del()
[578a1310f2592ba90c5674bca21c1dbd1adf3f0a]
dlci: acquire rtnl_lock before calling __dev_get_by_name()
[11eb2645cbf38a08ae491bf6c602eea900ec0bb5]
Zhang Yi (1):
futex: Take hugepages into account when generating futex_key
[13d60f4b6ab5b702dc8d2ee20999f98a93728aec]
Zhanghaoyu (A) (1):
KVM: x86: remove vcpu's CPL check in host-invoked XCR set
[764bcbc5a6d7a2f3e75c9f0e4caa984e2926e346]
stephen hemminger (1):
8139cp: reset BQL when ring tx ring cleared
[98962baad72fd6d393bf39dbb7c2076532c363c6]
----
MAINTAINERS | 1 + arch/arm/include/asm/cacheflush.h | 4 +- arch/arm/mm/flush.c | 33 ++++ arch/arm/mm/nommu.c | 6 + arch/tile/lib/exports.c | 2 + arch/x86/Kconfig | 1 + arch/x86/include/asm/irq_remapping.h | 2 + arch/x86/kernel/early-quirks.c | 20 +++ arch/x86/kvm/x86.c | 5 +- arch/x86/xen/time.c | 17 +- block/genhd.c | 2 +- crypto/algapi.c | 3 +- crypto/algboss.c | 15 +- crypto/api.c | 6 - crypto/internal.h | 6 + drivers/acpi/acpica/hwxfsleep.c | 8 +- drivers/ata/libahci.c | 3 +- drivers/ata/libata-acpi.c | 35 +++- drivers/ata/libata-core.c | 2 + drivers/ata/libata.h | 2 + drivers/block/nbd.c | 9 +- drivers/cdrom/cdrom.c | 2 +- drivers/clk/clk.c | 1 + drivers/dma/pl330.c | 4 +- drivers/gpu/drm/radeon/radeon_ring.c | 10 ++ drivers/hv/ring_buffer.c | 2 +- drivers/hv/vmbus_drv.c | 2 +- drivers/input/touchscreen/cyttsp_core.c | 2 +- drivers/iommu/intel_irq_remapping.c | 10 ++ drivers/iommu/irq_remapping.c | 6 + drivers/iommu/irq_remapping.h | 1 + drivers/net/ethernet/freescale/gianfar_ptp.c | 1 + drivers/net/ethernet/realtek/8139cp.c | 1 + drivers/net/ethernet/renesas/sh_eth.c | 15 +- drivers/net/phy/phy.c | 2 +- drivers/net/team/team.c | 2 +- drivers/net/team/team_mode_roundrobin.c | 2 + drivers/net/wan/dlci.c | 26 ++- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +- drivers/net/wireless/ath/carl9170/tx.c | 69 +++----- drivers/net/wireless/iwlwifi/dvm/rxon.c | 2 +- drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 2 +- drivers/pci/probe.c | 8 +- drivers/pcmcia/at91_cf.c | 4 +- drivers/power/charger-manager.c | 2 +- drivers/rtc/rtc-rv3029c2.c | 2 +- drivers/scsi/osd/osd_uld.c | 2 +- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 6 +- drivers/scsi/sd.c | 2 +- drivers/target/iscsi/iscsi_target_erl0.c | 4 +- drivers/usb/gadget/f_mass_storage.c | 2 + drivers/usb/host/xhci-mem.c | 4 + drivers/usb/host/xhci-plat.c | 1 + drivers/usb/serial/ti_usb_3410_5052.c | 3 +- drivers/usb/serial/ti_usb_3410_5052.h | 4 +- fs/cifs/cifs_unicode.h | 8 +- fs/cifs/cifsencrypt.c | 6 +- fs/cifs/inode.c | 5 + fs/exec.c | 16 +- fs/ext3/namei.c | 7 +- fs/ext4/extents.c | 4 +- fs/ext4/inode.c | 4 +- fs/ext4/mballoc.c | 11 +- fs/ext4/namei.c | 7 +- fs/hpfs/map.c | 3 +- fs/hpfs/super.c | 8 +- fs/jbd2/journal.c | 3 +- fs/jbd2/transaction.c | 2 +- fs/nfsd/nfs4xdr.c | 2 +- fs/ocfs2/xattr.c | 10 ++ fs/ubifs/dir.c | 54 ++++-- include/linux/hugetlb.h | 16 ++ include/linux/nbd.h | 1 + include/linux/perf_event.h | 3 +- include/linux/rculist_nulls.h | 7 +- include/linux/socket.h | 3 + kernel/cgroup.c | 25 ++- kernel/events/core.c | 233 +++++++++++++++++-------- kernel/events/hw_breakpoint.c | 4 +- kernel/events/internal.h | 4 + kernel/futex.c | 3 +- kernel/irq/manage.c | 6 +- kernel/timer.c | 8 +- mm/hugetlb.c | 17 ++ mm/page_alloc.c | 4 + net/bluetooth/l2cap_core.c | 3 + net/ceph/auth_none.c | 6 + net/compat.c | 13 +- net/core/sock.c | 6 +- net/ipv4/ip_gre.c | 2 +- net/ipv4/ipip.c | 2 +- net/ipv4/route.c | 7 +- net/ipv4/tcp.c | 7 +- net/ipv4/tcp_input.c | 23 +-- net/ipv4/tcp_output.c | 10 +- net/ipv6/addrconf.c | 4 +- net/ipv6/ip6_output.c | 2 +- net/l2tp/l2tp_ppp.c | 6 +- net/netlabel/netlabel_domainhash.c | 69 ++++++++ net/packet/af_packet.c | 5 +- net/sctp/outqueue.c | 6 +- net/sctp/socket.c | 6 + net/socket.c | 61 +++++-- sound/usb/card.c | 22 ++- sound/usb/mixer.c | 1 + 105 files changed, 818 insertions(+), 317 deletions(-)
Steven Rostedt
reviewerPATCH 1/88 ALSA: usb-audio: Fix invalid volume resolution for Logitech HD Webcam c310
3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 36691e1be6ec551eef4a5225f126a281f8c051c2 ]
Just like the previous fix for LogitechHD Webcam c270 in commit 11e7064f35bb87da8f427d1aa4bbd8b7473a3993, c310 model also requires the same workaround for avoiding the kernel warning.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=59741
--- sound/usb/mixer.c | 1 + 1 file changed, 1 insertion(+)
sound/usb/mixer.c +1 -0
@@ -841,6 +841,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,case USB_ID (0x046d ,0x0808 ):case USB_ID (0x046d ,0x0809 ): +case USB_ID (0x046d ,0x081b ):/* HD Webcam c310 */ case USB_ID (0x046d ,0x081d ):/* HD Webcam c510 */ case USB_ID (0x046d ,0x0825 ):/* HD Webcam c270 */ case USB_ID (0x046d ,0x0991 ):
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 2/88 ALSA: usb-audio: work around Android accessory firmware bug
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
[ Upstream commit 342cda29343a6272c630f94ed56810a76740251b ]
When the Android firmware enables the audio interfaces in accessory mode, it always declares in the control interface's baInterfaceNr array that interfaces 0 and 1 belong to the audio function. However, the accessory interface itself, if also enabled, already is at index 0 and shifts the actual audio interface numbers to 1 and 2, which prevents the PCM streaming interface from being seen by the host driver.
To get the PCM interface interface to work, detect when the descriptors point to the (for this driver useless) accessory interface, and redirect to the correct one.
--- sound/usb/card.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
sound/usb/card.c +20 -2
@@ -150,14 +150,32 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int intreturn -EINVAL ; } + alts = &iface->altsetting[0 ]; + altsd =get_iface_desc (alts); + +/* +* Android with both accessory and audio interfaces enabled gets the +* interface numbers wrong. +*/ +if ((chip->usb_id ==USB_ID (0x18d1 ,0x2d04 ) || + chip->usb_id ==USB_ID (0x18d1 ,0x2d05 )) && + interface ==0 && + altsd->bInterfaceClass ==USB_CLASS_VENDOR_SPEC && + altsd->bInterfaceSubClass ==USB_SUBCLASS_VENDOR_SPEC ) { + interface =2 ; + iface =usb_ifnum_to_if (dev, interface); +if (!iface) +return -EINVAL ; + alts = &iface->altsetting[0 ]; + altsd =get_iface_desc (alts); + } +if (usb_interface_claimed (iface)) {snd_printdd (KERN_INFO "%d:%d:%d: skipping, already claimed\n" , dev->devnum, ctrlif, interface);return -EINVAL ; } - alts = &iface->altsetting[0 ]; - altsd =get_iface_desc (alts);if ((altsd->bInterfaceClass ==USB_CLASS_AUDIO || altsd->bInterfaceClass ==USB_CLASS_VENDOR_SPEC ) && altsd->bInterfaceSubClass ==USB_SUBCLASS_MIDISTREAMING ) {
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 3/88 clk: remove notifier from list before freeing it
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Lai Jiangshan <[email protected]>
[ Upstream commit 72b5322f11ff0abf6a52b3007486656578d2c982 ]
The @cn is stay in @clk_notifier_list after it is freed, it cause memory corruption.
Example, if @clk is registered(first), unregistered(first), registered(second), unregistered(second).
The freed @cn will be used when @clk is registered(second), and the bug will be happened when @clk is unregistered(second):
[ 517.040000] clk_notif_dbg clk_notif_dbg.1: clk_notifier_unregister() [ 517.040000] Unable to handle kernel paging request at virtual address 00df3008 [ 517.050000] pgd = ed858000 [ 517.050000] [00df3008] *pgd=00000000 [ 517.060000] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [ 517.060000] Modules linked in: clk_notif_dbg(O-) [last unloaded: clk_notif_dbg] [ 517.060000] CPU: 1 PID: 499 Comm: modprobe Tainted: G O 3.10.0-rc3-00119-ga93cb29-dirty #85 [ 517.060000] task: ee1e0180 ti: ee3e6000 task.ti: ee3e6000 [ 517.060000] PC is at srcu_readers_seq_idx+0x48/0x84 [ 517.060000] LR is at srcu_readers_seq_idx+0x60/0x84 [ 517.060000] pc : [<c0052720>] lr : [<c0052738>] psr: 80070013 [ 517.060000] sp : ee3e7d48 ip : 00000000 fp : ee3e7d6c [ 517.060000] r10: 00000000 r9 : ee3e6000 r8 : 00000000 [ 517.060000] r7 : ed84fe4c r6 : c068ec90 r5 : c068e430 r4 : 00000000 [ 517.060000] r3 : 00df3000 r2 : 00000000 r1 : 00000002 r0 : 00000000 [ 517.060000] Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 517.060000] Control: 18c5387d Table: 2d85804a DAC: 00000015 [ 517.060000] Process modprobe (pid: 499, stack limit = 0xee3e6238) [ 517.060000] Stack: (0xee3e7d48 to 0xee3e8000) .... [ 517.060000] [<c0052720>] (srcu_readers_seq_idx+0x48/0x84) from [<c0052790>] (try_check_zero+0x34/0xfc) [ 517.060000] [<c0052790>] (try_check_zero+0x34/0xfc) from [<c00528b0>] (srcu_advance_batches+0x58/0x114) [ 517.060000] [<c00528b0>] (srcu_advance_batches+0x58/0x114) from [<c0052c30>] (__synchronize_srcu+0x114/0x1ac) [ 517.060000] [<c0052c30>] (__synchronize_srcu+0x114/0x1ac) from [<c0052d14>] (synchronize_srcu+0x2c/0x34) [ 517.060000] [<c0052d14>] (synchronize_srcu+0x2c/0x34) from [<c0053a08>] (srcu_notifier_chain_unregister+0x68/0x74) [ 517.060000] [<c0053a08>] (srcu_notifier_chain_unregister+0x68/0x74) from [<c0375a78>] (clk_notifier_unregister+0x7c/0xc0) [ 517.060000] [<c0375a78>] (clk_notifier_unregister+0x7c/0xc0) from [<bf008034>] (clk_notif_dbg_remove+0x34/0x9c [clk_notif_dbg]) [ 517.060000] [<bf008034>] (clk_notif_dbg_remove+0x34/0x9c [clk_notif_dbg]) from [<c02bb974>] (platform_drv_remove+0x24/0x28) [ 517.060000] [<c02bb974>] (platform_drv_remove+0x24/0x28) from [<c02b9bf8>] (__device_release_driver+0x8c/0xd4) [ 517.060000] [<c02b9bf8>] (__device_release_driver+0x8c/0xd4) from [<c02ba680>] (driver_detach+0x9c/0xc4) [ 517.060000] [<c02ba680>] (driver_detach+0x9c/0xc4) from [<c02b99c4>] (bus_remove_driver+0xcc/0xfc) [ 517.060000] [<c02b99c4>] (bus_remove_driver+0xcc/0xfc) from [<c02bace4>] (driver_unregister+0x54/0x78) [ 517.060000] [<c02bace4>] (driver_unregister+0x54/0x78) from [<c02bbb44>] (platform_driver_unregister+0x1c/0x20) [ 517.060000] [<c02bbb44>] (platform_driver_unregister+0x1c/0x20) from [<bf0081f8>] (clk_notif_dbg_driver_exit+0x14/0x1c [clk_notif_dbg]) [ 517.060000] [<bf0081f8>] (clk_notif_dbg_driver_exit+0x14/0x1c [clk_notif_dbg]) from [<c00835e4>] (SyS_delete_module+0x200/0x28c) [ 517.060000] [<c00835e4>] (SyS_delete_module+0x200/0x28c) from [<c000edc0>] (ret_fast_syscall+0x0/0x48) [ 517.060000] Code: e5973004 e7911102 e0833001 e2881002 (e7933101)
--- drivers/clk/clk.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk.c +1 -0
@@ -1542,6 +1542,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)/* XXX the notifier code should handle this better */ if (!cn->notifier_head.head) {srcu_cleanup_notifier_head (&cn->notifier_head); +list_del (&cn->node);kfree (cn); }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 4/88 tilepro: work around module link error with gcc 4.7
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Chris Metcalf <[email protected]>
[ Upstream commit 3cb3f839d306443f3d1e79b0bde1a2ad2c12b555 ]
gcc 4.7.x is emitting calls to __ffsdi2 where previously it used to inline the appropriate ctz instructions. While this needs to be fixed in gcc, it's also easy to avoid having it cause build failures when building with those compilers by exporting __ffsdi2 to modules.
--- arch/tile/lib/exports.c | 2 ++ 1 file changed, 2 insertions(+)
arch/tile/lib/exports.c +2 -0
@@ -82,4 +82,6 @@ uint64_t __ashrdi3(uint64_t, unsigned int);EXPORT_SYMBOL (__ashrdi3);uint64_t __ashldi3 (uint64_t ,unsigned int );EXPORT_SYMBOL (__ashldi3); +int __ffsdi2 (uint64_t ); +EXPORT_SYMBOL (__ffsdi2);#endif
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 5/88 carl9170: fix frame drop and WARN due to minstrel_ht change
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Christian Lamparter <[email protected]>
[ Upstream commit 5f34608fa2acbfef5a06d0072a978c9943c28a2d ]
With "mac80211/minstrel_ht: add support for using CCK rates" minstrel_ht selects legacy CCK rates as viable rates for outgoing frames which might be sent as part of an A-MPDU [IEEE80211_TX_CTL_AMPDU is set].
This behavior triggered the following WARN_ON in the driver:
Quoted 1 line
WARNING: at carl9170/tx.c:995 carl9170_op_tx+0x1dd/0x6fd
The driver assumed that the rate control algorithm made a mistake and dropped the frame.
This patch removes the noisy warning altogether and allows said A-MPDU frames with CCK sample and/or fallback rates to be transmitted seamlessly.
--- drivers/net/wireless/ath/carl9170/tx.c | 69 +++++++++++++------------------- 1 file changed, 28 insertions(+), 41 deletions(-)
drivers/net/wireless/ath/carl9170/tx.c +28 -41
@@ -387,8 +387,7 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,u8 tid;if (!(txinfo->flags &IEEE80211_TX_CTL_AMPDU ) || - txinfo->flags &IEEE80211_TX_CTL_INJECTED || - (!(super->f.mac_control &cpu_to_le16 (AR9170_TX_MAC_AGGR )))) + txinfo->flags &IEEE80211_TX_CTL_INJECTED )return ;rcu_read_lock ();
@@ -982,30 +981,6 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)SET_VAL (CARL9170_TX_SUPER_AMPDU_FACTOR , txc->s.ampdu_settings, factor); - -for (i =0 ; i <CARL9170_TX_MAX_RATES ; i++) { - txrate = &info->control.rates[i]; -if (txrate->idx >=0 ) { - txc->s.ri[i] = -CARL9170_TX_SUPER_RI_AMPDU ; - -if (WARN_ON (!(txrate->flags & -IEEE80211_TX_RC_MCS ))) { -/* -* Not sure if it's even possible -* to aggregate non-ht rates with -* this HW. -*/ - goto err_out; - } -continue ; - } - - txrate->idx =0 ; - txrate->count = ar->hw->max_rate_tries; - } - - mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_AGGR ); }/*
@@ -1013,11 +988,31 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)* taken from mac_control. For all fallback rate, the firmware * updates the mac_control flags from the rate info field. */ -for (i =1 ; i <CARL9170_TX_MAX_RATES ; i++) { +for (i =0 ; i <CARL9170_TX_MAX_RATES ; i++) { +__le32 phy_set; txrate = &info->control.rates[i];if (txrate->idx <0 )break ; + phy_set =carl9170_tx_physet (ar, info, txrate); +if (i ==0 ) { +/* first rate - part of the hw's frame header */ + txc->f.phy_control = phy_set; + +if (ampdu && txrate->flags &IEEE80211_TX_RC_MCS ) + mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_AGGR ); +if (carl9170_tx_rts_check (ar, txrate, ampdu, no_ack)) + mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_RTS ); +else if (carl9170_tx_cts_check (ar, txrate)) + mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_CTS ); + + }else { +/* fallback rates are stored in the firmware's +* retry rate set array. +*/ + txc->s.rr[i -1 ] = phy_set; + } +SET_VAL (CARL9170_TX_SUPER_RI_TRIES , txc->s.ri[i], txrate->count);
@@ -1028,21 +1023,13 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) txc->s.ri[i] |= (AR9170_TX_MAC_PROT_CTS <<CARL9170_TX_SUPER_RI_ERP_PROT_S ); - txc->s.rr[i -1 ] =carl9170_tx_physet (ar, info, txrate); +if (ampdu && (txrate->flags &IEEE80211_TX_RC_MCS )) + txc->s.ri[i] |=CARL9170_TX_SUPER_RI_AMPDU ; } - txrate = &info->control.rates[0 ]; -SET_VAL (CARL9170_TX_SUPER_RI_TRIES , txc->s.ri[0 ], txrate->count); - -if (carl9170_tx_rts_check (ar, txrate, ampdu, no_ack)) - mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_RTS ); -else if (carl9170_tx_cts_check (ar, txrate)) - mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_CTS ); - txc->s.len =cpu_to_le16 (skb->len); txc->f.length =cpu_to_le16 (len +FCS_LEN ); txc->f.mac_control = mac_tmp; - txc->f.phy_control =carl9170_tx_physet (ar, info, txrate); arinfo = (void *)info->rate_driver_data; arinfo->timeout = jiffies;
@@ -1382,9 +1369,9 @@ static void carl9170_tx(struct ar9170 *ar) }static bool carl9170_tx_ampdu_queue (struct ar9170 *ar, -struct ieee80211_sta *sta,struct sk_buff *skb) +struct ieee80211_sta *sta,struct sk_buff *skb, +struct ieee80211_tx_info *txinfo) { -struct _carl9170_tx_superframe *super = (void *) skb->data;struct carl9170_sta_info *sta_info;struct carl9170_sta_tid *agg;struct sk_buff *iter;
@@ -1451,7 +1438,7 @@ err_unlock: err_unlock_rcu:rcu_read_unlock (); - super->f.mac_control &= ~cpu_to_le16 (AR9170_TX_MAC_AGGR ); + txinfo->flags &= ~IEEE80211_TX_CTL_AMPDU ;carl9170_tx_status (ar, skb, false); ar->tx_dropped++;return false;
@@ -1485,7 +1472,7 @@ void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) }if (info->flags &IEEE80211_TX_CTL_AMPDU ) { - run =carl9170_tx_ampdu_queue (ar, sta, skb); + run =carl9170_tx_ampdu_queue (ar, sta, skb, info);if (run)carl9170_tx_ampdu (ar);
Signature · 1 line
1.7.10.4
Re: [05/88] carl9170: fix frame drop and WARN due to minstrel_ht change
Quoted 2 lines · Steven Rostedt
3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
Not exactly an objection, but the commit text refers to:
a0497f9 mac80211/minstrel_ht: add support for using CCK rates
which doesn't seem to exist in 3.6 kernel. I wonder if this commit is actually needed.
Cheers,
Signature · 1 line
Luis
Quoted 159 lines
------------------
From: Christian Lamparter <[email protected]>
[ Upstream commit
5f34608fa2acbfef5a06d0072a978c9943c28a2d]With "mac80211/minstrel_ht: add support for using CCK rates"
minstrel_htselects legacy CCK rates as viable rates for outgoing frames which might be sent as part of an A-MPDU [IEEE80211_TX_CTL_AMPDUis set].This behavior triggered the following
WARN_ONin the driver:Quoted 1 line
WARNING: at carl9170/tx.c:995 carl9170_op_tx+0x1dd/0x6fdThe driver assumed that the rate control algorithm made a mistake and dropped the frame.
This patch removes the noisy warning altogether and allows said A-MPDU frames with CCK sample and/or fallback rates to be transmitted seamlessly.
Signed-off-by Christian Lamparter <[email protected]>Signed-off-by John W. Linville <[email protected]>Signed-off-by Steven Rostedt <[email protected]>--- drivers/net/wireless/ath/carl9170/tx.c | 69 +++++++++++++------------------- 1 file changed, 28 insertions(+), 41 deletions(-)drivers/net/wireless/ath/carl9170/tx.c +28
-41@@ -387,8 +387,7 @@ static void carl9170_tx_status_process_ampdu(struct ar9170 *ar,u8 tid;if (!(txinfo->flags &IEEE80211_TX_CTL_AMPDU ) || - txinfo->flags &IEEE80211_TX_CTL_INJECTED || - (!(super->f.mac_control &cpu_to_le16 (AR9170_TX_MAC_AGGR )))) + txinfo->flags &IEEE80211_TX_CTL_INJECTED )return ;rcu_read_lock ();@@ -982,30 +981,6 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)SET_VAL (CARL9170_TX_SUPER_AMPDU_FACTOR , txc->s.ampdu_settings, factor); - -for (i =0 ; i <CARL9170_TX_MAX_RATES ; i++) { - txrate = &info->control.rates[i]; -if (txrate->idx >=0 ) { - txc->s.ri[i] = -CARL9170_TX_SUPER_RI_AMPDU ; - -if (WARN_ON (!(txrate->flags & -IEEE80211_TX_RC_MCS ))) { -/* -* Not sure if it's even possible -* to aggregate non-ht rates with -* this HW. -*/ - goto err_out; - } -continue ; - } - - txrate->idx =0 ; - txrate->count = ar->hw->max_rate_tries; - } - - mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_AGGR ); }/* @@ -1013,11 +988,31 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)* taken from mac_control. For all fallback rate, the firmware * updates the mac_control flags from the rate info field. */ -for (i =1 ; i <CARL9170_TX_MAX_RATES ; i++) { +for (i =0 ; i <CARL9170_TX_MAX_RATES ; i++) { +__le32 phy_set; txrate = &info->control.rates[i];if (txrate->idx <0 )break ; + phy_set =carl9170_tx_physet (ar, info, txrate); +if (i ==0 ) { +/* first rate - part of the hw's frame header */ + txc->f.phy_control = phy_set; + +if (ampdu && txrate->flags &IEEE80211_TX_RC_MCS ) + mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_AGGR ); +if (carl9170_tx_rts_check (ar, txrate, ampdu, no_ack)) + mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_RTS ); +else if (carl9170_tx_cts_check (ar, txrate)) + mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_CTS ); + + }else { +/* fallback rates are stored in the firmware's +* retry rate set array. +*/ + txc->s.rr[i -1 ] = phy_set; + } +SET_VAL (CARL9170_TX_SUPER_RI_TRIES , txc->s.ri[i], txrate->count);@@ -1028,21 +1023,13 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) txc->s.ri[i] |= (AR9170_TX_MAC_PROT_CTS <<CARL9170_TX_SUPER_RI_ERP_PROT_S ); - txc->s.rr[i -1 ] =carl9170_tx_physet (ar, info, txrate); +if (ampdu && (txrate->flags &IEEE80211_TX_RC_MCS )) + txc->s.ri[i] |=CARL9170_TX_SUPER_RI_AMPDU ; } - txrate = &info->control.rates[0 ]; -SET_VAL (CARL9170_TX_SUPER_RI_TRIES , txc->s.ri[0 ], txrate->count); - -if (carl9170_tx_rts_check (ar, txrate, ampdu, no_ack)) - mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_RTS ); -else if (carl9170_tx_cts_check (ar, txrate)) - mac_tmp |=cpu_to_le16 (AR9170_TX_MAC_PROT_CTS ); - txc->s.len =cpu_to_le16 (skb->len); txc->f.length =cpu_to_le16 (len +FCS_LEN ); txc->f.mac_control = mac_tmp; - txc->f.phy_control =carl9170_tx_physet (ar, info, txrate); arinfo = (void *)info->rate_driver_data; arinfo->timeout = jiffies;@@ -1382,9 +1369,9 @@ static void carl9170_tx(struct ar9170 *ar) }static bool carl9170_tx_ampdu_queue (struct ar9170 *ar, -struct ieee80211_sta *sta,struct sk_buff *skb) +struct ieee80211_sta *sta,struct sk_buff *skb, +struct ieee80211_tx_info *txinfo) { -struct _carl9170_tx_superframe *super = (void *) skb->data;struct carl9170_sta_info *sta_info;struct carl9170_sta_tid *agg;struct sk_buff *iter;@@ -1451,7 +1438,7 @@ err_unlock: err_unlock_rcu:rcu_read_unlock (); - super->f.mac_control &= ~cpu_to_le16 (AR9170_TX_MAC_AGGR ); + txinfo->flags &= ~IEEE80211_TX_CTL_AMPDU ;carl9170_tx_status (ar, skb, false); ar->tx_dropped++;return false;@@ -1485,7 +1472,7 @@ void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) }if (info->flags &IEEE80211_TX_CTL_AMPDU ) { - run =carl9170_tx_ampdu_queue (ar, sta, skb); + run =carl9170_tx_ampdu_queue (ar, sta, skb, info);if (run)carl9170_tx_ampdu (ar);
Steven Rostedt
reviewerRe: [05/88] carl9170: fix frame drop and WARN due to minstrel_ht change
Quoted 11 lines · On Tue, 13 Aug 2013 18:15:28 +0100 Luis Henriques…
Quoted 2 lines · Steven Rostedt
3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.Not exactly an objection, but the commit text refers to:
a0497f9 mac80211/minstrel_ht: add support for using CCK rates
which doesn't seem to exist in 3.6 kernel. I wonder if this commit is actually needed.
No it doesn't :-/
Grumble, it would be nice if people added which kernel a patch goes to. I started out looking at over 200 commits to determine which should be backported or not. I look for any stable tags first, and then read the commit log for SHA1s that I can look for. It seems that I missed that this commit did state which commit caused the issue, it must have applied fine, because failed applied patches I scrutinize even more.
Oh well, I'll nuke this commit.
Thanks!
-- Steve
Steven Rostedt
reviewerPATCH 6/88 KVM: x86: remove vcpus CPL check in host-invoked XCR set
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "Zhanghaoyu (A)" <[email protected]>
[ Upstream commit 764bcbc5a6d7a2f3e75c9f0e4caa984e2926e346 ]
__kvm_set_xcr function does the CPL check when set xcr. __kvm_set_xcr is called in two flows, one is invoked by guest, call stack shown as below,
handle_xsetbv(or xsetbv_interception)
kvm_set_xcr
__kvm_set_xcrthe other one is invoked by host, for example during system reset:
kvm_arch_vcpu_ioctl
kvm_vcpu_ioctl_x86_set_xcrs
__kvm_set_xcrThe former does need the CPL check, but the latter does not.
--- arch/x86/kvm/x86.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kvm/x86.c +2 -3
@@ -558,8 +558,6 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)if (index !=XCR_XFEATURE_ENABLED_MASK )return 1 ; xcr0 = xcr; -if (kvm_x86_ops->get_cpl (vcpu) !=0 ) -return 1 ;if (!(xcr0 &XSTATE_FP ))return 1 ;if ((xcr0 &XSTATE_YMM ) && !(xcr0 &XSTATE_SSE ))
@@ -573,7 +571,8 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)int kvm_set_xcr (struct kvm_vcpu *vcpu,u32 index,u64 xcr) { -if (__kvm_set_xcr (vcpu, index, xcr)) { +if (kvm_x86_ops->get_cpl (vcpu) !=0 || +__kvm_set_xcr (vcpu, index, xcr)) {kvm_inject_gp (vcpu,0 );return 1 ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 7/88 drm/radeon: prevent crash in the ring space allocation
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit fd5d93a0015ce1a7db881382022b2fcdfdc61760 ]
If the requested number of DWs on the ring is larger than the size of the ring itself, return an error.
In testing with large VM updates, we've seen crashes when we try and allocate more space on the ring than the total size of the ring without checking.
This prevents the crash but for large VM updates or bo moves of very large buffers, we will need to break the transaction down into multiple batches. I have patches to use IBs for the next kernel.
--- drivers/gpu/drm/radeon/radeon_ring.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/radeon/radeon_ring.c +3 -0
@@ -361,6 +361,9 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi {int r; +/* make sure we aren't trying to allocate more space than there is on the ring */ +if (ndw > (ring->ring_size /4 )) +return -ENOMEM ;/* Align requested size with padding so unlock_commit can * pad safely */ ndw = (ndw + ring->align_mask) & ~ring->align_mask;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 8/88 drm/radeon: update lockup tracking when scheduling in empty ring
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
[ Upstream commit 8444d5c69549aa0f0b574cc608742d4669e1cc01 ]
There might be issue with lockup detection when scheduling on an empty ring that have been sitting idle for a while. Thus update the lockup tracking data when scheduling new work in an empty ring.
--- drivers/gpu/drm/radeon/radeon_ring.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/radeon_ring.c +7 -0
@@ -366,6 +366,13 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsireturn -ENOMEM ;/* Align requested size with padding so unlock_commit can * pad safely */ +radeon_ring_free_size (rdev, ring); +if (ring->ring_free_dw == (ring->ring_size /4 )) { +/* This is an empty ring update lockup info to avoid +* false positive. +*/ +radeon_ring_lockup_update (ring); + } ndw = (ndw + ring->align_mask) & ~ring->align_mask;while (ndw > (ring->ring_free_dw -1 )) {radeon_ring_free_size (rdev, ring);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 9/88 x86: fix build error and kconfig for ia32_emulation and binfmt
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit d1603990ea626668c78527376d9ec084d634202d ]
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
@@ -2156,6 +2156,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
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 10/88 tcp: fix tcp_md5_hash_skb_data()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 54d27fcb338bd9c42d1dfc5a39e18f6f9d373c2e ]
TCP md5 communications fail [1] for some devices, because sg/crypto code assume page offsets are below PAGE_SIZE.
This was discovered using mlx4 driver [2], but I suspect loopback might trigger the same bug now we use order-3 pages in tcp_sendmsg()
[1] Failure is giving following messages.
huh, entered softirq 3 NET_RX ffffffff806ad230 preempt_count 00000100, exited with 00000101?
[2] mlx4 driver uses order-2 pages to allocate RX frags
--- net/ipv4/tcp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/tcp.c +5 -2
@@ -3368,8 +3368,11 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp,for (i =0 ; i < shi->nr_frags; ++i) {const struct skb_frag_struct *f = &shi->frags[i]; -struct page *page =skb_frag_page (f); -sg_set_page (&sg, page,skb_frag_size (f), f->page_offset); +unsigned int offset = f->page_offset; +struct page *page =skb_frag_page (f) + (offset >>PAGE_SHIFT ); + +sg_set_page (&sg, page,skb_frag_size (f), +offset_in_page (offset));if (crypto_hash_update (desc, &sg,skb_frag_size (f)))return 1 ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 11/88 gianfar: add missing iounmap() on error in gianfar_ptp_probe()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
[ Upstream commit e5f5e380e0f3bb11f04ca5bc66a551e58e0ad26e ]
Add the missing iounmap() before return from gianfar_ptp_probe() in the error handling case.
--- drivers/net/ethernet/freescale/gianfar_ptp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/freescale/gianfar_ptp.c +1 -0
@@ -521,6 +521,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)return 0 ; no_clock: +iounmap (etsects->regs); no_ioremap:release_resource (etsects->rsrc); no_resource:
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 12/88 ipv6: fix possible crashes in ip6_cork_release()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 284041ef21fdf2e0d216ab6b787bc9072b4eb58a ]
commit 0178b695fd6b4 ("ipv6: Copy cork options in ip6_append_data") added some code duplication and bad error recovery, leading to potential crash in ip6_cork_release() as kfree() could be called with garbage.
use kzalloc() to make sure this wont happen.
--- net/ipv6/ip6_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6_output.c +1 -1
@@ -1236,7 +1236,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,if (WARN_ON (np->cork.opt))return -EINVAL ; - np->cork.opt =kmalloc (opt->tot_len, sk->sk_allocation); + np->cork.opt =kzalloc (opt->tot_len, sk->sk_allocation);if (unlikely (np->cork.opt ==NULL ))return -ENOBUFS ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 13/88 netlabel: improve domain mapping validation
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
[ Upstream commit 6b21e1b77d1a3d58ebfd513264c885695e8a0ba5 ]
The net/netlabel/netlabel_domainhash.c:netlbl_domhsh_add() function does not properly validate new domain hash entries resulting in potential problems when an administrator attempts to add an invalid entry. One such problem, as reported by Vlad Halilov, is a kernel BUG (found in netlabel_domainhash.c:netlbl_domhsh_audit_add()) when adding an IPv6 outbound mapping with a CIPSO configuration.
This patch corrects this problem by adding the necessary validation code to netlbl_domhsh_add() via the newly created netlbl_domhsh_validate() function.
Ideally this patch should also be pushed to the currently active -stable trees.
--- net/netlabel/netlabel_domainhash.c | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
net/netlabel/netlabel_domainhash.c +69 -0
@@ -245,6 +245,71 @@ static void netlbl_domhsh_audit_add(struct netlbl_dom_map *entry, } } +/** +* netlbl_domhsh_validate - Validate a new domain mapping entry +* @entry: the entry to validate +* +* This function validates the new domain mapping entry to ensure that it is +* a valid entry. Returns zero on success, negative values on failure. +* +*/ +static int netlbl_domhsh_validate (const struct netlbl_dom_map *entry) +{ +struct netlbl_af4list *iter4; +struct netlbl_domaddr4_map *map4; +#if IS_ENABLED (CONFIG_IPV6 ) +struct netlbl_af6list *iter6; +struct netlbl_domaddr6_map *map6; +#endif /* IPv6 */ + +if (entry ==NULL ) +return -EINVAL ; + +switch (entry->type) { +case NETLBL_NLTYPE_UNLABELED : +if (entry->type_def.cipsov4 !=NULL || + entry->type_def.addrsel !=NULL ) +return -EINVAL ; +break ; +case NETLBL_NLTYPE_CIPSOV4 : +if (entry->type_def.cipsov4 ==NULL ) +return -EINVAL ; +break ; +case NETLBL_NLTYPE_ADDRSELECT : + netlbl_af4list_foreach(iter4, &entry->type_def.addrsel->list4) { + map4 =netlbl_domhsh_addr4_entry (iter4); +switch (map4->type) { +case NETLBL_NLTYPE_UNLABELED : +if (map4->type_def.cipsov4 !=NULL ) +return -EINVAL ; +break ; +case NETLBL_NLTYPE_CIPSOV4 : +if (map4->type_def.cipsov4 ==NULL ) +return -EINVAL ; +break ; +default : +return -EINVAL ; + } + } +#if IS_ENABLED (CONFIG_IPV6 ) + netlbl_af6list_foreach(iter6, &entry->type_def.addrsel->list6) { + map6 =netlbl_domhsh_addr6_entry (iter6); +switch (map6->type) { +case NETLBL_NLTYPE_UNLABELED : +break ; +default : +return -EINVAL ; + } + } +#endif /* IPv6 */ +break ; +default : +return -EINVAL ; + } + +return 0 ; +} +/* * Domain Hash Table Functions */
@@ -311,6 +376,10 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,struct netlbl_af6list *tmp6;#endif /* IPv6 */ + ret_val =netlbl_domhsh_validate (entry); +if (ret_val !=0 ) +return ret_val; +/* XXX - we can remove this RCU read lock as the spinlock protects the * entire function, but before we do we need to fixup the * netlbl_af[4,6]list RCU functions to do "the right thing" with
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 14/88 8139cp: reset BQL when ring tx ring cleared
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: stephen hemminger <[email protected]>
[ Upstream commit 98962baad72fd6d393bf39dbb7c2076532c363c6 ]
This patch cures transmit timeout's with DHCP observed while running under KVM. When the transmit ring is cleaned out, the Byte Queue Limit values need to be reset.
--- drivers/net/ethernet/realtek/8139cp.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/realtek/8139cp.c +1 -0
@@ -1100,6 +1100,7 @@ static void cp_clean_rings (struct cp_private *cp) cp->dev->stats.tx_dropped++; } } +netdev_reset_queue (cp->dev);memset (cp->rx_ring,0 ,sizeof (struct cp_desc ) *CP_RX_RING_SIZE );memset (cp->tx_ring,0 ,sizeof (struct cp_desc ) *CP_TX_RING_SIZE );
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 15/88 tcp: bug fix in proportional rate reduction.
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Nandita Dukkipati <[email protected]>
[ Upstream commit 35f079ebbc860dcd1cca70890c9c8d59c1145525 ]
This patch is a fix for a bug triggering newly_acked_sacked < 0 in tcp_ack(.).
The bug is triggered by sacked_out decreasing relative to prior_sacked, but packets_out remaining the same as pior_packets. This is because the snapshot of prior_packets is taken after tcp_sacktag_write_queue() while prior_sacked is captured before tcp_sacktag_write_queue(). The problem
is: tcp_sacktag_write_queue (tcp_match_skb_to_sack() -> tcp_fragment) adjusts the pcount for packets_out and sacked_out (MSS change or other reason). As a result, this delta in pcount is reflected in (prior_sacked - sacked_out) but not in (prior_packets - packets_out).
This patch does the following:
1) initializes prior_packets at the start of tcp_ack() so as to capture the delta in packets_out created by tcp_fragment.
2) introduces a new "previous_packets_out" variable that snapshots packets_out right before tcp_clean_rtx_queue, so pkts_acked can be correctly computed as before.
3) Computes pkts_acked using previous_packets_out, and computes newly_acked_sacked using prior_packets.
--- net/ipv4/tcp_input.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
net/ipv4/tcp_input.c +13 -10
@@ -2924,8 +2924,8 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)* tcp_xmit_retransmit_queue(). */ static void tcp_fastretrans_alert (struct sock *sk,int pkts_acked, -int prior_sacked,bool is_dupack, -int flag) +int prior_sacked,int prior_packets, +bool is_dupack,int flag) {struct inet_connection_sock *icsk =inet_csk (sk);struct tcp_sock *tp =tcp_sk (sk);
@@ -2991,7 +2991,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,tcp_add_reno_sack (sk); }else do_lost =tcp_try_undo_partial (sk, pkts_acked); - newly_acked_sacked = pkts_acked + tp->sacked_out - prior_sacked; + newly_acked_sacked = prior_packets - tp->packets_out + + tp->sacked_out - prior_sacked;break ;case TCP_CA_Loss:if (flag &FLAG_DATA_ACKED )
@@ -3013,7 +3014,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,if (is_dupack)tcp_add_reno_sack (sk); } - newly_acked_sacked = pkts_acked + tp->sacked_out - prior_sacked; + newly_acked_sacked = prior_packets - tp->packets_out + + tp->sacked_out - prior_sacked;if (icsk->icsk_ca_state <= TCP_CA_Disorder)tcp_try_undo_dsack (sk);
@@ -3632,10 +3634,11 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)bool is_dupack = false;u32 prior_in_flight;u32 prior_fackets; -int prior_packets; +int prior_packets = tp->packets_out;int prior_sacked = tp->sacked_out;int pkts_acked =0 ;bool frto_cwnd = false; +int previous_packets_out =0 ;/* If the ack is older than previous acks * then we can probably ignore it.
@@ -3714,14 +3717,14 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) sk->sk_err_soft =0 ; icsk->icsk_probes_out =0 ; tp->rcv_tstamp = tcp_time_stamp; - prior_packets = tp->packets_out;if (!prior_packets) goto no_queue;/* See if we can take anything off of the retransmit queue. */ + previous_packets_out = tp->packets_out; flag |=tcp_clean_rtx_queue (sk, prior_fackets, prior_snd_una); - pkts_acked = prior_packets - tp->packets_out; + pkts_acked = previous_packets_out - tp->packets_out;if (tp->frto_counter) frto_cwnd =tcp_process_frto (sk, flag);
@@ -3736,7 +3739,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_cong_avoid (sk, ack, prior_in_flight); is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED |FLAG_NOT_DUP ));tcp_fastretrans_alert (sk, pkts_acked, prior_sacked, - is_dupack, flag); + prior_packets, is_dupack, flag); }else {if ((flag &FLAG_DATA_ACKED ) && !frto_cwnd)tcp_cong_avoid (sk, ack, prior_in_flight);
@@ -3753,7 +3756,7 @@ no_queue:/* If data was DSACKed, see if we can undo a cwnd reduction. */ if (flag &FLAG_DSACKING_ACK )tcp_fastretrans_alert (sk, pkts_acked, prior_sacked, - is_dupack, flag); + prior_packets, is_dupack, flag);/* If this ack opens up a zero window, clear backoff. It was * being used to time the probes, and is probably far higher than * it needs to be for normal retransmission.
@@ -3773,7 +3776,7 @@ old_ack:if (TCP_SKB_CB (skb)->sacked) { flag |=tcp_sacktag_write_queue (sk, skb, prior_snd_una);tcp_fastretrans_alert (sk, pkts_acked, prior_sacked, - is_dupack, flag); + prior_packets, is_dupack, flag); }SOCK_DEBUG (sk,"Ack %u before %u:%u\n" , ack, tp->snd_una, tp->snd_nxt);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 16/88 tcp: xps: fix reordering issues
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 547669d483e5783d722772af1483fa474da7caf9 ]
commit 3853b5841c01a ("xps: Improvements in TX queue selection") introduced ooo_okay flag, but the condition to set it is slightly wrong.
In our traces, we have seen ACK packets being received out of order, and RST packets sent in response.
We should test if we have any packets still in host queue.
--- net/ipv4/tcp_output.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/ipv4/tcp_output.c +6 -4
@@ -1023,11 +1023,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, &md5); tcp_header_size = tcp_options_size +sizeof (struct tcphdr ); -if (tcp_packets_in_flight (tp) ==0 ) { +if (tcp_packets_in_flight (tp) ==0 )tcp_ca_event (sk,CA_EVENT_TX_START ); - skb->ooo_okay =1 ; - }else - skb->ooo_okay =0 ; + +/* if no packet is in qdisc/device queue, then allow XPS to select +* another queue. +*/ + skb->ooo_okay =sk_wmem_alloc_get (sk) ==0 ;skb_push (skb, tcp_header_size);skb_reset_transport_header (skb);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 17/88 ip_tunnel: fix kernel panic with icmp_dest_unreach
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a622260254ee481747cceaaa8609985b29a31565 ]
Daniel Petre reported crashes in icmp_dst_unreach() with following call graph:
#3 [ffff88003fc03938] __stack_chk_fail at ffffffff81037f77 #4 [ffff88003fc03948] icmp_send at ffffffff814d5fec #5 [ffff88003fc03ae8] ipv4_link_failure at ffffffff814a1795 #6 [ffff88003fc03af8] ipgre_tunnel_xmit at ffffffff814e7965 #7 [ffff88003fc03b78] dev_hard_start_xmit at ffffffff8146e032 #8 [ffff88003fc03bc8] sch_direct_xmit at ffffffff81487d66 #9 [ffff88003fc03c08] __qdisc_run at ffffffff81487efd #10 [ffff88003fc03c48] dev_queue_xmit at ffffffff8146e5a7 #11 [ffff88003fc03c88] ip_finish_output at ffffffff814ab596
Daniel found a similar problem mentioned in
http://lkml.indiana.edu/hypermail/linux/kernel/1007.0/00961.html
And indeed this is the root cause : skb->cb[] contains data fooling IP stack.
We must clear IPCB in ip_tunnel_xmit() sooner in case dst_link_failure() is called. Or else skb->cb[] might contain garbage from GSO segmentation layer.
A similar fix was tested on linux-3.9, but gre code was refactored in linux-3.10. I'll send patches for stable kernels as well.
Many thanks to Daniel for providing reports, patches and testing !
--- net/ipv4/ip_gre.c | 2 +- net/ipv4/ipip.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ip_gre.c +1 -1
@@ -756,6 +756,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev tiph = &tunnel->parms.iph; } +memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));if ((dst = tiph->daddr) ==0 ) {/* NBMA tunnel */
@@ -899,7 +900,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *devskb_reset_transport_header (skb);skb_push (skb, gre_hlen);skb_reset_network_header (skb); -memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));IPCB (skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE |IPSKB_XFRM_TRANSFORMED |IPSKB_REROUTED );skb_dst_drop (skb);
net/ipv4/ipip.c +1 -1
@@ -481,6 +481,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)if (tos &1 ) tos = old_iph->tos; +memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));if (!dst) {/* NBMA tunnel */ if ((rt =skb_rtable (skb)) ==NULL ) {
@@ -563,7 +564,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) skb->transport_header = skb->network_header;skb_push (skb,sizeof (struct iphdr ));skb_reset_network_header (skb); -memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));IPCB (skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE |IPSKB_XFRM_TRANSFORMED |IPSKB_REROUTED );skb_dst_drop (skb);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 18/88 net: phy: fix a bug when verify the EEE support
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Giuseppe CAVALLARO <[email protected]>
[ Upstream commit 9a9c56cb34e65000d1f0a4b7553399bfcf7c5a52 ]
The phy_init_eee has to exit with an error when the local device and its link partner both do not support EEE. So this patch fixes a problem when verify this.
--- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
@@ -1152,7 +1152,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) adv =phy_eee_to_adv (eee_adv); lp =phy_eee_to_adv (eee_lp); idx =phy_find_setting (phydev->speed, phydev->duplex); -if ((lp & adv & settings[idx].setting)) +if (!(lp & adv & settings[idx].setting)) goto eee_exit;if (clk_stop_enable) {
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 19/88 ipv4: fix redirect handling for TCP packets
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Michal Kubecek <[email protected]>
[ Upstream commit f96ef988cc603487c03a6de07807b06cbe641829 ]
Unlike ipv4_redirect() and ipv4_sk_redirect(), ip_do_redirect() doesn't call __build_flow_key() directly but via ip_rt_build_flow_key() wrapper. This leads to __build_flow_key() getting pointer to IPv4 header of the ICMP redirect packet rather than pointer to the embedded IPv4 header of the packet initiating the redirect.
As a result, handling of ICMP redirects initiated by TCP packets is broken. Issue was introduced by
4895c771c ("ipv4: Add FIB nexthop exceptions.")--- net/ipv4/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/ipv4/route.c +6 -1
@@ -741,10 +741,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf {struct rtable *rt;struct flowi4 fl4; +const struct iphdr *iph = (const struct iphdr *) skb->data; +int oif = skb->dev->ifindex; +u8 tos =RT_TOS (iph->tos); +u8 prot = iph->protocol; +u32 mark = skb->mark; rt = (struct rtable *) dst; -ip_rt_build_flow_key (&fl4, sk, skb); +__build_flow_key (&fl4, sk, iph, oif, tos, prot, mark,0 );__ip_do_redirect (rt, skb, &fl4, true); }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 20/88 net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
[ Upstream commit 1be374a0518a288147c6a7398792583200a67261 ]
To: [email protected]
Cc: [email protected], [email protected], Andy Lutomirski <[email protected]>, [email protected], "David S.
Miller" <[email protected]>
Subject: [20/88] [PATCH 5/5] net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg
MSG_CMSG_COMPAT is (AFAIK) not intended to be part of the API -- it's a hack that steals a bit to indicate to other networking code that a compat entry was used. So don't allow it from a non-compat syscall.
This prevents an oops when running this code:
int main()
{
int s;
struct sockaddr_in addr;
struct msghdr *hdr;
char *highpage = mmap((void*)(TASK_SIZE_MAX - 4096), 4096,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
if (highpage == MAP_FAILED)
err(1, "mmap");
s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (s == -1)
err(1, "socket");
addr.sin_family = AF_INET;
addr.sin_port = htons(1);
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (connect(s, (struct sockaddr*)&addr, sizeof(addr)) != 0)
err(1, "connect");
void *evil = highpage + 4096 - COMPAT_MSGHDR_SIZE;
printf("Evil address is %p\n", evil);
if (syscall(__NR_sendmmsg, s, evil, 1, MSG_CMSG_COMPAT) < 0)
err(1, "sendmmsg");
return 0;
}--- net/socket.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
net/socket.c +31 -2
@@ -2016,8 +2016,12 @@ SYSCALL_DEFINE3(sendmsg, int, fd, struct msghdr __user *, msg, unsigned int, fla {int fput_needed, err;struct msghdr msg_sys; -struct socket *sock =sockfd_lookup_light (fd, &err, &fput_needed); +struct socket *sock; + +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; + sock =sockfd_lookup_light (fd, &err, &fput_needed);if (!sock) goto out;
@@ -2090,6 +2094,8 @@ int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, SYSCALL_DEFINE4(sendmmsg, int, fd, struct mmsghdr __user *, mmsg, unsigned int, vlen, unsigned int, flags) { +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ;return __sys_sendmmsg (fd, mmsg, vlen, flags); }
@@ -2190,8 +2196,12 @@ SYSCALL_DEFINE3(recvmsg, int, fd, struct msghdr __user *, msg, {int fput_needed, err;struct msghdr msg_sys; -struct socket *sock =sockfd_lookup_light (fd, &err, &fput_needed); +struct socket *sock; + +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; + sock =sockfd_lookup_light (fd, &err, &fput_needed);if (!sock) goto out;
@@ -2316,6 +2326,9 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,int datagrams;struct timespec timeout_sys; +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +if (!timeout)return __sys_recvmmsg (fd, mmsg, vlen, flags,NULL );
@@ -2431,15 +2444,31 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args) (int __user *)a[4]);break ;case SYS_SENDMSG : +if (a[2 ] &MSG_CMSG_COMPAT ) { + err = -EINVAL ; +break ; + } err =sys_sendmsg (a0, (struct msghdr __user *)a1, a[2 ]);break ;case SYS_SENDMMSG : +if (a[3 ] &MSG_CMSG_COMPAT ) { + err = -EINVAL ; +break ; + } err =sys_sendmmsg (a0, (struct mmsghdr __user *)a1, a[2 ], a[3 ]);break ;case SYS_RECVMSG : +if (a[2 ] &MSG_CMSG_COMPAT ) { + err = -EINVAL ; +break ; + } err =sys_recvmsg (a0, (struct msghdr __user *)a1, a[2 ]);break ;case SYS_RECVMMSG : +if (a[3 ] &MSG_CMSG_COMPAT ) { + err = -EINVAL ; +break ; + } err =sys_recvmmsg (a0, (struct mmsghdr __user *)a1, a[2 ], a[3 ], (struct timespec __user *)a[4 ]);break ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 21/88 net: Unbreak compat_sys_{send,recv}msg
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Andy Lutomirski <[email protected]>
[ Upstream commit a7526eb5d06b0084ef12d7b168d008fcf516caab ]
I broke them in this commit:
commit 1be374a0518a288147c6a7398792583200a67261
Author: Andy Lutomirski <[email protected]>
Date: Wed May 22 14:07:44 2013 -0700
net: Block MSG_CMSG_COMPAT in send(m)msg and recv(m)msg
This patch adds __sys_sendmsg and __sys_sendmsg as common helpers that accept MSG_CMSG_COMPAT and blocks MSG_CMSG_COMPAT at the syscall entrypoints. It also reverts some unnecessary checks in sys_socketcall.
Apparently I was suffering from underscore blindness the first time around.
--- include/linux/socket.h | 3 ++ net/compat.c | 13 +++++++-- net/socket.c | 72 ++++++++++++++++++++++-------------------------- 3 files changed, 47 insertions(+), 41 deletions(-)
include/linux/socket.h +3 -0
@@ -337,6 +337,9 @@ extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);struct timespec ; +/* The __sys_...msg variants allow MSG_CMSG_COMPAT */ +extern long __sys_recvmsg (int fd,struct msghdr __user *msg,unsigned flags); +extern long __sys_sendmsg (int fd,struct msghdr __user *msg,unsigned flags);extern int __sys_recvmmsg (int fd,struct mmsghdr __user *mmsg,unsigned int vlen,unsigned int flags,struct timespec *timeout); extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
net/compat.c +11 -2
@@ -735,19 +735,25 @@ static unsigned char nas[21] = {asmlinkage long compat_sys_sendmsg (int fd,struct compat_msghdr __user *msg,unsigned int flags) { -return sys_sendmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +return __sys_sendmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); }asmlinkage long compat_sys_sendmmsg (int fd,struct compat_mmsghdr __user *mmsg,unsigned int vlen,unsigned int flags) { +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ;return __sys_sendmmsg (fd, (struct mmsghdr __user *)mmsg, vlen, flags |MSG_CMSG_COMPAT ); }asmlinkage long compat_sys_recvmsg (int fd,struct compat_msghdr __user *msg,unsigned int flags) { -return sys_recvmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +return __sys_recvmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); }asmlinkage long compat_sys_recv (int fd,void __user *buf,size_t len,unsigned int flags)
@@ -769,6 +775,9 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,int datagrams;struct timespec ktspec; +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +if (COMPAT_USE_64BIT_TIME ) return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, flags | MSG_CMSG_COMPAT,
net/socket.c +33 -39
163 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 22/88 net/core/sock.c: add missing VSOCK string in af_family_*_key_strings
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Federico Vaga <[email protected]>
[ Upstream commit 456db6a4d495f40777da6f1f32f62f13026f52db ]
The three arrays of strings: af_family_key_strings, af_family_slock_key_strings and af_family_clock_key_strings have not VSOCK's string
--- net/core/sock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/sock.c +3 -3
@@ -208,7 +208,7 @@ static const char *const af_family_key_strings[AF_MAX+1] = {"sk_lock-AF_TIPC" ,"sk_lock-AF_BLUETOOTH" ,"sk_lock-IUCV" ,"sk_lock-AF_RXRPC" ,"sk_lock-AF_ISDN" ,"sk_lock-AF_PHONET" ,"sk_lock-AF_IEEE802154" ,"sk_lock-AF_CAIF" ,"sk_lock-AF_ALG" , -"sk_lock-AF_NFC" ,"sk_lock-AF_MAX" +"sk_lock-AF_NFC" ,"sk_lock-AF_VSOCK" ,"sk_lock-AF_MAX" };static const char *const af_family_slock_key_strings[AF_MAX +1 ] = { "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
@@ -224,7 +224,7 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = {"slock-AF_TIPC" ,"slock-AF_BLUETOOTH" ,"slock-AF_IUCV" ,"slock-AF_RXRPC" ,"slock-AF_ISDN" ,"slock-AF_PHONET" ,"slock-AF_IEEE802154" ,"slock-AF_CAIF" ,"slock-AF_ALG" , -"slock-AF_NFC" ,"slock-AF_MAX" +"slock-AF_NFC" ,"slock-AF_VSOCK" ,"slock-AF_MAX" };static const char *const af_family_clock_key_strings[AF_MAX +1 ] = { "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
@@ -240,7 +240,7 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {"clock-AF_TIPC" ,"clock-AF_BLUETOOTH" ,"clock-AF_IUCV" ,"clock-AF_RXRPC" ,"clock-AF_ISDN" ,"clock-AF_PHONET" ,"clock-AF_IEEE802154" ,"clock-AF_CAIF" ,"clock-AF_ALG" , -"clock-AF_NFC" ,"clock-AF_MAX" +"clock-AF_NFC" ,"clock-AF_VSOCK" ,"clock-AF_MAX" };/*
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 23/88 net: force a reload of first item in hlist_nulls_for_each_entry_rcu
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit c87a124a5d5e8cf8e21c4363c3372bcaf53ea190 ]
Roman Gushchin discovered that udp4_lib_lookup2() was not reloading first item in the rcu protected list, in case the loop was restarted.
This produced soft lockups as in https://lkml.org/lkml/2013/4/16/37
rcu_dereference(X)/ACCESS_ONCE(X) seem to not work as intended if X is ptr->field :
In some cases, gcc caches the value or ptr->field in a register.
Use a barrier() to disallow such caching, as documented in Documentation/atomic_ops.txt line 114
Thanks a lot to Roman for providing analysis and numerous patches.
--- include/linux/rculist_nulls.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/rculist_nulls.h +6 -1
@@ -105,9 +105,14 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,* @head: the head for your list. * @member: the name of the hlist_nulls_node within the struct. * +* The barrier() is needed to make sure compiler doesn't cache first element [1], +* as this loop can be restarted [2] +* [1] Documentation/atomic_ops.txt around line 114 +* [2] Documentation/RCU/rculist_nulls.txt around line 146 */ #define hlist_nulls_for_each_entry_rcu (tpos, pos, head, member) \ - for (pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ + for (({barrier();}), \ + pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ (!is_a_nulls(pos)) && \ ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ pos = rcu_dereference_raw(hlist_nulls_next_rcu(pos)))
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 24/88 ipv6: assign rt6_info to inet6_ifaddr in init_loopback
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Gao feng <[email protected]>
[ Upstream commit 534c877928a16ae5f9776436a497109639bf67dc ]
Commit 25fb6ca4ed9cad72f14f61629b68dc03c0d9713f
"net IPv6 : Fix broken IPv6 routing table after loopback down-up" forgot to assign rt6_info to the inet6_ifaddr.
When disable the net device, the rt6_info which allocated in init_loopback will not be destroied in __ipv6_ifa_notify.
This will trigger the waring message below
[23527.916091] unregister_netdevice: waiting for tap0 to become free. Usage count = 1
--- net/ipv6/addrconf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +3 -1
@@ -2430,8 +2430,10 @@ static void init_loopback(struct net_device *dev) sp_rt =addrconf_dst_alloc (idev, &sp_ifa->addr,0 );/* Failure cases are ignored */ -if (!IS_ERR (sp_rt)) +if (!IS_ERR (sp_rt)) { + sp_ifa->rt = sp_rt;ip6_ins_rt (sp_rt); + } }read_unlock_bh (&idev->lock); }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 25/88 net: sctp: fix NULL pointer dereference in socket destruction
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 1abd165ed757db1afdefaac0a4bc8a70f97d258c ]
While stress testing sctp sockets, I hit the following panic:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
IP: [<ffffffffa0490c4e>] sctp_endpoint_free+0xe/0x40 [sctp]
PGD 7cead067 PUD 7ce76067 PMD 0
Oops: 0000 [#1] SMP
Modules linked in: sctp(F) libcrc32c(F) [...]
CPU: 7 PID: 2950 Comm: acc Tainted: GF 3.10.0-rc2+ #1
Hardware name: Dell Inc. PowerEdge T410/0H19HD, BIOS 1.6.3 02/01/2011
task: ffff88007ce0e0c0 ti: ffff88007b568000 task.ti: ffff88007b568000
RIP: 0010:[<ffffffffa0490c4e>] [<ffffffffa0490c4e>] sctp_endpoint_free+0xe/0x40 [sctp]
RSP: 0018:ffff88007b569e08 EFLAGS: 00010292
RAX: 0000000000000000 RBX: ffff88007db78a00 RCX: dead000000200200
RDX: ffffffffa049fdb0 RSI: ffff8800379baf38 RDI: 0000000000000000
RBP: ffff88007b569e18 R08: ffff88007c230da0 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff880077990d00 R14: 0000000000000084 R15: ffff88007db78a00
FS: 00007fc18ab61700(0000) GS:ffff88007fc60000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000020 CR3: 000000007cf9d000 CR4: 00000000000007e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Stack:
ffff88007b569e38 ffff88007db78a00 ffff88007b569e38 ffffffffa049fded
ffffffff81abf0c0 ffff88007db78a00 ffff88007b569e58 ffffffff8145b60e
0000000000000000 0000000000000000 ffff88007b569eb8 ffffffff814df36e
Call Trace:
[<ffffffffa049fded>] sctp_destroy_sock+0x3d/0x80 [sctp]
[<ffffffff8145b60e>] sk_common_release+0x1e/0xf0
[<ffffffff814df36e>] inet_create+0x2ae/0x350
[<ffffffff81455a6f>] __sock_create+0x11f/0x240
[<ffffffff81455bf0>] sock_create+0x30/0x40
[<ffffffff8145696c>] SyS_socket+0x4c/0xc0
[<ffffffff815403be>] ? do_page_fault+0xe/0x10
[<ffffffff8153cb32>] ? page_fault+0x22/0x30
[<ffffffff81544e02>] system_call_fastpath+0x16/0x1b
Code: 0c c9 c3 66 2e 0f 1f 84 00 00 00 00 00 e8 fb fe ff ff c9 c3 66 0f
1f 84 00 00 00 00 00 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 <48>
8b 47 20 48 89 fb c6 47 1c 01 c6 40 12 07 e8 9e 68 01 00 48
RIP [<ffffffffa0490c4e>] sctp_endpoint_free+0xe/0x40 [sctp]
RSP <ffff88007b569e08>
CR2: 0000000000000020
---[ end trace e0d71ec1108c1dd9 ]---I did not hit this with the lksctp-tools functional tests, but with a small, multi-threaded test program, that heavily allocates, binds, listens and waits in accept on sctp sockets, and then randomly kills some of them (no need for an actual client in this case to hit this). Then, again, allocating, binding, etc, and then killing child processes.
This panic then only occurs when ``echo 1 > /proc/sys/net/sctp/auth_enable'' is set. The cause for that is actually very simple: in sctp_endpoint_init() we enter the path of sctp_auth_init_hmacs(). There, we try to allocate our crypto transforms through crypto_alloc_hash(). In our scenario, it then can happen that crypto_alloc_hash() fails with -EINTR from crypto_larval_wait(), thus we bail out and release the socket via sk_common_release(), sctp_destroy_sock() and hit the NULL pointer dereference as soon as we try to access members in the endpoint during sctp_endpoint_free(), since endpoint at that time is still NULL. Now, if we have that case, we do not need to do any cleanup work and just leave the destruction handler.
--- net/sctp/socket.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/sctp/socket.c +6 -0
@@ -3982,6 +3982,12 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk)/* Release our hold on the endpoint. */ sp =sctp_sk (sk); +/* This could happen during socket init, thus we bail out +* early, since the rest of the below is not setup either. +*/ +if (sp->ep ==NULL ) +return ; +if (sp->do_auto_asconf) { sp->do_auto_asconf =0 ;list_del (&sp->auto_asconf_list);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 26/88 team: check return value of team_get_port_by_index_rcu() for NULL
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 76c455decbbad31de21c727edb184a963f42b40b ]
team_get_port_by_index_rcu() might return NULL due to race between port removal and skb tx path. Panic is easily triggeable when txing packets and adding/removing port in a loop.
introduced by commit 3d249d4ca "net: introduce ethernet teaming device" and commit 753f993911b "team: introduce random mode" (for random mode)
--- drivers/net/team/team_mode_roundrobin.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/team/team_mode_roundrobin.c +2 -0
@@ -52,6 +52,8 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb) port_index =rr_priv (team)->sent_packets++ % team->en_port_count; port =team_get_port_by_index_rcu (team, port_index); +if (unlikely (!port)) + goto drop; port =__get_first_port_up (team, port);if (unlikely (!port)) goto drop;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 27/88 team: move add to port list before port enablement
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 72df935d985c1575ed44ad2c8c653b28147993fa ]
team_port_enable() adds port to port_hashlist. Reader sees port in team_get_port_by_index_rcu() and returns it, but team_get_first_port_txable_rcu() tries to go through port_list, where the port is not inserted yet -> NULL pointer dereference.
Fix this by reordering port_list and port_hashlist insertion. Panic is easily triggeable when txing packets and adding/removing port in a loop.
Introduced by commit 3d249d4c "net: introduce ethernet teaming device"
--- drivers/net/team/team.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/team/team.c +1 -1
@@ -945,8 +945,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev) } port->index =-1 ; -team_port_enable (team, port);list_add_tail_rcu (&port->list, &team->port_list); +team_port_enable (team, port);__team_compute_features (team);__team_port_change_port_added (port, !!netif_carrier_ok (port_dev));__team_options_change_check (team);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 28/88 packet: packet_getname_spkt: make sure string is always 0-terminated
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit 2dc85bf323515e59e15dfa858d1472bb25cad0fe ]
uaddr->sa_data is exactly of size 14, which is hard-coded here and passed as a size argument to strncpy(). A device name can be of size IFNAMSIZ (== 16), meaning we might leave the destination string unterminated. Thus, use strlcpy() and also sizeof() while we're at it. We need to memset the data area beforehand, since strlcpy does not padd the remaining buffer with zeroes for user space, so that we do not possibly leak anything.
--- net/packet/af_packet.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/packet/af_packet.c +2 -3
@@ -2848,12 +2848,11 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,return -EOPNOTSUPP ; uaddr->sa_family =AF_PACKET ; +memset (uaddr->sa_data,0 ,sizeof (uaddr->sa_data));rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk),pkt_sk (sk)->ifindex);if (dev) -strncpy (uaddr->sa_data, dev->name,14 ); -else -memset (uaddr->sa_data,0 ,14 ); +strlcpy (uaddr->sa_data, dev->name,sizeof (uaddr->sa_data));rcu_read_unlock (); *uaddr_len =sizeof (*uaddr);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 29/88 l2tp: Fix PPP header erasure and memory leak
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit 55b92b7a11690bc377b5d373872a6b650ae88e64 ]
Copy user data after PPP framing header. This prevents erasure of the added PPP header and avoids leaking two bytes of uninitialised memory at the end of skb's data buffer.
--- net/l2tp/l2tp_ppp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/l2tp/l2tp_ppp.c +2 -2
@@ -345,12 +345,12 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghskb_put (skb,2 );/* Copy user data into skb */ - error =memcpy_fromiovec (skb->data, m->msg_iov, total_len); + error =memcpy_fromiovec (skb_put (skb, total_len), m->msg_iov, + total_len);if (error <0 ) {kfree_skb (skb); goto error_put_sess_tun; } -skb_put (skb, total_len);l2tp_xmit_skb (session, skb, session->hdr_len);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 30/88 l2tp: Fix sendmsg() return value
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
[ Upstream commit a6f79d0f26704214b5b702bbac525cb72997f984 ]
PPPoL2TP sockets should comply with the standard send*() return values (i.e. return number of bytes sent instead of 0 upon success).
--- net/l2tp/l2tp_ppp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_ppp.c +1 -1
@@ -357,7 +357,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghsock_put (ps->tunnel_sock);sock_put (sk); -return error; +return total_len; error_put_sess_tun:sock_put (ps->tunnel_sock);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 31/88 sctp: fully initialize sctp_outq in sctp_outq_init
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit c5c7774d7eb4397891edca9ebdf750ba90977a69 ]
In commit 2f94aabd9f6c925d77aecb3ff020f1cc12ed8f86
(refactor sctp_outq_teardown to insure proper re-initalization) we modified sctp_outq_teardown to use sctp_outq_init to fully re-initalize the outq structure. Steve West recently asked me why I removed the q->error = 0 initalization from sctp_outq_teardown. I did so because I was operating under the impression that sctp_outq_init would properly initalize that value for us, but it doesn't. sctp_outq_init operates under the assumption that the outq struct is all 0's (as it is when called from sctp_association_init), but using it in __sctp_outq_teardown violates that assumption. We should do a memset in sctp_outq_init to ensure that the entire structure is in a known state there instead.
--- net/sctp/outqueue.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/sctp/outqueue.c +2 -4
@@ -205,6 +205,8 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary,*/ void sctp_outq_init (struct sctp_association *asoc,struct sctp_outq *q) { +memset (q,0 ,sizeof (struct sctp_outq )); + q->asoc = asoc;INIT_LIST_HEAD (&q->out_chunk_list);INIT_LIST_HEAD (&q->control_chunk_list);
@@ -212,13 +214,9 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)INIT_LIST_HEAD (&q->sacked);INIT_LIST_HEAD (&q->abandoned); - q->fast_rtx =0 ; - q->outstanding_bytes =0 ; q->empty =1 ; - q->cork =0 ; q->malloced =0 ; - q->out_qlen =0 ; }/* Free the outqueue structure and any related pending chunks.
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 32/88 net: sh_eth: fix incorrect RX length error if R8A7740
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Yoshihiro Shimoda <[email protected]>
[ Upstream commit dd019897358b815f7828dab90b51d51df4d3658d ]
This patch fixes an issue that the driver increments the "RX length error" on every buffer in sh_eth_rx() if the R8A7740.
This patch also adds a description about the Receive Frame Status bits.
--- drivers/net/ethernet/renesas/sh_eth.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +11 -4
@@ -1102,16 +1102,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) desc_status =edmac_to_cpu (mdp, rxdesc->status); pkt_len = rxdesc->frame_length; -#if defined(CONFIG_ARCH_R8A7740 ) - desc_status >>=16 ; -#endif -if (--boguscnt <0 )break ;if (!(desc_status &RDFEND )) ndev->stats.rx_length_errors++; +#if defined(CONFIG_ARCH_R8A7740 ) +/* +* In case of almost all GETHER/ETHERs, the Receive Frame State +* (RFS) bits in the Receive Descriptor 0 are from bit 9 to +* bit 0. However, in case of the R8A7740's GETHER, the RFS +* bits are from bit 25 to bit 16. So, the driver needs right +* shifting by 16. +*/ + desc_status >>=16 ; +#endif +if (desc_status & (RD_RFS1 |RD_RFS2 |RD_RFS3 |RD_RFS4 |RD_RFS5 |RD_RFS6 |RD_RFS10 )) { ndev->stats.rx_errors++;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 33/88 Input: cyttsp - fix memcpy size param
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Ferruh Yigit <[email protected]>
[ Upstream commit d2983cdb480157f637df07723f28aaa657b1080d ]
memcpy param is wrong because of offset in bl_cmd, this may corrupt the stack which may cause a crash.
--- drivers/input/touchscreen/cyttsp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/cyttsp_core.c +1 -1
@@ -133,7 +133,7 @@ static int cyttsp_exit_bl_mode(struct cyttsp *ts)memcpy (bl_cmd, bl_command,sizeof (bl_command));if (ts->pdata->bl_keys)memcpy (&bl_cmd[sizeof (bl_command) -CY_NUM_BL_KEYS ], - ts->pdata->bl_keys,sizeof (bl_command)); + ts->pdata->bl_keys,CY_NUM_BL_KEYS ); error =ttsp_write_block_data (ts,CY_REG_BASE ,sizeof (bl_cmd), bl_cmd);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 34/88 USB: serial: ti_usb_3410_5052: new device id for Abbot strip port cable
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Anders Hammarquist <[email protected]>
[ Upstream commit 35a2fbc941accd0e9f1bfadd669311786118d874 ]
Add product id for Abbott strip port cable for Precision meter which uses the TI 3410 chip.
--- drivers/usb/serial/ti_usb_3410_5052.c | 3 ++- drivers/usb/serial/ti_usb_3410_5052.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/usb/serial/ti_usb_3410_5052.c +2 -1
@@ -180,7 +180,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = { { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, - { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, + { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) }, + { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, };
drivers/usb/serial/ti_usb_3410_5052.h +3 -1
@@ -52,7 +52,9 @@/* Abbott Diabetics vendor and product ids */ #define ABBOTT_VENDOR_ID 0x1a61 -#define ABBOTT_PRODUCT_ID 0x3410 +#define ABBOTT_STEREO_PLUG_ID 0x3410 +#define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID +#define ABBOTT_STRIP_PORT_ID 0x3420/* Commands */ #define TI_GET_VERSION 0x01
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 35/88 tcm_qla2xxx: Fix residual for underrun commands that fail
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
[ Upstream commit b5aff3d2747bea08b386edd070941a45611ffe51 ]
Suppose an initiator sends a DATA IN command with an allocation length shorter than the FC transfer length -- we get a target message like
TARGET_CORE[qla2xxx]: Expected Transfer Length: 256 does not match SCSI CDB Length: 0 for SAM Opcode: 0x12
In that case, the target core adjusts the data_length and sets se_cmd->residual_count for the underrun. But now suppose that command fails and we end up in tcm_qla2xxx_queue_status() -- that function unconditionally overwrites residual_count with the already adjusted data_length, and the initiator will burp with a message like
qla2xxx [0000:00:06.0]-301d:0: Dropped frame(s) detected (0x100 of 0x100 bytes).
Fix this by adding on to the existing underflow residual count instead.
--- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +5 -1
@@ -688,8 +688,12 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)* For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen * for qla_tgt_xmit_response LLD code */ +if (se_cmd->se_cmd_flags &SCF_OVERFLOW_BIT ) { + se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT ; + se_cmd->residual_count =0 ; + } se_cmd->se_cmd_flags |=SCF_UNDERFLOW_BIT ; - se_cmd->residual_count = se_cmd->data_length; + se_cmd->residual_count += se_cmd->data_length; cmd->bufflen =0 ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 36/88 target/iscsi: dont corrupt bh_count in iscsit_stop_time2retain_timer()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?J=C3=B6rn=20Engel?= <[email protected]>
[ Upstream commit 574780fd5e6ec52bd43e0bdb777a19e4c4c6aa9c ]
Here is a fun one. Bug seems to have been introduced by commit 140854cb, almost two years ago. I have no idea why we only started seeing it now, but we did.
Rough callgraph:core_tpg_set_initiator_node_queue_depth()
`-> spin_lock_irqsave(&tpg->session_lock, flags);
`-> lio_tpg_shutdown_session()
`-> iscsit_stop_time2retain_timer()
`-> spin_unlock_bh(&se_tpg->session_lock);
`-> spin_lock_bh(&se_tpg->session_lock);`-> spin_unlock_irqrestore(&tpg->session_lock, flags);
core_tpg_set_initiator_node_queue_depth() used to call spin_lock_bh(), but 140854cb changed that to spin_lock_irqsave(). However, lio_tpg_shutdown_session() still claims to be called with spin_lock_bh() held, as does iscsit_stop_time2retain_timer():
* Called with spin_lock_bh(&struct se_portal_group->session_lock) held
Stale documentation is mostly annoying, but in this case the dropping the lock with the _bh variant is plain wrong. It is also wrong to drop locks two functions below the lock-holder, but I will ignore that bit for now.
After some more locking and unlocking we eventually hit this backtrace:
------------[ cut here ]------------ WARNING: at kernel/softirq.c:159 local_bh_enable_ip+0xe8/0x100() Pid: 24645, comm: lio_helper.py Tainted: G O 3.6.11+ Call Trace: [<ffffffff8103e5ff>] warn_slowpath_common+0x7f/0xc0 [<ffffffffa040ae37>] ? iscsit_inc_conn_usage_count+0x37/0x50 [iscsi_target_mod] [<ffffffff8103e65a>] warn_slowpath_null+0x1a/0x20 [<ffffffff810472f8>] local_bh_enable_ip+0xe8/0x100 [<ffffffff815b8365>] _raw_spin_unlock_bh+0x15/0x20 [<ffffffffa040ae37>] iscsit_inc_conn_usage_count+0x37/0x50 [iscsi_target_mod] [<ffffffffa041149a>] iscsit_stop_session+0xfa/0x1c0 [iscsi_target_mod] [<ffffffffa0417fab>] lio_tpg_shutdown_session+0x7b/0x90 [iscsi_target_mod] [<ffffffffa033ede4>] core_tpg_set_initiator_node_queue_depth+0xe4/0x290 [target_core_mod] [<ffffffffa0409032>] iscsit_tpg_set_initiator_node_queue_depth+0x12/0x20 [iscsi_target_mod] [<ffffffffa0415c29>] lio_target_nacl_store_cmdsn_depth+0xa9/0x180 [iscsi_target_mod] [<ffffffffa0331b49>] target_fabric_nacl_base_attr_store+0x39/0x40 [target_core_mod] [<ffffffff811b857d>] configfs_write_file+0xbd/0x120 [<ffffffff81148f36>] vfs_write+0xc6/0x180 [<ffffffff81149251>] sys_write+0x51/0x90 [<ffffffff815c0969>] system_call_fastpath+0x16/0x1b ---[ end trace 3747632b9b164652 ]---
As a pure band-aid, this patch drops the _bh.
--- drivers/target/iscsi/iscsi_target_erl0.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/iscsi/iscsi_target_erl0.c +2 -2
@@ -834,11 +834,11 @@ extern int iscsit_stop_time2retain_timer(struct iscsi_session *sess)return 0 ; sess->time2retain_timer_flags |=ISCSI_TF_STOP ; -spin_unlock_bh (&se_tpg->session_lock); +spin_unlock (&se_tpg->session_lock);del_timer_sync (&sess->time2retain_timer); -spin_lock_bh (&se_tpg->session_lock); +spin_lock (&se_tpg->session_lock); sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING ;pr_debug ("Stopped Time2Retain Timer for SID: %u\n" , sess->sid);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 37/88 perf: Fix perf mmap bugs
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 26cb63ad11e04047a64309362674bcbbd6a6f246 ]
Vince reported a problem found by his perf specific trinity fuzzer.
Al noticed 2 problems with perf's mmap():
- it has issues against fork() since we use vma->vm_mm for accounting.
- it has an rb refcount leak on double mmap().
We fix the issues against fork() by using VM_DONTCOPY; I don't think there's code out there that uses this; we didn't hear about weird accounting problems/crashes. If we do need this to work, the previously proposed VM_PINNED could make this work.
Aside from the rb reference leak spotted by Al, Vince's example prog was indeed doing a double mmap() through the use of perf_event_set_output().
This exposes another problem, since we now have 2 events with one buffer, the accounting gets screwy because we account per event. Fix this by making the buffer responsible for its own accounting.
--- include/linux/perf_event.h | 3 +-- kernel/events/core.c | 37 ++++++++++++++++++++----------------- kernel/events/internal.h | 3 +++ 3 files changed, 24 insertions(+), 19 deletions(-)
include/linux/perf_event.h +1 -2
@@ -953,8 +953,7 @@ struct perf_event {/* mmap bits */ struct mutex mmap_mutex;atomic_t mmap_count; -int mmap_locked; -struct user_struct *mmap_user; +struct ring_buffer *rb;struct list_head rb_entry;
kernel/events/core.c +20 -17
@@ -2854,7 +2854,7 @@ static void free_event_rcu(struct rcu_head *head)kfree (event); } -static void ring_buffer_put (struct ring_buffer *rb); +static bool ring_buffer_put (struct ring_buffer *rb);static void free_event (struct perf_event *event) {
@@ -3525,13 +3525,13 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event)return rb; } -static void ring_buffer_put (struct ring_buffer *rb) +static bool ring_buffer_put (struct ring_buffer *rb) {struct perf_event *event, *n;unsigned long flags;if (!atomic_dec_and_test (&rb->refcount)) -return ; +return false;spin_lock_irqsave (&rb->event_lock, flags);list_for_each_entry_safe (event, n, &rb->event_list, rb_entry) {
@@ -3541,6 +3541,7 @@ static void ring_buffer_put(struct ring_buffer *rb)spin_unlock_irqrestore (&rb->event_lock, flags);call_rcu (&rb->rcu_head, rb_free_rcu); +return true; }static void perf_mmap_open (struct vm_area_struct *vma)
@@ -3555,18 +3556,20 @@ static void perf_mmap_close(struct vm_area_struct *vma)struct perf_event *event = vma->vm_file->private_data;if (atomic_dec_and_mutex_lock (&event->mmap_count, &event->mmap_mutex)) { -unsigned long size =perf_data_size (event->rb); -struct user_struct *user = event->mmap_user;struct ring_buffer *rb = event->rb; +struct user_struct *mmap_user = rb->mmap_user; +int mmap_locked = rb->mmap_locked; +unsigned long size =perf_data_size (rb); -atomic_long_sub ((size >>PAGE_SHIFT ) +1 , &user->locked_vm); - vma->vm_mm->pinned_vm -= event->mmap_locked;rcu_assign_pointer (event->rb,NULL );ring_buffer_detach (event, rb);mutex_unlock (&event->mmap_mutex); -ring_buffer_put (rb); -free_uid (user); +if (ring_buffer_put (rb)) { +atomic_long_sub ((size >>PAGE_SHIFT ) +1 , &mmap_user->locked_vm); + vma->vm_mm->pinned_vm -= mmap_locked; +free_uid (mmap_user); + } } }
@@ -3619,9 +3622,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)WARN_ON_ONCE (event->ctx->parent_ctx);mutex_lock (&event->mmap_mutex);if (event->rb) { -if (event->rb->nr_pages == nr_pages) -atomic_inc (&event->rb->refcount); -else +if (event->rb->nr_pages != nr_pages) ret = -EINVAL ; goto unlock; }
@@ -3663,12 +3664,14 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) ret = -ENOMEM ; goto unlock; } -rcu_assign_pointer (event->rb, rb); + + rb->mmap_locked = extra; + rb->mmap_user =get_current_user ();atomic_long_add (user_extra, &user->locked_vm); - event->mmap_locked = extra; - event->mmap_user =get_current_user (); - vma->vm_mm->pinned_vm += event->mmap_locked; + vma->vm_mm->pinned_vm += extra; + +rcu_assign_pointer (event->rb, rb);perf_event_update_userpage (event);
@@ -3677,7 +3680,7 @@ unlock:atomic_inc (&event->mmap_count);mutex_unlock (&event->mmap_mutex); - vma->vm_flags |=VM_RESERVED ; + vma->vm_flags |=VM_DONTCOPY |VM_RESERVED ; vma->vm_ops = &perf_mmap_vmops;return ret;
kernel/events/internal.h +3 -0
@@ -30,6 +30,9 @@ struct ring_buffer {spinlock_t event_lock;struct list_head event_list; +int mmap_locked; +struct user_struct *mmap_user; +struct perf_event_mmap_page *user_page;void *data_pages[0 ]; };
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 38/88 perf: Fix mmap() accounting hole
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 9bb5d40cd93c9dd4be74834b1dcb1ba03629716b ]
Vince's fuzzer once again found holes. This time it spotted a leak in the locked page accounting.
When an event had redirected output and its close() was the last reference to the buffer we didn't have a vm context to undo accounting.
Change the code to destroy the buffer on the last munmap() and detach all redirected events at that time. This provides us the right context to undo the vm accounting.
--- kernel/events/core.c | 228 +++++++++++++++++++++++++++++++--------------- kernel/events/internal.h | 3 +- 2 files changed, 159 insertions(+), 72 deletions(-)
kernel/events/core.c +157 -71
@@ -193,9 +193,6 @@ static void cpu_ctx_sched_in(struct perf_cpu_context *cpuctx,static void update_context_time (struct perf_event_context *ctx);static u64 perf_event_time (struct perf_event *event); -static void ring_buffer_attach (struct perf_event *event, -struct ring_buffer *rb); -void __weak perf_event_print_debug (void ) { }extern __weak const char *perf_pmu_name (void )
@@ -2854,7 +2851,8 @@ static void free_event_rcu(struct rcu_head *head)kfree (event); } -static bool ring_buffer_put (struct ring_buffer *rb); +static void ring_buffer_put (struct ring_buffer *rb); +static void ring_buffer_detach (struct perf_event *event,struct ring_buffer *rb);static void free_event (struct perf_event *event) {
@@ -2879,15 +2877,30 @@ static void free_event(struct perf_event *event)if (has_branch_stack (event)) {static_key_slow_dec_deferred (&perf_sched_events);/* is system-wide event */ -if (!(event->attach_state &PERF_ATTACH_TASK )) +if (!(event->attach_state &PERF_ATTACH_TASK )) {atomic_dec (&per_cpu (perf_branch_stack_events, event->cpu)); + } } }if (event->rb) { -ring_buffer_put (event->rb); - event->rb =NULL ; +struct ring_buffer *rb; + +/* +* Can happen when we close an event with re-directed output. +* +* Since we have a 0 refcount, perf_mmap_close() will skip +* over us; possibly making our ring_buffer_put() the last. +*/ +mutex_lock (&event->mmap_mutex); + rb = event->rb; +if (rb) { +rcu_assign_pointer (event->rb,NULL ); +ring_buffer_detach (event, rb); +ring_buffer_put (rb);/* could be last */ + } +mutex_unlock (&event->mmap_mutex); }if (is_cgroup_event (event))
@@ -3125,30 +3138,13 @@ static unsigned int perf_poll(struct file *file, poll_table *wait)unsigned int events =POLL_HUP ;/* -* Race between perf_event_set_output() and perf_poll(): perf_poll() -* grabs the rb reference but perf_event_set_output() overrides it. -* Here is the timeline for two threads T1, T2: -* t0: T1, rb = rcu_dereference(event->rb) -* t1: T2, old_rb = event->rb -* t2: T2, event->rb = new rb -* t3: T2, ring_buffer_detach(old_rb) -* t4: T1, ring_buffer_attach(rb1) -* t5: T1, poll_wait(event->waitq) -* -* To avoid this problem, we grab mmap_mutex in perf_poll() -* thereby ensuring that the assignment of the new ring buffer -* and the detachment of the old buffer appear atomic to perf_poll() +* Pin the event->rb by taking event->mmap_mutex; otherwise +* perf_event_set_output() can swizzle our rb and make us miss wakeups. */ mutex_lock (&event->mmap_mutex); - -rcu_read_lock (); - rb =rcu_dereference (event->rb); -if (rb) { -ring_buffer_attach (event, rb); + rb = event->rb; +if (rb) events =atomic_xchg (&rb->poll,0 ); - } -rcu_read_unlock (); -mutex_unlock (&event->mmap_mutex);poll_wait (file, &event->waitq, wait);
@@ -3464,16 +3460,12 @@ static void ring_buffer_attach(struct perf_event *event,return ;spin_lock_irqsave (&rb->event_lock, flags); -if (!list_empty (&event->rb_entry)) - goto unlock; - -list_add (&event->rb_entry, &rb->event_list); -unlock: +if (list_empty (&event->rb_entry)) +list_add (&event->rb_entry, &rb->event_list);spin_unlock_irqrestore (&rb->event_lock, flags); } -static void ring_buffer_detach (struct perf_event *event, -struct ring_buffer *rb) +static void ring_buffer_detach (struct perf_event *event,struct ring_buffer *rb) {unsigned long flags;
@@ -3492,13 +3484,10 @@ static void ring_buffer_wakeup(struct perf_event *event)rcu_read_lock (); rb =rcu_dereference (event->rb); -if (!rb) - goto unlock; - -list_for_each_entry_rcu (event, &rb->event_list, rb_entry) -wake_up_all (&event->waitq); - -unlock: +if (rb) { +list_for_each_entry_rcu (event, &rb->event_list, rb_entry) +wake_up_all (&event->waitq); + }rcu_read_unlock (); }
@@ -3525,23 +3514,14 @@ static struct ring_buffer *ring_buffer_get(struct perf_event *event)return rb; } -static bool ring_buffer_put (struct ring_buffer *rb) +static void ring_buffer_put (struct ring_buffer *rb) { -struct perf_event *event, *n; -unsigned long flags; -if (!atomic_dec_and_test (&rb->refcount)) -return false; +return ; -spin_lock_irqsave (&rb->event_lock, flags); -list_for_each_entry_safe (event, n, &rb->event_list, rb_entry) { -list_del_init (&event->rb_entry); -wake_up_all (&event->waitq); - } -spin_unlock_irqrestore (&rb->event_lock, flags); +WARN_ON_ONCE (!list_empty (&rb->event_list));call_rcu (&rb->rcu_head, rb_free_rcu); -return true; }static void perf_mmap_open (struct vm_area_struct *vma)
@@ -3549,28 +3529,100 @@ static void perf_mmap_open(struct vm_area_struct *vma)struct perf_event *event = vma->vm_file->private_data;atomic_inc (&event->mmap_count); +atomic_inc (&event->rb->mmap_count); } +/* +* A buffer can be mmap()ed multiple times; either directly through the same +* event, or through other events by use of perf_event_set_output(). +* +* In order to undo the VM accounting done by perf_mmap() we need to destroy +* the buffer here, where we still have a VM context. This means we need +* to detach all events redirecting to us. +*/ static void perf_mmap_close (struct vm_area_struct *vma) {struct perf_event *event = vma->vm_file->private_data; -if (atomic_dec_and_mutex_lock (&event->mmap_count, &event->mmap_mutex)) { -struct ring_buffer *rb = event->rb; -struct user_struct *mmap_user = rb->mmap_user; -int mmap_locked = rb->mmap_locked; -unsigned long size =perf_data_size (rb); +struct ring_buffer *rb = event->rb; +struct user_struct *mmap_user = rb->mmap_user; +int mmap_locked = rb->mmap_locked; +unsigned long size =perf_data_size (rb); -rcu_assign_pointer (event->rb,NULL ); -ring_buffer_detach (event, rb); -mutex_unlock (&event->mmap_mutex); +atomic_dec (&rb->mmap_count); + +if (!atomic_dec_and_mutex_lock (&event->mmap_count, &event->mmap_mutex)) +return ; -if (ring_buffer_put (rb)) { -atomic_long_sub ((size >>PAGE_SHIFT ) +1 , &mmap_user->locked_vm); - vma->vm_mm->pinned_vm -= mmap_locked; -free_uid (mmap_user); +/* Detach current event from the buffer. */ +rcu_assign_pointer (event->rb,NULL ); +ring_buffer_detach (event, rb); +mutex_unlock (&event->mmap_mutex); + +/* If there's still other mmap()s of this buffer, we're done. */ +if (atomic_read (&rb->mmap_count)) { +ring_buffer_put (rb);/* can't be last */ +return ; + } + +/* +* No other mmap()s, detach from all other events that might redirect +* into the now unreachable buffer. Somewhat complicated by the +* fact that rb::event_lock otherwise nests inside mmap_mutex. +*/ +again: +rcu_read_lock (); +list_for_each_entry_rcu (event, &rb->event_list, rb_entry) { +if (!atomic_long_inc_not_zero (&event->refcount)) { +/* +* This event is en-route to free_event() which will +* detach it and remove it from the list. +*/ +continue ; } +rcu_read_unlock (); + +mutex_lock (&event->mmap_mutex); +/* +* Check we didn't race with perf_event_set_output() which can +* swizzle the rb from under us while we were waiting to +* acquire mmap_mutex. +* +* If we find a different rb; ignore this event, a next +* iteration will no longer find it on the list. We have to +* still restart the iteration to make sure we're not now +* iterating the wrong list. +*/ +if (event->rb == rb) { +rcu_assign_pointer (event->rb,NULL ); +ring_buffer_detach (event, rb); +ring_buffer_put (rb);/* can't be last, we still have one */ + } +mutex_unlock (&event->mmap_mutex); +put_event (event); + +/* +* Restart the iteration; either we're on the wrong list or +* destroyed its integrity by doing a deletion. +*/ + goto again; } +rcu_read_unlock (); + +/* +* It could be there's still a few 0-ref events on the list; they'll +* get cleaned up by free_event() -- they'll also still have their +* ref on the rb and will free it whenever they are done with it. +* +* Aside from that, this buffer is 'fully' detached and unmapped, +* undo the VM accounting. +*/ + +atomic_long_sub ((size >>PAGE_SHIFT ) +1 , &mmap_user->locked_vm); + vma->vm_mm->pinned_vm -= mmap_locked; +free_uid (mmap_user); + +ring_buffer_put (rb);/* could be last */ }static const struct vm_operations_struct perf_mmap_vmops = {
@@ -3620,10 +3672,24 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)return -EINVAL ;WARN_ON_ONCE (event->ctx->parent_ctx); +again:mutex_lock (&event->mmap_mutex);if (event->rb) { -if (event->rb->nr_pages != nr_pages) +if (event->rb->nr_pages != nr_pages) { ret = -EINVAL ; + goto unlock; + } + +if (!atomic_inc_not_zero (&event->rb->mmap_count)) { +/* +* Raced against perf_mmap_close() through +* perf_event_set_output(). Try again, hope for better +* luck. +*/ +mutex_unlock (&event->mmap_mutex); + goto again; + } + goto unlock; }
@@ -3665,12 +3731,14 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) goto unlock; } +atomic_set (&rb->mmap_count,1 ); rb->mmap_locked = extra; rb->mmap_user =get_current_user ();atomic_long_add (user_extra, &user->locked_vm); vma->vm_mm->pinned_vm += extra; +ring_buffer_attach (event, rb);rcu_assign_pointer (event->rb, rb);perf_event_update_userpage (event);
@@ -3680,6 +3748,10 @@ unlock:atomic_inc (&event->mmap_count);mutex_unlock (&event->mmap_mutex); +/* +* Since pinned accounting is per vm we cannot allow fork() to copy our +* vma. +*/ vma->vm_flags |=VM_DONTCOPY |VM_RESERVED ; vma->vm_ops = &perf_mmap_vmops;
@@ -6194,6 +6266,8 @@ set:if (atomic_read (&event->mmap_count)) goto unlock; + old_rb = event->rb; +if (output_event) {/* get the rb we want to redirect to */ rb =ring_buffer_get (output_event);
@@ -6201,16 +6275,28 @@ set: goto unlock; } - old_rb = event->rb; -rcu_assign_pointer (event->rb, rb);if (old_rb)ring_buffer_detach (event, old_rb); + +if (rb) +ring_buffer_attach (event, rb); + +rcu_assign_pointer (event->rb, rb); + +if (old_rb) { +ring_buffer_put (old_rb); +/* +* Since we detached before setting the new rb, so that we +* could attach the new rb, we could have missed a wakeup. +* Provide it now. +*/ +wake_up_all (&event->waitq); + } + ret =0 ; unlock:mutex_unlock (&event->mmap_mutex); -if (old_rb) -ring_buffer_put (old_rb); out:return ret; }
kernel/events/internal.h +2 -1
@@ -30,7 +30,8 @@ struct ring_buffer {spinlock_t event_lock;struct list_head event_list; -int mmap_locked; +atomic_t mmap_count; +unsigned long mmap_locked;struct user_struct *mmap_user;struct perf_event_mmap_page *user_page;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 39/88 ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Simon Baatz <[email protected]>
[ Upstream commit 1bc39742aab09248169ef9d3727c9def3528b3f3 ]
Commit f8b63c1 made flush_kernel_dcache_page a no-op assuming that the pages it needs to handle are kernel mapped only. However, for example when doing direct I/O, pages with user space mappings may occur.
Thus, continue to do lazy flushing if there are no user space mappings. Otherwise, flush the kernel cache lines directly.
--- arch/arm/include/asm/cacheflush.h | 4 +--- arch/arm/mm/flush.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-)
arch/arm/include/asm/cacheflush.h +1 -3
@@ -305,9 +305,7 @@ static inline void flush_anon_page(struct vm_area_struct *vma, }#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE -static inline void flush_kernel_dcache_page (struct page *page) -{ -} +extern void flush_kernel_dcache_page (struct page *);#define flush_dcache_mmap_lock (mapping) \ spin_lock_irq(&(mapping)->tree_lock)
arch/arm/mm/flush.c +33 -0
@@ -299,6 +299,39 @@ void flush_dcache_page(struct page *page)EXPORT_SYMBOL (flush_dcache_page);/* +* Ensure cache coherency for the kernel mapping of this page. We can +* assume that the page is pinned via kmap. +* +* If the page only exists in the page cache and there are no user +* space mappings, this is a no-op since the page was already marked +* dirty at creation. Otherwise, we need to flush the dirty kernel +* cache lines directly. +*/ +void flush_kernel_dcache_page (struct page *page) +{ +if (cache_is_vivt () ||cache_is_vipt_aliasing ()) { +struct address_space *mapping; + + mapping =page_mapping (page); + +if (!mapping ||mapping_mapped (mapping)) { +void *addr; + + addr =page_address (page); +/* +* kmap_atomic() doesn't set the page virtual +* address for highmem pages, and +* kunmap_atomic() takes care of cache +* flushing already. +*/ +if (!IS_ENABLED (CONFIG_HIGHMEM ) || addr) +__cpuc_flush_dcache_area (addr,PAGE_SIZE ); + } + } +} +EXPORT_SYMBOL (flush_kernel_dcache_page); + +/* * Flush an anonymous page so that users of get_user_pages() * can safely access the data. The expected sequence is: *
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 40/88 ARM: 7772/1: Fix missing flush_kernel_dcache_page() for noMMU
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Simon Baatz <[email protected]>
[ Upstream commit 63384fd0b1509acf522a8a8fcede09087eedb7df ]
Commit 1bc3974 (ARM: 7755/1: handle user space mapped pages in flush_kernel_dcache_page) moved the implementation of flush_kernel_dcache_page() into mm/flush.c but did not implement it on noMMU ARM.
--- arch/arm/mm/nommu.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mm/nommu.c +6 -0
@@ -57,6 +57,12 @@ void flush_dcache_page(struct page *page) }EXPORT_SYMBOL (flush_dcache_page); +void flush_kernel_dcache_page (struct page *page) +{ +__cpuc_flush_dcache_area (page_address (page),PAGE_SIZE ); +} +EXPORT_SYMBOL (flush_kernel_dcache_page); +void copy_to_user_page (struct vm_area_struct *vma,struct page *page,unsigned long uaddr,void *dst,const void *src,unsigned long len)
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 41/88 Bluetooth: Fix crash in l2cap_build_cmd() with small MTU
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Anderson Lizardo <[email protected]>
[ Upstream commit 300b962e5244a1ea010df7e88595faa0085b461d ]
If a too small MTU value is set with ioctl(HCISETACLMTU) or by a bogus controller, memory corruption happens due to a memcpy() call with negative length.
Fix this crash on either incoming or outgoing connections with a MTU smaller than L2CAP_HDR_SIZE + L2CAP_CMD_HDR_SIZE:
[ 46.885433] BUG: unable to handle kernel paging request at f56ad000 [ 46.888037] IP: [<c03d94cd>] memcpy+0x1d/0x40 [ 46.888037] *pdpt = 0000000000ac3001 *pde = 00000000373f8067 *pte = 80000000356ad060 [ 46.888037] Oops: 0002 [#1] SMP DEBUG_PAGEALLOC [ 46.888037] Modules linked in: hci_vhci bluetooth virtio_balloon i2c_piix4 uhci_hcd usbcore usb_common [ 46.888037] CPU: 0 PID: 1044 Comm: kworker/u3:0 Not tainted 3.10.0-rc1+ #12 [ 46.888037] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007 [ 46.888037] Workqueue: hci0 hci_rx_work [bluetooth] [ 46.888037] task: f59b15b0 ti: f55c4000 task.ti: f55c4000 [ 46.888037] EIP: 0060:[<c03d94cd>] EFLAGS: 00010212 CPU: 0 [ 46.888037] EIP is at memcpy+0x1d/0x40 [ 46.888037] EAX: f56ac1c0 EBX: fffffff8 ECX: 3ffffc6e EDX: f55c5cf2 [ 46.888037] ESI: f55c6b32 EDI: f56ad000 EBP: f55c5c68 ESP: f55c5c5c [ 46.888037] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 [ 46.888037] CR0: 8005003b CR2: f56ad000 CR3: 3557d000 CR4: 000006f0 [ 46.888037] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000 [ 46.888037] DR6: ffff0ff0 DR7: 00000400 [ 46.888037] Stack: [ 46.888037] fffffff8 00000010 00000003 f55c5cac f8c6a54c ffffffff f8c69eb2 00000000 [ 46.888037] f4783cdc f57f0070 f759c590 1001c580 00000003 0200000a 00000000 f5a88560 [ 46.888037] f5ba2600 f5a88560 00000041 00000000 f55c5d90 f8c6f4c7 00000008 f55c5cf2 [ 46.888037] Call Trace: [ 46.888037] [<f8c6a54c>] l2cap_send_cmd+0x1cc/0x230 [bluetooth] [ 46.888037] [<f8c69eb2>] ? l2cap_global_chan_by_psm+0x152/0x1a0 [bluetooth] [ 46.888037] [<f8c6f4c7>] l2cap_connect+0x3f7/0x540 [bluetooth] [ 46.888037] [<c019b37b>] ? trace_hardirqs_off+0xb/0x10 [ 46.888037] [<c01a0ff8>] ? mark_held_locks+0x68/0x110 [ 46.888037] [<c064ad20>] ? mutex_lock_nested+0x280/0x360 [ 46.888037] [<c064b9d9>] ? __mutex_unlock_slowpath+0xa9/0x150 [ 46.888037] [<c01a118c>] ? trace_hardirqs_on_caller+0xec/0x1b0 [ 46.888037] [<c064ad08>] ? mutex_lock_nested+0x268/0x360 [ 46.888037] [<c01a125b>] ? trace_hardirqs_on+0xb/0x10 [ 46.888037] [<f8c72f8d>] l2cap_recv_frame+0xb2d/0x1d30 [bluetooth] [ 46.888037] [<c01a0ff8>] ? mark_held_locks+0x68/0x110 [ 46.888037] [<c064b9d9>] ? __mutex_unlock_slowpath+0xa9/0x150 [ 46.888037] [<c01a118c>] ? trace_hardirqs_on_caller+0xec/0x1b0 [ 46.888037] [<f8c754f1>] l2cap_recv_acldata+0x2a1/0x320 [bluetooth] [ 46.888037] [<f8c491d8>] hci_rx_work+0x518/0x810 [bluetooth] [ 46.888037] [<f8c48df2>] ? hci_rx_work+0x132/0x810 [bluetooth] [ 46.888037] [<c0158979>] process_one_work+0x1a9/0x600 [ 46.888037] [<c01588fb>] ? process_one_work+0x12b/0x600 [ 46.888037] [<c015922e>] ? worker_thread+0x19e/0x320 [ 46.888037] [<c015922e>] ? worker_thread+0x19e/0x320 [ 46.888037] [<c0159187>] worker_thread+0xf7/0x320 [ 46.888037] [<c0159090>] ? rescuer_thread+0x290/0x290 [ 46.888037] [<c01602f8>] kthread+0xa8/0xb0 [ 46.888037] [<c0656777>] ret_from_kernel_thread+0x1b/0x28 [ 46.888037] [<c0160250>] ? flush_kthread_worker+0x120/0x120 [ 46.888037] Code: c3 90 8d 74 26 00 e8 63 fc ff ff eb e8 90 55 89 e5 83 ec 0c 89 5d f4 89 75 f8 89 7d fc 3e 8d 74 26 00 89 cb 89 c7 c1 e9 02 89 d6 <f3> a5 89 d9 83 e1 03 74 02 f3 a4 8b 5d f4 8b 75 f8 8b 7d fc 89 [ 46.888037] EIP: [<c03d94cd>] memcpy+0x1d/0x40 SS:ESP 0068:f55c5c5c [ 46.888037] CR2: 00000000f56ad000 [ 46.888037] ---[ end trace 0217c1f4d78714a9 ]---
--- net/bluetooth/l2cap_core.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/l2cap_core.c +3 -0
@@ -2548,6 +2548,9 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code,BT_DBG ("conn %p, code 0x%2.2x, ident 0x%2.2x, len %u" , conn, code, ident, dlen); +if (conn->mtu <L2CAP_HDR_SIZE +L2CAP_CMD_HDR_SIZE ) +return NULL ; + len =L2CAP_HDR_SIZE +L2CAP_CMD_HDR_SIZE + dlen; count = min_t(unsigned int, conn->mtu, len);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 42/88 hw_breakpoint: Use cpu_possible_mask in {reserve,release}_bp_slot()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
[ Upstream commit c790b0ad23f427c7522ffed264706238c57c007e ]
fetch_bp_busy_slots() and toggle_bp_slot() use for_each_online_cpu(), this is obviously wrong wrt cpu_up() or cpu_down(), we can over/under account the per-cpu numbers.
For example:
# echo 0 >> /sys/devices/system/cpu/cpu1/online # perf record -e mem:0x10 -p 1 & # echo 1 >> /sys/devices/system/cpu/cpu1/online # perf record -e mem:0x10,mem:0x10,mem:0x10,mem:0x10 -C1 -a & # taskset -p 0x2 1
triggers the same WARN_ONCE("Can't find any breakpoint slot") in arch_install_hw_breakpoint().
--- kernel/events/hw_breakpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/events/hw_breakpoint.c +2 -2
@@ -147,7 +147,7 @@ fetch_bp_busy_slots(struct bp_busy_slots *slots, struct perf_event *bp,return ; } -for_each_online_cpu (cpu) { +for_each_possible_cpu (cpu) {unsigned int nr; nr =per_cpu (nr_cpu_bp_pinned[type], cpu);
@@ -233,7 +233,7 @@ toggle_bp_slot(struct perf_event *bp, bool enable, enum bp_type_idx type,if (cpu >=0 ) {toggle_bp_task_slot (bp, cpu, enable, type, weight); }else { -for_each_online_cpu (cpu) +for_each_possible_cpu (cpu)toggle_bp_task_slot (bp, cpu, enable, type, weight); }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 43/88 ath9k_htc: Handle IDLE state transition properly
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sujith Manoharan <[email protected]>
[ Upstream commit 075163bbb0f51174359947e1bce84f5edb23f21e ]
Make sure that a chip reset is done when IDLE is turned off - this fixes authentication timeouts.
--- drivers/net/wireless/ath/ath9k/htc_drv_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 -1
@@ -1193,7 +1193,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)mutex_lock (&priv->htc_pm_lock); priv->ps_idle = !!(conf->flags &IEEE80211_CONF_IDLE ); -if (priv->ps_idle) +if (!priv->ps_idle) chip_reset = true;mutex_unlock (&priv->htc_pm_lock);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 44/88 iwlwifi: dvm: fix chain noise calibration
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Nikolay Martynov <[email protected]>
[ Upstream commit b28b6dfe580ab1ab8bf08b908fd69e299b877103 ]
First step of chain noise calibration process had disable flag check inverted. Chain noise calibration never started because of this.
Tested on intel 5300 with two antennas attached. The driver correctly disabled one chain.
--- drivers/net/wireless/iwlwifi/dvm/rxon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/iwlwifi/dvm/rxon.c +1 -1
@@ -1377,7 +1377,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)struct iwl_chain_noise_data *data = &priv->chain_noise_data;int ret; -if (!(priv->calib_disabled &IWL_CHAIN_NOISE_CALIB_DISABLED )) +if (priv->calib_disabled &IWL_CHAIN_NOISE_CALIB_DISABLED )return ; if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 45/88 dlci: acquire rtnl_lock before calling __dev_get_by_name()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Zefan Li <[email protected]>
[ Upstream commit 11eb2645cbf38a08ae491bf6c602eea900ec0bb5 ]
Otherwise the net device returned can be freed at anytime.
--- drivers/net/wan/dlci.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/wan/dlci.c +9 -5
@@ -385,20 +385,24 @@ static int dlci_del(struct dlci_add *dlci)struct net_device *master, *slave;int err; +rtnl_lock (); +/* validate slave device */ master =__dev_get_by_name (&init_net, dlci->devname); -if (!master) -return -ENODEV ; +if (!master) { + err = -ENODEV ; + goto out; + }if (netif_running (master)) { -return -EBUSY ; + err = -EBUSY ; + goto out; } dlp =netdev_priv (master); slave = dlp->slave; flp =netdev_priv (slave); -rtnl_lock (); err = (*flp->deassoc)(slave, master);if (!err) {list_del (&dlp->list);
@@ -407,8 +411,8 @@ static int dlci_del(struct dlci_add *dlci)dev_put (slave); } +out:rtnl_unlock (); -return err; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 46/88 dlci: validate the net device in dlci_del()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Zefan Li <[email protected]>
[ Upstream commit 578a1310f2592ba90c5674bca21c1dbd1adf3f0a ]
We triggered an oops while running trinity with 3.4 kernel:
BUG: unable to handle kernel paging request at 0000000100000d07 IP: [<ffffffffa0109738>] dlci_ioctl+0xd8/0x2d4 [dlci] PGD 640c0d067 PUD 0 Oops: 0000 [#1] PREEMPT SMP CPU 3 ... Pid: 7302, comm: trinity-child3 Not tainted 3.4.24.09+ 40 Huawei Technologies Co., Ltd. Tecal RH2285 /BC11BTSA RIP: 0010:[<ffffffffa0109738>] [<ffffffffa0109738>] dlci_ioctl+0xd8/0x2d4 [dlci] ... Call Trace: [<ffffffff8137c5c3>] sock_ioctl+0x153/0x280 [<ffffffff81195494>] do_vfs_ioctl+0xa4/0x5e0 [<ffffffff8118354a>] ? fget_light+0x3ea/0x490 [<ffffffff81195a1f>] sys_ioctl+0x4f/0x80 [<ffffffff81478b69>] system_call_fastpath+0x16/0x1b
...
It's because the net device is not a dlci device.
--- drivers/net/wan/dlci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/wan/dlci.c +12 -0
@@ -384,6 +384,7 @@ static int dlci_del(struct dlci_add *dlci)struct frad_local *flp;struct net_device *master, *slave;int err; +bool found = false;rtnl_lock ();
@@ -394,6 +395,17 @@ static int dlci_del(struct dlci_add *dlci) goto out; } +list_for_each_entry (dlp, &dlci_devs, list) { +if (dlp->master == master) { + found = true; +break ; + } + } +if (!found) { + err = -ENODEV ; + goto out; + } +if (netif_running (master)) { err = -EBUSY ; goto out;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 47/88 iommu/vt-d: add quirk for broken interrupt remapping on 55XX chipsets
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit 03bbcb2e7e292838bb0244f5a7816d194c911d62 ]
A few years back intel published a spec update:
http://www.intel.com/content/dam/doc/specification-update/5520-and-5500-chipset-ioh-specification-update.pdf
For the 5520 and 5500 chipsets which contained an errata (specificially errata 53), which noted that these chipsets can't properly do interrupt remapping, and as a result the recommend that interrupt remapping be disabled in bios. While many vendors have a bios update to do exactly that, not all do, and of course not all users update their bios to a level that corrects the problem. As a result, occasionally interrupts can arrive at a cpu even after affinity for that interrupt has be moved, leading to lost or spurrious interrupts (usually characterized by the message:
kernel: do_IRQ: 7.71 No irq handler for vector (irq -1)
There have been several incidents recently of people seeing this error, and investigation has shown that they have system for which their BIOS level is such that this feature was not properly turned off. As such, it would be good to give them a reminder that their systems are vulnurable to this problem. For details of those that reported the problem, please see:
https://bugzilla.redhat.com/show_bug.cgi?id=887006
[ Joerg: Removed CONFIG_IRQ_REMAP ifdef from early-quirks.c ]
--- arch/x86/include/asm/irq_remapping.h | 2 ++ arch/x86/kernel/early-quirks.c | 20 ++++++++++++++++++++ drivers/iommu/intel_irq_remapping.c | 10 ++++++++++ drivers/iommu/irq_remapping.c | 6 ++++++ drivers/iommu/irq_remapping.h | 1 + 5 files changed, 39 insertions(+)
arch/x86/include/asm/irq_remapping.h +2 -0
@@ -30,6 +30,7 @@ extern int irq_remapping_enabled;extern void setup_irq_remapping_ops (void );extern int irq_remapping_supported (void ); +extern void set_irq_remapping_broken (void );extern int irq_remapping_prepare (void );extern int irq_remapping_enable (void );extern void irq_remapping_disable (void );
@@ -58,6 +59,7 @@ extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);static inline void setup_irq_remapping_ops (void ) { }static inline int irq_remapping_supported (void ) {return 0 ; } +static inline void set_irq_remapping_broken (void ) { }static inline int irq_remapping_prepare (void ) {return -ENODEV ; }static inline int irq_remapping_enable (void ) {return -ENODEV ; }static inline void irq_remapping_disable (void ) { }
arch/x86/kernel/early-quirks.c +20 -0
@@ -18,6 +18,7 @@#include <asm/apic.h> #include <asm/iommu.h> #include <asm/gart.h> +#include <asm/irq_remapping.h> static void __init fix_hypertransport_config (int num,int slot,int func) {
@@ -192,6 +193,21 @@ static void __init ati_bugs_contd(int num, int slot, int func) }#endif +static void __init intel_remapping_check (int num,int slot,int func) +{ +u8 revision; + + revision =read_pci_config_byte (num, slot, func,PCI_REVISION_ID ); + +/* +* Revision 0x13 of this chipset supports irq remapping +* but has an erratum that breaks its behavior, flag it as such +*/ +if (revision ==0x13 ) +set_irq_remapping_broken (); + +} +#define QFLAG_APPLY_ONCE 0x1#define QFLAG_APPLIED 0x2#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -221,6 +237,10 @@ static struct chipset early_qrk[] __initdata = { PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, + { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, {} };
drivers/iommu/intel_irq_remapping.c +10 -0
@@ -509,6 +509,16 @@ static int __init intel_irq_remapping_supported(void)if (disable_irq_remap)return 0 ; +if (irq_remap_broken) { +WARN_TAINT (1 ,TAINT_FIRMWARE_WORKAROUND , +"This system BIOS has enabled interrupt remapping\n" +"on a chipset that contains an erratum making that\n" +"feature unstable. To maintain system stability\n" +"interrupt remapping is being disabled. Please\n" +"contact your BIOS vendor for an update\n" ); + disable_irq_remap =1 ; +return 0 ; + }if (!dmar_ir_support ())return 0 ;
drivers/iommu/irq_remapping.c +6 -0
@@ -12,6 +12,7 @@int irq_remapping_enabled;int disable_irq_remap; +int irq_remap_broken;int disable_sourceid_checking;int no_x2apic_optout;
@@ -53,6 +54,11 @@ void __init setup_irq_remapping_ops(void) remap_ops = &intel_irq_remap_ops; } +void set_irq_remapping_broken (void ) +{ + irq_remap_broken =1 ; +} +int irq_remapping_supported (void ) {if (disable_irq_remap)
drivers/iommu/irq_remapping.h +1 -0
@@ -32,6 +32,7 @@ struct pci_dev;struct msi_msg ;extern int disable_irq_remap; +extern int irq_remap_broken;extern int disable_sourceid_checking;extern int no_x2apic_optout;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 48/88 perf: Disable monitoring on setuid processes for regular users
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Stephane Eranian <[email protected]>
[ Upstream commit 2976b10f05bd7f6dab9f9e7524451ddfed656a89 ]
There was a a bug in setup_new_exec(), whereby the test to disabled perf monitoring was not correct because the new credentials for the process were not yet committed and therefore the get_dumpable() test was never firing.
The patch fixes the problem by moving the perf_event test until after the credentials are committed.
--- fs/exec.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
fs/exec.c +9 -7
@@ -1162,13 +1162,6 @@ void setup_new_exec(struct linux_binprm * bprm)set_dumpable (current->mm, suid_dumpable); } -/* -* Flush performance counters when crossing a -* security domain: -*/ -if (!get_dumpable (current->mm)) -perf_event_exit_task (current); -/* An exec changes our domain. We are no longer part of the thread group */
@@ -1217,6 +1210,15 @@ void install_exec_creds(struct linux_binprm *bprm)commit_creds (bprm->cred); bprm->cred =NULL ; + +/* +* Disable monitoring for regular users +* when executing setuid binaries. Must +* wait until new credentials are committed +* by commit_creds() above +*/ +if (get_dumpable (current->mm) !=SUID_DUMP_USER ) +perf_event_exit_task (current);/* * cred_guard_mutex must be held at least to this point to prevent * ptrace_attach() from altering our determination of the task's
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 49/88 crypto: algboss - Hold ref count on larval
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 939e17799619e31331d2433041196529515a86a6 ]
Quoted 60 lines · Daniel Borkmann
After having fixed a NULL pointer dereference in SCTP
1abd165e("net:
sctp: fix NULL pointer dereference in socket destruction"), I ran into the following NULL pointer dereference in the crypto subsystem with the same reproducer, easily hit each time:BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<ffffffff81070321>] __wake_up_common+0x31/0x90 PGD 0 Oops: 0000 [#1] SMP Modules linked in: padlock_sha(F-) sha256_generic(F) sctp(F) libcrc32c(F) [..] CPU: 6 PID: 3326 Comm: cryptomgr_probe Tainted: GF 3.10.0-rc5+ #1 Hardware name: Dell Inc. PowerEdge T410/0H19HD, BIOS 1.6.3 02/01/2011 task: ffff88007b6cf4e0 ti: ffff88007b7cc000 task.ti: ffff88007b7cc000 RIP: 0010:[<ffffffff81070321>] [<ffffffff81070321>] __wake_up_common+0x31/0x90 RSP: 0018:ffff88007b7cde08 EFLAGS: 00010082 RAX: ffffffffffffffe8 RBX: ffff88003756c130 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000003 RDI: ffff88003756c130 RBP: ffff88007b7cde48 R08: 0000000000000000 R09: ffff88012b173200 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000282 R13: ffff88003756c138 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88012fc60000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000000 CR3: 0000000001a0b000 CR4: 00000000000007e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Stack: ffff88007b7cde28 0000000300000000 ffff88007b7cde28 ffff88003756c130 0000000000000282 ffff88003756c128 ffffffff81227670 0000000000000000 ffff88007b7cde78 ffffffff810722b7 ffff88007cdcf000 ffffffff81a90540 Call Trace: [<ffffffff81227670>] ? crypto_alloc_pcomp+0x20/0x20 [<ffffffff810722b7>] complete_all+0x47/0x60 [<ffffffff81227708>] cryptomgr_probe+0x98/0xc0 [<ffffffff81227670>] ? crypto_alloc_pcomp+0x20/0x20 [<ffffffff8106760e>] kthread+0xce/0xe0 [<ffffffff81067540>] ? kthread_freezable_should_stop+0x70/0x70 [<ffffffff815450dc>] ret_from_fork+0x7c/0xb0 [<ffffffff81067540>] ? kthread_freezable_should_stop+0x70/0x70 Code: 41 56 41 55 41 54 53 48 83 ec 18 66 66 66 66 90 89 75 cc 89 55 c8 4c 8d 6f 08 48 8b 57 08 41 89 cf 4d 89 c6 48 8d 42 e RIP [<ffffffff81070321>] __wake_up_common+0x31/0x90 RSP <ffff88007b7cde08> CR2: 0000000000000000 ---[ end trace b495b19270a4d37e ]---My assumption is that the following is happening: the minimal SCTP tool runs under ``echo 1 >
/proc/sys/net/sctp/auth_enable'', hence it's making use ofcrypto_alloc_hash()viasctp_auth_init_hmacs(). It forks itself, heavily allocates, binds, listens and waits in accept on sctp sockets, and then randomly kills some of them (no need for an actual client in this case to hit this). Then, again, allocating, binding, etc, and then killing child processes.The problem that might be happening here is that cryptomgr requests the module to probe/load through
cryptomgr_schedule_probe(), but before the thread handlercryptomgr_probe()returns, we return from thewait_for_completion_interruptible()function and probably already have cleared up larval, thus we run into a NULL pointer dereference when incryptomgr_probe()complete_all()is being called.
Quoted 4 lines
If we wait with
wait_for_completion()instead, this panic will not occur anymore. This is valid, because in case a signal is pending,cryptomgr_probe()returns from probing anyway with properly callingcomplete_all().
The use of wait_for_completion_interruptible is intentional so that we don't lock up the thread if a bug causes us to never wake up.
This bug is caused by the helper thread using the larval without holding a reference count on it. If the helper thread completes after the original thread requesting for help has gone away and destroyed the larval, then we get the crash above.
So the fix is to hold a reference count on the larval.
--- crypto/algboss.c | 15 ++++++++------- crypto/api.c | 6 ------ crypto/internal.h | 6 ++++++ 3 files changed, 14 insertions(+), 13 deletions(-)
crypto/algboss.c +8 -7
@@ -45,10 +45,9 @@ struct cryptomgr_param { } nu32; } attrs[CRYPTO_MAX_ATTRS ]; -char larval[CRYPTO_MAX_ALG_NAME ];char template[CRYPTO_MAX_ALG_NAME ]; -struct completion *completion; +struct crypto_larval *larval;u32 otype;u32 omask;
@@ -87,7 +86,8 @@ static int cryptomgr_probe(void *data)crypto_tmpl_put (tmpl); out: -complete_all (param->completion); +complete_all (¶m->larval->completion); +crypto_alg_put (¶m->larval->alg);kfree (param);module_put_and_exit (0 ); }
@@ -187,18 +187,19 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) param->otype = larval->alg.cra_flags; param->omask = larval->mask; -memcpy (param->larval, larval->alg.cra_name,CRYPTO_MAX_ALG_NAME ); - - param->completion = &larval->completion; +crypto_alg_get (&larval->alg); + param->larval = larval; thread =kthread_run (cryptomgr_probe, param,"cryptomgr_probe" );if (IS_ERR (thread)) - goto err_free_param; + goto err_put_larval;wait_for_completion_interruptible (&larval->completion);return NOTIFY_STOP ; +err_put_larval: +crypto_alg_put (&larval->alg); err_free_param:kfree (param); err_put_module:
crypto/api.c +0 -6
@@ -34,12 +34,6 @@ EXPORT_SYMBOL_GPL(crypto_alg_sem);BLOCKING_NOTIFIER_HEAD (crypto_chain);EXPORT_SYMBOL_GPL (crypto_chain); -static inline struct crypto_alg *crypto_alg_get (struct crypto_alg *alg) -{ -atomic_inc (&alg->cra_refcnt); -return alg; -} -struct crypto_alg *crypto_mod_get (struct crypto_alg *alg) {return try_module_get (alg->cra_module) ?crypto_alg_get (alg) :NULL ;
crypto/internal.h +6 -0
@@ -103,6 +103,12 @@ int crypto_register_notifier(struct notifier_block *nb);int crypto_unregister_notifier (struct notifier_block *nb);int crypto_probing_notify (unsigned long val,void *v); +static inline struct crypto_alg *crypto_alg_get (struct crypto_alg *alg) +{ +atomic_inc (&alg->cra_refcnt); +return alg; +} +static inline void crypto_alg_put (struct crypto_alg *alg) {if (atomic_dec_and_test (&alg->cra_refcnt) && alg->cra_destroy)
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 50/88 UBIFS: prepare to fix a horrid bug
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
[ Upstream commit 33f1a63ae84dfd9ad298cf275b8f1887043ced36 ]
Al Viro pointed me to the fact that '->readdir()' and '->llseek()' have no mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are in the middle of 'ubifs_readdir()'.
First of all, this means that 'file->private_data' can be freed while 'ubifs_readdir()' uses it. But this particular patch does not fix the problem. This patch is only a preparation, and the fix will follow next.
In this patch we make 'ubifs_readdir()' stop using 'file->f_pos' directly, because 'file->f_pos' can be changed by '->llseek()' at any point. This may lead 'ubifs_readdir()' to returning inconsistent data: directory entry names may correspond to incorrect file positions.
So here we introduce a local variable 'pos', read 'file->f_pose' once at very the beginning, and then stick to 'pos'. The result of this is that when 'ubifs_dir_llseek()' changes 'file->f_pos' while we are in the middle of 'ubifs_readdir()', the latter "wins".
--- fs/ubifs/dir.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
fs/ubifs/dir.c +12 -12
@@ -349,15 +349,16 @@ static unsigned int vfs_dent_type(uint8_t type)static int ubifs_readdir (struct file *file,void *dirent,filldir_t filldir) {int err, over =0 ; +loff_t pos = file->f_pos;struct qstr nm;union ubifs_key key;struct ubifs_dent_node *dent;struct inode *dir = file->f_path.dentry->d_inode;struct ubifs_info *c = dir->i_sb->s_fs_info; -dbg_gen ("dir ino %lu, f_pos %#llx" , dir->i_ino, file->f_pos); +dbg_gen ("dir ino %lu, f_pos %#llx" , dir->i_ino, pos); -if (file->f_pos >UBIFS_S_KEY_HASH_MASK || file->f_pos ==2 ) +if (pos >UBIFS_S_KEY_HASH_MASK || pos ==2 )/* * The directory was seek'ed to a senseless position or there * are no more entries.
@@ -365,15 +366,15 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)return 0 ;/* File positions 0 and 1 correspond to "." and ".." */ -if (file->f_pos ==0 ) { +if (pos ==0 ) {ubifs_assert (!file->private_data); over =filldir (dirent,"." ,1 ,0 , dir->i_ino,DT_DIR );if (over)return 0 ; - file->f_pos =1 ; + file->f_pos = pos =1 ; } -if (file->f_pos ==1 ) { +if (pos ==1 ) {ubifs_assert (!file->private_data); over =filldir (dirent,".." ,2 ,1 ,parent_ino (file->f_path.dentry),DT_DIR );
@@ -389,7 +390,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) goto out; } - file->f_pos =key_hash_flash (c, &dent->key); + file->f_pos = pos =key_hash_flash (c, &dent->key); file->private_data = dent; }
@@ -397,17 +398,16 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)if (!dent) {/* * The directory was seek'ed to and is now readdir'ed. -* Find the entry corresponding to @file->f_pos or the -* closest one. +* Find the entry corresponding to @pos or the closest one. */ -dent_key_init_hash (c, &key, dir->i_ino, file->f_pos); +dent_key_init_hash (c, &key, dir->i_ino, pos); nm.name =NULL ; dent =ubifs_tnc_next_ent (c, &key, &nm);if (IS_ERR (dent)) { err =PTR_ERR (dent); goto out; } - file->f_pos =key_hash_flash (c, &dent->key); + file->f_pos = pos =key_hash_flash (c, &dent->key); file->private_data = dent; }
@@ -419,7 +419,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) ubifs_inode(dir)->creat_sqnum); nm.len =le16_to_cpu (dent->nlen); - over =filldir (dirent, dent->name, nm.len, file->f_pos, + over =filldir (dirent, dent->name, nm.len, pos,le64_to_cpu (dent->inum),vfs_dent_type (dent->type));if (over)
@@ -435,7 +435,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) }kfree (file->private_data); - file->f_pos =key_hash_flash (c, &dent->key); + file->f_pos = pos =key_hash_flash (c, &dent->key); file->private_data = dent;cond_resched (); }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 51/88 UBIFS: fix a horrid bug
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Artem Bityutskiy <[email protected]>
[ Upstream commit 605c912bb843c024b1ed173dc427cd5c08e5d54d ]
Al Viro pointed me to the fact that '->readdir()' and '->llseek()' have no mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are in the middle of 'ubifs_readdir()'.
This means that 'file->private_data' can be freed while 'ubifs_readdir()' uses it, and this is a very bad bug: not only 'ubifs_readdir()' can return garbage, but this may corrupt memory and lead to all kinds of problems like crashes an security holes.
This patch fixes the problem by using the 'file->f_version' field, which '->llseek()' always unconditionally sets to zero. We set it to 1 in 'ubifs_readdir()' and whenever we detect that it became 0, we know there was a seek and it is time to clear the state saved in 'file->private_data'.
I tested this patch by writing a user-space program which runds readdir and seek in parallell. I could easily crash the kernel without these patches, but could not crash it with these patches.
--- fs/ubifs/dir.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
fs/ubifs/dir.c +27 -3
@@ -365,6 +365,24 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)*/ return 0 ; +if (file->f_version ==0 ) { +/* +* The file was seek'ed, which means that @file->private_data +* is now invalid. This may also be just the first +* 'ubifs_readdir()' invocation, in which case +* @file->private_data is NULL, and the below code is +* basically a no-op. +*/ +kfree (file->private_data); + file->private_data =NULL ; + } + +/* +* 'generic_file_llseek()' unconditionally sets @file->f_version to +* zero, and we use this for detecting whether the file was seek'ed. +*/ + file->f_version =1 ; +/* File positions 0 and 1 correspond to "." and ".." */ if (pos ==0 ) {ubifs_assert (!file->private_data);
@@ -438,6 +456,14 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir) file->f_pos = pos =key_hash_flash (c, &dent->key); file->private_data = dent;cond_resched (); + +if (file->f_version ==0 ) +/* +* The file was seek'ed meanwhile, lets return and start +* reading direntries from the new position on the next +* invocation. +*/ +return 0 ; } out:
@@ -448,15 +474,13 @@ out:kfree (file->private_data); file->private_data =NULL ; +/* 2 is a special value indicating that there are no more direntries */ file->f_pos =2 ;return 0 ; } -/* If a directory is seeked, we have to free saved readdir() state */ static loff_t ubifs_dir_llseek (struct file *file,loff_t offset,int origin) { -kfree (file->private_data); - file->private_data =NULL ;return generic_file_llseek (file, offset, origin); }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 52/88 libata-acpi: add back ACPI based hotplug functionality
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
[ Upstream commit 44521527be36172864e6e7a6fba4b66e9aa48e40 ]
Commit 30dcf76acc69 "libata: migrate ACPI code over to new bindings" mistakenly dropped the code to register hotplug notificaion handler for ATA port/devices, causing regression for people using ATA bay, as kernel bug #59871 shows.
Fix this by adding back the hotplug notification handler registration code. Since this code has to be run once and notification needs to be installed on every ATA port/devices handle no matter if there is actual device attached, we can't do this in binding time for ATA device ACPI handle, as the binding only occurs when a SCSI device is created, i.e. there is device attached. So introduce the ata_acpi_hotplug_init() function to loop scan all ATA ACPI handles and if it is available, install the notificaion handler for it during ATA init time.
With the ATA ACPI handle binding to SCSI device tree, it is possible now that when the SCSI hotplug work removes the SCSI device, the ACPI unbind function will find that the corresponding ACPI device has already been deleted by dock driver, causing a scaring message like:
[ 128.263966] scsi 4:0:0:0: Oops, 'acpi_handle' corrupt
Fix this by waiting for SCSI hotplug task finish in our notificaion handler, so that the removal of ACPI device done in ACPI unbind function triggered by the removal of SCSI device is run earlier when ACPI device is still available.
[rjw: Rebased]
References: https://bugzilla.kernel.org/show_bug.cgi?id=59871
--- drivers/ata/libata-acpi.c | 35 ++++++++++++++++++++++++++++++++++- drivers/ata/libata-core.c | 2 ++ drivers/ata/libata.h | 2 ++ 3 files changed, 38 insertions(+), 1 deletion(-)
drivers/ata/libata-acpi.c +34 -1
@@ -153,8 +153,10 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,spin_unlock_irqrestore (ap->lock, flags); -if (wait) +if (wait) {ata_port_wait_eh (ap); +flush_work (&ap->hotplug_task.work); + } }static void ata_acpi_dev_notify_dock (acpi_handle handle,u32 event,void *data)
@@ -211,6 +213,37 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = { .uevent = ata_acpi_ap_uevent, }; +void ata_acpi_hotplug_init (struct ata_host *host) +{ +int i; + +for (i =0 ; i < host->n_ports; i++) { +struct ata_port *ap = host->ports[i]; +acpi_handle handle; +struct ata_device *dev; + +if (!ap) +continue ; + + handle =ata_ap_acpi_handle (ap); +if (handle) { +/* we might be on a docking station */ +register_hotplug_dock_device (handle, + &ata_acpi_ap_dock_ops, ap); + } + +ata_for_each_dev (dev, &ap->link,ALL ) { + handle =ata_dev_acpi_handle (dev); +if (!handle) +continue ; + +/* we might be on a docking station */ +register_hotplug_dock_device (handle, + &ata_acpi_dev_dock_ops, dev); + } + } +} +/** * ata_acpi_dissociate - dissociate ATA host from ACPI objects * @host: target ATA host
drivers/ata/libata-core.c +2 -0
@@ -6066,6 +6066,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)if (rc) goto err_tadd; +ata_acpi_hotplug_init (host); +/* set cable, sata_spd_limit and report */ for (i =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i];
drivers/ata/libata.h +2 -0
@@ -122,6 +122,7 @@ extern int ata_acpi_register(void);extern void ata_acpi_unregister (void );extern void ata_acpi_bind (struct ata_device *dev);extern void ata_acpi_unbind (struct ata_device *dev); +extern void ata_acpi_hotplug_init (struct ata_host *host);#else static inline void ata_acpi_dissociate (struct ata_host *host) { }static inline int ata_acpi_on_suspend (struct ata_port *ap) {return 0 ; }
@@ -134,6 +135,7 @@ static inline int ata_acpi_register(void) { return 0; }static inline void ata_acpi_unregister (void ) { }static inline void ata_acpi_bind (struct ata_device *dev) { }static inline void ata_acpi_unbind (struct ata_device *dev) { } +static inline void ata_acpi_hotplug_init (struct ata_host *host) {}#endif /* libata-scsi.c */
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 53/88 libceph: Fix NULL pointer dereference in auth client code
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
[ Upstream commit 2cb33cac622afde897aa02d3dcd9fbba8bae839e ]
A malicious monitor can craft an auth reply message that could cause a NULL function pointer dereference in the client's kernel.
To prevent this, the auth_none protocol handler needs an empty ceph_auth_client_ops->build_request() function.
CVE-2013-1059
--- net/ceph/auth_none.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ceph/auth_none.c +6 -0
@@ -39,6 +39,11 @@ static int should_authenticate(struct ceph_auth_client *ac)return xi->starting; } +static int build_request (struct ceph_auth_client *ac,void *buf,void *end) +{ +return 0 ; +} +/* * the generic auth code decode the global_id, and we carry no actual * authenticate state, so nothing happens here.
@@ -106,6 +111,7 @@ static const struct ceph_auth_client_ops ceph_auth_none_ops = { .destroy = destroy, .is_authenticated = is_authenticated, .should_authenticate = should_authenticate, + .build_request = build_request, .handle_reply = handle_reply, .create_authorizer = ceph_auth_none_create_authorizer, .destroy_authorizer = ceph_auth_none_destroy_authorizer,
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 54/88 drivers/cdrom/cdrom.c: use kzalloc() for failing hardware
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jonathan Salwan <[email protected]>
[ Upstream commit 542db01579fbb7ea7d1f7bb9ddcef1559df660b2 ]
In drivers/cdrom/cdrom.c mmc_ioctl_cdrom_read_data() allocates a memory area with kmalloc in line 2885.
2885 cgc->buffer = kmalloc(blocksize, GFP_KERNEL); 2886 if (cgc->buffer == NULL) 2887 return -ENOMEM;
In line 2908 we can find the copy_to_user function:
2908 if (!ret && copy_to_user(arg, cgc->buffer, blocksize))
The cgc->buffer is never cleaned and initialized before this function. If ret = 0 with the previous basic block, it's possible to display some memory bytes in kernel space from userspace.
When we read a block from the disk it normally fills the ->buffer but if the drive is malfunctioning there is a chance that it would only be partially filled. The result is an leak information to userspace.
--- drivers/cdrom/cdrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cdrom/cdrom.c +1 -1
@@ -2882,7 +2882,7 @@ static noinline int mmc_ioctl_cdrom_read_data(struct cdrom_device_info *cdi,if (lba <0 )return -EINVAL ; - cgc->buffer =kmalloc (blocksize,GFP_KERNEL ); + cgc->buffer =kzalloc (blocksize,GFP_KERNEL );if (cgc->buffer ==NULL )return -ENOMEM ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 55/88 charger-manager: Ensure event is not used as format string
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 3594f4c0d7bc51e3a7e6d73c44e368ae079e42f3 ]
The exposed interface for cm_notify_event() could result in the event msg string being parsed as a format string. Make sure it is only used as a literal string.
--- drivers/power/charger-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/charger-manager.c +1 -1
@@ -368,7 +368,7 @@ static void uevent_notify(struct charger_manager *cm, const char *event)strncpy (env_str, event,UEVENT_BUF_SIZE );kobject_uevent (&cm->dev->kobj,KOBJ_CHANGE ); -dev_info (cm->dev, event); +dev_info (cm->dev,"%s" , event); }/**
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 56/88 hpfs: better test for errors
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
[ Upstream commit 3ebacb05044f82c5f0bb456a894eb9dc57d0ed90 ]
The test if bitmap access is out of bound could errorneously pass if the device size is divisible by 16384 sectors and we are asking for one bitmap after the end.
Check for invalid size in the superblock. Invalid size could cause integer overflows in the rest of the code.
--- fs/hpfs/map.c | 3 ++- fs/hpfs/super.c | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
fs/hpfs/map.c +2 -1
@@ -17,7 +17,8 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block, struct quad_buffer_head *qbh, char *id) { secno sec; -if (hpfs_sb (s)->sb_chk)if (bmp_block *16384 >hpfs_sb (s)->sb_fs_size) { +unsigned n_bands = (hpfs_sb (s)->sb_fs_size +0x3fff ) >>14 ; +if (hpfs_sb (s)->sb_chk)if (bmp_block >= n_bands) {hpfs_error (s,"hpfs_map_bitmap called with bad parameter: %08x at %s" , bmp_block, id);return NULL ; }
fs/hpfs/super.c +7 -1
@@ -552,7 +552,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) sbi->sb_cp_table =NULL ; sbi->sb_c_bitmap =-1 ; sbi->sb_max_fwd_alloc =0xffffff ; - + +if (sbi->sb_fs_size >=0x80000000 ) { +hpfs_error (s,"invalid size in superblock: %08x" , + (unsigned )sbi->sb_fs_size); + goto bail4; + } +/* Load bitmap directory */ if (!(sbi->sb_bmp_dir =hpfs_load_bitmap_directory (s,le32_to_cpu (superblock->bitmaps)))) goto bail4;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 57/88 block: do not pass disk names as format strings
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit ffc8b30866879ed9ba62bd0a86fecdbd51cd3d19 ]
Disk names may contain arbitrary strings, so they must not be interpreted as format strings. It seems that only md allows arbitrary strings to be used for disk names, but this could allow for a local memory corruption from uid 0 into ring 0.
CVE-2013-2851
--- block/genhd.c | 2 +- drivers/block/nbd.c | 3 ++- drivers/scsi/osd/osd_uld.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)
block/genhd.c +1 -1
@@ -517,7 +517,7 @@ static void register_disk(struct gendisk *disk) ddev->parent = disk->driverfs_dev; -dev_set_name (ddev, disk->disk_name); +dev_set_name (ddev,"%s" , disk->disk_name);/* delay uevents, until we scanned partition table */ dev_set_uevent_suppress (ddev,1 );
drivers/block/nbd.c +2 -1
@@ -670,7 +670,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,mutex_unlock (&nbd->tx_lock); - thread =kthread_create (nbd_thread, nbd, nbd->disk->disk_name); + thread =kthread_create (nbd_thread, nbd,"%s" , + nbd->disk->disk_name);if (IS_ERR (thread)) {mutex_lock (&nbd->tx_lock);return PTR_ERR (thread);
drivers/scsi/osd/osd_uld.c +1 -1
@@ -465,7 +465,7 @@ static int osd_probe(struct device *dev) oud->class_dev.class = &osd_uld_class; oud->class_dev.parent = dev; oud->class_dev.release = __remove; - error =dev_set_name (&oud->class_dev, disk->disk_name); + error =dev_set_name (&oud->class_dev,"%s" , disk->disk_name);if (error) {OSD_ERR ("dev_set_name failed => %d\n" , error); goto err_put_cdev;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 58/88 crypto: sanitize argument for format string
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 1c8fca1d92e14859159a82b8a380d220139b7344 ]
The template lookup interface does not provide a way to use format strings, so make sure that the interface cannot be abused accidentally.
--- crypto/algapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/algapi.c +2 -1
@@ -495,7 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)struct crypto_template *crypto_lookup_template (const char *name) { -return try_then_request_module (__crypto_lookup_template (name), name); +return try_then_request_module (__crypto_lookup_template (name),"%s" , + name); }EXPORT_SYMBOL_GPL (crypto_lookup_template);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 59/88 MAINTAINERS: add stable_kernel_rules.txt to stable maintainer information
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
[ Upstream commit 7b175c46720f8e6b92801bb634c93d1016f80c62 ]
This hopefully will help point developers to the proper way that patches should be submitted for inclusion in the stable kernel releases.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -6542,6 +6542,7 @@ STABLE BRANCH M: Greg Kroah-Hartman <[email protected]> L: [email protected] S: Supported +F: Documentation/stable_kernel_rules.txt STAGING SUBSYSTEM M: Greg Kroah-Hartman <[email protected]>
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 60/88 futex: Take hugepages into account when generating futex_key
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Zhang Yi <[email protected]>
[ Upstream commit 13d60f4b6ab5b702dc8d2ee20999f98a93728aec ]
The futex_keys of process shared futexes are generated from the page offset, the mapping host and the mapping index of the futex user space address. This should result in an unique identifier for each futex.
Though this is not true when futexes are located in different subpages of an hugepage. The reason is, that the mapping index for all those futexes evaluates to the index of the base page of the hugetlbfs mapping. So a futex at offset 0 of the hugepage mapping and another one at offset PAGE_SIZE of the same hugepage mapping have identical futex_keys. This happens because the futex code blindly uses page->index.
Steps to reproduce the bug:
1. Map a file from hugetlbfs. Initialize pthread_mutex1 at offset 0 and pthread_mutex2 at offset PAGE_SIZE of the hugetlbfs mapping.
The mutexes must be initialized as PTHREAD_PROCESS_SHARED because PTHREAD_PROCESS_PRIVATE mutexes are not affected by this issue as their keys solely depend on the user space address.
2. Lock mutex1 and mutex2
3. Create thread1 and in the thread function lock mutex1, which results in thread1 blocking on the locked mutex1.
4. Create thread2 and in the thread function lock mutex2, which results in thread2 blocking on the locked mutex2.
5. Unlock mutex2. Despite the fact that mutex2 got unlocked, thread2 still blocks on mutex2 because the futex_key points to mutex1.
To solve this issue we need to take the normal page index of the page which contains the futex into account, if the futex is in an hugetlbfs mapping. In other words, we calculate the normal page mapping index of the subpage in the hugetlbfs mapping.
Mappings which are not based on hugetlbfs are not affected and still use page->index.
Thanks to Mel Gorman who provided a patch for adding proper evaluation functions to the hugetlbfs code to avoid exposing hugetlbfs specific details to the futex code.
[ tglx: Massaged changelog ]
--- include/linux/hugetlb.h | 16 ++++++++++++++++ kernel/futex.c | 3 ++- mm/hugetlb.c | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
include/linux/hugetlb.h +16 -0
@@ -341,6 +341,17 @@ static inline int hstate_index(struct hstate *h) return h - hstates; } +pgoff_t __basepage_index (struct page *page); + +/* Return page->index in PAGE_SIZE units */ +static inline pgoff_t basepage_index (struct page *page) +{ +if (!PageCompound (page)) +return page->index; + +return __basepage_index (page); +} +#else struct hstate {};#define alloc_huge_page_node (h, nid) NULL
@@ -360,6 +371,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h) }#define hstate_index_to_shift (index) 0#define hstate_index (h) 0 + +static inline pgoff_t basepage_index (struct page *page) +{ +return page->index; +}#endif #endif /* _LINUX_HUGETLB_H */
kernel/futex.c +2 -1
@@ -60,6 +60,7 @@#include <linux/pid.h> #include <linux/nsproxy.h> #include <linux/ptrace.h> +#include <linux/hugetlb.h> #include <asm/futex.h>
@@ -363,7 +364,7 @@ again: }else { key->both.offset |=FUT_OFF_INODE ;/* inode-based key */ key->shared.inode = page_head->mapping->host; - key->shared.pgoff = page_head->index; + key->shared.pgoff =basepage_index (page); }get_futex_key_refs (key);
mm/hugetlb.c +17 -0
@@ -685,6 +685,23 @@ int PageHuge(struct page *page) }EXPORT_SYMBOL_GPL (PageHuge); +pgoff_t __basepage_index (struct page *page) +{ +struct page *page_head =compound_head (page); +pgoff_t index =page_index (page_head); +unsigned long compound_idx; + +if (!PageHuge (page_head)) +return page_index (page); + +if (compound_order (page_head) >=MAX_ORDER ) + compound_idx =page_to_pfn (page) -page_to_pfn (page_head); +else + compound_idx = page - page_head; + +return (index <<compound_order (page_head)) + compound_idx; +} +static struct page *alloc_fresh_huge_page_node (struct hstate *h,int nid) {struct page *page;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 61/88 nfsd4: fix decoding of compounds across page boundaries
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
[ Upstream commit 247500820ebd02ad87525db5d9b199e5b66f6636 ]
A freebsd NFSv4.0 client was getting rare IO errors expanding a tarball. A network trace showed the server returning BAD_XDR on the final getattr of a getattr+write+getattr compound. The final getattr started on a page boundary.
I believe the Linux client ignores errors on the post-write getattr, and that that's why we haven't seen this before.
--- 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_compoundargs *argp, u32 nbytes)*/ memcpy (p, argp->p, avail);/* step to next page */ - argp->p =page_address (argp->pagelist[0 ]); argp->pagelist++; + argp->p =page_address (argp->pagelist[0 ]);if (argp->pagelen <PAGE_SIZE ) { argp->end = argp->p + (argp->pagelen>>2 ); argp->pagelen =0 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 62/88 sd: Fix parsing of temporary cache mode prefix
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 2ee3e26c673e75c05ef8b914f54fadee3d7b9c88 ]
Commit 39c60a0948cc '[SCSI] sd: fix array cache flushing bug causing performance problems' added temp as a pointer to "temporary " and used sizeof(temp) - 1 as its length. But sizeof(temp) is the size of the pointer, not the size of the string constant. Change temp to a static array so that sizeof() does what was intended.
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -141,7 +141,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,char *buffer_data;struct scsi_mode_data data;struct scsi_sense_hdr sshdr; -const char *temp ="temporary " ; +static const char temp[] ="temporary " ;int len;if (sdp->type !=TYPE_DISK )
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 63/88 use sensible file nlink values if unprovided
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit 6658b9f70ebca5fc0795b1d6d733996af1e2caa7 ]
Certain servers may not set the NumberOfLinks field in query file/path info responses. In such a case, cifs_inode_needs_reval() assumes that all regular files are hardlinks and triggers revalidation, leading to excessive and unnecessary network traffic.
This change hardcodes cf_nlink (and subsequently i_nlink) when not returned by the server, similar to what already occurs in cifs_mkdir().
--- fs/cifs/inode.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/cifs/inode.c +5 -0
@@ -545,6 +545,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mode &= ~(S_IWUGO ); fattr->cf_nlink =le32_to_cpu (info->NumberOfLinks); +if (fattr->cf_nlink <1 ) { +cifserror ("replacing bogus file nlink value %u\n" , + fattr->cf_nlink); + fattr->cf_nlink =1 ; + } } fattr->cf_uid = cifs_sb->mnt_uid;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 64/88 rtlwifi: rtl8192cu: Fix duplicate if test
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
[ Upstream commit 10d0b9030a3f86e1e26c710c7580524d7787d688 ]
A typo causes routine rtl92cu_phy_rf6052_set_cck_txpower() to test the same condition twice. The problem was found using cppcheck-1.49, and the proper fix was verified against the pre-mac80211 version of the code.
This patch was originally included as commit 1288aa4, but was accidentally reverted in a later patch.
--- drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +1 -1
@@ -104,7 +104,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, tx_agc[RF90_PATH_A ] =0x10101010 ; tx_agc[RF90_PATH_B ] =0x10101010 ; }else if (rtlpriv->dm.dynamic_txhighpower_lvl == -TXHIGHPWRLEVEL_LEVEL1 ) { +TXHIGHPWRLEVEL_LEVEL2 ) { tx_agc[RF90_PATH_A ] =0x00000000 ; tx_agc[RF90_PATH_B ] =0x00000000 ; }else {
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 65/88 jbd2: move superblock checksum calculation to jbd2_write_superblock()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit fe52d17cdd343ac43c85cf72940a58865b9d3bfb ]
Some of the functions which modify the jbd2 superblock were not updating the checksum before calling jbd2_write_superblock(). Move the call to jbd2_superblock_csum_set() to jbd2_write_superblock(), so that the checksum is calculated consistently.
--- fs/jbd2/journal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jbd2/journal.c +2 -1
@@ -1304,6 +1304,7 @@ static int journal_reset(journal_t *journal)static void jbd2_write_superblock (journal_t *journal,int write_op) {struct buffer_head *bh = journal->j_sb_buffer; +journal_superblock_t *sb = journal->j_superblock;int ret;trace_jbd2_write_superblock (journal, write_op);
@@ -1325,6 +1326,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)clear_buffer_write_io_error (bh);set_buffer_uptodate (bh); } +jbd2_superblock_csum_set (journal, sb);get_bh (bh); bh->b_end_io = end_buffer_write_sync; ret =submit_bh (write_op, bh);
@@ -1421,7 +1423,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal)jbd_debug (1 ,"JBD2: updating superblock error (errno %d)\n" , journal->j_errno); sb->s_errno =cpu_to_be32 (journal->j_errno); -jbd2_superblock_csum_set (journal, sb);read_unlock (&journal->j_state_lock);jbd2_write_superblock (journal,WRITE_SYNC );
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 66/88 jbd2: fix theoretical race in jbd2__journal_restart
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit 39c04153fda8c32e85b51c96eb5511a326ad7609 ]
Once we decrement transaction->t_updates, if this is the last handle holding the transaction from closing, and once we release the t_handle_lock spinlock, it's possible for the transaction to commit and be released. In practice with normal kernels, this probably won't happen, since the commit happens in a separate kernel thread and it's unlikely this could all happen within the space of a few CPU cycles.
On the other hand, with a real-time kernel, this could potentially happen, so save the tid found in transaction->t_tid before we release t_handle_lock. It would require an insane configuration, such as one where the jbd2 thread was set to a very high real-time priority, perhaps because a high priority real-time thread is trying to read or write to a file system. But some people who use real-time kernels have been known to do insane things, including controlling laser-wielding industrial robots. :-)
--- fs/jbd2/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd2/transaction.c +1 -1
@@ -499,10 +499,10 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) &transaction->t_outstanding_credits);if (atomic_dec_and_test (&transaction->t_updates))wake_up (&journal->j_wait_updates); + tid = transaction->t_tid;spin_unlock (&transaction->t_handle_lock);jbd_debug (2 ,"restarting handle %p\n" , handle); - tid = transaction->t_tid; need_to_start = !tid_geq (journal->j_commit_request, tid);read_unlock (&journal->j_state_lock);if (need_to_start)
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 67/88 ext3,ext4: dont mess with dir_file->f_pos in htree_dirblock_to_tree()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 64cb927371cd2ec43758d8a094a003d27bc3d0dc ]
Both ext3 and ext4 htree_dirblock_to_tree() is just filling the in-core rbtree for use by call_filldir(). All updates of ->f_pos are done by the latter; bumping it here (on error) is obviously wrong - we might very well have it nowhere near the block we'd found an error in.
--- fs/ext3/namei.c | 7 ++----- fs/ext4/namei.c | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-)
fs/ext3/namei.c +2 -5
@@ -573,11 +573,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,if (!ext3_check_dir_entry ("htree_dirblock_to_tree" , dir, de, bh, (block<<EXT3_BLOCK_SIZE_BITS (dir->i_sb)) +((char *)de - bh->b_data))) { -/* On error, skip the f_pos to the next block. */ - dir_file->f_pos = (dir_file->f_pos | - (dir->i_sb->s_blocksize -1 )) +1 ; -brelse (bh); -return count; +/* silently ignore the rest of the block */ +break ; }ext3fs_dirhash (de->name, de->name_len, hinfo); if ((hinfo->hash < start_hash) ||
fs/ext4/namei.c +2 -5
@@ -859,11 +859,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,if (ext4_check_dir_entry (dir,NULL , de, bh, (block<<EXT4_BLOCK_SIZE_BITS (dir->i_sb)) + ((char *)de - bh->b_data))) { -/* On error, skip the f_pos to the next block. */ - dir_file->f_pos = (dir_file->f_pos | - (dir->i_sb->s_blocksize -1 )) +1 ; -brelse (bh); -return count; +/* silently ignore the rest of the block */ +break ; }ext4fs_dirhash (de->name, de->name_len, hinfo); if ((hinfo->hash < start_hash) ||
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 68/88 usb: gadget: f_mass_storage: add missing memory barrier for thread_wakeup_needed
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: UCHINO Satoshi <[email protected]>
[ Upstream commit d68c277b501889b3a50c179d1c3d704db7947b83 ]
Without this memory barrier, the file-storage thread may fail to escape from the following while loop, because it may observe new common->thread_wakeup_needed and old bh->state which are updated by the callback functions.
/* Wait for the CBW to arrive */
while (bh->state != BUF_STATE_FULL) {
rc = sleep_thread(common);
if (rc)
return rc;
}--- drivers/usb/gadget/f_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/f_mass_storage.c +2 -0
@@ -433,6 +433,7 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)/* Caller must hold fsg->lock */ static void wakeup_thread (struct fsg_common *common) { +smp_wmb ();/* ensure the write of bh->state is complete */ /* Tell the main thread that something has happened */ common->thread_wakeup_needed =1 ;if (common->thread_task)
@@ -652,6 +653,7 @@ static int sleep_thread(struct fsg_common *common) }__set_current_state (TASK_RUNNING ); common->thread_wakeup_needed =0 ; +smp_rmb ();/* ensure the latest bh->state is visible */ return rc; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 69/88 xhci: check for failed dma pool allocation
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
[ Upstream commit 025f880cb2e4d7218d0422d4b07bea1a68959c38 ]
Fail and free the container context in case dma_pool_alloc() can't allocate the raw context data part of it
This patch should be backported to kernels as old as 2.6.31, that contain the commit d115b04818e57bdbc7ccde4d0660b15e33013dc8 "USB: xhci:
Support for 64-byte contexts".
--- drivers/usb/host/xhci-mem.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-mem.c +4 -0
@@ -364,6 +364,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci ctx->size +=CTX_SIZE (xhci->hcc_params); ctx->bytes =dma_pool_alloc (xhci->device_pool, flags, &ctx->dma); +if (!ctx->bytes) { +kfree (ctx); +return NULL ; + }memset (ctx->bytes,0 , ctx->size);return ctx; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 70/88 usb: host: xhci-plat: release mem region while removing module
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: George Cherian <[email protected]>
[ Upstream commit 5388a3a5faba8dfa69e5f06c3a415d373c1a4316 ]
Do a release_mem_region of the hcd resource. Without this the subsequent insertion of module fails in request_mem_region.
--- drivers/usb/host/xhci-plat.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/xhci-plat.c +1 -0
@@ -179,6 +179,7 @@ static int xhci_plat_remove(struct platform_device *dev)usb_remove_hcd (hcd);iounmap (hcd->regs); +release_mem_region (hcd->rsrc_start, hcd->rsrc_len);usb_put_hcd (hcd);kfree (xhci);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 71/88 drivers: hv: switch to use mb() instead of smp_mb()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jason Wang <[email protected]>
[ Upstream commit 35848f68b07df3f917cb13fc3c134718669f569b ]
Even if guest were compiled without SMP support, it could not assume that host wasn't. So switch to use mb() instead of smp_mb() to force memory barriers for UP guest.
--- drivers/hv/ring_buffer.c | 2 +- drivers/hv/vmbus_drv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/hv/ring_buffer.c +1 -1
@@ -454,7 +454,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,/* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ /*is updated */ -smp_mb (); +mb ();/* Update the read index */ hv_set_next_read_location (inring_info, next_read_location);
drivers/hv/vmbus_drv.c +1 -1
@@ -466,7 +466,7 @@ static void vmbus_on_msg_dpc(unsigned long data)* will not deliver any more messages since there is * no empty slot */ -smp_mb (); +mb ();if (msg->header.message_flags.msg_pending) {/*
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 72/88 pcmcia: at91_cf: fix gpio_get_value in at91_cf_get_status
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Joachim Eastwood <[email protected]>
[ Upstream commit e39506b466edcda2a7e9d0174d7987ae654137b7 ]
Commit 80af9e6d (pcmcia at91_cf: fix raw gpio number usage) forgot to change the parameter in gpio_get_value after adding gpio validation.
--- drivers/pcmcia/at91_cf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pcmcia/at91_cf.c +2 -2
@@ -100,9 +100,9 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)int vcc =gpio_is_valid (cf->board->vcc_pin); *sp =SS_DETECT |SS_3VCARD ; -if (!rdy ||gpio_get_value (rdy)) +if (!rdy ||gpio_get_value (cf->board->irq_pin)) *sp |=SS_READY ; -if (!vcc ||gpio_get_value (vcc)) +if (!vcc ||gpio_get_value (cf->board->vcc_pin)) *sp |=SS_POWERON ; }else *sp =0 ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 73/88 cgroup: fix umount vs cgroup_event_remove() race
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Li Zefan <[email protected]>
[ Upstream commit 1c8158eeae0f37d0eee9f1fbe68080df6a408df2 ]
commit 5db9a4d99b0157a513944e9a44d29c9cec2e91dc
Author: Tejun Heo <[email protected]>
Date: Sat Jul 7 16:08:18 2012 -0700
cgroup: fix cgroup hierarchy umount race
This commit fixed a race caused by the dput() in css_dput_fn(), but the dput() in cgroup_event_remove() can also lead to the same BUG().
--- kernel/cgroup.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
kernel/cgroup.c +19 -6
@@ -3613,6 +3613,23 @@ static int cgroup_write_notify_on_release(struct cgroup *cgrp, }/* +* When dput() is called asynchronously, if umount has been done and +* then deactivate_super() in cgroup_free_fn() kills the superblock, +* there's a small window that vfs will see the root dentry with non-zero +* refcnt and trigger BUG(). +* +* That's why we hold a reference before dput() and drop it right after. +*/ +static void cgroup_dput (struct cgroup *cgrp) +{ +struct super_block *sb = cgrp->root->sb; + +atomic_inc (&sb->s_active); +dput (cgrp->dentry); +deactivate_super (sb); +} + +/* * Unregister event and free resources. * * Gets called from workqueue.
@@ -3627,7 +3644,7 @@ static void cgroup_event_remove(struct work_struct *work)eventfd_ctx_put (event->eventfd);kfree (event); -dput (cgrp->dentry); +cgroup_dput (cgrp); }/*
@@ -3878,12 +3895,8 @@ static void css_dput_fn(struct work_struct *work) {struct cgroup_subsys_state *css = container_of(work, struct cgroup_subsys_state, dput_work); -struct dentry *dentry = css->cgroup->dentry; -struct super_block *sb = dentry->d_sb; -atomic_inc (&sb->s_active); -dput (dentry); -deactivate_super (sb); +cgroup_dput (css->cgroup); } static void init_cgroup_css(struct cgroup_subsys_state *css,
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 74/88 xen/time: remove blocked time accounting from xen "clockchip"
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Laszlo Ersek <[email protected]>
[ Upstream commit 0b0c002c340e78173789f8afaa508070d838cf3d ]
... because the "clock_event_device framework" already accounts for idle time through the "event_handler" function pointer in xen_timer_interrupt().
The patch is intended as the completion of [1]. It should fix the double idle times seen in PV guests' /proc/stat [2]. It should be orthogonal to stolen time accounting (the removed code seems to be isolated).
The approach may be completely misguided.
[1] https://lkml.org/lkml/2011/10/6/10
[2] http://lists.xensource.com/archives/html/xen-devel/2010-08/msg01068.html
John took the time to retest this patch on top of v3.10 and reported:
"idle time is correctly incremented for pv and hvm for the normal case, nohz=off and nohz=idle." so lets put this patch in.
--- arch/x86/xen/time.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
arch/x86/xen/time.c +2 -15
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);/* snapshots of runstate info */ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); -/* unused ns of stolen and blocked time */ +/* unused ns of stolen time */ static DEFINE_PER_CPU(u64, xen_residual_stolen); -static DEFINE_PER_CPU(u64, xen_residual_blocked);/* return an consistent snapshot of 64-bit time/counter value */ static u64 get64 (const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void) {struct vcpu_runstate_info state;struct vcpu_runstate_info *snap; -s64 blocked, runnable, offline, stolen; +s64 runnable, offline, stolen;cputime_t ticks;get_runstate_snapshot (&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void) snap = &__get_cpu_var (xen_runstate_snapshot);/* work out how much time the VCPU has not been runn*ing* */ - blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked]; runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (stolen,NS_PER_TICK , &stolen);__this_cpu_write (xen_residual_stolen, stolen);account_steal_ticks (ticks); - -/* Add the appropriate number of ticks of blocked time, -including any left-overs from last time. */ - blocked +=__this_cpu_read (xen_residual_blocked); - -if (blocked <0 ) - blocked =0 ; - - ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked); -__this_cpu_write (xen_residual_blocked, blocked); -account_idle_ticks (ticks); }/* Get the TSC speed from Xen */
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 75/88 genirq: Fix can_request_irq() for IRQs without an action
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 2779db8d37d4b542d9ca2575f5f178dbeaca6c86 ]
Commit 02725e7471b8 ('genirq: Use irq_get/put functions'), inadvertently changed can_request_irq() to return 0 for IRQs that have no action. This causes pcibios_lookup_irq() to select only IRQs that already have an action with IRQF_SHARED set, or to fail if there are none. Change can_request_irq() to return 1 for IRQs that have no action (if the first two conditions are met).
--- kernel/irq/manage.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/irq/manage.c +3 -3
@@ -554,9 +554,9 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)return 0 ;if (irq_settings_can_request (desc)) { -if (desc->action) -if (irqflags & desc->action->flags &IRQF_SHARED ) - canrequest =1 ; +if (!desc->action || + irqflags & desc->action->flags &IRQF_SHARED ) + canrequest =1 ; }irq_put_desc_unlock (desc, flags);return canrequest;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 76/88 drivers/rtc/rtc-rv3029c2.c: fix disabling AIE irq
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
[ Upstream commit 29ecd78c0fd6ee05f2c6b07b23823a6ae43c13ff ]
In the disable AIE irq code path, current code passes "1" to enable parameter of rv3029c2_rtc_i2c_alarm_set_irq(). Thus it does not disable AIE irq.
--- drivers/rtc/rtc-rv3029c2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rv3029c2.c +1 -1
@@ -310,7 +310,7 @@ static int rv3029c2_rtc_i2c_set_alarm(struct i2c_client *client,dev_dbg (&client->dev,"alarm IRQ armed\n" ); }else {/* disable AIE irq */ - ret =rv3029c2_rtc_i2c_alarm_set_irq (client,1 ); + ret =rv3029c2_rtc_i2c_alarm_set_irq (client,0 );if (ret)return ret;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 77/88 ACPICA: Do not use extended sleep registers unless HW-reduced bit is set
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Lv Zheng <[email protected]>
[ Upstream commit 7cec7048fe22e3e92389da2cd67098f6c4284e7f ]
Previous implementation incorrectly used the ACPI 5.0 extended sleep registers if they were simply populated. This caused problems on some non-HW-reduced machines. As per the ACPI spec, they should only be used if the HW-reduced bit is set. Lv Zheng, ACPICA BZ 1020.
References: https://bugzilla.kernel.org/show_bug.cgi?id=54181
References: https://bugs.acpica.org/show_bug.cgi?id=1020
--- drivers/acpi/acpica/hwxfsleep.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/acpi/acpica/hwxfsleep.c +5 -3
@@ -242,12 +242,14 @@ acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id) &acpi_sleep_dispatch[function_id];#if (!ACPI_REDUCED_HARDWARE ) -/* * If the Hardware Reduced flag is set (from the FADT), we must -* use the extended sleep registers +* use the extended sleep registers (FADT). Note: As per the ACPI +* specification, these extended registers are to be used for HW-reduced +* platforms only. They are not general-purpose replacements for the +* legacy PM register sleep support. */ -if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { +if (acpi_gbl_reduced_hardware) { status = sleep_functions->extended_function (sleep_state); }else {/* Legacy sleep */
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 78/88 ocfs2: xattr: fix inlined xattr reflink
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Junxiao Bi <[email protected]>
[ Upstream commit ef962df057aaafd714f5c22ba3de1be459571fdf ]
Inlined xattr shared free space of inode block with inlined data or data extent record, so the size of the later two should be adjusted when inlined xattr is enabled. See ocfs2_xattr_ibody_init(). But this isn't done well when reflink. For inode with inlined data, its max inlined data size is adjusted in ocfs2_duplicate_inline_data(), no problem. But for inode with data extent record, its record count isn't adjusted. Fix it, or data extent record and inlined xattr may overwrite each other, then cause data corruption or xattr failure.
One panic caused by this bug in our test environment is the following:
kernel BUG at fs/ocfs2/xattr.c:1435!
invalid opcode: 0000 [#1] SMP
Pid: 10871, comm: multi_reflink_t Not tainted 2.6.39-300.17.1.el5uek #1
RIP: ocfs2_xa_offset_pointer+0x17/0x20 [ocfs2]
RSP: e02b:ffff88007a587948 EFLAGS: 00010283
RAX: 0000000000000000 RBX: 0000000000000010 RCX: 00000000000051e4
RDX: ffff880057092060 RSI: 0000000000000f80 RDI: ffff88007a587a68
RBP: ffff88007a587948 R08: 00000000000062f4 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000010
R13: ffff88007a587a68 R14: 0000000000000001 R15: ffff88007a587c68
FS: 00007fccff7f06e0(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
CS: e033 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00000000015cf000 CR3: 000000007aa76000 CR4: 0000000000000660
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process multi_reflink_t
Call Trace:
ocfs2_xa_reuse_entry+0x60/0x280 [ocfs2]
ocfs2_xa_prepare_entry+0x17e/0x2a0 [ocfs2]
ocfs2_xa_set+0xcc/0x250 [ocfs2]
ocfs2_xattr_ibody_set+0x98/0x230 [ocfs2]
__ocfs2_xattr_set_handle+0x4f/0x700 [ocfs2]
ocfs2_xattr_set+0x6c6/0x890 [ocfs2]
ocfs2_xattr_user_set+0x46/0x50 [ocfs2]
generic_setxattr+0x70/0x90
__vfs_setxattr_noperm+0x80/0x1a0
vfs_setxattr+0xa9/0xb0
setxattr+0xc3/0x120
sys_fsetxattr+0xa8/0xd0
system_call_fastpath+0x16/0x1b--- fs/ocfs2/xattr.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ocfs2/xattr.c +10 -0
@@ -6499,6 +6499,16 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args) } new_oi =OCFS2_I (args->new_inode); +/* +* Adjust extent record count to reserve space for extended attribute. +* Inline data count had been adjusted in ocfs2_duplicate_inline_data(). +*/ +if (!(new_oi->ip_dyn_features &OCFS2_INLINE_DATA_FL ) && + !(ocfs2_inode_is_fast_symlink (args->new_inode))) { +struct ocfs2_extent_list *el = &new_di->id2.i_list; +le16_add_cpu (&el->l_count, -(inline_size / +sizeof (struct ocfs2_extent_rec ))); + }spin_lock (&new_oi->ip_lock); new_oi->ip_dyn_features |=OCFS2_HAS_XATTR_FL |OCFS2_INLINE_XATTR_FL ; new_di->i_dyn_features =cpu_to_le16 (new_oi->ip_dyn_features);
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 79/88 nbd: correct disconnect behavior
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Paul Clements <[email protected]>
[ Upstream commit c378f70adbc1bbecd9e6db145019f14b2f688c7c ]
Currently, when a disconnect is requested by the user (via NBD_DISCONNECT ioctl) the return from NBD_DO_IT is undefined (it is usually one of several error codes). This means that nbd-client does not know if a manual disconnect was performed or whether a network error occurred. Because of this, nbd-client's persist mode (which tries to reconnect after error, but not after manual disconnect) does not always work correctly.
This change fixes this by causing NBD_DO_IT to always return 0 if a user requests a disconnect. This means that nbd-client can correctly either persist the connection (if an error occurred) or disconnect (if the user requested it).
--- drivers/block/nbd.c | 6 ++++++ include/linux/nbd.h | 1 + 2 files changed, 7 insertions(+)
drivers/block/nbd.c +6 -0
@@ -594,6 +594,9 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,nbd_cmd (&sreq) =NBD_CMD_DISC ;if (!nbd->sock)return -EINVAL ; + + nbd->disconnect =1 ; +nbd_send_req (nbd, &sreq);return 0 ; }
@@ -624,6 +627,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, nbd->sock =SOCKET_I (inode);if (max_part >0 ) bdev->bd_invalidated =1 ; + nbd->disconnect =0 ;/* we're connected now */ return 0 ; }else {fput (file);
@@ -695,6 +699,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,set_capacity (nbd->disk,0 );if (max_part >0 )ioctl_by_bdev (bdev,BLKRRPART ,0 ); +if (nbd->disconnect)/* user requested, ignore socket errors */ +return 0 ;return nbd->harderror; }
include/linux/nbd.h +1 -0
@@ -68,6 +68,7 @@ struct nbd_device {u64 bytesize;pid_t pid;/* pid of nbd-client, if attached */ int xmit_timeout; + int disconnect; /* a disconnect has been requested by user */ };#endif
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 80/88 PCI: Fix refcount issue in pci_create_root_bus() error recovery path
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
[ Upstream commit 343df771e671d821478dd3ef525a0610b808dbf8 ]
After calling device_register(&bridge->dev), the bridge is reference- counted, and it is illegal to call kfree() on it except in the release function.
--- drivers/pci/probe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/probe.c +4 -4
@@ -1671,8 +1671,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->dev.release = pci_release_bus_bridge_dev;dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus); error =device_register (&bridge->dev); -if (error) - goto bridge_dev_reg_err; +if (error) { +put_device (&bridge->dev); + goto err_out; + } b->bridge =get_device (&bridge->dev);device_enable_async_suspend (b->bridge);pci_set_bus_of_node (b);
@@ -1728,8 +1730,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, class_dev_reg_err:put_device (&bridge->dev);device_unregister (&bridge->dev); -bridge_dev_reg_err: -kfree (bridge); err_out:kfree (b);return NULL ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 81/88 ahci: remove pmp link online check in FBS EH
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Shane Huang <[email protected]>
[ Upstream commit 912b9ac683b112615d5605686f1dc086402ce9f7 ]
ata_link_online() check in ahci_error_intr() is unnecessary, it should be removed otherwise may lead to lockup with FBS enabled PMP.
http://marc.info/?l=linux-ide&m=137050421603272&w=2
--- drivers/ata/libahci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ata/libahci.c +1 -2
@@ -1544,8 +1544,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)u32 fbs =readl (port_mmio +PORT_FBS );int pmp = fbs >>PORT_FBS_DWE_OFFSET ; -if ((fbs &PORT_FBS_SDE ) && (pmp < ap->nr_pmp_links) && -ata_link_online (&ap->pmp_link[pmp])) { +if ((fbs &PORT_FBS_SDE ) && (pmp < ap->nr_pmp_links)) { link = &ap->pmp_link[pmp]; fbs_need_dec = true; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 82/88 timer: Fix jiffies wrap behavior of round_jiffies_common()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
[ Upstream commit 9e04d3804d3ac97d8c03a41d78d0f0674b5d01e1 ]
Direct compare of jiffies related values does not work in the wrap around case. Replace it with time_is_after_jiffies().
--- kernel/timer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
kernel/timer.c +5 -3
@@ -146,9 +146,11 @@ static unsigned long round_jiffies_common(unsigned long j, int cpu,/* now that we have rounded, subtract the extra skew again */ j -= cpu *3 ; -if (j <= jiffies)/* rounding ate our timeout entirely; */ -return original; -return j; +/* +* Make sure j is still in the future. Otherwise return the +* unmodified value. +*/ +return time_is_after_jiffies (j) ? j : original; }/**
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 83/88 ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit a60697f411eb365fb09e639e6f183fe33d1eb796 ]
On 32-bit architectures with 32-bit sector_t computation of data offset in ext4_xattr_fiemap() can overflow resulting in reporting bogus data location. Fix the problem by typing block number to proper type before shifting.
--- fs/ext4/extents.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/extents.c +2 -2
@@ -4767,7 +4767,7 @@ static int ext4_xattr_fiemap(struct inode *inode, error =ext4_get_inode_loc (inode, &iloc);if (error)return error; - physical = iloc.bh->b_blocknr << blockbits; + physical = (__u64 )iloc.bh->b_blocknr << blockbits; offset =EXT4_GOOD_OLD_INODE_SIZE +EXT4_I (inode)->i_extra_isize; physical += offset;
@@ -4775,7 +4775,7 @@ static int ext4_xattr_fiemap(struct inode *inode, flags |=FIEMAP_EXTENT_DATA_INLINE ;brelse (iloc.bh); }else {/* external block */ - physical =EXT4_I (inode)->i_file_acl << blockbits; + physical = (__u64 )EXT4_I (inode)->i_file_acl << blockbits; length = inode->i_sb->s_blocksize; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 84/88 ext4: fix overflow when counting used blocks on 32-bit architectures
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 8af8eecc1331dbf5e8c662022272cf667e213da5 ]
The arithmetics adding delalloc blocks to the number of used blocks in ext4_getattr() can easily overflow on 32-bit archs as we first multiply number of blocks by blocksize and then divide back by 512. Make the arithmetics more clever and also use proper type (unsigned long long instead of unsigned long).
--- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/inode.c +2 -2
@@ -4385,7 +4385,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) {struct inode *inode; -unsigned long delalloc_blocks; +unsigned long long delalloc_blocks; inode = dentry->d_inode;generic_fillattr (inode, stat);
@@ -4403,7 +4403,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, delalloc_blocks =EXT4_C2B (EXT4_SB (inode->i_sb),EXT4_I (inode)->i_reserved_data_blocks); - stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9 ; + stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits-9 );return 0 ; }
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 85/88 ext4: dont allow ext4_free_blocks() to fail due to ENOMEM
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
[ Upstream commit e7676a704ee0a1ef71a6b23760b5a8f6896cb1a1 ]
The filesystem should not be marked inconsistent if ext4_free_blocks() is not able to allocate memory. Unfortunately some callers (most notably ext4_truncate) don't have a way to reflect an error back up to the VFS. And even if we did, most userspace applications won't deal with most system calls returning ENOMEM anyway.
--- fs/ext4/mballoc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/ext4/mballoc.c +8 -3
@@ -4641,11 +4641,16 @@ do_more:* blocks being freed are metadata. these blocks shouldn't * be used until this transaction is committed */ + retry: new_entry =kmem_cache_alloc (ext4_free_data_cachep,GFP_NOFS );if (!new_entry) { -ext4_mb_unload_buddy (&e4b); - err = -ENOMEM ; - goto error_return; +/* +* We use a retry loop because +* ext4_free_blocks() is not allowed to fail. +*/ +cond_resched (); +congestion_wait (BLK_RW_ASYNC ,HZ /50 ); + goto retry; } new_entry->efd_start_cluster = bit; new_entry->efd_group = block_group;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 86/88 drivers/dma/pl330.c: fix locking in pl330_free_chan_resources()
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Bartlomiej Zolnierkiewicz <[email protected]>
[ Upstream commit da331ba8e9c5de72a27e50f71105395bba6eebe0 ]
tasklet_kill() may sleep so call it before taking pch->lock.
Fixes following lockup:
BUG: scheduling while atomic: cat/2383/0x00000002
Modules linked in:
unwind_backtrace+0x0/0xfc
__schedule_bug+0x4c/0x58
__schedule+0x690/0x6e0
sys_sched_yield+0x70/0x78
tasklet_kill+0x34/0x8c
pl330_free_chan_resources+0x24/0x88
dma_chan_put+0x4c/0x50
[...]
BUG: spinlock lockup suspected on CPU#0, swapper/0/0
lock: 0xe52aa04c, .magic: dead4ead, .owner: cat/2383, .owner_cpu: 1
unwind_backtrace+0x0/0xfc
do_raw_spin_lock+0x194/0x204
_raw_spin_lock_irqsave+0x20/0x28
pl330_tasklet+0x2c/0x5a8
tasklet_action+0xfc/0x114
__do_softirq+0xe4/0x19c
irq_exit+0x98/0x9c
handle_IPI+0x124/0x16c
gic_handle_irq+0x64/0x68
__irq_svc+0x40/0x70
cpuidle_wrap_enter+0x4c/0xa0
cpuidle_enter_state+0x18/0x68
cpuidle_idle_call+0xac/0xe0
cpu_idle+0xac/0xf0--- drivers/dma/pl330.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/pl330.c +2 -2
@@ -2462,10 +2462,10 @@ static void pl330_free_chan_resources(struct dma_chan *chan)struct dma_pl330_chan *pch =to_pchan (chan);unsigned long flags; -spin_lock_irqsave (&pch->lock, flags); -tasklet_kill (&pch->task); +spin_lock_irqsave (&pch->lock, flags); +pl330_release_channel (pch->pl330_chid); pch->pl330_chid =NULL ;
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 87/88 mm/memory-hotplug: fix lowmem count overflow when offline pages
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
[ Upstream commit cea27eb2a202959783f81254c48c250ddd80e129 ]
The logic for the memory-remove code fails to correctly account the Total High Memory when a memory block which contains High Memory is offlined as shown in the example below. The following patch fixes it.
Before logic memory remove:
MemTotal: 7603740 kB MemFree: 6329612 kB Buffers: 94352 kB Cached: 872008 kB SwapCached: 0 kB Active: 626932 kB Inactive: 519216 kB Active(anon): 180776 kB Inactive(anon): 222944 kB Active(file): 446156 kB Inactive(file): 296272 kB Unevictable: 0 kB Mlocked: 0 kB HighTotal: 7294672 kB HighFree: 5704696 kB LowTotal: 309068 kB LowFree: 624916 kB
After logic memory remove:
MemTotal: 7079452 kB MemFree: 5805976 kB Buffers: 94372 kB Cached: 872000 kB SwapCached: 0 kB Active: 626936 kB Inactive: 519236 kB Active(anon): 180780 kB Inactive(anon): 222944 kB Active(file): 446156 kB Inactive(file): 296292 kB Unevictable: 0 kB Mlocked: 0 kB HighTotal: 7294672 kB HighFree: 5181024 kB LowTotal: 4294752076 kB LowFree: 624952 kB
--- mm/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+)
mm/page_alloc.c +4 -0
@@ -5936,6 +5936,10 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)list_del (&page->lru);rmv_page_order (page); zone->free_area[order].nr_free--; +#ifdef CONFIG_HIGHMEM +if (PageHighMem (page)) + totalhigh_pages -=1 << order; +#endif __mod_zone_page_state (zone,NR_FREE_PAGES , - (1UL << order));for (i =0 ; i < (1 << order); i++)
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerPATCH 88/88 Handle big endianness in NTLM (ntlmv2) authentication
In reply to Steven Rostedt3.6.11.7-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
[ Upstream commit fdf96a907c1fbb93c633e2b7ede3b8df26d6a4c0 ]
This is RH bug 970891
Uppercasing of username during calculation of ntlmv2 hash fails because UniStrupr function does not handle big endian wchars.
Also fix a comment in the same code to reflect its correct usage.
[To make it easier for stable (rather than require 2nd patch) fixed this patch of Shirish's to remove endian warning generated by sparse -- steve f.]
--- fs/cifs/cifs_unicode.h | 8 ++++---- fs/cifs/cifsencrypt.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-)
fs/cifs/cifs_unicode.h +4 -4
@@ -327,14 +327,14 @@ UniToupper(register wchar_t uc)/* * UniStrupr: Upper case a unicode string */ -static inline wchar_t * -UniStrupr (registerwchar_t *upin) +static inline __le16 * +UniStrupr (register__le16 *upin) { - registerwchar_t *up; + register__le16 *up; up = upin;while (*up) {/* For all characters */ - *up =UniToupper (*up); + *up =cpu_to_le16 (UniToupper (le16_to_cpu (*up))); up++; }return upin;/* Return input pointer */
fs/cifs/cifsencrypt.c +3 -3
@@ -394,7 +394,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,int rc =0 ;int len;char nt_hash[CIFS_NTHASH_SIZE ]; -wchar_t *user; +__le16 *user;wchar_t *domain;wchar_t *server;
@@ -419,7 +419,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,return rc; } -/* convert ses->user_name to unicode and uppercase */ +/* convert ses->user_name to unicode */ len = ses->user_name ?strlen (ses->user_name) :0 ; user =kmalloc (2 + (len *2 ),GFP_KERNEL );if (user ==NULL ) {
@@ -429,7 +429,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, }if (len) { - len =cifs_strtoUTF16 ((__le16 *)user, ses->user_name, len, nls_cp); + len =cifs_strtoUTF16 (user, ses->user_name, len, nls_cp);UniStrupr (user); }else {memset (user,'\0' ,2 );
Signature · 1 line
1.7.10.4
Steven Rostedt
reviewerMAINTAINERS +1 -0
@@ -6542,6 +6542,7 @@ STABLE BRANCH M: Greg Kroah-Hartman <[email protected]> L: [email protected] S: Supported +F: Documentation/stable_kernel_rules.txt STAGING SUBSYSTEM M: Greg Kroah-Hartman <[email protected]>
Makefile +1 -1
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 6 SUBLEVEL = 11 -EXTRAVERSION = .6 +EXTRAVERSION = .7 NAME = Terrified Chipmunk # *DOCUMENTATION*
arch/arm/include/asm/cacheflush.h +1 -3
@@ -305,9 +305,7 @@ static inline void flush_anon_page(struct vm_area_struct *vma, }#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE -static inline void flush_kernel_dcache_page (struct page *page) -{ -} +extern void flush_kernel_dcache_page (struct page *);#define flush_dcache_mmap_lock (mapping) \ spin_lock_irq(&(mapping)->tree_lock)
arch/arm/mm/flush.c +33 -0
@@ -299,6 +299,39 @@ void flush_dcache_page(struct page *page)EXPORT_SYMBOL (flush_dcache_page);/* +* Ensure cache coherency for the kernel mapping of this page. We can +* assume that the page is pinned via kmap. +* +* If the page only exists in the page cache and there are no user +* space mappings, this is a no-op since the page was already marked +* dirty at creation. Otherwise, we need to flush the dirty kernel +* cache lines directly. +*/ +void flush_kernel_dcache_page (struct page *page) +{ +if (cache_is_vivt () ||cache_is_vipt_aliasing ()) { +struct address_space *mapping; + + mapping =page_mapping (page); + +if (!mapping ||mapping_mapped (mapping)) { +void *addr; + + addr =page_address (page); +/* +* kmap_atomic() doesn't set the page virtual +* address for highmem pages, and +* kunmap_atomic() takes care of cache +* flushing already. +*/ +if (!IS_ENABLED (CONFIG_HIGHMEM ) || addr) +__cpuc_flush_dcache_area (addr,PAGE_SIZE ); + } + } +} +EXPORT_SYMBOL (flush_kernel_dcache_page); + +/* * Flush an anonymous page so that users of get_user_pages() * can safely access the data. The expected sequence is: *
arch/arm/mm/nommu.c +6 -0
@@ -57,6 +57,12 @@ void flush_dcache_page(struct page *page) }EXPORT_SYMBOL (flush_dcache_page); +void flush_kernel_dcache_page (struct page *page) +{ +__cpuc_flush_dcache_area (page_address (page),PAGE_SIZE ); +} +EXPORT_SYMBOL (flush_kernel_dcache_page); +void copy_to_user_page (struct vm_area_struct *vma,struct page *page,unsigned long uaddr,void *dst,const void *src,unsigned long len)
arch/tile/lib/exports.c +2 -0
@@ -82,4 +82,6 @@ uint64_t __ashrdi3(uint64_t, unsigned int);EXPORT_SYMBOL (__ashrdi3);uint64_t __ashldi3 (uint64_t ,unsigned int );EXPORT_SYMBOL (__ashldi3); +int __ffsdi2 (uint64_t ); +EXPORT_SYMBOL (__ffsdi2);#endif
arch/x86/Kconfig +1 -0
@@ -2156,6 +2156,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
arch/x86/include/asm/irq_remapping.h +2 -0
@@ -30,6 +30,7 @@ extern int irq_remapping_enabled;extern void setup_irq_remapping_ops (void );extern int irq_remapping_supported (void ); +extern void set_irq_remapping_broken (void );extern int irq_remapping_prepare (void );extern int irq_remapping_enable (void );extern void irq_remapping_disable (void );
@@ -58,6 +59,7 @@ extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);static inline void setup_irq_remapping_ops (void ) { }static inline int irq_remapping_supported (void ) {return 0 ; } +static inline void set_irq_remapping_broken (void ) { }static inline int irq_remapping_prepare (void ) {return -ENODEV ; }static inline int irq_remapping_enable (void ) {return -ENODEV ; }static inline void irq_remapping_disable (void ) { }
arch/x86/kernel/early-quirks.c +20 -0
@@ -18,6 +18,7 @@#include <asm/apic.h> #include <asm/iommu.h> #include <asm/gart.h> +#include <asm/irq_remapping.h> static void __init fix_hypertransport_config (int num,int slot,int func) {
@@ -192,6 +193,21 @@ static void __init ati_bugs_contd(int num, int slot, int func) }#endif +static void __init intel_remapping_check (int num,int slot,int func) +{ +u8 revision; + + revision =read_pci_config_byte (num, slot, func,PCI_REVISION_ID ); + +/* +* Revision 0x13 of this chipset supports irq remapping +* but has an erratum that breaks its behavior, flag it as such +*/ +if (revision ==0x13 ) +set_irq_remapping_broken (); + +} +#define QFLAG_APPLY_ONCE 0x1#define QFLAG_APPLIED 0x2#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -221,6 +237,10 @@ static struct chipset early_qrk[] __initdata = { PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, + { PCI_VENDOR_ID_INTEL, 0x3403, PCI_CLASS_BRIDGE_HOST, + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, + PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, {} };
arch/x86/kvm/x86.c +2 -3
@@ -558,8 +558,6 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)if (index !=XCR_XFEATURE_ENABLED_MASK )return 1 ; xcr0 = xcr; -if (kvm_x86_ops->get_cpl (vcpu) !=0 ) -return 1 ;if (!(xcr0 &XSTATE_FP ))return 1 ;if ((xcr0 &XSTATE_YMM ) && !(xcr0 &XSTATE_SSE ))
@@ -573,7 +571,8 @@ int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)int kvm_set_xcr (struct kvm_vcpu *vcpu,u32 index,u64 xcr) { -if (__kvm_set_xcr (vcpu, index, xcr)) { +if (kvm_x86_ops->get_cpl (vcpu) !=0 || +__kvm_set_xcr (vcpu, index, xcr)) {kvm_inject_gp (vcpu,0 );return 1 ; }
arch/x86/xen/time.c +2 -15
@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);/* snapshots of runstate info */ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot); -/* unused ns of stolen and blocked time */ +/* unused ns of stolen time */ static DEFINE_PER_CPU(u64, xen_residual_stolen); -static DEFINE_PER_CPU(u64, xen_residual_blocked);/* return an consistent snapshot of 64-bit time/counter value */ static u64 get64 (const u64 *p)
@@ -115,7 +114,7 @@ static void do_stolen_accounting(void) {struct vcpu_runstate_info state;struct vcpu_runstate_info *snap; -s64 blocked, runnable, offline, stolen; +s64 runnable, offline, stolen;cputime_t ticks;get_runstate_snapshot (&state);
@@ -125,7 +124,6 @@ static void do_stolen_accounting(void) snap = &__get_cpu_var (xen_runstate_snapshot);/* work out how much time the VCPU has not been runn*ing* */ - blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked]; runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable]; offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
@@ -141,17 +139,6 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (stolen,NS_PER_TICK , &stolen);__this_cpu_write (xen_residual_stolen, stolen);account_steal_ticks (ticks); - -/* Add the appropriate number of ticks of blocked time, -including any left-overs from last time. */ - blocked +=__this_cpu_read (xen_residual_blocked); - -if (blocked <0 ) - blocked =0 ; - - ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked); -__this_cpu_write (xen_residual_blocked, blocked); -account_idle_ticks (ticks); }/* Get the TSC speed from Xen */
block/genhd.c +1 -1
@@ -517,7 +517,7 @@ static void register_disk(struct gendisk *disk) ddev->parent = disk->driverfs_dev; -dev_set_name (ddev, disk->disk_name); +dev_set_name (ddev,"%s" , disk->disk_name);/* delay uevents, until we scanned partition table */ dev_set_uevent_suppress (ddev,1 );
crypto/algapi.c +2 -1
@@ -495,7 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)struct crypto_template *crypto_lookup_template (const char *name) { -return try_then_request_module (__crypto_lookup_template (name), name); +return try_then_request_module (__crypto_lookup_template (name),"%s" , + name); }EXPORT_SYMBOL_GPL (crypto_lookup_template);
crypto/algboss.c +8 -7
@@ -45,10 +45,9 @@ struct cryptomgr_param { } nu32; } attrs[CRYPTO_MAX_ATTRS ]; -char larval[CRYPTO_MAX_ALG_NAME ];char template[CRYPTO_MAX_ALG_NAME ]; -struct completion *completion; +struct crypto_larval *larval;u32 otype;u32 omask;
@@ -87,7 +86,8 @@ static int cryptomgr_probe(void *data)crypto_tmpl_put (tmpl); out: -complete_all (param->completion); +complete_all (¶m->larval->completion); +crypto_alg_put (¶m->larval->alg);kfree (param);module_put_and_exit (0 ); }
@@ -187,18 +187,19 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) param->otype = larval->alg.cra_flags; param->omask = larval->mask; -memcpy (param->larval, larval->alg.cra_name,CRYPTO_MAX_ALG_NAME ); - - param->completion = &larval->completion; +crypto_alg_get (&larval->alg); + param->larval = larval; thread =kthread_run (cryptomgr_probe, param,"cryptomgr_probe" );if (IS_ERR (thread)) - goto err_free_param; + goto err_put_larval;wait_for_completion_interruptible (&larval->completion);return NOTIFY_STOP ; +err_put_larval: +crypto_alg_put (&larval->alg); err_free_param:kfree (param); err_put_module:
crypto/api.c +0 -6
@@ -34,12 +34,6 @@ EXPORT_SYMBOL_GPL(crypto_alg_sem);BLOCKING_NOTIFIER_HEAD (crypto_chain);EXPORT_SYMBOL_GPL (crypto_chain); -static inline struct crypto_alg *crypto_alg_get (struct crypto_alg *alg) -{ -atomic_inc (&alg->cra_refcnt); -return alg; -} -struct crypto_alg *crypto_mod_get (struct crypto_alg *alg) {return try_module_get (alg->cra_module) ?crypto_alg_get (alg) :NULL ;
crypto/internal.h +6 -0
@@ -103,6 +103,12 @@ int crypto_register_notifier(struct notifier_block *nb);int crypto_unregister_notifier (struct notifier_block *nb);int crypto_probing_notify (unsigned long val,void *v); +static inline struct crypto_alg *crypto_alg_get (struct crypto_alg *alg) +{ +atomic_inc (&alg->cra_refcnt); +return alg; +} +static inline void crypto_alg_put (struct crypto_alg *alg) {if (atomic_dec_and_test (&alg->cra_refcnt) && alg->cra_destroy)
drivers/acpi/acpica/hwxfsleep.c +5 -3
@@ -242,12 +242,14 @@ acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id) &acpi_sleep_dispatch[function_id];#if (!ACPI_REDUCED_HARDWARE ) -/* * If the Hardware Reduced flag is set (from the FADT), we must -* use the extended sleep registers +* use the extended sleep registers (FADT). Note: As per the ACPI +* specification, these extended registers are to be used for HW-reduced +* platforms only. They are not general-purpose replacements for the +* legacy PM register sleep support. */ -if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) { +if (acpi_gbl_reduced_hardware) { status = sleep_functions->extended_function (sleep_state); }else {/* Legacy sleep */
drivers/ata/libahci.c +1 -2
@@ -1544,8 +1544,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)u32 fbs =readl (port_mmio +PORT_FBS );int pmp = fbs >>PORT_FBS_DWE_OFFSET ; -if ((fbs &PORT_FBS_SDE ) && (pmp < ap->nr_pmp_links) && -ata_link_online (&ap->pmp_link[pmp])) { +if ((fbs &PORT_FBS_SDE ) && (pmp < ap->nr_pmp_links)) { link = &ap->pmp_link[pmp]; fbs_need_dec = true; }
drivers/ata/libata-acpi.c +34 -1
@@ -153,8 +153,10 @@ static void ata_acpi_handle_hotplug(struct ata_port *ap, struct ata_device *dev,spin_unlock_irqrestore (ap->lock, flags); -if (wait) +if (wait) {ata_port_wait_eh (ap); +flush_work (&ap->hotplug_task.work); + } }static void ata_acpi_dev_notify_dock (acpi_handle handle,u32 event,void *data)
@@ -211,6 +213,37 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = { .uevent = ata_acpi_ap_uevent, }; +void ata_acpi_hotplug_init (struct ata_host *host) +{ +int i; + +for (i =0 ; i < host->n_ports; i++) { +struct ata_port *ap = host->ports[i]; +acpi_handle handle; +struct ata_device *dev; + +if (!ap) +continue ; + + handle =ata_ap_acpi_handle (ap); +if (handle) { +/* we might be on a docking station */ +register_hotplug_dock_device (handle, + &ata_acpi_ap_dock_ops, ap); + } + +ata_for_each_dev (dev, &ap->link,ALL ) { + handle =ata_dev_acpi_handle (dev); +if (!handle) +continue ; + +/* we might be on a docking station */ +register_hotplug_dock_device (handle, + &ata_acpi_dev_dock_ops, dev); + } + } +} +/** * ata_acpi_dissociate - dissociate ATA host from ACPI objects * @host: target ATA host
drivers/ata/libata-core.c +2 -0
@@ -6066,6 +6066,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)if (rc) goto err_tadd; +ata_acpi_hotplug_init (host); +/* set cable, sata_spd_limit and report */ for (i =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i];
drivers/ata/libata.h +2 -0
@@ -122,6 +122,7 @@ extern int ata_acpi_register(void);extern void ata_acpi_unregister (void );extern void ata_acpi_bind (struct ata_device *dev);extern void ata_acpi_unbind (struct ata_device *dev); +extern void ata_acpi_hotplug_init (struct ata_host *host);#else static inline void ata_acpi_dissociate (struct ata_host *host) { }static inline int ata_acpi_on_suspend (struct ata_port *ap) {return 0 ; }
@@ -134,6 +135,7 @@ static inline int ata_acpi_register(void) { return 0; }static inline void ata_acpi_unregister (void ) { }static inline void ata_acpi_bind (struct ata_device *dev) { }static inline void ata_acpi_unbind (struct ata_device *dev) { } +static inline void ata_acpi_hotplug_init (struct ata_host *host) {}#endif /* libata-scsi.c */
drivers/block/nbd.c +8 -1
@@ -594,6 +594,9 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,nbd_cmd (&sreq) =NBD_CMD_DISC ;if (!nbd->sock)return -EINVAL ; + + nbd->disconnect =1 ; +nbd_send_req (nbd, &sreq);return 0 ; }
@@ -624,6 +627,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, nbd->sock =SOCKET_I (inode);if (max_part >0 ) bdev->bd_invalidated =1 ; + nbd->disconnect =0 ;/* we're connected now */ return 0 ; }else {fput (file);
@@ -670,7 +674,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,mutex_unlock (&nbd->tx_lock); - thread =kthread_create (nbd_thread, nbd, nbd->disk->disk_name); + thread =kthread_create (nbd_thread, nbd,"%s" , + nbd->disk->disk_name);if (IS_ERR (thread)) {mutex_lock (&nbd->tx_lock);return PTR_ERR (thread);
@@ -694,6 +699,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,set_capacity (nbd->disk,0 );if (max_part >0 )ioctl_by_bdev (bdev,BLKRRPART ,0 ); +if (nbd->disconnect)/* user requested, ignore socket errors */ +return 0 ;return nbd->harderror; }
drivers/cdrom/cdrom.c +1 -1
@@ -2882,7 +2882,7 @@ static noinline int mmc_ioctl_cdrom_read_data(struct cdrom_device_info *cdi,if (lba <0 )return -EINVAL ; - cgc->buffer =kmalloc (blocksize,GFP_KERNEL ); + cgc->buffer =kzalloc (blocksize,GFP_KERNEL );if (cgc->buffer ==NULL )return -ENOMEM ;
drivers/clk/clk.c +1 -0
@@ -1542,6 +1542,7 @@ int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)/* XXX the notifier code should handle this better */ if (!cn->notifier_head.head) {srcu_cleanup_notifier_head (&cn->notifier_head); +list_del (&cn->node);kfree (cn); }
drivers/dma/pl330.c +2 -2
@@ -2462,10 +2462,10 @@ static void pl330_free_chan_resources(struct dma_chan *chan)struct dma_pl330_chan *pch =to_pchan (chan);unsigned long flags; -spin_lock_irqsave (&pch->lock, flags); -tasklet_kill (&pch->task); +spin_lock_irqsave (&pch->lock, flags); +pl330_release_channel (pch->pl330_chid); pch->pl330_chid =NULL ;
drivers/gpu/drm/radeon/radeon_ring.c +10 -0
@@ -361,8 +361,18 @@ int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *ring, unsi {int r; +/* make sure we aren't trying to allocate more space than there is on the ring */ +if (ndw > (ring->ring_size /4 )) +return -ENOMEM ;/* Align requested size with padding so unlock_commit can * pad safely */ +radeon_ring_free_size (rdev, ring); +if (ring->ring_free_dw == (ring->ring_size /4 )) { +/* This is an empty ring update lockup info to avoid +* false positive. +*/ +radeon_ring_lockup_update (ring); + } ndw = (ndw + ring->align_mask) & ~ring->align_mask;while (ndw > (ring->ring_free_dw -1 )) {radeon_ring_free_size (rdev, ring);
drivers/hv/ring_buffer.c +1 -1
@@ -454,7 +454,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,/* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ /*is updated */ -smp_mb (); +mb ();/* Update the read index */ hv_set_next_read_location (inring_info, next_read_location);
drivers/hv/vmbus_drv.c +1 -1
@@ -466,7 +466,7 @@ static void vmbus_on_msg_dpc(unsigned long data)* will not deliver any more messages since there is * no empty slot */ -smp_mb (); +mb ();if (msg->header.message_flags.msg_pending) {/*
drivers/input/touchscreen/cyttsp_core.c +1 -1
@@ -133,7 +133,7 @@ static int cyttsp_exit_bl_mode(struct cyttsp *ts)memcpy (bl_cmd, bl_command,sizeof (bl_command));if (ts->pdata->bl_keys)memcpy (&bl_cmd[sizeof (bl_command) -CY_NUM_BL_KEYS ], - ts->pdata->bl_keys,sizeof (bl_command)); + ts->pdata->bl_keys,CY_NUM_BL_KEYS ); error =ttsp_write_block_data (ts,CY_REG_BASE ,sizeof (bl_cmd), bl_cmd);
drivers/iommu/intel_irq_remapping.c +10 -0
@@ -509,6 +509,16 @@ static int __init intel_irq_remapping_supported(void)if (disable_irq_remap)return 0 ; +if (irq_remap_broken) { +WARN_TAINT (1 ,TAINT_FIRMWARE_WORKAROUND , +"This system BIOS has enabled interrupt remapping\n" +"on a chipset that contains an erratum making that\n" +"feature unstable. To maintain system stability\n" +"interrupt remapping is being disabled. Please\n" +"contact your BIOS vendor for an update\n" ); + disable_irq_remap =1 ; +return 0 ; + }if (!dmar_ir_support ())return 0 ;
drivers/iommu/irq_remapping.c +6 -0
@@ -12,6 +12,7 @@int irq_remapping_enabled;int disable_irq_remap; +int irq_remap_broken;int disable_sourceid_checking;int no_x2apic_optout;
@@ -53,6 +54,11 @@ void __init setup_irq_remapping_ops(void) remap_ops = &intel_irq_remap_ops; } +void set_irq_remapping_broken (void ) +{ + irq_remap_broken =1 ; +} +int irq_remapping_supported (void ) {if (disable_irq_remap)
drivers/iommu/irq_remapping.h +1 -0
@@ -32,6 +32,7 @@ struct pci_dev;struct msi_msg ;extern int disable_irq_remap; +extern int irq_remap_broken;extern int disable_sourceid_checking;extern int no_x2apic_optout;
drivers/net/ethernet/freescale/gianfar_ptp.c +1 -0
@@ -521,6 +521,7 @@ static int gianfar_ptp_probe(struct platform_device *dev)return 0 ; no_clock: +iounmap (etsects->regs); no_ioremap:release_resource (etsects->rsrc); no_resource:
drivers/net/ethernet/realtek/8139cp.c +1 -0
@@ -1100,6 +1100,7 @@ static void cp_clean_rings (struct cp_private *cp) cp->dev->stats.tx_dropped++; } } +netdev_reset_queue (cp->dev);memset (cp->rx_ring,0 ,sizeof (struct cp_desc ) *CP_RX_RING_SIZE );memset (cp->tx_ring,0 ,sizeof (struct cp_desc ) *CP_TX_RING_SIZE );
drivers/net/ethernet/renesas/sh_eth.c +11 -4
@@ -1102,16 +1102,23 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) desc_status =edmac_to_cpu (mdp, rxdesc->status); pkt_len = rxdesc->frame_length; -#if defined(CONFIG_ARCH_R8A7740 ) - desc_status >>=16 ; -#endif -if (--boguscnt <0 )break ;if (!(desc_status &RDFEND )) ndev->stats.rx_length_errors++; +#if defined(CONFIG_ARCH_R8A7740 ) +/* +* In case of almost all GETHER/ETHERs, the Receive Frame State +* (RFS) bits in the Receive Descriptor 0 are from bit 9 to +* bit 0. However, in case of the R8A7740's GETHER, the RFS +* bits are from bit 25 to bit 16. So, the driver needs right +* shifting by 16. +*/ + desc_status >>=16 ; +#endif +if (desc_status & (RD_RFS1 |RD_RFS2 |RD_RFS3 |RD_RFS4 |RD_RFS5 |RD_RFS6 |RD_RFS10 )) { ndev->stats.rx_errors++;
drivers/net/phy/phy.c +1 -1
@@ -1152,7 +1152,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) adv =phy_eee_to_adv (eee_adv); lp =phy_eee_to_adv (eee_lp); idx =phy_find_setting (phydev->speed, phydev->duplex); -if ((lp & adv & settings[idx].setting)) +if (!(lp & adv & settings[idx].setting)) goto eee_exit;if (clk_stop_enable) {
drivers/net/team/team.c +1 -1
@@ -945,8 +945,8 @@ static int team_port_add(struct team *team, struct net_device *port_dev) } port->index =-1 ; -team_port_enable (team, port);list_add_tail_rcu (&port->list, &team->port_list); +team_port_enable (team, port);__team_compute_features (team);__team_port_change_port_added (port, !!netif_carrier_ok (port_dev));__team_options_change_check (team);
drivers/net/team/team_mode_roundrobin.c +2 -0
@@ -52,6 +52,8 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb) port_index =rr_priv (team)->sent_packets++ % team->en_port_count; port =team_get_port_by_index_rcu (team, port_index); +if (unlikely (!port)) + goto drop; port =__get_first_port_up (team, port);if (unlikely (!port)) goto drop;
drivers/net/wan/dlci.c +21 -5
@@ -384,21 +384,37 @@ static int dlci_del(struct dlci_add *dlci)struct frad_local *flp;struct net_device *master, *slave;int err; +bool found = false; + +rtnl_lock ();/* validate slave device */ master =__dev_get_by_name (&init_net, dlci->devname); -if (!master) -return -ENODEV ; +if (!master) { + err = -ENODEV ; + goto out; + } + +list_for_each_entry (dlp, &dlci_devs, list) { +if (dlp->master == master) { + found = true; +break ; + } + } +if (!found) { + err = -ENODEV ; + goto out; + }if (netif_running (master)) { -return -EBUSY ; + err = -EBUSY ; + goto out; } dlp =netdev_priv (master); slave = dlp->slave; flp =netdev_priv (slave); -rtnl_lock (); err = (*flp->deassoc)(slave, master);if (!err) {list_del (&dlp->list);
@@ -407,8 +423,8 @@ static int dlci_del(struct dlci_add *dlci)dev_put (slave); } +out:rtnl_unlock (); -return err; }
drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 -1
@@ -1193,7 +1193,7 @@ static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)mutex_lock (&priv->htc_pm_lock); priv->ps_idle = !!(conf->flags &IEEE80211_CONF_IDLE ); -if (priv->ps_idle) +if (!priv->ps_idle) chip_reset = true;mutex_unlock (&priv->htc_pm_lock);
drivers/net/wireless/ath/carl9170/tx.c +28 -41
121 lines not on this page · raw message
drivers/net/wireless/iwlwifi/dvm/rxon.c +1 -1
@@ -1377,7 +1377,7 @@ static void iwlagn_chain_noise_reset(struct iwl_priv *priv)struct iwl_chain_noise_data *data = &priv->chain_noise_data;int ret; -if (!(priv->calib_disabled &IWL_CHAIN_NOISE_CALIB_DISABLED )) +if (priv->calib_disabled &IWL_CHAIN_NOISE_CALIB_DISABLED )return ; if ((data->state == IWL_CHAIN_NOISE_ALIVE) &&
drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +1 -1
@@ -104,7 +104,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, tx_agc[RF90_PATH_A ] =0x10101010 ; tx_agc[RF90_PATH_B ] =0x10101010 ; }else if (rtlpriv->dm.dynamic_txhighpower_lvl == -TXHIGHPWRLEVEL_LEVEL1 ) { +TXHIGHPWRLEVEL_LEVEL2 ) { tx_agc[RF90_PATH_A ] =0x00000000 ; tx_agc[RF90_PATH_B ] =0x00000000 ; }else {
drivers/pci/probe.c +4 -4
@@ -1671,8 +1671,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->dev.release = pci_release_bus_bridge_dev;dev_set_name (&bridge->dev,"pci%04x:%02x" ,pci_domain_nr (b), bus); error =device_register (&bridge->dev); -if (error) - goto bridge_dev_reg_err; +if (error) { +put_device (&bridge->dev); + goto err_out; + } b->bridge =get_device (&bridge->dev);device_enable_async_suspend (b->bridge);pci_set_bus_of_node (b);
@@ -1728,8 +1730,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, class_dev_reg_err:put_device (&bridge->dev);device_unregister (&bridge->dev); -bridge_dev_reg_err: -kfree (bridge); err_out:kfree (b);return NULL ;
drivers/pcmcia/at91_cf.c +2 -2
@@ -100,9 +100,9 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)int vcc =gpio_is_valid (cf->board->vcc_pin); *sp =SS_DETECT |SS_3VCARD ; -if (!rdy ||gpio_get_value (rdy)) +if (!rdy ||gpio_get_value (cf->board->irq_pin)) *sp |=SS_READY ; -if (!vcc ||gpio_get_value (vcc)) +if (!vcc ||gpio_get_value (cf->board->vcc_pin)) *sp |=SS_POWERON ; }else *sp =0 ;
drivers/power/charger-manager.c +1 -1
@@ -368,7 +368,7 @@ static void uevent_notify(struct charger_manager *cm, const char *event)strncpy (env_str, event,UEVENT_BUF_SIZE );kobject_uevent (&cm->dev->kobj,KOBJ_CHANGE ); -dev_info (cm->dev, event); +dev_info (cm->dev,"%s" , event); }/**
drivers/rtc/rtc-rv3029c2.c +1 -1
@@ -310,7 +310,7 @@ static int rv3029c2_rtc_i2c_set_alarm(struct i2c_client *client,dev_dbg (&client->dev,"alarm IRQ armed\n" ); }else {/* disable AIE irq */ - ret =rv3029c2_rtc_i2c_alarm_set_irq (client,1 ); + ret =rv3029c2_rtc_i2c_alarm_set_irq (client,0 );if (ret)return ret;
drivers/scsi/osd/osd_uld.c +1 -1
@@ -465,7 +465,7 @@ static int osd_probe(struct device *dev) oud->class_dev.class = &osd_uld_class; oud->class_dev.parent = dev; oud->class_dev.release = __remove; - error =dev_set_name (&oud->class_dev, disk->disk_name); + error =dev_set_name (&oud->class_dev,"%s" , disk->disk_name);if (error) {OSD_ERR ("dev_set_name failed => %d\n" , error); goto err_put_cdev;
drivers/scsi/qla2xxx/tcm_qla2xxx.c +5 -1
@@ -688,8 +688,12 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd)* For FCP_READ with CHECK_CONDITION status, clear cmd->bufflen * for qla_tgt_xmit_response LLD code */ +if (se_cmd->se_cmd_flags &SCF_OVERFLOW_BIT ) { + se_cmd->se_cmd_flags &= ~SCF_OVERFLOW_BIT ; + se_cmd->residual_count =0 ; + } se_cmd->se_cmd_flags |=SCF_UNDERFLOW_BIT ; - se_cmd->residual_count = se_cmd->data_length; + se_cmd->residual_count += se_cmd->data_length; cmd->bufflen =0 ; }
drivers/scsi/sd.c +1 -1
@@ -141,7 +141,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,char *buffer_data;struct scsi_mode_data data;struct scsi_sense_hdr sshdr; -const char *temp ="temporary " ; +static const char temp[] ="temporary " ;int len;if (sdp->type !=TYPE_DISK )
drivers/target/iscsi/iscsi_target_erl0.c +2 -2
@@ -834,11 +834,11 @@ extern int iscsit_stop_time2retain_timer(struct iscsi_session *sess)return 0 ; sess->time2retain_timer_flags |=ISCSI_TF_STOP ; -spin_unlock_bh (&se_tpg->session_lock); +spin_unlock (&se_tpg->session_lock);del_timer_sync (&sess->time2retain_timer); -spin_lock_bh (&se_tpg->session_lock); +spin_lock (&se_tpg->session_lock); sess->time2retain_timer_flags &= ~ISCSI_TF_RUNNING ;pr_debug ("Stopped Time2Retain Timer for SID: %u\n" , sess->sid);
drivers/usb/gadget/f_mass_storage.c +2 -0
@@ -433,6 +433,7 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)/* Caller must hold fsg->lock */ static void wakeup_thread (struct fsg_common *common) { +smp_wmb ();/* ensure the write of bh->state is complete */ /* Tell the main thread that something has happened */ common->thread_wakeup_needed =1 ;if (common->thread_task)
@@ -652,6 +653,7 @@ static int sleep_thread(struct fsg_common *common) }__set_current_state (TASK_RUNNING ); common->thread_wakeup_needed =0 ; +smp_rmb ();/* ensure the latest bh->state is visible */ return rc; }
drivers/usb/host/xhci-mem.c +4 -0
@@ -364,6 +364,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci ctx->size +=CTX_SIZE (xhci->hcc_params); ctx->bytes =dma_pool_alloc (xhci->device_pool, flags, &ctx->dma); +if (!ctx->bytes) { +kfree (ctx); +return NULL ; + }memset (ctx->bytes,0 , ctx->size);return ctx; }
drivers/usb/host/xhci-plat.c +1 -0
@@ -179,6 +179,7 @@ static int xhci_plat_remove(struct platform_device *dev)usb_remove_hcd (hcd);iounmap (hcd->regs); +release_mem_region (hcd->rsrc_start, hcd->rsrc_len);usb_put_hcd (hcd);kfree (xhci);
drivers/usb/serial/ti_usb_3410_5052.c +2 -1
@@ -180,7 +180,8 @@ static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = { { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, - { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, + { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STEREO_PLUG_ID) }, + { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_STRIP_PORT_ID) }, { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) }, };
drivers/usb/serial/ti_usb_3410_5052.h +3 -1
@@ -52,7 +52,9 @@/* Abbott Diabetics vendor and product ids */ #define ABBOTT_VENDOR_ID 0x1a61 -#define ABBOTT_PRODUCT_ID 0x3410 +#define ABBOTT_STEREO_PLUG_ID 0x3410 +#define ABBOTT_PRODUCT_ID ABBOTT_STEREO_PLUG_ID +#define ABBOTT_STRIP_PORT_ID 0x3420/* Commands */ #define TI_GET_VERSION 0x01
fs/cifs/cifs_unicode.h +4 -4
@@ -327,14 +327,14 @@ UniToupper(register wchar_t uc)/* * UniStrupr: Upper case a unicode string */ -static inline wchar_t * -UniStrupr (registerwchar_t *upin) +static inline __le16 * +UniStrupr (register__le16 *upin) { - registerwchar_t *up; + register__le16 *up; up = upin;while (*up) {/* For all characters */ - *up =UniToupper (*up); + *up =cpu_to_le16 (UniToupper (le16_to_cpu (*up))); up++; }return upin;/* Return input pointer */
fs/cifs/cifsencrypt.c +3 -3
@@ -394,7 +394,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,int rc =0 ;int len;char nt_hash[CIFS_NTHASH_SIZE ]; -wchar_t *user; +__le16 *user;wchar_t *domain;wchar_t *server;
@@ -419,7 +419,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,return rc; } -/* convert ses->user_name to unicode and uppercase */ +/* convert ses->user_name to unicode */ len = ses->user_name ?strlen (ses->user_name) :0 ; user =kmalloc (2 + (len *2 ),GFP_KERNEL );if (user ==NULL ) {
@@ -429,7 +429,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, }if (len) { - len =cifs_strtoUTF16 ((__le16 *)user, ses->user_name, len, nls_cp); + len =cifs_strtoUTF16 (user, ses->user_name, len, nls_cp);UniStrupr (user); }else {memset (user,'\0' ,2 );
fs/cifs/inode.c +5 -0
@@ -545,6 +545,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, fattr->cf_mode &= ~(S_IWUGO ); fattr->cf_nlink =le32_to_cpu (info->NumberOfLinks); +if (fattr->cf_nlink <1 ) { +cifserror ("replacing bogus file nlink value %u\n" , + fattr->cf_nlink); + fattr->cf_nlink =1 ; + } } fattr->cf_uid = cifs_sb->mnt_uid;
fs/exec.c +9 -7
@@ -1162,13 +1162,6 @@ void setup_new_exec(struct linux_binprm * bprm)set_dumpable (current->mm, suid_dumpable); } -/* -* Flush performance counters when crossing a -* security domain: -*/ -if (!get_dumpable (current->mm)) -perf_event_exit_task (current); -/* An exec changes our domain. We are no longer part of the thread group */
@@ -1217,6 +1210,15 @@ void install_exec_creds(struct linux_binprm *bprm)commit_creds (bprm->cred); bprm->cred =NULL ; + +/* +* Disable monitoring for regular users +* when executing setuid binaries. Must +* wait until new credentials are committed +* by commit_creds() above +*/ +if (get_dumpable (current->mm) !=SUID_DUMP_USER ) +perf_event_exit_task (current);/* * cred_guard_mutex must be held at least to this point to prevent * ptrace_attach() from altering our determination of the task's
fs/ext3/namei.c +2 -5
@@ -573,11 +573,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,if (!ext3_check_dir_entry ("htree_dirblock_to_tree" , dir, de, bh, (block<<EXT3_BLOCK_SIZE_BITS (dir->i_sb)) +((char *)de - bh->b_data))) { -/* On error, skip the f_pos to the next block. */ - dir_file->f_pos = (dir_file->f_pos | - (dir->i_sb->s_blocksize -1 )) +1 ; -brelse (bh); -return count; +/* silently ignore the rest of the block */ +break ; }ext3fs_dirhash (de->name, de->name_len, hinfo); if ((hinfo->hash < start_hash) ||
fs/ext4/extents.c +2 -2
@@ -4767,7 +4767,7 @@ static int ext4_xattr_fiemap(struct inode *inode, error =ext4_get_inode_loc (inode, &iloc);if (error)return error; - physical = iloc.bh->b_blocknr << blockbits; + physical = (__u64 )iloc.bh->b_blocknr << blockbits; offset =EXT4_GOOD_OLD_INODE_SIZE +EXT4_I (inode)->i_extra_isize; physical += offset;
@@ -4775,7 +4775,7 @@ static int ext4_xattr_fiemap(struct inode *inode, flags |=FIEMAP_EXTENT_DATA_INLINE ;brelse (iloc.bh); }else {/* external block */ - physical =EXT4_I (inode)->i_file_acl << blockbits; + physical = (__u64 )EXT4_I (inode)->i_file_acl << blockbits; length = inode->i_sb->s_blocksize; }
fs/ext4/inode.c +2 -2
@@ -4385,7 +4385,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) {struct inode *inode; -unsigned long delalloc_blocks; +unsigned long long delalloc_blocks; inode = dentry->d_inode;generic_fillattr (inode, stat);
@@ -4403,7 +4403,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, delalloc_blocks =EXT4_C2B (EXT4_SB (inode->i_sb),EXT4_I (inode)->i_reserved_data_blocks); - stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9 ; + stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits-9 );return 0 ; }
fs/ext4/mballoc.c +8 -3
@@ -4641,11 +4641,16 @@ do_more:* blocks being freed are metadata. these blocks shouldn't * be used until this transaction is committed */ + retry: new_entry =kmem_cache_alloc (ext4_free_data_cachep,GFP_NOFS );if (!new_entry) { -ext4_mb_unload_buddy (&e4b); - err = -ENOMEM ; - goto error_return; +/* +* We use a retry loop because +* ext4_free_blocks() is not allowed to fail. +*/ +cond_resched (); +congestion_wait (BLK_RW_ASYNC ,HZ /50 ); + goto retry; } new_entry->efd_start_cluster = bit; new_entry->efd_group = block_group;
fs/ext4/namei.c +2 -5
@@ -859,11 +859,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,if (ext4_check_dir_entry (dir,NULL , de, bh, (block<<EXT4_BLOCK_SIZE_BITS (dir->i_sb)) + ((char *)de - bh->b_data))) { -/* On error, skip the f_pos to the next block. */ - dir_file->f_pos = (dir_file->f_pos | - (dir->i_sb->s_blocksize -1 )) +1 ; -brelse (bh); -return count; +/* silently ignore the rest of the block */ +break ; }ext4fs_dirhash (de->name, de->name_len, hinfo); if ((hinfo->hash < start_hash) ||
fs/hpfs/map.c +2 -1
@@ -17,7 +17,8 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block, struct quad_buffer_head *qbh, char *id) { secno sec; -if (hpfs_sb (s)->sb_chk)if (bmp_block *16384 >hpfs_sb (s)->sb_fs_size) { +unsigned n_bands = (hpfs_sb (s)->sb_fs_size +0x3fff ) >>14 ; +if (hpfs_sb (s)->sb_chk)if (bmp_block >= n_bands) {hpfs_error (s,"hpfs_map_bitmap called with bad parameter: %08x at %s" , bmp_block, id);return NULL ; }
fs/hpfs/super.c +7 -1
@@ -552,7 +552,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) sbi->sb_cp_table =NULL ; sbi->sb_c_bitmap =-1 ; sbi->sb_max_fwd_alloc =0xffffff ; - + +if (sbi->sb_fs_size >=0x80000000 ) { +hpfs_error (s,"invalid size in superblock: %08x" , + (unsigned )sbi->sb_fs_size); + goto bail4; + } +/* Load bitmap directory */ if (!(sbi->sb_bmp_dir =hpfs_load_bitmap_directory (s,le32_to_cpu (superblock->bitmaps)))) goto bail4;
fs/jbd2/journal.c +2 -1
@@ -1304,6 +1304,7 @@ static int journal_reset(journal_t *journal)static void jbd2_write_superblock (journal_t *journal,int write_op) {struct buffer_head *bh = journal->j_sb_buffer; +journal_superblock_t *sb = journal->j_superblock;int ret;trace_jbd2_write_superblock (journal, write_op);
@@ -1325,6 +1326,7 @@ static void jbd2_write_superblock(journal_t *journal, int write_op)clear_buffer_write_io_error (bh);set_buffer_uptodate (bh); } +jbd2_superblock_csum_set (journal, sb);get_bh (bh); bh->b_end_io = end_buffer_write_sync; ret =submit_bh (write_op, bh);
@@ -1421,7 +1423,6 @@ void jbd2_journal_update_sb_errno(journal_t *journal)jbd_debug (1 ,"JBD2: updating superblock error (errno %d)\n" , journal->j_errno); sb->s_errno =cpu_to_be32 (journal->j_errno); -jbd2_superblock_csum_set (journal, sb);read_unlock (&journal->j_state_lock);jbd2_write_superblock (journal,WRITE_SYNC );
fs/jbd2/transaction.c +1 -1
@@ -499,10 +499,10 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask) &transaction->t_outstanding_credits);if (atomic_dec_and_test (&transaction->t_updates))wake_up (&journal->j_wait_updates); + tid = transaction->t_tid;spin_unlock (&transaction->t_handle_lock);jbd_debug (2 ,"restarting handle %p\n" , handle); - tid = transaction->t_tid; need_to_start = !tid_geq (journal->j_commit_request, tid);read_unlock (&journal->j_state_lock);if (need_to_start)
fs/nfsd/nfs4xdr.c +1 -1
@@ -161,8 +161,8 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)*/ memcpy (p, argp->p, avail);/* step to next page */ - argp->p =page_address (argp->pagelist[0 ]); argp->pagelist++; + argp->p =page_address (argp->pagelist[0 ]);if (argp->pagelen <PAGE_SIZE ) { argp->end = argp->p + (argp->pagelen>>2 ); argp->pagelen =0 ;
fs/ocfs2/xattr.c +10 -0
@@ -6499,6 +6499,16 @@ static int ocfs2_reflink_xattr_inline(struct ocfs2_xattr_reflink *args) } new_oi =OCFS2_I (args->new_inode); +/* +* Adjust extent record count to reserve space for extended attribute. +* Inline data count had been adjusted in ocfs2_duplicate_inline_data(). +*/ +if (!(new_oi->ip_dyn_features &OCFS2_INLINE_DATA_FL ) && + !(ocfs2_inode_is_fast_symlink (args->new_inode))) { +struct ocfs2_extent_list *el = &new_di->id2.i_list; +le16_add_cpu (&el->l_count, -(inline_size / +sizeof (struct ocfs2_extent_rec ))); + }spin_lock (&new_oi->ip_lock); new_oi->ip_dyn_features |=OCFS2_HAS_XATTR_FL |OCFS2_INLINE_XATTR_FL ; new_di->i_dyn_features =cpu_to_le16 (new_oi->ip_dyn_features);
fs/ubifs/dir.c +39 -15
125 lines not on this page · raw message
include/linux/hugetlb.h +16 -0
@@ -341,6 +341,17 @@ static inline int hstate_index(struct hstate *h) return h - hstates; } +pgoff_t __basepage_index (struct page *page); + +/* Return page->index in PAGE_SIZE units */ +static inline pgoff_t basepage_index (struct page *page) +{ +if (!PageCompound (page)) +return page->index; + +return __basepage_index (page); +} +#else struct hstate {};#define alloc_huge_page_node (h, nid) NULL
@@ -360,6 +371,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h) }#define hstate_index_to_shift (index) 0#define hstate_index (h) 0 + +static inline pgoff_t basepage_index (struct page *page) +{ +return page->index; +}#endif #endif /* _LINUX_HUGETLB_H */
include/linux/nbd.h +1 -0
@@ -68,6 +68,7 @@ struct nbd_device {u64 bytesize;pid_t pid;/* pid of nbd-client, if attached */ int xmit_timeout; + int disconnect; /* a disconnect has been requested by user */ };#endif
include/linux/perf_event.h +1 -2
@@ -953,8 +953,7 @@ struct perf_event {/* mmap bits */ struct mutex mmap_mutex;atomic_t mmap_count; -int mmap_locked; -struct user_struct *mmap_user; +struct ring_buffer *rb;struct list_head rb_entry;
include/linux/rculist_nulls.h +6 -1
@@ -105,9 +105,14 @@ static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,* @head: the head for your list. * @member: the name of the hlist_nulls_node within the struct. * +* The barrier() is needed to make sure compiler doesn't cache first element [1], +* as this loop can be restarted [2] +* [1] Documentation/atomic_ops.txt around line 114 +* [2] Documentation/RCU/rculist_nulls.txt around line 146 */ #define hlist_nulls_for_each_entry_rcu (tpos, pos, head, member) \ - for (pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ + for (({barrier();}), \ + pos = rcu_dereference_raw(hlist_nulls_first_rcu(head)); \ (!is_a_nulls(pos)) && \ ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \ pos = rcu_dereference_raw(hlist_nulls_next_rcu(pos)))
include/linux/socket.h +3 -0
@@ -337,6 +337,9 @@ extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);struct timespec ; +/* The __sys_...msg variants allow MSG_CMSG_COMPAT */ +extern long __sys_recvmsg (int fd,struct msghdr __user *msg,unsigned flags); +extern long __sys_sendmsg (int fd,struct msghdr __user *msg,unsigned flags);extern int __sys_recvmmsg (int fd,struct mmsghdr __user *mmsg,unsigned int vlen,unsigned int flags,struct timespec *timeout); extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
kernel/cgroup.c +19 -6
@@ -3613,6 +3613,23 @@ static int cgroup_write_notify_on_release(struct cgroup *cgrp, }/* +* When dput() is called asynchronously, if umount has been done and +* then deactivate_super() in cgroup_free_fn() kills the superblock, +* there's a small window that vfs will see the root dentry with non-zero +* refcnt and trigger BUG(). +* +* That's why we hold a reference before dput() and drop it right after. +*/ +static void cgroup_dput (struct cgroup *cgrp) +{ +struct super_block *sb = cgrp->root->sb; + +atomic_inc (&sb->s_active); +dput (cgrp->dentry); +deactivate_super (sb); +} + +/* * Unregister event and free resources. * * Gets called from workqueue.
@@ -3627,7 +3644,7 @@ static void cgroup_event_remove(struct work_struct *work)eventfd_ctx_put (event->eventfd);kfree (event); -dput (cgrp->dentry); +cgroup_dput (cgrp); }/*
@@ -3878,12 +3895,8 @@ static void css_dput_fn(struct work_struct *work) {struct cgroup_subsys_state *css = container_of(work, struct cgroup_subsys_state, dput_work); -struct dentry *dentry = css->cgroup->dentry; -struct super_block *sb = dentry->d_sb; -atomic_inc (&sb->s_active); -dput (dentry); -deactivate_super (sb); +cgroup_dput (css->cgroup); } static void init_cgroup_css(struct cgroup_subsys_state *css,
kernel/events/core.c +161 -72
347 lines not on this page · raw message
kernel/events/hw_breakpoint.c +2 -2
@@ -147,7 +147,7 @@ fetch_bp_busy_slots(struct bp_busy_slots *slots, struct perf_event *bp,return ; } -for_each_online_cpu (cpu) { +for_each_possible_cpu (cpu) {unsigned int nr; nr =per_cpu (nr_cpu_bp_pinned[type], cpu);
@@ -233,7 +233,7 @@ toggle_bp_slot(struct perf_event *bp, bool enable, enum bp_type_idx type,if (cpu >=0 ) {toggle_bp_task_slot (bp, cpu, enable, type, weight); }else { -for_each_online_cpu (cpu) +for_each_possible_cpu (cpu)toggle_bp_task_slot (bp, cpu, enable, type, weight); }
kernel/events/internal.h +4 -0
@@ -30,6 +30,10 @@ struct ring_buffer {spinlock_t event_lock;struct list_head event_list; +atomic_t mmap_count; +unsigned long mmap_locked; +struct user_struct *mmap_user; +struct perf_event_mmap_page *user_page;void *data_pages[0 ]; };
kernel/futex.c +2 -1
@@ -60,6 +60,7 @@#include <linux/pid.h> #include <linux/nsproxy.h> #include <linux/ptrace.h> +#include <linux/hugetlb.h> #include <asm/futex.h>
@@ -363,7 +364,7 @@ again: }else { key->both.offset |=FUT_OFF_INODE ;/* inode-based key */ key->shared.inode = page_head->mapping->host; - key->shared.pgoff = page_head->index; + key->shared.pgoff =basepage_index (page); }get_futex_key_refs (key);
kernel/irq/manage.c +3 -3
@@ -554,9 +554,9 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)return 0 ;if (irq_settings_can_request (desc)) { -if (desc->action) -if (irqflags & desc->action->flags &IRQF_SHARED ) - canrequest =1 ; +if (!desc->action || + irqflags & desc->action->flags &IRQF_SHARED ) + canrequest =1 ; }irq_put_desc_unlock (desc, flags);return canrequest;
kernel/timer.c +5 -3
@@ -146,9 +146,11 @@ static unsigned long round_jiffies_common(unsigned long j, int cpu,/* now that we have rounded, subtract the extra skew again */ j -= cpu *3 ; -if (j <= jiffies)/* rounding ate our timeout entirely; */ -return original; -return j; +/* +* Make sure j is still in the future. Otherwise return the +* unmodified value. +*/ +return time_is_after_jiffies (j) ? j : original; }/**
mm/hugetlb.c +17 -0
@@ -685,6 +685,23 @@ int PageHuge(struct page *page) }EXPORT_SYMBOL_GPL (PageHuge); +pgoff_t __basepage_index (struct page *page) +{ +struct page *page_head =compound_head (page); +pgoff_t index =page_index (page_head); +unsigned long compound_idx; + +if (!PageHuge (page_head)) +return page_index (page); + +if (compound_order (page_head) >=MAX_ORDER ) + compound_idx =page_to_pfn (page) -page_to_pfn (page_head); +else + compound_idx = page - page_head; + +return (index <<compound_order (page_head)) + compound_idx; +} +static struct page *alloc_fresh_huge_page_node (struct hstate *h,int nid) {struct page *page;
mm/page_alloc.c +4 -0
@@ -5936,6 +5936,10 @@ __offline_isolated_pages(unsigned long start_pfn, unsigned long end_pfn)list_del (&page->lru);rmv_page_order (page); zone->free_area[order].nr_free--; +#ifdef CONFIG_HIGHMEM +if (PageHighMem (page)) + totalhigh_pages -=1 << order; +#endif __mod_zone_page_state (zone,NR_FREE_PAGES , - (1UL << order));for (i =0 ; i < (1 << order); i++)
net/bluetooth/l2cap_core.c +3 -0
@@ -2548,6 +2548,9 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn, u8 code,BT_DBG ("conn %p, code 0x%2.2x, ident 0x%2.2x, len %u" , conn, code, ident, dlen); +if (conn->mtu <L2CAP_HDR_SIZE +L2CAP_CMD_HDR_SIZE ) +return NULL ; + len =L2CAP_HDR_SIZE +L2CAP_CMD_HDR_SIZE + dlen; count = min_t(unsigned int, conn->mtu, len);
net/ceph/auth_none.c +6 -0
@@ -39,6 +39,11 @@ static int should_authenticate(struct ceph_auth_client *ac)return xi->starting; } +static int build_request (struct ceph_auth_client *ac,void *buf,void *end) +{ +return 0 ; +} +/* * the generic auth code decode the global_id, and we carry no actual * authenticate state, so nothing happens here.
@@ -106,6 +111,7 @@ static const struct ceph_auth_client_ops ceph_auth_none_ops = { .destroy = destroy, .is_authenticated = is_authenticated, .should_authenticate = should_authenticate, + .build_request = build_request, .handle_reply = handle_reply, .create_authorizer = ceph_auth_none_create_authorizer, .destroy_authorizer = ceph_auth_none_destroy_authorizer,
net/compat.c +11 -2
@@ -735,19 +735,25 @@ static unsigned char nas[21] = {asmlinkage long compat_sys_sendmsg (int fd,struct compat_msghdr __user *msg,unsigned int flags) { -return sys_sendmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +return __sys_sendmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); }asmlinkage long compat_sys_sendmmsg (int fd,struct compat_mmsghdr __user *mmsg,unsigned int vlen,unsigned int flags) { +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ;return __sys_sendmmsg (fd, (struct mmsghdr __user *)mmsg, vlen, flags |MSG_CMSG_COMPAT ); }asmlinkage long compat_sys_recvmsg (int fd,struct compat_msghdr __user *msg,unsigned int flags) { -return sys_recvmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +return __sys_recvmsg (fd, (struct msghdr __user *)msg, flags |MSG_CMSG_COMPAT ); }asmlinkage long compat_sys_recv (int fd,void __user *buf,size_t len,unsigned int flags)
@@ -769,6 +775,9 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,int datagrams;struct timespec ktspec; +if (flags &MSG_CMSG_COMPAT ) +return -EINVAL ; +if (COMPAT_USE_64BIT_TIME ) return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, flags | MSG_CMSG_COMPAT,
net/core/sock.c +3 -3
@@ -208,7 +208,7 @@ static const char *const af_family_key_strings[AF_MAX+1] = {"sk_lock-AF_TIPC" ,"sk_lock-AF_BLUETOOTH" ,"sk_lock-IUCV" ,"sk_lock-AF_RXRPC" ,"sk_lock-AF_ISDN" ,"sk_lock-AF_PHONET" ,"sk_lock-AF_IEEE802154" ,"sk_lock-AF_CAIF" ,"sk_lock-AF_ALG" , -"sk_lock-AF_NFC" ,"sk_lock-AF_MAX" +"sk_lock-AF_NFC" ,"sk_lock-AF_VSOCK" ,"sk_lock-AF_MAX" };static const char *const af_family_slock_key_strings[AF_MAX +1 ] = { "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" ,
@@ -224,7 +224,7 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = {"slock-AF_TIPC" ,"slock-AF_BLUETOOTH" ,"slock-AF_IUCV" ,"slock-AF_RXRPC" ,"slock-AF_ISDN" ,"slock-AF_PHONET" ,"slock-AF_IEEE802154" ,"slock-AF_CAIF" ,"slock-AF_ALG" , -"slock-AF_NFC" ,"slock-AF_MAX" +"slock-AF_NFC" ,"slock-AF_VSOCK" ,"slock-AF_MAX" };static const char *const af_family_clock_key_strings[AF_MAX +1 ] = { "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" ,
@@ -240,7 +240,7 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = {"clock-AF_TIPC" ,"clock-AF_BLUETOOTH" ,"clock-AF_IUCV" ,"clock-AF_RXRPC" ,"clock-AF_ISDN" ,"clock-AF_PHONET" ,"clock-AF_IEEE802154" ,"clock-AF_CAIF" ,"clock-AF_ALG" , -"clock-AF_NFC" ,"clock-AF_MAX" +"clock-AF_NFC" ,"clock-AF_VSOCK" ,"clock-AF_MAX" };/*
net/ipv4/ip_gre.c +1 -1
@@ -756,6 +756,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev tiph = &tunnel->parms.iph; } +memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));if ((dst = tiph->daddr) ==0 ) {/* NBMA tunnel */
@@ -899,7 +900,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *devskb_reset_transport_header (skb);skb_push (skb, gre_hlen);skb_reset_network_header (skb); -memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));IPCB (skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE |IPSKB_XFRM_TRANSFORMED |IPSKB_REROUTED );skb_dst_drop (skb);
net/ipv4/ipip.c +1 -1
@@ -481,6 +481,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)if (tos &1 ) tos = old_iph->tos; +memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));if (!dst) {/* NBMA tunnel */ if ((rt =skb_rtable (skb)) ==NULL ) {
@@ -563,7 +564,6 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) skb->transport_header = skb->network_header;skb_push (skb,sizeof (struct iphdr ));skb_reset_network_header (skb); -memset (&(IPCB (skb)->opt),0 ,sizeof (IPCB (skb)->opt));IPCB (skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE |IPSKB_XFRM_TRANSFORMED |IPSKB_REROUTED );skb_dst_drop (skb);
net/ipv4/route.c +6 -1
@@ -741,10 +741,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf {struct rtable *rt;struct flowi4 fl4; +const struct iphdr *iph = (const struct iphdr *) skb->data; +int oif = skb->dev->ifindex; +u8 tos =RT_TOS (iph->tos); +u8 prot = iph->protocol; +u32 mark = skb->mark; rt = (struct rtable *) dst; -ip_rt_build_flow_key (&fl4, sk, skb); +__build_flow_key (&fl4, sk, iph, oif, tos, prot, mark,0 );__ip_do_redirect (rt, skb, &fl4, true); }
net/ipv4/tcp.c +5 -2
@@ -3368,8 +3368,11 @@ int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *hp,for (i =0 ; i < shi->nr_frags; ++i) {const struct skb_frag_struct *f = &shi->frags[i]; -struct page *page =skb_frag_page (f); -sg_set_page (&sg, page,skb_frag_size (f), f->page_offset); +unsigned int offset = f->page_offset; +struct page *page =skb_frag_page (f) + (offset >>PAGE_SHIFT ); + +sg_set_page (&sg, page,skb_frag_size (f), +offset_in_page (offset));if (crypto_hash_update (desc, &sg,skb_frag_size (f)))return 1 ; }
net/ipv4/tcp_input.c +13 -10
@@ -2924,8 +2924,8 @@ static void tcp_enter_recovery(struct sock *sk, bool ece_ack)* tcp_xmit_retransmit_queue(). */ static void tcp_fastretrans_alert (struct sock *sk,int pkts_acked, -int prior_sacked,bool is_dupack, -int flag) +int prior_sacked,int prior_packets, +bool is_dupack,int flag) {struct inet_connection_sock *icsk =inet_csk (sk);struct tcp_sock *tp =tcp_sk (sk);
@@ -2991,7 +2991,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,tcp_add_reno_sack (sk); }else do_lost =tcp_try_undo_partial (sk, pkts_acked); - newly_acked_sacked = pkts_acked + tp->sacked_out - prior_sacked; + newly_acked_sacked = prior_packets - tp->packets_out + + tp->sacked_out - prior_sacked;break ;case TCP_CA_Loss:if (flag &FLAG_DATA_ACKED )
@@ -3013,7 +3014,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked,if (is_dupack)tcp_add_reno_sack (sk); } - newly_acked_sacked = pkts_acked + tp->sacked_out - prior_sacked; + newly_acked_sacked = prior_packets - tp->packets_out + + tp->sacked_out - prior_sacked;if (icsk->icsk_ca_state <= TCP_CA_Disorder)tcp_try_undo_dsack (sk);
@@ -3632,10 +3634,11 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)bool is_dupack = false;u32 prior_in_flight;u32 prior_fackets; -int prior_packets; +int prior_packets = tp->packets_out;int prior_sacked = tp->sacked_out;int pkts_acked =0 ;bool frto_cwnd = false; +int previous_packets_out =0 ;/* If the ack is older than previous acks * then we can probably ignore it.
@@ -3714,14 +3717,14 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) sk->sk_err_soft =0 ; icsk->icsk_probes_out =0 ; tp->rcv_tstamp = tcp_time_stamp; - prior_packets = tp->packets_out;if (!prior_packets) goto no_queue;/* See if we can take anything off of the retransmit queue. */ + previous_packets_out = tp->packets_out; flag |=tcp_clean_rtx_queue (sk, prior_fackets, prior_snd_una); - pkts_acked = prior_packets - tp->packets_out; + pkts_acked = previous_packets_out - tp->packets_out;if (tp->frto_counter) frto_cwnd =tcp_process_frto (sk, flag);
@@ -3736,7 +3739,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_cong_avoid (sk, ack, prior_in_flight); is_dupack = !(flag & (FLAG_SND_UNA_ADVANCED |FLAG_NOT_DUP ));tcp_fastretrans_alert (sk, pkts_acked, prior_sacked, - is_dupack, flag); + prior_packets, is_dupack, flag); }else {if ((flag &FLAG_DATA_ACKED ) && !frto_cwnd)tcp_cong_avoid (sk, ack, prior_in_flight);
@@ -3753,7 +3756,7 @@ no_queue:/* If data was DSACKed, see if we can undo a cwnd reduction. */ if (flag &FLAG_DSACKING_ACK )tcp_fastretrans_alert (sk, pkts_acked, prior_sacked, - is_dupack, flag); + prior_packets, is_dupack, flag);/* If this ack opens up a zero window, clear backoff. It was * being used to time the probes, and is probably far higher than * it needs to be for normal retransmission.
@@ -3773,7 +3776,7 @@ old_ack:if (TCP_SKB_CB (skb)->sacked) { flag |=tcp_sacktag_write_queue (sk, skb, prior_snd_una);tcp_fastretrans_alert (sk, pkts_acked, prior_sacked, - is_dupack, flag); + prior_packets, is_dupack, flag); }SOCK_DEBUG (sk,"Ack %u before %u:%u\n" , ack, tp->snd_una, tp->snd_nxt);
net/ipv4/tcp_output.c +6 -4
@@ -1023,11 +1023,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, &md5); tcp_header_size = tcp_options_size +sizeof (struct tcphdr ); -if (tcp_packets_in_flight (tp) ==0 ) { +if (tcp_packets_in_flight (tp) ==0 )tcp_ca_event (sk,CA_EVENT_TX_START ); - skb->ooo_okay =1 ; - }else - skb->ooo_okay =0 ; + +/* if no packet is in qdisc/device queue, then allow XPS to select +* another queue. +*/ + skb->ooo_okay =sk_wmem_alloc_get (sk) ==0 ;skb_push (skb, tcp_header_size);skb_reset_transport_header (skb);
net/ipv6/addrconf.c +3 -1
@@ -2430,8 +2430,10 @@ static void init_loopback(struct net_device *dev) sp_rt =addrconf_dst_alloc (idev, &sp_ifa->addr,0 );/* Failure cases are ignored */ -if (!IS_ERR (sp_rt)) +if (!IS_ERR (sp_rt)) { + sp_ifa->rt = sp_rt;ip6_ins_rt (sp_rt); + } }read_unlock_bh (&idev->lock); }
net/ipv6/ip6_output.c +1 -1
@@ -1236,7 +1236,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,if (WARN_ON (np->cork.opt))return -EINVAL ; - np->cork.opt =kmalloc (opt->tot_len, sk->sk_allocation); + np->cork.opt =kzalloc (opt->tot_len, sk->sk_allocation);if (unlikely (np->cork.opt ==NULL ))return -ENOBUFS ;
net/l2tp/l2tp_ppp.c +3 -3
@@ -345,19 +345,19 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghskb_put (skb,2 );/* Copy user data into skb */ - error =memcpy_fromiovec (skb->data, m->msg_iov, total_len); + error =memcpy_fromiovec (skb_put (skb, total_len), m->msg_iov, + total_len);if (error <0 ) {kfree_skb (skb); goto error_put_sess_tun; } -skb_put (skb, total_len);l2tp_xmit_skb (session, skb, session->hdr_len);sock_put (ps->tunnel_sock);sock_put (sk); -return error; +return total_len; error_put_sess_tun:sock_put (ps->tunnel_sock);
net/netlabel/netlabel_domainhash.c +69 -0
81 lines not on this page · raw message
net/packet/af_packet.c +2 -3
@@ -2848,12 +2848,11 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,return -EOPNOTSUPP ; uaddr->sa_family =AF_PACKET ; +memset (uaddr->sa_data,0 ,sizeof (uaddr->sa_data));rcu_read_lock (); dev =dev_get_by_index_rcu (sock_net (sk),pkt_sk (sk)->ifindex);if (dev) -strncpy (uaddr->sa_data, dev->name,14 ); -else -memset (uaddr->sa_data,0 ,14 ); +strlcpy (uaddr->sa_data, dev->name,sizeof (uaddr->sa_data));rcu_read_unlock (); *uaddr_len =sizeof (*uaddr);
net/sctp/outqueue.c +2 -4
@@ -205,6 +205,8 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary,*/ void sctp_outq_init (struct sctp_association *asoc,struct sctp_outq *q) { +memset (q,0 ,sizeof (struct sctp_outq )); + q->asoc = asoc;INIT_LIST_HEAD (&q->out_chunk_list);INIT_LIST_HEAD (&q->control_chunk_list);
@@ -212,13 +214,9 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)INIT_LIST_HEAD (&q->sacked);INIT_LIST_HEAD (&q->abandoned); - q->fast_rtx =0 ; - q->outstanding_bytes =0 ; q->empty =1 ; - q->cork =0 ; q->malloced =0 ; - q->out_qlen =0 ; }/* Free the outqueue structure and any related pending chunks.
net/sctp/socket.c +6 -0
@@ -3982,6 +3982,12 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk)/* Release our hold on the endpoint. */ sp =sctp_sk (sk); +/* This could happen during socket init, thus we bail out +* early, since the rest of the below is not setup either. +*/ +if (sp->ep ==NULL ) +return ; +if (sp->do_auto_asconf) { sp->do_auto_asconf =0 ;list_del (&sp->auto_asconf_list);
net/socket.c +42 -19
142 lines not on this page · raw message
sound/usb/card.c +20 -2
@@ -150,14 +150,32 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int intreturn -EINVAL ; } + alts = &iface->altsetting[0 ]; + altsd =get_iface_desc (alts); + +/* +* Android with both accessory and audio interfaces enabled gets the +* interface numbers wrong. +*/ +if ((chip->usb_id ==USB_ID (0x18d1 ,0x2d04 ) || + chip->usb_id ==USB_ID (0x18d1 ,0x2d05 )) && + interface ==0 && + altsd->bInterfaceClass ==USB_CLASS_VENDOR_SPEC && + altsd->bInterfaceSubClass ==USB_SUBCLASS_VENDOR_SPEC ) { + interface =2 ; + iface =usb_ifnum_to_if (dev, interface); +if (!iface) +return -EINVAL ; + alts = &iface->altsetting[0 ]; + altsd =get_iface_desc (alts); + } +if (usb_interface_claimed (iface)) {snd_printdd (KERN_INFO "%d:%d:%d: skipping, already claimed\n" , dev->devnum, ctrlif, interface);return -EINVAL ; } - alts = &iface->altsetting[0 ]; - altsd =get_iface_desc (alts);if ((altsd->bInterfaceClass ==USB_CLASS_AUDIO || altsd->bInterfaceClass ==USB_CLASS_VENDOR_SPEC ) && altsd->bInterfaceSubClass ==USB_SUBCLASS_MIDISTREAMING ) {
sound/usb/mixer.c +1 -0
@@ -841,6 +841,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,case USB_ID (0x046d ,0x0808 ):case USB_ID (0x046d ,0x0809 ): +case USB_ID (0x046d ,0x081b ):/* HD Webcam c310 */ case USB_ID (0x046d ,0x081d ):/* HD Webcam c510 */ case USB_ID (0x046d ,0x0825 ):/* HD Webcam c270 */ case USB_ID (0x046d ,0x0991 ):