3.10.29-stable review
Greg Kroah-Hartman
maintainercover 3.10.29-stable review
This is the start of the stable review cycle for the 3.10.29 release. There are 104 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Feb 6 21:02:03 UTC 2014. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.29-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.29-rc1
Paul Mackerras <[email protected]>
powerpc: Make sure "cache" directory is removed when offlining cpu
Srivatsa S. Bhat <[email protected]>
powerpc: Fix the setup of CPU-to-Node mappings during CPU online
David Sterba <[email protected]>
btrfs: restrict snapshotting to own subvolumes
Wang Shilong <[email protected]>
Btrfs: handle EAGAIN case properly in btrfs_drop_snapshot()
Andy Grover <[email protected]>
target/iscsi: Fix network portal creation race
Asias He <[email protected]>
virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze
Vijaya Mohan Guvva <[email protected]>
SCSI: bfa: Chinook quad port 16G FC HBA claim issue
Thomas Pugliese <[email protected]>
usb: core: get config and string descriptors for unauthorized devices
Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: fix interrupt coalescing for 7260 / 3160
Stephen Warren <[email protected]>
ALSA: hda/hdmi - allow PIN_OUT to be dynamically enabled
Anssi Hannula <[email protected]>
ALSA: hda - hdmi: introduce patch_nvhdmi()
Mihai Caraman <[email protected]>
KVM: PPC: e500: Fix bad address type in deliver_tlb_misss()
Andreas Schwab <[email protected]>
KVM: PPC: Book3S HV: use xics_wake_cpu only when defined
Helge Deller <[email protected]>
parisc: fix cache-flushing
Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: enable oscillator for L1 exit
Nicolas Dichtel <[email protected]>
ip6tnl: fix double free of fb_tnl_dev on exit
Nicolas Dichtel <[email protected]>
Revert "ip6tnl: fix use after free of fb_tnl_dev"
Nicolas Dichtel <[email protected]>
sit: fix double free of fb_tunnel_dev on exit
Annie Li <[email protected]>
xen-netfront: fix resource leak in netfront
Holger Eitzenberger <[email protected]>
net: Fix memory leak if TPROXY used with TCP early demux
Oliver Hartkopp <[email protected]>
fib_frontend: fix possible NULL pointer dereference
Duan Jiong <[email protected]>
ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called
Heiko Carstens <[email protected]>
s390/bpf,jit: fix 32 bit divisions, use unsigned divide instructions
Eric Dumazet <[email protected]>
bpf: do not use reciprocal divide
Christoph Paasch <[email protected]>
tcp: metrics: Avoid duplicate entries with the same destination-IP
Gerald Schaefer <[email protected]>
net: rds: fix per-cpu helper usage
Richard Weinberger <[email protected]>
net,via-rhine: Fix tx_timeout handling
Hannes Frederic Sowa <[email protected]>
net: avoid reference counter overflows on fib_rules in multicast forwarding
Christian Engelmayer <[email protected]>
ieee802154: Fix memory leak in ieee802154_add_iface()
Neal Cardwell <[email protected]>
inet_diag: fix inet_diag_dump_icsk() timewait socket state logic
Michal Schmidt <[email protected]>
bnx2x: fix DMA unmapping of TSO split BDs
Takashi Iwai <[email protected]>
hp_accel: Add a new PnP ID HPQ6007 for new HP laptops
Kent Overstreet <[email protected]>
bcache: Data corruption fix
Eric W. Biederman <[email protected]>
vfs: Is mounted should be testing mnt_ns for NULL or error.
Theodore Ts'o <[email protected]>
ext4: avoid clearing beyond i_blocks when truncating an inline data file
Tejun Heo <[email protected]>
libata: disable LPM for some WD SATA-I devices
Lior Amsalem <[email protected]>
ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs
Simon Guinot <[email protected]>
ata: sata_mv: introduce compatible string "marvell, armada-370-sata"
Peter Huewe <[email protected]>
tpm/tpm_ppi: Do not compare strcmp(a,b) == -1
Peter Huewe <[email protected]>
tpm/tpm_i2c_stm_st33: Check return code of get_burstcount
Adrien Vergé <[email protected]>
ALSA: hda - Fix silent output on MacBook Air 1,1
Takashi Iwai <[email protected]>
ALSA: Enable CONFIG_ZONE_DMA for smaller PCI DMA masks
Takashi Iwai <[email protected]>
ALSA: hda - Don't create duplicated ctls for loopback paths
Takashi Iwai <[email protected]>
ALSA: rme9652: fix a missing comma in channel_map_9636_ds[]
Charles Keepax <[email protected]>
ASoC: wm5110: Extend SYSCLK patch file for rev D
Lars-Peter Clausen <[email protected]>
ASoC: adau1701: Fix ADAU1701_SEROCTL_WORD_LEN_16 constant
Krzysztof Kozlowski <[email protected]>
mfd: max77686: Fix regmap resource leak on driver remove
Dongsheng Yang <[email protected]>
perf kvm: Fix kvm report without guestmount.
Chen-Yu Tsai <[email protected]>
pinctrl: sunxi: Honor GPIO output initial vaules
Stephen Warren <[email protected]>
rtc: max8907: weekday encoding fixes
Borislav Petkov <[email protected]>
rtc-cmos: Add an alarm disable quirk
Sebastian Andrzej Siewior <[email protected]>
parport: parport_pc: remove double PCI ID for NetMos
Heiko Carstens <[email protected]>
s390/uapi: fix struct statfs64 definition
Heiko Carstens <[email protected]>
KVM: s390: fix diagnose code extraction
Stephen Warren <[email protected]>
serial: 8250: enable UART_BUG_NOMSR for Tegra
Jonathan Woithe <[email protected]>
serial: 8250: Fix initialisation of Quatech cards with the AMCC PCI chip
Yegor Yefremov <[email protected]>
serial: add support for 200 v3 series Titan card
Phil Pokorny <[email protected]>
hwmon: (k10temp) Add support for Kaveri CPUs
Jean-Jacques Hiblot <[email protected]>
ARM: at91: smc: bug fix in sam9_smc_cs_read()
Marek Roszko <[email protected]>
tty/serial: at91: Handle shutdown more safely
Malcolm Priestley <[email protected]>
staging: vt6656: CARDqGetNextTBTT correct uLowNextTBTT
Malcolm Priestley <[email protected]>
staging: vt6656: [BUG] BBvUpdatePreEDThreshold Always set sensitivity on bScanning
Larry Finger <[email protected]>
staging: r8712u: Set device type to wlan
ZHAO Gang <[email protected]>
b43: fix the wrong assignment of status.freq in b43_rx()
Larry Finger <[email protected]>
b43legacy: Fix unload oops if firmware is not available
Larry Finger <[email protected]>
b43: Fix unload oops if firmware is not available
Larry Finger <[email protected]>
b43: Fix lockdep splat
Eliad Peller <[email protected]>
iwlwifi: mvm: fix missing cleanup in .start() error path
Bing Zhao <[email protected]>
mwifiex: fix wrong 11ac bits setting in fw_cap_info
Amitkumar Karwar <[email protected]>
mwifiex: add missing endian conversion for fw_tsf
Larry Finger <[email protected]>
rtlwifi: rtl8188ee: Fix typo in code
Larry Finger <[email protected]>
rtlwifi: Add missing code to PWDB statics routine
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Fix some code in RF handling
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Update the power index registers
Larry Finger <[email protected]>
rtlwifi: rtl8192c: Add routines to save/restore power index registers
Larry Finger <[email protected]>
rtlwifi: Increase the RX queue length for USB drivers
Larry Finger <[email protected]>
rtlwifi: rtl8192c: Add new definitions in the dm_common header
Larry Finger <[email protected]>
rtlwifi: Set the link state
Larry Finger <[email protected]>
rtlwifi: Redo register save locations
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Add new firmware
Larry Finger <[email protected]>
rtlwifi: rtl8192c: Prevent reconnect attempts if not connected
Larry Finger <[email protected]>
rtlwifi: Update beacon statistics for USB driver
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Add new device ID
Peter Chen <[email protected]>
usb: ehci: add freescale imx28 special write register method
Alan Stern <[email protected]>
USB: fix race between hub_disconnect and recursively_mark_NOTATTACHED
Jack Pham <[email protected]>
usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix()
Mikhail Zolotaryov <[email protected]>
USB: Nokia 502 is an unusual device
Colin Leitner <[email protected]>
USB: ftdi_sio: added CS5 quirk for broken smartcard readers
Johan Hovold <[email protected]>
USB: cypress_m8: fix ring-indicator detection and reporting
Rahul Bedarkar <[email protected]>
USB: serial: add support for iBall 3.5G connect usb modem
张君 <[email protected]>
usb: option: add new zte 3g modem pids to option driver
Johan Hovold <[email protected]>
USB: pl2303: fix data corruption on termios updates
Marcelo Tosatti <[email protected]>
KVM: x86: limit PIT timer frequency
Prarit Bhargava <[email protected]>
x86: Add check for number of available vectors before CPU down
Dave Young <[email protected]>
x86/efi: Fix off-by-one bug in EFI Boot Services reservation
PaX Team <[email protected]>
x86, x32: Correct invalid use of user timespec in the kernel
David Rientjes <[email protected]>
mm/mempolicy.c: fix mempolicy printing in numa_maps
David Ertman <[email protected]>
e1000e: fix compiler warnings
Aristeu Rozanski <[email protected]>
e752x_edac: Fix pci_dev usage count
Andrea Arcangeli <[email protected]>
mm: hugetlbfs: fix hugetlbfs optimization
Alexandre Courbot <[email protected]>
lib/decompressors: fix "no limit" output buffer length
Ilia Mirkin <[email protected]>
drm/nouveau/bios: fix offset calculation for BMPv1 bioses
NeilBrown <[email protected]>
md/raid5: fix long-standing problem with bitmap handling on write failure.
Andrew Jones <[email protected]>
kvm: x86: fix apic_base enable check
-------------
Diffstat:
Documentation/devicetree/bindings/ata/marvell.txt | 2 +- Makefile | 4 +- arch/arm/mach-at91/sam9_smc.c | 2 +- arch/arm/net/bpf_jit_32.c | 6 +- arch/parisc/include/asm/cacheflush.h | 2 - arch/parisc/include/asm/page.h | 3 +- arch/parisc/kernel/cache.c | 14 +++ arch/powerpc/include/asm/topology.h | 10 +- arch/powerpc/kernel/cacheinfo.c | 3 + arch/powerpc/kvm/book3s_hv.c | 7 +- arch/powerpc/kvm/e500_mmu.c | 2 +- arch/powerpc/mm/numa.c | 70 ++++++++++- arch/powerpc/net/bpf_jit_comp.c | 7 +- arch/s390/include/uapi/asm/statfs.h | 10 +- arch/s390/kvm/diag.c | 2 +- arch/s390/net/bpf_jit_comp.c | 29 +++-- arch/sparc/net/bpf_jit_comp.c | 17 ++- arch/x86/include/asm/irq.h | 1 + arch/x86/kernel/irq.c | 70 +++++++++++ arch/x86/kernel/smpboot.c | 6 + arch/x86/kvm/i8254.c | 18 +++ arch/x86/kvm/lapic.c | 5 +- arch/x86/kvm/x86.c | 3 + arch/x86/kvm/x86.h | 2 + arch/x86/net/bpf_jit_comp.c | 14 ++- arch/x86/platform/efi/efi.c | 2 +- drivers/ata/libata-core.c | 27 ++++ drivers/ata/libata-scsi.c | 18 ++- drivers/ata/sata_mv.c | 25 ++++ drivers/char/tpm/tpm_i2c_stm_st33.c | 7 +- drivers/char/tpm/tpm_ppi.c | 8 +- drivers/edac/e752x_edac.c | 4 +- drivers/gpu/drm/nouveau/core/subdev/bios/init.c | 8 +- drivers/hwmon/k10temp.c | 1 + drivers/md/bcache/bset.c | 26 +++- drivers/md/raid5.c | 1 + drivers/mfd/max77686.c | 2 +- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 13 +- drivers/net/ethernet/intel/e1000e/phy.c | 10 +- drivers/net/ethernet/via/via-rhine.c | 1 + drivers/net/wireless/b43/b43.h | 4 +- drivers/net/wireless/b43/main.c | 27 ++-- drivers/net/wireless/b43/xmit.c | 4 +- drivers/net/wireless/b43legacy/main.c | 1 + drivers/net/wireless/iwlwifi/iwl-7000.c | 6 + drivers/net/wireless/iwlwifi/iwl-config.h | 3 + drivers/net/wireless/iwlwifi/iwl-csr.h | 5 +- drivers/net/wireless/iwlwifi/iwl-prph.h | 4 + drivers/net/wireless/iwlwifi/mvm/ops.c | 1 + drivers/net/wireless/iwlwifi/pcie/rx.c | 4 + drivers/net/wireless/iwlwifi/pcie/trans.c | 19 ++- drivers/net/wireless/mwifiex/fw.h | 2 +- drivers/net/wireless/mwifiex/scan.c | 4 +- drivers/net/wireless/rtlwifi/base.c | 3 +- drivers/net/wireless/rtlwifi/core.c | 11 ++ drivers/net/wireless/rtlwifi/rtl8188ee/dm.c | 2 +- drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 36 ++++++ drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | 14 +++ drivers/net/wireless/rtlwifi/rtl8192cu/dm.c | 9 ++ drivers/net/wireless/rtlwifi/rtl8192cu/dm.h | 3 + drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 29 +++-- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 17 ++- drivers/net/wireless/rtlwifi/stats.c | 14 +++ drivers/net/wireless/rtlwifi/usb.c | 4 +- drivers/net/wireless/rtlwifi/wifi.h | 33 ++--- drivers/net/xen-netfront.c | 88 ++++--------- drivers/parport/parport_pc.c | 10 +- drivers/pinctrl/pinctrl-sunxi.c | 13 +- drivers/platform/x86/hp_accel.c | 1 + drivers/rtc/rtc-cmos.c | 52 +++++++- drivers/rtc/rtc-max8907.c | 11 +- drivers/scsi/bfa/bfad.c | 6 +- drivers/scsi/virtio_scsi.c | 15 ++- drivers/staging/rtl8712/usb_intf.c | 5 + drivers/staging/vt6656/baseband.c | 3 - drivers/staging/vt6656/card.c | 2 +- drivers/target/iscsi/iscsi_target.c | 34 +++-- drivers/tty/serial/8250/8250_core.c | 4 + drivers/tty/serial/8250/8250_pci.c | 8 +- drivers/tty/serial/atmel_serial.c | 20 +-- drivers/usb/core/config.c | 7 -- drivers/usb/core/hub.c | 54 +++----- drivers/usb/host/ehci.h | 18 ++- drivers/usb/host/xhci.c | 3 + drivers/usb/serial/cypress_m8.h | 2 +- drivers/usb/serial/ftdi_sio.c | 17 ++- drivers/usb/serial/option.c | 15 +++ drivers/usb/serial/pl2303.c | 33 +++-- drivers/usb/storage/unusual_devs.h | 7 ++ fs/btrfs/extent-tree.c | 2 +- fs/btrfs/ioctl.c | 6 + fs/ext4/inline.c | 8 +- fs/mount.h | 2 +- include/linux/hugetlb.h | 6 + include/linux/libata.h | 2 + lib/decompress_inflate.c | 2 +- mm/hugetlb.c | 17 +++ mm/mempolicy.c | 2 +- mm/swap.c | 143 +++++++++++++--------- net/compat.c | 9 +- net/core/filter.c | 30 +---- net/ieee802154/nl-phy.c | 6 +- net/ipv4/fib_frontend.c | 2 + net/ipv4/inet_diag.c | 4 +- net/ipv4/ip_input.c | 2 +- net/ipv4/ip_tunnel.c | 1 + net/ipv4/ipmr.c | 7 +- net/ipv4/tcp_metrics.c | 51 +++++--- net/ipv6/ip6_input.c | 2 +- net/ipv6/ip6_tunnel.c | 12 ++ net/ipv6/ip6mr.c | 7 +- net/ipv6/sit.c | 10 ++ net/rds/ib_recv.c | 7 +- sound/pci/Kconfig | 12 ++ sound/pci/hda/hda_generic.c | 6 +- sound/pci/hda/patch_hdmi.c | 100 +++++++++++---- sound/pci/hda/patch_realtek.c | 19 ++- sound/pci/rme9652/rme9652.c | 2 +- sound/soc/codecs/adau1701.c | 2 +- sound/soc/codecs/wm5110.c | 48 ++++++++ tools/perf/util/session.c | 7 +- 121 files changed, 1216 insertions(+), 469 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 2/104 md/raid5: fix long-standing problem with bitmap handling on write failure.
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
commit 9f97e4b128d2ea90a5f5063ea0ee3b0911f4c669 upstream.
Before a write starts we set a bit in the write-intent bitmap. When the write completes we clear that bit if the write was successful to all devices. However if the write wasn't fully successful we should not clear the bit. If the faulty drive is subsequently re-added, the fact that the bit is still set ensure that we will re-write the data that is missing.
This logic is mediated by the STRIPE_DEGRADED flag - we only clear the bitmap bit when this flag is not set.
Currently we correctly set the flag if a write starts when some devices are failed or missing. But we do *not* set the flag if some device failed during the write attempt.
This is wrong and can result in clearing the bit inappropriately.
So: set the flag when a write fails.
This bug has been present since bitmaps were introduces, so the fix is suitable for any -stable kernel.
--- drivers/md/raid5.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/raid5.c +1 -0
@@ -1893,6 +1893,7 @@ static void raid5_end_write_request(struset_bit (R5_MadeGoodRepl, &sh->dev[i].flags); }else {if (!uptodate) { +set_bit (STRIPE_DEGRADED , &sh->state);set_bit (WriteErrorSeen, &rdev->flags);set_bit (R5_WriteError, &sh->dev[i].flags);if (!test_and_set_bit (WantReplacement, &rdev->flags))
Greg Kroah-Hartman
maintainerPATCH 3/104 drm/nouveau/bios: fix offset calculation for BMPv1 bioses
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilia Mirkin <[email protected]>
commit 5d2f4767c4eacab351b8450b0de4d3261fe1a957 upstream.
The only BIOS on record that needs the 14 offset has a bios major version 2 but BMP version 1.01. Another bunch of BIOSes that need the 18 offset have BMP version 2.01 or 5.01 or higher. So instead of looking at the bios major version, look at the BMP version. BIOSes with BMP version 0 do not contain a detectable script, so always return 0 for them.
See https://bugs.freedesktop.org/show_bug.cgi?id=68835
--- drivers/gpu/drm/nouveau/core/subdev/bios/init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/core/subdev/bios/init.c +4 -4
@@ -366,13 +366,13 @@ static u16 init_script(struct nouveau_bios *bios, int index) {struct nvbios_init init = { .bios = bios }; -u16 data; +u16 bmp_ver =bmp_version (bios), data; -if (bmp_version (bios) &&bmp_version (bios) <0x0510 ) { -if (index >1 ) +if (bmp_ver && bmp_ver <0x0510 ) { +if (index >1 || bmp_ver <0x0100 )return 0x0000 ; - data = bios->bmp_offset + (bios->version.major <2 ?14 :18 ); + data = bios->bmp_offset + (bmp_ver <0x0200 ?14 :18 );return nv_ro16 (bios, data + (index *2 )); }
Greg Kroah-Hartman
maintainerPATCH 4/104 lib/decompressors: fix "no limit" output buffer length
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Courbot <[email protected]>
commit 1431574a1c4c669a0c198e4763627837416e4443 upstream.
When decompressing into memory, the output buffer length is set to some arbitrarily high value (0x7fffffff) to indicate the output is, virtually, unlimited in size.
The problem with this is that some platforms have their physical memory at high physical addresses (0x80000000 or more), and that the output buffer address and its "unlimited" length cannot be added without overflowing. An example of this can be found in inflate_fast():
/* next_out is the output buffer address */
out = strm->next_out - OFF;
/* avail_out is the output buffer size. end will overflow if the output
* address is >= 0x80000104 */
end = out + (strm->avail_out - 257);
This has huge consequences on the performance of kernel decompression, since the following exit condition of inflate_fast() will be always true:
} while (in < last && out < end);
Indeed, "end" has overflowed and is now always lower than "out". As a result, inflate_fast() will return after processing one single byte of input data, and will thus need to be called an unreasonably high number of times. This probably went unnoticed because kernel decompression is fast enough even with this issue.
Nonetheless, adjusting the output buffer length in such a way that the above pointer arithmetic never overflows results in a kernel decompression that is about 3 times faster on affected machines.
--- lib/decompress_inflate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/decompress_inflate.c +1 -1
@@ -48,7 +48,7 @@ STATIC int INIT gunzip(unsigned char *bu out_len =0x8000 ;/* 32 K */ out_buf =malloc (out_len); }else { - out_len =0x7fffffff ;/* no limit */ + out_len = ((size_t )~0 ) - (size_t )out_buf;/* no limit */ }if (!out_buf) {error ("Out of memory while allocating output buffer" );
Greg Kroah-Hartman
maintainerPATCH 5/104 mm: hugetlbfs: fix hugetlbfs optimization
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Arcangeli <[email protected]>
commit 27c73ae759774e63313c1fbfeb17ba076cea64c5 upstream.
Commit 7cb2ef56e6a8 ("mm: fix aio performance regression for database caused by THP") can cause dereference of a dangling pointer if split_huge_page runs during PageHuge() if there are updates to the tail_page->private field.
Also it is repeating compound_head twice for hugetlbfs and it is running compound_head+compound_trans_head for THP when a single one is needed in both cases.
The new code within the PageSlab() check doesn't need to verify that the THP page size is never bigger than the smallest hugetlbfs page size, to avoid memory corruption.
A longstanding theoretical race condition was found while fixing the above (see the change right after the skip_unlock label, that is relevant for the compound_lock path too).
By re-establishing the _mapcount tail refcounting for all compound pages, this also fixes the below problem:
echo 0 >/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
BUG: Bad page state in process bash pfn:59a01
page:ffffea000139b038 count:0 mapcount:10 mapping: (null) index:0x0
page flags: 0x1c00000000008000(tail)
Modules linked in:
CPU: 6 PID: 2018 Comm: bash Not tainted 3.12.0+ #25
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
dump_stack+0x55/0x76
bad_page+0xd5/0x130
free_pages_prepare+0x213/0x280
__free_pages+0x36/0x80
update_and_free_page+0xc1/0xd0
free_pool_huge_page+0xc2/0xe0
set_max_huge_pages.part.58+0x14c/0x220
nr_hugepages_store_common.isra.60+0xd0/0xf0
nr_hugepages_store+0x13/0x20
kobj_attr_store+0xf/0x20
sysfs_write_file+0x189/0x1e0
vfs_write+0xc5/0x1f0
SyS_write+0x55/0xb0
system_call_fastpath+0x16/0x1b--- include/linux/hugetlb.h | 6 ++ mm/hugetlb.c | 17 +++++ mm/swap.c | 143 +++++++++++++++++++++++++++--------------------- 3 files changed, 106 insertions(+), 60 deletions(-)
include/linux/hugetlb.h +6 -0
@@ -31,6 +31,7 @@ struct hugepage_subpool *hugepage_new_suvoid hugepage_put_subpool (struct hugepage_subpool *spool);int PageHuge (struct page *page); +int PageHeadHuge (struct page *page_head);void reset_vma_resv_huge_pages (struct vm_area_struct *vma);int hugetlb_sysctl_handler (struct ctl_table *,int ,void __user *,size_t *,loff_t *);
@@ -97,6 +98,11 @@ static inline int PageHuge(struct page * {return 0 ; } + +static inline int PageHeadHuge (struct page *page_head) +{ +return 0 ; +}static inline void reset_vma_resv_huge_pages (struct vm_area_struct *vma) {
mm/hugetlb.c +17 -0
@@ -690,6 +690,23 @@ int PageHuge(struct page *page) }EXPORT_SYMBOL_GPL (PageHuge); +/* +* PageHeadHuge() only returns true for hugetlbfs head page, but not for +* normal or transparent huge pages. +*/ +int PageHeadHuge (struct page *page_head) +{ +compound_page_dtor *dtor; + +if (!PageHead (page_head)) +return 0 ; + + dtor =get_compound_page_dtor (page_head); + +return dtor == free_huge_page; +} +EXPORT_SYMBOL_GPL (PageHeadHuge); +pgoff_t __basepage_index (struct page *page) {struct page *page_head =compound_head (page);
mm/swap.c +83 -60
182 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 6/104 e752x_edac: Fix pci_dev usage count
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aristeu Rozanski <[email protected]>
commit 90ed4988b8c030d65b41b7d13140e9376dc6ec5a upstream.
In case the device 0, function 1 is not found using pci_get_device(), pci_scan_single_device() will be used but, differently than pci_get_device(), it allocates a pci_dev but doesn't does bump the usage count on the pci_dev and after few module removals and loads the pci_dev will be freed.
--- drivers/edac/e752x_edac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/edac/e752x_edac.c +3 -1
@@ -1182,9 +1182,11 @@ static int e752x_get_devs(struct pci_dev pvt->bridge_ck =pci_get_device (PCI_VENDOR_ID_INTEL , pvt->dev_info->err_dev, pvt->bridge_ck); -if (pvt->bridge_ck ==NULL ) +if (pvt->bridge_ck ==NULL ) { pvt->bridge_ck =pci_scan_single_device (pdev->bus,PCI_DEVFN (0 ,1 )); +pci_dev_get (pvt->bridge_ck); + }if (pvt->bridge_ck ==NULL ) { e752x_printk(KERN_ERR, "error reporting device not found:"
Greg Kroah-Hartman
maintainerPATCH 7/104 e1000e: fix compiler warnings
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ertman <[email protected]>
commit 9e6c3b63399dd424d33a34e08b77f2cab0b84cdc upstream.
This patch is to fix a compiler warning of __bad_udelay due to a value of >999 being passed as a parameter to udelay() in the function e1000e_phy_has_link_generic(). This affects the gcc compiler when it is given a flag of -O3 and the icc compiler.
This patch is also making the change from mdelay() to msleep() in the same function, since it was determined though code inspection that this function is never called in atomic context.
--- drivers/net/ethernet/intel/e1000e/phy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/e1000e/phy.c +7 -3
@@ -1757,19 +1757,23 @@ s32 e1000e_phy_has_link_generic(struct e* it across the board. */ ret_val =e1e_rphy (hw,MII_BMSR , &phy_status); -if (ret_val) +if (ret_val) {/* If the first read fails, another entity may have * ownership of the resources, wait and try again to * see if they have relinquished the resources yet. */ -udelay (usec_interval); +if (usec_interval >=1000 ) +msleep (usec_interval /1000 ); +else +udelay (usec_interval); + } ret_val =e1e_rphy (hw,MII_BMSR , &phy_status);if (ret_val)break ;if (phy_status &BMSR_LSTATUS )break ;if (usec_interval >=1000 ) -mdelay (usec_interval /1000 ); +msleep (usec_interval /1000 );else udelay (usec_interval); }
Greg Kroah-Hartman
maintainerPATCH 8/104 mm/mempolicy.c: fix mempolicy printing in numa_maps
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Rientjes <[email protected]>
commit 8790c71a18e5d2d93532ae250bcf5eddbba729cd upstream.
As a result of commit 5606e3877ad8 ("mm: numa: Migrate on reference policy"), /proc/<pid>/numa_maps prints the mempolicy for any <pid> as "prefer:N" for the local node, N, of the process reading the file.
This should only be printed when the mempolicy of <pid> is MPOL_PREFERRED for node N.
If the process is actually only using the default mempolicy for local node allocation, make sure "default" is printed as expected.
--- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -1
@@ -2801,7 +2801,7 @@ int mpol_to_str(char *buffer, int maxlen*/ VM_BUG_ON (maxlen <strlen ("interleave" ) +strlen ("relative" ) +16 ); -if (!pol || pol == &default_policy) +if (!pol || pol == &default_policy || (pol->flags &MPOL_F_MORON )) mode =MPOL_DEFAULT ;else mode = pol->mode;
Greg Kroah-Hartman
maintainerPATCH 9/104 x86, x32: Correct invalid use of user timespec in the kernel
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: PaX Team <[email protected]>
commit 2def2ef2ae5f3990aabdbe8a755911902707d268 upstream.
The x32 case for the recvmsg() timout handling is broken:
asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
unsigned int vlen, unsigned int flags, struct compat_timespec __user *timeout)
{
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,
(struct timespec *) timeout);
...The timeout pointer parameter is provided by userland (hence the __user annotation) but for x32 syscalls it's simply cast to a kernel pointer and is passed to __sys_recvmmsg which will eventually directly dereference it for both reading and writing. Other callers to __sys_recvmmsg properly copy from userland to the kernel first.
The bug was introduced by commit ee4fa23c4bfc ("compat: Use COMPAT_USE_64BIT_TIME in net/compat.c") and should affect all kernels since 3.4 (and perhaps vendor kernels if they backported x32 support along with this code).
Note that CONFIG_X86_X32_ABI gets enabled at build time and only if CONFIG_X86_X32 is enabled and ld can build x32 executables.
Other uses of COMPAT_USE_64BIT_TIME seem fine.
This addresses CVE-2014-0038.
--- net/compat.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
net/compat.c +2 -7
@@ -780,21 +780,16 @@ asmlinkage long compat_sys_recvmmsg(intif (flags &MSG_CMSG_COMPAT )return -EINVAL ; -if (COMPAT_USE_64BIT_TIME ) -return __sys_recvmmsg (fd, (struct mmsghdr __user *)mmsg, vlen, - flags |MSG_CMSG_COMPAT , - (struct timespec *) timeout); -if (timeout ==NULL )return __sys_recvmmsg (fd, (struct mmsghdr __user *)mmsg, vlen, flags |MSG_CMSG_COMPAT ,NULL ); -if (get_compat_timespec (&ktspec, timeout)) +if (compat_get_timespec (&ktspec, timeout))return -EFAULT ; datagrams =__sys_recvmmsg (fd, (struct mmsghdr __user *)mmsg, vlen, flags |MSG_CMSG_COMPAT , &ktspec); -if (datagrams >0 &&put_compat_timespec (&ktspec, timeout)) +if (datagrams >0 &&compat_put_timespec (&ktspec, timeout)) datagrams = -EFAULT ;return datagrams;
Greg Kroah-Hartman
maintainerPATCH 10/104 x86/efi: Fix off-by-one bug in EFI Boot Services reservation
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Young <[email protected]>
commit a7f84f03f660d93574ac88835d056c0d6468aebe upstream.
Current code check boot service region with kernel text region by:
start+size >= __pa_symbol(_text)
The end of the above region should be start + size - 1 instead.
I see this problem in ovmf + Fedora 19 grub boot:
text start: 1000000 md start: 800000 md size: 800000
--- arch/x86/platform/efi/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/efi/efi.c +1 -1
@@ -438,7 +438,7 @@ void __init efi_reserve_boot_services(vo* - Not within any part of the kernel * - Not the bios reserved area */ -if ((start+size >=__pa_symbol (_text) +if ((start + size >__pa_symbol (_text) && start <=__pa_symbol (_end)) || !e820_all_mapped (start, start+size,E820_RAM ) ||memblock_is_region_reserved (start, size)) {
Greg Kroah-Hartman
maintainerPATCH 11/104 x86: Add check for number of available vectors before CPU down
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit da6139e49c7cb0f4251265cb5243b8d220adb48d upstream.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64791
When a cpu is downed on a system, the irqs on the cpu are assigned to other cpus. It is possible, however, that when a cpu is downed there aren't enough free vectors on the remaining cpus to account for the vectors from the cpu that is being downed.
This results in an interesting "overflow" condition where irqs are "assigned" to a CPU but are not handled.
For example, when downing cpus on a 1-64 logical processor system:
<snip>
[ 232.021745] smpboot: CPU 61 is now offline [ 238.480275] smpboot: CPU 62 is now offline [ 245.991080] ------------[ cut here ]------------ [ 245.996270] WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:264 dev_watchdog+0x246/0x250() [ 246.005688] NETDEV WATCHDOG: p786p1 (ixgbe): transmit queue 0 timed out [ 246.013070] Modules linked in: lockd sunrpc iTCO_wdt iTCO_vendor_support sb_edac ixgbe microcode e1000e pcspkr joydev edac_core lpc_ich ioatdma ptp mdio mfd_core i2c_i801 dca pps_core i2c_core wmi acpi_cpufreq isci libsas scsi_transport_sas [ 246.037633] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.12.0+ #14 [ 246.044451] Hardware name: Intel Corporation S4600LH ........../SVRBD-ROW_T, BIOS SE5C600.86B.01.08.0003.022620131521 02/26/2013 [ 246.057371] 0000000000000009 ffff88081fa03d40 ffffffff8164fbf6 ffff88081fa0ee48 [ 246.065728] ffff88081fa03d90 ffff88081fa03d80 ffffffff81054ecc ffff88081fa13040 [ 246.074073] 0000000000000000 ffff88200cce0000 0000000000000040 0000000000000000 [ 246.082430] Call Trace: [ 246.085174] <IRQ> [<ffffffff8164fbf6>] dump_stack+0x46/0x58 [ 246.091633] [<ffffffff81054ecc>] warn_slowpath_common+0x8c/0xc0 [ 246.098352] [<ffffffff81054fb6>] warn_slowpath_fmt+0x46/0x50 [ 246.104786] [<ffffffff815710d6>] dev_watchdog+0x246/0x250 [ 246.110923] [<ffffffff81570e90>] ? dev_deactivate_queue.constprop.31+0x80/0x80 [ 246.119097] [<ffffffff8106092a>] call_timer_fn+0x3a/0x110 [ 246.125224] [<ffffffff8106280f>] ? update_process_times+0x6f/0x80 [ 246.132137] [<ffffffff81570e90>] ? dev_deactivate_queue.constprop.31+0x80/0x80 [ 246.140308] [<ffffffff81061db0>] run_timer_softirq+0x1f0/0x2a0 [ 246.146933] [<ffffffff81059a80>] __do_softirq+0xe0/0x220 [ 246.152976] [<ffffffff8165fedc>] call_softirq+0x1c/0x30 [ 246.158920] [<ffffffff810045f5>] do_softirq+0x55/0x90 [ 246.164670] [<ffffffff81059d35>] irq_exit+0xa5/0xb0 [ 246.170227] [<ffffffff8166062a>] smp_apic_timer_interrupt+0x4a/0x60 [ 246.177324] [<ffffffff8165f40a>] apic_timer_interrupt+0x6a/0x70 [ 246.184041] <EOI> [<ffffffff81505a1b>] ? cpuidle_enter_state+0x5b/0xe0 [ 246.191559] [<ffffffff81505a17>] ? cpuidle_enter_state+0x57/0xe0 [ 246.198374] [<ffffffff81505b5d>] cpuidle_idle_call+0xbd/0x200 [ 246.204900] [<ffffffff8100b7ae>] arch_cpu_idle+0xe/0x30 [ 246.210846] [<ffffffff810a47b0>] cpu_startup_entry+0xd0/0x250 [ 246.217371] [<ffffffff81646b47>] rest_init+0x77/0x80 [ 246.223028] [<ffffffff81d09e8e>] start_kernel+0x3ee/0x3fb [ 246.229165] [<ffffffff81d0989f>] ? repair_env_string+0x5e/0x5e [ 246.235787] [<ffffffff81d095a5>] x86_64_start_reservations+0x2a/0x2c [ 246.242990] [<ffffffff81d0969f>] x86_64_start_kernel+0xf8/0xfc [ 246.249610] ---[ end trace fb74fdef54d79039 ]--- [ 246.254807] ixgbe 0000:c2:00.0 p786p1: initiating reset due to tx timeout [ 246.262489] ixgbe 0000:c2:00.0 p786p1: Reset adapter Last login: Mon Nov 11 08:35:14 from 10.18.17.119 [root@(none) ~]# [ 246.792676] ixgbe 0000:c2:00.0 p786p1: detected SFP+: 5 [ 249.231598] ixgbe 0000:c2:00.0 p786p1: NIC Link is Up 10 Gbps, Flow Control: RX/TX [ 246.792676] ixgbe 0000:c2:00.0 p786p1: detected SFP+: 5 [ 249.231598] ixgbe 0000:c2:00.0 p786p1: NIC Link is Up 10 Gbps, Flow Control: RX/TX
(last lines keep repeating. ixgbe driver is dead until module reload.)
If the downed cpu has more vectors than are free on the remaining cpus on the system, it is possible that some vectors are "orphaned" even though they are assigned to a cpu. In this case, since the ixgbe driver had a watchdog, the watchdog fired and notified that something was wrong.
This patch adds a function, check_vectors(), to compare the number of vectors on the CPU going down and compares it to the number of vectors available on the system. If there aren't enough vectors for the CPU to go down, an error is returned and propogated back to userspace.
v2: Do not need to look at percpu irqs
v3: Need to check affinity to prevent counting of MSIs in IOAPIC Lowest
Priority Mode
v4: Additional changes suggested by Gong Chen.
v5/v6/v7/v8: Updated comment text
--- arch/x86/include/asm/irq.h | 1 arch/x86/kernel/irq.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/smpboot.c | 6 +++ 3 files changed, 77 insertions(+)
arch/x86/include/asm/irq.h +1 -0
@@ -25,6 +25,7 @@ extern void irq_ctx_init(int cpu);#ifdef CONFIG_HOTPLUG_CPU #include <linux/cpumask.h> +extern int check_irq_vectors_for_cpu_disable (void );extern void fixup_irqs (void );extern void irq_force_complete_move (int );#endif
arch/x86/kernel/irq.c +70 -0
76 lines not on this page · raw message
arch/x86/kernel/smpboot.c +6 -0
@@ -1309,6 +1309,12 @@ void cpu_disable_common(void)int native_cpu_disable (void ) { +int ret; + + ret =check_irq_vectors_for_cpu_disable (); +if (ret) +return ret; +clear_local_APIC ();cpu_disable_common ();
Re: [PATCH 3.10 011/104] x86: Add check for number of available vectors before CPU down
Quoted 9 lines · Greg Kroah-Hartman
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <[email protected]>
commit
da6139e49c7cb0f4251265cb5243b8d220adb48dupstream.
Greg, there is a follow up to this patch that removes declarations from the stack and makes them global within the file. This was done to avoid a -Wframe-larger-than warning that was found in with 0day kernel build service, kbuild.
So I don't think this should go into -stable yet. I've pushed a patch onto LKML to resolve the kbuild warning, and hopefully on the x86 maintainers pick it up.
P.
Greg Kroah-Hartman
maintainerPATCH 12/104 KVM: x86: limit PIT timer frequency
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Tosatti <[email protected]>
commit 9ed96e87c5748de4c2807ef17e81287c7304186c upstream.
Limit PIT timer frequency similarly to the limit applied by LAPIC timer.
--- arch/x86/kvm/i8254.c | 18 ++++++++++++++++++ arch/x86/kvm/lapic.c | 3 --- arch/x86/kvm/x86.c | 3 +++ arch/x86/kvm/x86.h | 2 ++ 4 files changed, 23 insertions(+), 3 deletions(-)
arch/x86/kvm/i8254.c +18 -0
@@ -37,6 +37,7 @@#include "irq.h" #include "i8254.h" +#include "x86.h" #ifndef CONFIG_X86_64 #define mod_64 (x, y) ((x) - (y) * div64_u64(x, y))
@@ -349,6 +350,23 @@ static void create_pit_timer(struct kvmatomic_set (&ps->pending,0 ); ps->irq_ack =1 ; +/* +* Do not allow the guest to program periodic timers with small +* interval, since the hrtimers are not throttled by the host +* scheduler. +*/ +if (ps->is_periodic) { +s64 min_period = min_timer_period_us *1000LL ; + +if (ps->period < min_period) { +pr_info_ratelimited ( +"kvm: requested %lld ns " +"i8254 timer period limited to %lld ns\n" , + ps->period, min_period); + ps->period = min_period; + } + } +hrtimer_start (&ps->timer,ktime_add_ns (ktime_get (), interval),HRTIMER_MODE_ABS ); }
arch/x86/kvm/lapic.c +0 -3
@@ -71,9 +71,6 @@#define VEC_POS (v) ((v) & (32 - 1))#define REG_POS (v) (((v) >> 5) << 4) -static unsigned int min_timer_period_us =500 ; -module_param (min_timer_period_us, uint,S_IRUGO |S_IWUSR ); -static inline void apic_set_reg (struct kvm_lapic *apic,int reg_off,u32 val) { *((u32 *) (apic->regs + reg_off)) = val;
arch/x86/kvm/x86.c +3 -0
@@ -94,6 +94,9 @@ EXPORT_SYMBOL_GPL(kvm_x86_ops);static bool ignore_msrs =0 ;module_param (ignore_msrs, bool,S_IRUGO |S_IWUSR ); +unsigned int min_timer_period_us =500 ; +module_param (min_timer_period_us, uint,S_IRUGO |S_IWUSR ); +bool kvm_has_tsc_control;EXPORT_SYMBOL_GPL (kvm_has_tsc_control);u32 kvm_max_guest_tsc_khz;
arch/x86/kvm/x86.h +2 -0
@@ -124,5 +124,7 @@ int kvm_write_guest_virt_system(struct xextern u64 host_xcr0; +extern unsigned int min_timer_period_us; +extern struct static_key kvm_no_apic_vcpu;#endif
Greg Kroah-Hartman
maintainerPATCH 14/104 usb: option: add new zte 3g modem pids to option driver
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?=E5=BC=A0=E5=90=9B?= <[email protected]>
commit 4d90b819ae4c7ea8fd5e2bb7edc68c0f334be2e4 upstream.
--- drivers/usb/serial/option.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/usb/serial/option.c +11 -0
@@ -1447,6 +1447,17 @@ static const struct usb_device_id option .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xffe9, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8b, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8c, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8d, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8e, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff8f, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff90, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff91, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff92, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff93, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff94, 0xff, 0xff, 0xff) },/* NOTE: most ZTE CDMA devices should be driven by zte_ev, not option */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2718, 0xff, 0xff, 0xff),
Greg Kroah-Hartman
maintainerPATCH 16/104 USB: cypress_m8: fix ring-indicator detection and reporting
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 440ebadeae9298d7de3d4d105342691841ec88d0 upstream.
Fix ring-indicator (RI) status-bit definition, which was defined as CTS, effectively preventing RI-changes from being detected while reporting false RI status.
This bug predates git.
--- drivers/usb/serial/cypress_m8.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/cypress_m8.h +1 -1
@@ -63,7 +63,7 @@#define UART_DSR 0x20/* data set ready - flow control - device to host */ #define CONTROL_RTS 0x10/* request to send - flow control - host to device */ #define UART_CTS 0x10/* clear to send - flow control - device to host */ -#define UART_RI 0x10/* ring indicator - modem - device to host */ +#define UART_RI 0x80/* ring indicator - modem - device to host */ #define UART_CD 0x40/* carrier detect - modem - device to host */ #define CYP_ERROR 0x08/* received from input report - device to host */ /* Note - the below has nothing to do with the "feature report" reset */
Greg Kroah-Hartman
maintainerPATCH 17/104 USB: ftdi_sio: added CS5 quirk for broken smartcard readers
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Leitner <[email protected]>
commit c1f15196ac3b541d084dc80a8fbd8a74c6a0bd44 upstream.
Genuine FTDI chips support only CS7/8. A previous fix in commit 8704211f65a2 ("USB: ftdi_sio: fixed handling of unsupported CSIZE setting") enforced this limitation and reported it back to userspace.
However, certain types of smartcard readers depend on specific driver behaviour that requests 0 data bits (not 5) to change into a different operating mode if CS5 has been set.
This patch reenables this behaviour for all FTDI devices.
Tagged to be added to stable, because it affects a lot of users of embedded systems which rely on these readers to work properly.
--- drivers/usb/serial/ftdi_sio.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +15 -2
@@ -2132,10 +2132,20 @@ static void ftdi_set_termios(struct tty_ }/* -* All FTDI UART chips are limited to CS7/8. We won't pretend to +* All FTDI UART chips are limited to CS7/8. We shouldn't pretend to * support CS5/6 and revert the CSIZE setting instead. +* +* CS5 however is used to control some smartcard readers which abuse +* this limitation to switch modes. Original FTDI chips fall back to +* eight data bits. +* +* TODO: Implement a quirk to only allow this with mentioned +* readers. One I know of (Argolis Smartreader V1) +* returns "USB smartcard server" as iInterface string. +* The vendor didn't bother with a custom VID/PID of +* course. */ -if ((C_CSIZE (tty) !=CS8 ) && (C_CSIZE (tty) !=CS7 )) { +if (C_CSIZE (tty) ==CS6 ) {dev_warn (ddev,"requested CSIZE setting not supported\n" ); termios->c_cflag &= ~CSIZE ;
@@ -2182,6 +2192,9 @@ no_skip: urb_value |=FTDI_SIO_SET_DATA_PARITY_NONE ; }switch (cflag &CSIZE ) { +case CS5 : +dev_dbg (ddev,"Setting CS5 quirk\n" ); +break ;case CS7 : urb_value |=7 ;dev_dbg (ddev,"Setting CS7\n" );
Greg Kroah-Hartman
maintainerPATCH 18/104 USB: Nokia 502 is an unusual device
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikhail Zolotaryov <[email protected]>
commit 0e16114f2db4838251fb64f3b550996ad3585890 upstream.
The USB storage operation of Nokia Asha 502 Dual SIM smartphone running Asha Platform 1.1.1 is unreliable in respect of data consistency (i.e. transfered files are corrupted). A similar issue is described here:
http://discussions.nokia.com/t5/Asha-and-other-Nokia-Series-30/Nokia-301-USB-transfers-and-corrupted-files/td-p/1974170
The workaround is (MAX_SECTORS_64):
rmmod usb_storage && modprobe usb_storage quirks=0421:06aa:m
The patch adds the tested device to the unusual list permanently.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -234,6 +234,13 @@ UNUSUAL_DEV( 0x0421, 0x0495, 0x0370, 0x USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_MAX_SECTORS_64 ), +/* Patch submitted by Mikhail Zolotaryov <[email protected]> */ +UNUSUAL_DEV( 0x0421, 0x06aa, 0x1110, 0x1110, + "Nokia", + "502", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_MAX_SECTORS_64 ), +#ifdef NO_SDDR09 UNUSUAL_DEV( 0x0436, 0x0005, 0x0100, 0x0100, "Microtech",
Greg Kroah-Hartman
maintainerPATCH 19/104 usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Pham <[email protected]>
commit 9005355af23856c55a5538c9024355785424821b upstream.
If CONFIG_PCI is enabled, make sure xhci_cleanup_msix() doesn't try to free a bogus PCI IRQ or dereference an invalid pci_dev when the xHCI device is actually a platform_device.
This patch should be backported to kernels as old as 3.9, that contain the commit 52fb61250a7a132b0cfb9f4a1060a1f3c49e5a25 "xhci-plat: Don't enable legacy PCI interrupts."
--- drivers/usb/host/xhci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/host/xhci.c +3 -0
@@ -315,6 +315,9 @@ static void xhci_cleanup_msix(struct xhcstruct usb_hcd *hcd =xhci_to_hcd (xhci);struct pci_dev *pdev =to_pci_dev (hcd->self.controller); +if (xhci->quirks &XHCI_PLAT ) +return ; +xhci_free_irq (xhci);if (xhci->msix_entries) {
Greg Kroah-Hartman
maintainerPATCH 20/104 USB: fix race between hub_disconnect and recursively_mark_NOTATTACHED
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 543d7784b07ffd16cc82a9cb4e1e0323fd0040f1 upstream.
There is a race in the hub driver between hub_disconnect() and recursively_mark_NOTATTACHED(). This race can be triggered if the driver is unbound from a device at the same time as the bus's root hub is removed. When the race occurs, it can cause an oops:
BUG: unable to handle kernel NULL pointer dereference at 0000015c IP: [<c16d5fb0>] recursively_mark_NOTATTACHED+0x20/0x60 Call Trace: [<c16d5fc4>] recursively_mark_NOTATTACHED+0x34/0x60 [<c16d5fc4>] recursively_mark_NOTATTACHED+0x34/0x60 [<c16d5fc4>] recursively_mark_NOTATTACHED+0x34/0x60 [<c16d5fc4>] recursively_mark_NOTATTACHED+0x34/0x60 [<c16d6082>] usb_set_device_state+0x92/0x120 [<c16d862b>] usb_disconnect+0x2b/0x1a0 [<c16dd4c0>] usb_remove_hcd+0xb0/0x160 [<c19ca846>] ? _raw_spin_unlock_irqrestore+0x26/0x50 [<c1704efc>] ehci_mid_remove+0x1c/0x30 [<c1704f26>] ehci_mid_stop_host+0x16/0x30 [<c16f7698>] penwell_otg_work+0xd28/0x3520 [<c19c945b>] ? __schedule+0x39b/0x7f0 [<c19cdb9d>] ? sub_preempt_count+0x3d/0x50 [<c125e97d>] process_one_work+0x11d/0x3d0 [<c19c7f4d>] ? mutex_unlock+0xd/0x10 [<c125e0e5>] ? manage_workers.isra.24+0x1b5/0x270 [<c125f009>] worker_thread+0xf9/0x320 [<c19ca846>] ? _raw_spin_unlock_irqrestore+0x26/0x50 [<c125ef10>] ? rescuer_thread+0x2b0/0x2b0 [<c1264ac4>] kthread+0x94/0xa0 [<c19d0f77>] ret_from_kernel_thread+0x1b/0x28 [<c1264a30>] ? kthread_create_on_node+0xc0/0xc0
One problem is that recursively_mark_NOTATTACHED() uses the intfdata value and hub->hdev->maxchild while hub_disconnect() is clearing them. Another problem is that it uses hub->ports[i] while the port device is being released.
To fix this race, we need to hold the device_state_lock while hub_disconnect() changes the values. (Note that usb_disconnect() and hub_port_connect_change() already acquire this lock at similar critical times during a USB device's life cycle.) We also need to remove the port devices after maxchild has been set to 0, instead of before.
--- drivers/usb/core/hub.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/usb/core/hub.c +9 -5
@@ -1605,7 +1605,7 @@ static void hub_disconnect(struct usb_in {struct usb_hub *hub =usb_get_intfdata (intf);struct usb_device *hdev =interface_to_usbdev (intf); -int i; +int port1;/* Take the hub off the event list and don't let it be added again */ spin_lock_irq (&hub_event_lock);
@@ -1620,11 +1620,15 @@ static void hub_disconnect(struct usb_in hub->error =0 ;hub_quiesce (hub,HUB_DISCONNECT ); -usb_set_intfdata (intf,NULL ); +/* Avoid races with recursively_mark_NOTATTACHED() */ +spin_lock_irq (&device_state_lock); + port1 = hdev->maxchild; + hdev->maxchild =0 ; +usb_set_intfdata (intf,NULL ); +spin_unlock_irq (&device_state_lock); -for (i =0 ; i < hdev->maxchild; i++) -usb_hub_remove_port_device (hub, i +1 ); - hub->hdev->maxchild =0 ; +for (; port1 >0 ; --port1) +usb_hub_remove_port_device (hub, port1);if (hub->hdev->speed ==USB_SPEED_HIGH ) highspeed_hubs--;
Greg Kroah-Hartman
maintainerPATCH 21/104 usb: ehci: add freescale imx28 special write register method
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chen <[email protected]>
commit feffe09f510c475df082546815f9e4a573f6a233 upstream.
According to Freescale imx28 Errata, "ENGR119653 USB: ARM to USB register error issue", All USB register write operations must use the ARM SWP instruction. So, we implement a special ehci_write for imx28.
Discussion for it at below:
http://marc.info/?l=linux-usb&m=137996395529294&w=2
Without this patcheset, imx28 works unstable at high AHB bus loading. If the bus loading is not high, the imx28 usb can work well at the most of time. There is a IC errata for this problem, usually, we consider IC errata is a problem not a new feature, and this workaround is needed for that, so we need to add them to stable tree 3.11+.
--- drivers/usb/host/ehci.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/usb/host/ehci.h +17 -1
@@ -200,6 +200,7 @@ struct ehci_hcd { /* one per controlle unsigned has_synopsys_hc_bug:1; /* Synopsys HC */ unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */ unsigned need_oc_pp_cycle:1; /* MPC834X port power */ + unsigned imx28_write_fix:1; /* For Freescale i.MX28 *//* required for usb32 quirk */ #define OHCI_CTRL_HCFS (3 << 6)
@@ -675,6 +676,18 @@ static inline unsigned int ehci_readl(co#endif } +#ifdef CONFIG_SOC_IMX28 +static inline void imx28_ehci_writel (const unsigned int val, +volatile __u32 __iomem *addr) +{ + __asm__ ("swp %0, %0, [%1]" : :"r" (val),"r" (addr)); +} +#else +static inline void imx28_ehci_writel (const unsigned int val, +volatile __u32 __iomem *addr) +{ +} +#endif static inline void ehci_writel (const struct ehci_hcd *ehci,const unsigned int val,__u32 __iomem *regs) {
@@ -683,7 +696,10 @@ static inline void ehci_writel(const str writel_be(val, regs) :writel (val, regs);#else -writel (val, regs); +if (ehci->imx28_write_fix) +imx28_ehci_writel (val, regs); +else +writel (val, regs);#endif }
Greg Kroah-Hartman
maintainerPATCH 22/104 rtlwifi: rtl8192cu: Add new device ID
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit f87f960b2fb802f26ee3b00c19320e57a9c583ff upstream.
--- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +1 -0
@@ -306,6 +306,7 @@ static struct usb_device_id rtl8192c_usb {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ + {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*//* HP - Lite-On ,8188CUS Slim Combo */
Greg Kroah-Hartman
maintainerPATCH 23/104 rtlwifi: Update beacon statistics for USB driver
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 65b9cc97c6852fae19dc5c7745e9abc8dd380aad upstream.
The USB drivers were not updating the beacon statistics, which led to false beacon loss indications.
--- drivers/net/wireless/rtlwifi/usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/rtlwifi/usb.c +2 -0
@@ -477,6 +477,8 @@ static void _rtl_usb_rx_process_agg(struif (unicast) rtlpriv->link_info.num_rx_inperiod++; } +/* static bcn for roaming */ +rtl_beacon_statistic (hw, skb); } }
Greg Kroah-Hartman
maintainerPATCH 24/104 rtlwifi: rtl8192c: Prevent reconnect attempts if not connected
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 8fd77aec1a9d6f4328fc0244f21932114e066df3 upstream.
This driver has a watchdog timer that attempts to reconnect when beacon frames are not seen for 6 seconds. This patch disables that reconnect whenever the device has never been connected.
--- drivers/net/wireless/rtlwifi/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/base.c +2 -1
@@ -1427,7 +1427,8 @@ void rtl_watchdog_wq_callback(void *data/* if we can't recv beacon for 6s, we should * reconnect this AP */ -if (rtlpriv->link_info.roam_times >=3 ) { +if ((rtlpriv->link_info.roam_times >=3 ) && + !is_zero_ether_addr (rtlpriv->mac80211.bssid)) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"AP off, try to reconnect now\n" ); rtlpriv->link_info.roam_times =0 ;
Greg Kroah-Hartman
maintainerPATCH 25/104 rtlwifi: rtl8192cu: Add new firmware
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 62009b7f12793c932aaba0df946b04cb4a77d022 upstream.
Vendor driver rtl8188C_8192C_8192D_usb_linux_v3.4.2_3727.20120404 introduced new firmware for these chips. The code try for the new file, and fall back to the original firmware if the new file is not available.
--- drivers/net/wireless/rtlwifi/core.c | 10 ++++++++++ drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 16 +++++++++++++--- drivers/net/wireless/rtlwifi/wifi.h | 1 + 3 files changed, 24 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/core.c +10 -0
@@ -46,10 +46,20 @@ void rtl_fw_cb(const struct firmware *fi "Firmware callback routine entered!\n");complete (&rtlpriv->firmware_loading_complete);if (!firmware) { +if (rtlpriv->cfg->alt_fw_name) { + err =request_firmware (&firmware, + rtlpriv->cfg->alt_fw_name, + rtlpriv->io.dev); +pr_info ("Loading alternative firmware %s\n" , + rtlpriv->cfg->alt_fw_name); +if (!err) + goto found_alt; + }pr_err ("Firmware %s not available\n" , rtlpriv->cfg->fw_name); rtlpriv->max_fw_size =0 ;return ; } +found_alt:if (firmware->size > rtlpriv->max_fw_size) {RT_TRACE (rtlpriv,COMP_ERR ,DBG_EMERG ,"Firmware is too big!\n" );
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +13 -3
@@ -49,6 +49,9 @@ MODULE_AUTHOR("Larry Finger <Larry.FingeMODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Realtek 8192C/8188C 802.11n USB wireless" );MODULE_FIRMWARE ("rtlwifi/rtl8192cufw.bin" ); +MODULE_FIRMWARE ("rtlwifi/rtl8192cufw_A.bin" ); +MODULE_FIRMWARE ("rtlwifi/rtl8192cufw_B.bin" ); +MODULE_FIRMWARE ("rtlwifi/rtl8192cufw_TMSC.bin" );static int rtl92cu_init_sw_vars (struct ieee80211_hw *hw) {
@@ -68,14 +71,21 @@ static int rtl92cu_init_sw_vars(struct i "Can't alloc buffer for fw\n");return 1 ; } - +if (IS_VENDOR_UMC_A_CUT (rtlpriv->rtlhal.version) && + !IS_92C_SERIAL (rtlpriv->rtlhal.version)) { + rtlpriv->cfg->fw_name ="rtlwifi/rtl8192cufw_A.bin" ; + }else if (IS_81xxC_VENDOR_UMC_B_CUT (rtlpriv->rtlhal.version)) { + rtlpriv->cfg->fw_name ="rtlwifi/rtl8192cufw_B.bin" ; + }else { + rtlpriv->cfg->fw_name ="rtlwifi/rtl8192cufw_TMSC.bin" ; + } +/* provide name of alternative file */ + rtlpriv->cfg->alt_fw_name ="rtlwifi/rtl8192cufw.bin" ;pr_info ("Loading firmware %s\n" , rtlpriv->cfg->fw_name); rtlpriv->max_fw_size =0x4000 ; err =request_firmware_nowait (THIS_MODULE ,1 , rtlpriv->cfg->fw_name, rtlpriv->io.dev,GFP_KERNEL , hw, rtl_fw_cb); - -return err; }
drivers/net/wireless/rtlwifi/wifi.h +1 -0
@@ -1806,6 +1806,7 @@ struct rtl_hal_cfg {bool write_readback;char *name;char *fw_name; +char *alt_fw_name;struct rtl_hal_ops *ops;struct rtl_mod_params *mod_params;struct rtl_hal_usbint_cfg *usb_interface_cfg;
Greg Kroah-Hartman
maintainerPATCH 26/104 rtlwifi: Redo register save locations
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit b9a758a8c905fc59e783ae91ad645452d877ea88 upstream.
The initial USB driver did not use some register save locations in the private data storage. To save some memory, a union was used to overlay these variables with USB I/O components. In an update of the gain-control code, these register save locations are now needed for USB drivers.
--- drivers/net/wireless/rtlwifi/wifi.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/net/wireless/rtlwifi/wifi.h +16 -16
@@ -1035,6 +1035,7 @@ struct rtl_ht_agg {struct rssi_sta {long undec_sm_pwdb; +long undec_sm_cck; };struct rtl_tid_data {
@@ -1325,8 +1326,10 @@ struct fast_ant_training {struct rtl_dm {/*PHY status for Dynamic Management */ long entry_min_undec_sm_pwdb; +long undec_sm_cck;long undec_sm_pwdb;/*out dm */ long entry_max_undec_sm_pwdb; +s32 ofdm_pkt_cnt;bool dm_initialgain_enable;bool dynamic_txpower_enable;bool current_turbo_edca;
@@ -1341,6 +1344,7 @@ struct rtl_dm {bool inform_fw_driverctrldm;bool current_mrc_switch;u8 txpowercount; +u8 powerindex_backup[6 ];u8 thermalvalue_rxgain;u8 thermalvalue_iqk;
@@ -1352,7 +1356,9 @@ struct rtl_dm {bool done_txpower;u8 dynamic_txhighpower_lvl;/*Tx high power level */ u8 dm_flag;/*Indicate each dynamic mechanism's status. */ +u8 dm_flag_tmp;u8 dm_type; +u8 dm_rssi_sel;u8 txpower_track_control;bool interrupt_migration;bool disable_tx_int;
@@ -1951,6 +1957,7 @@ struct dig_t {u8 pre_ccastate;u8 cur_ccasate;u8 large_fa_hit; +u8 dig_dynamic_min;u8 forbidden_igi;u8 dig_state;u8 dig_highpwrstate;
@@ -2031,22 +2038,15 @@ struct rtl_priv {struct dig_t dm_digtable;struct ps_t dm_pstable; -/* section shared by individual drivers */ -union { -struct {/* data buffer pointer for USB reads */ -__le32 *usb_data; -int usb_data_index; -bool initialized; - }; -struct {/* section for 8723ae */ -bool reg_init;/* true if regs saved */ -u32 reg_874; -u32 reg_c70; -u32 reg_85c; -u32 reg_a74; -bool bt_operation_on; - }; - }; +u32 reg_874; +u32 reg_c70; +u32 reg_85c; +u32 reg_a74; +bool reg_init;/* true if regs saved */ +bool bt_operation_on; +__le32 *usb_data; +int usb_data_index; +bool initialized;bool enter_ps;/* true when entering PS */ u8 rate_mask[5 ];
Greg Kroah-Hartman
maintainerPATCH 27/104 rtlwifi: Set the link state
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 619ce76f8bb850b57032501a39f26aa6c6731c70 upstream.
The present code fails to set the linked state when an interface is added.
--- drivers/net/wireless/rtlwifi/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rtlwifi/core.c +1 -0
@@ -194,6 +194,7 @@ static int rtl_op_add_interface(struct i rtlpriv->cfg->maps [RTL_IBSS_INT_MASKS]); } + mac->link_state =MAC80211_LINKED ;break ;case NL80211_IFTYPE_ADHOC : RT_TRACE(rtlpriv, COMP_MAC80211, DBG_LOUD,
Greg Kroah-Hartman
maintainerPATCH 28/104 rtlwifi: rtl8192c: Add new definitions in the dm_common header
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit c908c74e005de780fddbe8cb6fcd44803f5d4b74 upstream.
Changes in the gain-control mechanism will require some changes in the header.
--- drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h +14 -0
@@ -91,6 +91,17 @@#define TX_POWER_NEAR_FIELD_THRESH_LVL2 74#define TX_POWER_NEAR_FIELD_THRESH_LVL1 67 +#define DYNAMIC_FUNC_DISABLE 0x0 +#define DYNAMIC_FUNC_DIG BIT(0) +#define DYNAMIC_FUNC_HP BIT(1) +#define DYNAMIC_FUNC_SS BIT(2)/*Tx Power Tracking*/ +#define DYNAMIC_FUNC_BT BIT(3) +#define DYNAMIC_FUNC_ANT_DIV BIT(4) + +#define RSSI_CCK 0 +#define RSSI_OFDM 1 +#define RSSI_DEFAULT 2 +struct swat_t {u8 failure_cnt;u8 try_flag;
@@ -167,5 +178,8 @@ void rtl92c_phy_lc_calibrate(struct ieeevoid rtl92c_phy_iq_calibrate (struct ieee80211_hw *hw,bool recovery);void rtl92c_dm_dynamic_txpower (struct ieee80211_hw *hw);void rtl92c_dm_bt_coexist (struct ieee80211_hw *hw); +void dm_savepowerindex (struct ieee80211_hw *hw); +void dm_writepowerindex (struct ieee80211_hw *hw,u8 value); +void dm_restorepowerindex (struct ieee80211_hw *hw);#endif
Greg Kroah-Hartman
maintainerPATCH 29/104 rtlwifi: Increase the RX queue length for USB drivers
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit dc6405712268fe514d3dd89aa936c4397b0871b9 upstream.
The current number of RX buffers queued is 32, which is too small under heavy load. That number is doubled.
--- drivers/net/wireless/rtlwifi/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/usb.c +1 -1
@@ -550,7 +550,7 @@ static void _rtl_rx_pre_process(struct i } } -#define __RX_SKB_MAX_QUEUED 32 +#define __RX_SKB_MAX_QUEUED 64static void _rtl_rx_work (unsigned long param) {
Greg Kroah-Hartman
maintainerPATCH 30/104 rtlwifi: rtl8192c: Add routines to save/restore power index registers
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 97204e93f01868eeba6ae5c4f3270f32905bb418 upstream.
--- drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +36 -0
@@ -158,6 +158,42 @@ static const u8 cckswing_table_ch14[CCK_ {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00} }; +static u32 power_index_reg[6 ] = {0xc90 ,0xc91 ,0xc92 ,0xc98 ,0xc99 ,0xc9a }; + +void dm_restorepowerindex (struct ieee80211_hw *hw) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +u8 index; + +for (index =0 ; index <6 ; index++) +rtl_write_byte (rtlpriv, power_index_reg[index], + rtlpriv->dm.powerindex_backup[index]); +} +EXPORT_SYMBOL_GPL (dm_restorepowerindex); + +void dm_writepowerindex (struct ieee80211_hw *hw,u8 value) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +u8 index; + +for (index =0 ; index <6 ; index++) +rtl_write_byte (rtlpriv, power_index_reg[index], value); +} +EXPORT_SYMBOL_GPL (dm_writepowerindex); + +void dm_savepowerindex (struct ieee80211_hw *hw) +{ +struct rtl_priv *rtlpriv =rtl_priv (hw); +u8 index; +u8 tmp; + +for (index =0 ; index <6 ; index++) { + tmp =rtl_read_byte (rtlpriv, power_index_reg[index]); + rtlpriv->dm.powerindex_backup[index] = tmp; + } +} +EXPORT_SYMBOL_GPL (dm_savepowerindex); +static void rtl92c_dm_diginit (struct ieee80211_hw *hw) {struct rtl_priv *rtlpriv =rtl_priv (hw);
Greg Kroah-Hartman
maintainerPATCH 31/104 rtlwifi: rtl8192cu: Update the power index registers
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 9806eacf5de27ab01d680c5d75c92a3a89734e4f upstream.
This patch uses the newly introduced power index register routines.
--- drivers/net/wireless/rtlwifi/rtl8192cu/dm.c | 9 +++++++++ drivers/net/wireless/rtlwifi/rtl8192cu/dm.h | 3 +++ 2 files changed, 12 insertions(+)
drivers/net/wireless/rtlwifi/rtl8192cu/dm.c +9 -0
@@ -101,6 +101,15 @@ void rtl92cu_dm_dynamic_txpower(struct i"PHY_SetTxPowerLevel8192S() Channel = %d\n" , rtlphy->current_channel);rtl92c_phy_set_txpower_level (hw, rtlphy->current_channel); +if (rtlpriv->dm.dynamic_txhighpower_lvl == +TXHIGHPWRLEVEL_NORMAL ) +dm_restorepowerindex (hw); +else if (rtlpriv->dm.dynamic_txhighpower_lvl == +TXHIGHPWRLEVEL_LEVEL1 ) +dm_writepowerindex (hw,0x14 ); +else if (rtlpriv->dm.dynamic_txhighpower_lvl == +TXHIGHPWRLEVEL_LEVEL2 ) +dm_writepowerindex (hw,0x10 ); } rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl;
drivers/net/wireless/rtlwifi/rtl8192cu/dm.h +3 -0
@@ -30,3 +30,6 @@#include "../rtl8192ce/dm.h" void rtl92cu_dm_dynamic_txpower (struct ieee80211_hw *hw); +void dm_savepowerindex (struct ieee80211_hw *hw); +void dm_writepowerindex (struct ieee80211_hw *hw,u8 value); +void dm_restorepowerindex (struct ieee80211_hw *hw);
Greg Kroah-Hartman
maintainerPATCH 32/104 rtlwifi: rtl8192cu: Fix some code in RF handling
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit e9b0784bb9de3152e787ee779868c626b137fb3b upstream.
--- drivers/net/wireless/rtlwifi/rtl8192cu/rf.c | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192cu/rf.c +16 -13
@@ -85,17 +85,15 @@ void rtl92cu_phy_rf6052_set_cck_txpower(if (mac->act_scanning) { tx_agc[RF90_PATH_A ] =0x3f3f3f3f ; tx_agc[RF90_PATH_B ] =0x3f3f3f3f ; -if (turbo_scanoff) { -for (idx1 =RF90_PATH_A ; idx1 <=RF90_PATH_B ; idx1++) { - tx_agc[idx1] = ppowerlevel[idx1] | - (ppowerlevel[idx1] <<8 ) | - (ppowerlevel[idx1] <<16 ) | - (ppowerlevel[idx1] <<24 ); -if (rtlhal->interface ==INTF_USB ) { -if (tx_agc[idx1] >0x20 && - rtlefuse->external_pa) - tx_agc[idx1] =0x20 ; - } +for (idx1 =RF90_PATH_A ; idx1 <=RF90_PATH_B ; idx1++) { + tx_agc[idx1] = ppowerlevel[idx1] | + (ppowerlevel[idx1] <<8 ) | + (ppowerlevel[idx1] <<16 ) | + (ppowerlevel[idx1] <<24 ); +if (rtlhal->interface ==INTF_USB ) { +if (tx_agc[idx1] >0x20 && + rtlefuse->external_pa) + tx_agc[idx1] =0x20 ; } } }else {
@@ -107,7 +105,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower( TXHIGHPWRLEVEL_LEVEL2) { tx_agc[RF90_PATH_A ] =0x00000000 ; tx_agc[RF90_PATH_B ] =0x00000000 ; - } else{ + } else {for (idx1 =RF90_PATH_A ; idx1 <=RF90_PATH_B ; idx1++) { tx_agc[idx1] = ppowerlevel[idx1] | (ppowerlevel[idx1] << 8) |
@@ -373,7 +371,12 @@ static void _rtl92c_write_ofdm_power_reg regoffset == RTXAGC_B_MCS07_MCS04) regoffset =0xc98 ;for (i =0 ; i <3 ; i++) { - writeVal = (writeVal >6 ) ? (writeVal -6 ) :0 ; +if (i !=2 ) + writeVal = (writeVal >8 ) ? + (writeVal -8 ) :0 ; +else + writeVal = (writeVal >6 ) ? + (writeVal -6 ) :0 ;rtl_write_byte (rtlpriv, (u32)(regoffset + i), (u8 )writeVal); }
Greg Kroah-Hartman
maintainerPATCH 33/104 rtlwifi: Add missing code to PWDB statics routine
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit d82403a9f407217b6aed5260aa92a120e8e98310 upstream.
--- drivers/net/wireless/rtlwifi/stats.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/net/wireless/rtlwifi/stats.c +14 -0
@@ -176,6 +176,7 @@ static void rtl_process_pwdb(struct ieeestruct rtl_sta_info *drv_priv =NULL ;struct ieee80211_sta *sta =NULL ;long undec_sm_pwdb; +long undec_sm_cck;rcu_read_lock ();if (rtlpriv->mac80211.opmode !=NL80211_IFTYPE_STATION )
@@ -185,12 +186,16 @@ static void rtl_process_pwdb(struct ieeeif (sta) { drv_priv = (struct rtl_sta_info *) sta->drv_priv; undec_sm_pwdb = drv_priv->rssi_stat.undec_sm_pwdb; + undec_sm_cck = drv_priv->rssi_stat.undec_sm_cck; }else { undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; + undec_sm_cck = rtlpriv->dm.undec_sm_cck; }if (undec_sm_pwdb <0 ) undec_sm_pwdb = pstatus->rx_pwdb_all; +if (undec_sm_cck <0 ) + undec_sm_cck = pstatus->rx_pwdb_all;if (pstatus->rx_pwdb_all > (u32 ) undec_sm_pwdb) { undec_sm_pwdb = (((undec_sm_pwdb) * (RX_SMOOTH_FACTOR - 1)) +
@@ -200,6 +205,15 @@ static void rtl_process_pwdb(struct ieee undec_sm_pwdb = (((undec_sm_pwdb) * (RX_SMOOTH_FACTOR -1 )) + (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR ); } +if (pstatus->rx_pwdb_all > (u32 ) undec_sm_cck) { + undec_sm_cck = (((undec_sm_pwdb) * + (RX_SMOOTH_FACTOR -1 )) + + (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR ); + undec_sm_cck = undec_sm_cck +1 ; + }else { + undec_sm_pwdb = (((undec_sm_cck) * (RX_SMOOTH_FACTOR -1 )) + + (pstatus->rx_pwdb_all)) / (RX_SMOOTH_FACTOR ); + }if (sta) { drv_priv->rssi_stat.undec_sm_pwdb = undec_sm_pwdb;
Greg Kroah-Hartman
maintainerPATCH 34/104 rtlwifi: rtl8188ee: Fix typo in code
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit f699273d6a624266ebc9198774f06ee64a3847a1 upstream.
The static analyser "cppcheck" shows the following typo:drivers/net/wireless/rtlwifi/rtl8188ee/dm.c:1081]: (style) Same expression on both sides of '!='.
--- drivers/net/wireless/rtlwifi/rtl8188ee/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/rtl8188ee/dm.c +1 -1
@@ -1078,7 +1078,7 @@ static void rtl88e_dm_txpower_tracking_c rtldm->swing_flag_ofdm = true; } -if (rtldm->swing_idx_cck != rtldm->swing_idx_cck) { +if (rtldm->swing_idx_cck_cur != rtldm->swing_idx_cck) { rtldm->swing_idx_cck_cur = rtldm->swing_idx_cck; rtldm->swing_flag_cck = true; }
Greg Kroah-Hartman
maintainerPATCH 35/104 mwifiex: add missing endian conversion for fw_tsf
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amitkumar Karwar <[email protected]>
commit 9795229752c31da0c5f8a7dc4c827665327b52f9 upstream.
It is u64 data received from firmware. Little endian to cpu conversion is required here.
--- drivers/net/wireless/mwifiex/scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/scan.c +2 -2
@@ -1622,7 +1622,7 @@ int mwifiex_ret_802_11_scan(struct mwificonst u8 *ie_buf;size_t ie_len;u16 channel =0 ; -u64 fw_tsf =0 ; +__le64 fw_tsf =0 ;u16 beacon_size =0 ;u32 curr_bcn_bytes;u32 freq;
@@ -1749,7 +1749,7 @@ int mwifiex_ret_802_11_scan(struct mwifi ie_buf, ie_len, rssi, GFP_KERNEL); bss_priv = (struct mwifiex_bss_priv *)bss->priv; bss_priv->band = band; - bss_priv->fw_tsf = fw_tsf; + bss_priv->fw_tsf =le64_to_cpu (fw_tsf);if (priv->media_connected && !memcmp(bssid, priv->curr_bss_params.bss_descriptor
Greg Kroah-Hartman
maintainerPATCH 36/104 mwifiex: fix wrong 11ac bits setting in fw_cap_info
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bing Zhao <[email protected]>
commit 1e202242ee1432d68a8bea4919b2ae0ef19d9e06 upstream.
bit 14 is actually reserved and bit 12 & 13 should be used for 11ac capability in fw_cap_info.
--- drivers/net/wireless/mwifiex/fw.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mwifiex/fw.h +1 -1
@@ -228,7 +228,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {/* HW_SPEC fw_cap_info */ -#define ISSUPP_11ACENABLED (fw_cap_info) (fw_cap_info & (BIT(13)|BIT(14))) +#define ISSUPP_11ACENABLED (fw_cap_info) (fw_cap_info & (BIT(12)|BIT(13)))#define GET_VHTCAP_CHWDSET (vht_cap_info) ((vht_cap_info >> 2) & 0x3)#define GET_VHTNSSMCS (mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3)
Greg Kroah-Hartman
maintainerPATCH 37/104 iwlwifi: mvm: fix missing cleanup in .start() error path
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit 91b0d1198417cf4fd9a7bd4138b6909f0b359099 upstream.
Cleanup of iwl_mvm_leds was missing in case of error, resulting in the following warning:
WARNING: at lib/kobject.c:196 kobject_add_internal+0x1f4/0x210()
kobject_add_internal failed for phy0-led with -EEXIST, don't try to register things with the same name in the same directory.
which prevents further reloads of the driver.
--- drivers/net/wireless/iwlwifi/mvm/ops.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/iwlwifi/mvm/ops.c +1 -0
@@ -424,6 +424,7 @@ iwl_op_mode_mvm_start(struct iwl_trans * out_unregister:ieee80211_unregister_hw (mvm->hw); +iwl_mvm_leds_exit (mvm); out_free:iwl_phy_db_free (mvm->phy_db);kfree (mvm->scan_cmd);
Greg Kroah-Hartman
maintainerPATCH 38/104 b43: Fix lockdep splat
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 09164043f63c947a49797750a09ca1cd7c31108e upstream.
In https://bugzilla.kernel.org/show_bug.cgi?id=67561, a locking dependency is reported when b43 is used with hostapd, and rfkill is used to kill the radio output.
The lockdep splat (in part) is as follows:
======================================================
[ INFO: possible circular locking dependency detected ] 3.12.0 #1 Not tainted
-------------------------------------------------------
rfkill/10040 is trying to acquire lock:
(rtnl_mutex){+.+.+.}, at: [<ffffffff8146f282>] rtnl_lock+0x12/0x20
but task is already holding lock:
(rfkill_global_mutex){+.+.+.}, at: [<ffffffffa04832ca>] rfkill_fop_write+0x6a/0x170 [rfkill]
--snip--
Chain exists of: rtnl_mutex --> misc_mtx --> rfkill_global_mutex
The fix is to move the initialization of the hardware random number generator outside the code range covered by the rtnl_mutex.
--- drivers/net/wireless/b43/main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/wireless/b43/main.c +11 -6
@@ -2422,6 +2422,7 @@ error:static int b43_one_core_attach (struct b43_bus_dev *dev,struct b43_wl *wl);static void b43_one_core_detach (struct b43_bus_dev *dev); +static int b43_rng_init (struct b43_wl *wl);static void b43_request_firmware (struct work_struct *work) {
@@ -2473,6 +2474,10 @@ start_ieee80211: goto err_one_core_detach; wl->hw_registred = true;b43_leds_register (wl->current_dev); + +/* Register HW RNG driver */ +b43_rng_init (wl); + goto out; err_one_core_detach:
@@ -4634,9 +4639,6 @@ static void b43_wireless_core_exit(strucif (!dev ||b43_status (dev) !=B43_STAT_INITIALIZED )return ; -/* Unregister HW RNG driver */ -b43_rng_exit (dev->wl); -b43_set_status (dev,B43_STAT_UNINIT );/* Stop the microcode PSM. */
@@ -4779,9 +4781,6 @@ static int b43_wireless_core_init(structb43_set_status (dev,B43_STAT_INITIALIZED ); -/* Register HW RNG driver */ -b43_rng_init (dev->wl); - out:return err;
@@ -5442,6 +5441,9 @@ static void b43_bcma_remove(struct bcma_b43_one_core_detach (wldev->dev); +/* Unregister HW RNG driver */ +b43_rng_exit (wl); +b43_leds_unregister (wl);ieee80211_free_hw (wl->hw);
@@ -5519,6 +5521,9 @@ static void b43_ssb_remove(struct ssb_deb43_one_core_detach (dev); +/* Unregister HW RNG driver */ +b43_rng_exit (wl); +if (list_empty (&wl->devlist)) {b43_leds_unregister (wl);/* Last core on the chip unregistered.
Greg Kroah-Hartman
maintainerPATCH 39/104 b43: Fix unload oops if firmware is not available
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 0673effd41dba323d6a280ef37b5ef29f3f5a653 upstream.
The asyncronous firmware load uses a completion struct to hold firmware processing until the user-space routines are up and running. There is. however, a problem in that the waiter is nevered canceled during teardown. As a result, unloading the driver when firmware is not available causes an oops.
To be able to access the completion structure at teardown, it had to be moved into the b43_wldev structure.
This patch also fixes a typo in a comment.
--- drivers/net/wireless/b43/b43.h | 4 ++-- drivers/net/wireless/b43/main.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/wireless/b43/b43.h +2 -2
@@ -731,8 +731,6 @@ enum b43_firmware_file_type {struct b43_request_fw_context {/* The device we are requesting the fw for. */ struct b43_wldev *dev; -/* a completion event structure needed if this call is asynchronous */ -struct completion fw_load_complete;/* a pointer to the firmware object */ const struct firmware *blob;/* The type of firmware to request. */
@@ -809,6 +807,8 @@ enum {struct b43_wldev {struct b43_bus_dev *dev;struct b43_wl *wl; +/* a completion event structure needed if this call is asynchronous */ +struct completion fw_load_complete;/* The device initialization status. * Use b43_status() to query. */
drivers/net/wireless/b43/main.c +5 -5
@@ -2068,6 +2068,7 @@ void b43_do_release_fw(struct b43_firmwastatic void b43_release_firmware (struct b43_wldev *dev) { +complete (&dev->fw_load_complete);b43_do_release_fw (&dev->fw.ucode);b43_do_release_fw (&dev->fw.pcm);b43_do_release_fw (&dev->fw.initvals);
@@ -2093,7 +2094,7 @@ static void b43_fw_cb(const struct firmwstruct b43_request_fw_context *ctx = context; ctx->blob = firmware; -complete (&ctx->fw_load_complete); +complete (&ctx->dev->fw_load_complete); } int b43_do_request_fw(struct b43_request_fw_context *ctx,
@@ -2140,7 +2141,7 @@ int b43_do_request_fw(struct b43_request }if (async) {/* do this part asynchronously */ -init_completion (&ctx->fw_load_complete); +init_completion (&ctx->dev->fw_load_complete); err =request_firmware_nowait (THIS_MODULE ,1 , ctx->fwname, ctx->dev->dev->dev,GFP_KERNEL , ctx, b43_fw_cb);
@@ -2148,12 +2149,11 @@ int b43_do_request_fw(struct b43_requestpr_err ("Unable to load firmware\n" );return err; } -/* stall here until fw ready */ -wait_for_completion (&ctx->fw_load_complete); +wait_for_completion (&ctx->dev->fw_load_complete);if (ctx->blob) goto fw_ready;/* On some ARM systems, the async request will fail, but the next sync -* request works. For this reason, we dall through here +* request works. For this reason, we fall through here */ } err = request_firmware(&ctx->blob, ctx->fwname,
Greg Kroah-Hartman
maintainerPATCH 40/104 b43legacy: Fix unload oops if firmware is not available
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 452028665312672c6ba9e16a19248ee00ead9400 upstream.
The asyncronous firmware load uses a completion struct to hold firmware processing until the user-space routines are up and running. There is. however, a problem in that the waiter is nevered canceled during teardown. As a result, unloading the driver when firmware is not available causes an oops.
--- drivers/net/wireless/b43legacy/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/b43legacy/main.c +1 -0
@@ -3919,6 +3919,7 @@ static void b43legacy_remove(struct ssb_* as the ieee80211 unreg will destroy the workqueue. */ cancel_work_sync (&wldev->restart_work);cancel_work_sync (&wl->firmware_load); +complete (&wldev->fw_load_complete);B43legacy_WARN_ON (!wl);if (!wldev->fw.ucode)
Greg Kroah-Hartman
maintainerPATCH 41/104 b43: fix the wrong assignment of status.freq in b43_rx()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZHAO Gang <[email protected]>
commit 64e5acb09ca6b50c97299cff9ef51299470b29f2 upstream.
Use the right function to update frequency value.
If rx skb is probe response or beacon, the wrong frequency value can cause problem that bss info can't be updated when it should be.
--- drivers/net/wireless/b43/xmit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/b43/xmit.c +2 -2
@@ -821,10 +821,10 @@ void b43_rx(struct b43_wldev *dev, struc* channel number in b43. */ if (chanstat &B43_RX_CHAN_5GHZ ) { status.band =IEEE80211_BAND_5GHZ ; - status.freq =b43_freq_to_channel_5ghz (chanid); + status.freq =b43_channel_to_freq_5ghz (chanid); }else { status.band =IEEE80211_BAND_2GHZ ; - status.freq =b43_freq_to_channel_2ghz (chanid); + status.freq =b43_channel_to_freq_2ghz (chanid); }break ;default :
Greg Kroah-Hartman
maintainerPATCH 42/104 staging: r8712u: Set device type to wlan
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 3a21f00a5002b14e4aab52aef59d33ed28468a13 upstream.
The latest version of NetworkManager does not recognize the device as wireless without this change.
--- drivers/staging/rtl8712/usb_intf.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/rtl8712/usb_intf.c +5 -0
@@ -358,6 +358,10 @@ static u8 key_2char2num(u8 hch, u8 lch)return (hex_to_bin (hch) <<4 ) |hex_to_bin (lch); } +static const struct device_type wlan_type = { + .name ="wlan" , +}; +/* * drv_init() - a device potentially for us *
@@ -393,6 +397,7 @@ static int r871xu_drv_init(struct usb_in padapter->pusb_intf = pusb_intf;usb_set_intfdata (pusb_intf, pnetdev);SET_NETDEV_DEV (pnetdev, &pusb_intf->dev); + pnetdev->dev.type = &wlan_type;/* step 2. */ padapter->dvobj_init = &r8712_usb_dvobj_init; padapter->dvobj_deinit = &r8712_usb_dvobj_deinit;
Greg Kroah-Hartman
maintainerPATCH 43/104 staging: vt6656: [BUG] BBvUpdatePreEDThreshold Always set sensitivity on bScanning
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 8f248dae133668bfb8e9379b4b3f0571c858b24a upstream.
byBBPreEDIndex value is initially 0, this means that from cold BBvUpdatePreEDThreshold is never set.
This means that sensitivity may be in an ambiguous state, failing to scan any wireless points or at least distant ones.
--- drivers/staging/vt6656/baseband.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/vt6656/baseband.c +0 -3
@@ -1466,7 +1466,6 @@ void BBvUpdatePreEDThreshold(struct vnt_if ( bScanning ) {// need Max sensitivity //RSSI -69, -70,.... -if (pDevice->byBBPreEDIndex ==0 )break ; pDevice->byBBPreEDIndex =0 ;ControlvWriteByte (pDevice,MESSAGE_REQUEST_BBREG ,0xC9 ,0x00 );//CR201(0xC9) ControlvWriteByte (pDevice,MESSAGE_REQUEST_BBREG ,0xCE ,0x30 );//CR206(0xCE)
@@ -1609,7 +1608,6 @@ void BBvUpdatePreEDThreshold(struct vnt_if ( bScanning ) {// need Max sensitivity //RSSI -69, -70, ... -if (pDevice->byBBPreEDIndex ==0 )break ; pDevice->byBBPreEDIndex =0 ;ControlvWriteByte (pDevice,MESSAGE_REQUEST_BBREG ,0xC9 ,0x00 );//CR201(0xC9) ControlvWriteByte (pDevice,MESSAGE_REQUEST_BBREG ,0xCE ,0x24 );//CR206(0xCE)
@@ -1761,7 +1759,6 @@ void BBvUpdatePreEDThreshold(struct vnt_case RF_VT3342A0 ://RobertYu:20060627, testing table if ( bScanning ) {// need Max sensitivity //RSSI -67, -68, ... -if (pDevice->byBBPreEDIndex ==0 )break ; pDevice->byBBPreEDIndex =0 ;ControlvWriteByte (pDevice,MESSAGE_REQUEST_BBREG ,0xC9 ,0x00 );//CR201(0xC9) ControlvWriteByte (pDevice,MESSAGE_REQUEST_BBREG ,0xCE ,0x38 );//CR206(0xCE)
Greg Kroah-Hartman
maintainerPATCH 44/104 staging: vt6656: CARDqGetNextTBTT correct uLowNextTBTT
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Malcolm Priestley <[email protected]>
commit 9acec059c0cef0bf086c738f4c0b1f4447782a48 upstream.
value uLowNextTBTT yields wrong value.
ULL is needed with qwTSF
--- drivers/staging/vt6656/card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6656/card.c +1 -1
@@ -761,7 +761,7 @@ u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBea uBeaconInterval = wBeaconInterval *1024 ;// Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval - uLowNextTBTT = ((qwTSF &0xffffffffU ) >>10 ) <<10 ; + uLowNextTBTT = ((qwTSF &0xffffffffULL ) >>10 ) <<10 ; uLowRemain = (uLowNextTBTT) % uBeaconInterval; uHighRemain = ((0x80000000 % uBeaconInterval) *2 * (u32)(qwTSF >>32 )) % uBeaconInterval;
Greg Kroah-Hartman
maintainerPATCH 45/104 tty/serial: at91: Handle shutdown more safely
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Roszko <[email protected]>
commit 0cc7c6c7916b1b6f34350ff1473b80b9f7e459c0 upstream.
Interrupts were being cleaned up late in the shutdown handler, it is possible that an interrupt can occur and schedule a tasklet that runs after the port is cleaned up. There is a null dereference due to this race condition with the following stacktrace:
[<c02092b0>] (atmel_tasklet_func+0x514/0x814) from [<c001fd34>] (tasklet_action+0x70/0xa8) [<c001fd34>] (tasklet_action+0x70/0xa8) from [<c001f60c>] (__do_softirq+0x90/0x144) [<c001f60c>] (__do_softirq+0x90/0x144) from [<c001fa18>] (irq_exit+0x40/0x4c) [<c001fa18>] (irq_exit+0x40/0x4c) from [<c000e298>] (handle_IRQ+0x64/0x84) [<c000e298>] (handle_IRQ+0x64/0x84) from [<c000d6c0>] (__irq_svc+0x40/0x50) [<c000d6c0>] (__irq_svc+0x40/0x50) from [<c0208060>] (atmel_rx_dma_release+0x88/0xb8) [<c0208060>] (atmel_rx_dma_release+0x88/0xb8) from [<c0209740>] (atmel_shutdown+0x104/0x160) [<c0209740>] (atmel_shutdown+0x104/0x160) from [<c0205e8c>] (uart_port_shutdown+0x2c/0x38)
--- drivers/tty/serial/atmel_serial.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/tty/serial/atmel_serial.c +13 -7
@@ -1022,12 +1022,24 @@ static int atmel_startup(struct uart_porstatic void atmel_shutdown (struct uart_port *port) {struct atmel_uart_port *atmel_port =to_atmel_uart_port (port); + +/* +* Clear out any scheduled tasklets before +* we destroy the buffers +*/ +tasklet_kill (&atmel_port->tasklet); +/* -* Ensure everything is stopped. +* Ensure everything is stopped and +* disable all interrupts, port and break condition. */ atmel_stop_rx (port);atmel_stop_tx (port); +UART_PUT_CR (port,ATMEL_US_RSTSTA ); +UART_PUT_IDR (port,-1 ); + +/* * Shut-down the DMA. */
@@ -1054,12 +1066,6 @@ static void atmel_shutdown(struct uart_p }/* -* Disable all interrupts, port and break condition. -*/ -UART_PUT_CR (port,ATMEL_US_RSTSTA ); -UART_PUT_IDR (port,-1 ); - -/* * Free the interrupt */ free_irq (port->irq, port);
Greg Kroah-Hartman
maintainerPATCH 46/104 ARM: at91: smc: bug fix in sam9_smc_cs_read()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean-Jacques Hiblot <[email protected]>
commit 1588c51cf6d782e63a8719681d905ef0ac22ee62 upstream.
There was a copy/paste error when reading the nwe_pulse value.
--- arch/arm/mach-at91/sam9_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-at91/sam9_smc.c +1 -1
@@ -101,7 +101,7 @@ static void sam9_smc_cs_read(void __iome/* Pulse register */ val =__raw_readl (base +AT91_SMC_PULSE ); - config->nwe_setup = val &AT91_SMC_NWEPULSE ; + config->nwe_pulse = val &AT91_SMC_NWEPULSE ; config->ncs_write_pulse = (val &AT91_SMC_NCS_WRPULSE ) >>8 ; config->nrd_pulse = (val &AT91_SMC_NRDPULSE ) >>16 ; config->ncs_read_pulse = (val &AT91_SMC_NCS_RDPULSE ) >>24 ;
Greg Kroah-Hartman
maintainerPATCH 47/104 hwmon: (k10temp) Add support for Kaveri CPUs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Pokorny <[email protected]>
commit d303b1b5fbb688282bbf72a534b9dfed7af9fe4f upstream.
Add new PCI ID to support new model "Kaveri" family.
--- drivers/hwmon/k10temp.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/k10temp.c +1 -0
@@ -211,6 +211,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_i { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, {} };
Greg Kroah-Hartman
maintainerPATCH 48/104 serial: add support for 200 v3 series Titan card
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yegor Yefremov <[email protected]>
commit 48c0247d7b7bf58abb85a39021099529df365c4d upstream.
--- drivers/tty/serial/8250/8250_pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_pci.c +4 -0
@@ -1545,6 +1545,7 @@ pci_wch_ch353_setup(struct serial_privat#define PCI_DEVICE_ID_TITAN_800E 0xA014#define PCI_DEVICE_ID_TITAN_200EI 0xA016#define PCI_DEVICE_ID_TITAN_200EISI 0xA017 +#define PCI_DEVICE_ID_TITAN_200V3 0xA306#define PCI_DEVICE_ID_TITAN_400V3 0xA310#define PCI_DEVICE_ID_TITAN_410V3 0xA312#define PCI_DEVICE_ID_TITAN_800V3 0xA314
@@ -4139,6 +4140,9 @@ static struct pci_device_id serial_pci_t {PCI_VENDOR_ID_TITAN ,PCI_DEVICE_ID_TITAN_200EISI ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_oxsemi_2_4000000 }, + { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_200V3, +PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , + pbn_b0_bt_2_921600 }, { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_400V3,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 , pbn_b0_4_921600 },
Greg Kroah-Hartman
maintainerPATCH 49/104 serial: 8250: Fix initialisation of Quatech cards with the AMCC PCI chip
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Woithe <[email protected]>
commit 9c5320f8d7d9a2cf623e65d50e1113f34d9b9eb1 upstream.
Fix the initialisation of older Quatech serial cards which are fitted with the AMCC PCI Matchmaker interface chip.
--- drivers/tty/serial/8250/8250_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_pci.c +2 -2
@@ -1260,10 +1260,10 @@ static int pci_quatech_init(struct pci_dunsigned long base =pci_resource_start (dev,0 );if (base) {u32 tmp; -outl (inl (base +0x38 ), base +0x38 ); +outl (inl (base +0x38 ) |0x00002000 , base +0x38 ); tmp =inl (base +0x3c );outl (tmp |0x01000000 , base +0x3c ); -outl (tmp, base +0x3c ); +outl (tmp &= ~0x01000000 , base +0x3c ); } }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 50/104 serial: 8250: enable UART_BUG_NOMSR for Tegra
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
commit 3685f19e07802ec4207b52465c408f185b66490e upstream.
Tegra chips have 4 or 5 identical UART modules embedded. UARTs C..E have their MODEM-control signals tied off to a static state. However UARTs A and B can optionally route those signals to/from package pins, depending on the exact pinmux configuration.
When these signals are not routed to package pins, false interrupts may trigger either temporarily, or permanently, all while not showing up in the IIR; it will read as NO_INT. This will eventually lead to the UART IRQ being disabled due to unhandled interrupts. When this happens, the kernel may print e.g.:
irq 68: nobody cared (try booting with the "irqpoll" option)
In order to prevent this, enable UART_BUG_NOMSR. This prevents UART_IER_MSI from being enabled, which prevents the false interrupts from triggering.
In practice, this is not needed under any of the following conditions:
* On Tegra chips after Tegra30, since the HW bug has apparently been fixed.
* On UARTs C..E since their MODEM control signals are tied to the correct static state which doesn't trigger the issue.
* On UARTs A..B if the MODEM control signals are routed out to package pins, since they will then carry valid signals.
However, we ignore these exceptions for now, since they are only relevant if a board actually hooks up more than a 4-wire UART, and no currently supported board does this. If we ever support a board that does, we can refine the algorithm that enables UART_BUG_NOMSR to take those exceptions into account, and/or read a flag from DT/... that indicates that the board has hooked up and pinmux'd more than a 4-wire UART.
--- drivers/tty/serial/8250/8250_core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/tty/serial/8250/8250_core.c +4 -0
@@ -2670,6 +2670,10 @@ static void serial8250_config_port(strucif (port->type ==PORT_16550A && port->iotype ==UPIO_AU ) up->bugs |=UART_BUG_NOMSR ; +/* HW bugs may trigger IRQ while IIR == NO_INT */ +if (port->type ==PORT_TEGRA ) + up->bugs |=UART_BUG_NOMSR ; +if (port->type !=PORT_UNKNOWN && flags &UART_CONFIG_IRQ )autoconfig_irq (up);
Greg Kroah-Hartman
maintainerPATCH 51/104 KVM: s390: fix diagnose code extraction
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 743db27c526e0f31cc507959d662e97e2048a86f upstream.
The diagnose code to be used is the contents of the base register (if not zero), plus the displacement. The current code ignores the base register contents. So let's fix that...
--- arch/s390/kvm/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/diag.c +1 -1
@@ -130,7 +130,7 @@ static int __diag_virtio_hypercall(strucint kvm_s390_handle_diag (struct kvm_vcpu *vcpu) { -int code = (vcpu->arch.sie_block->ipb &0xfff0000 ) >>16 ; +int code =kvm_s390_get_base_disp_rs (vcpu) &0xffff ;trace_kvm_s390_handle_diag (vcpu, code);switch (code) {
Greg Kroah-Hartman
maintainerPATCH 52/104 s390/uapi: fix struct statfs64 definition
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 4e078146dff728f4865270a47710d57797e81eb6 upstream.
With b8668fd0a7e1b59f "s390/uapi: change struct statfs[64] member types to unsigned values" the size of a couple of struct statfs64 member got incorrectly changed from 64 to 32 bit for 32 bit builds.
Fix this by changing the type of couple of struct statfs64 members from unsigned long to unsigned long long.
The definition of struct compat_statfs64 was correct however.
--- arch/s390/include/uapi/asm/statfs.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/s390/include/uapi/asm/statfs.h +5 -5
@@ -35,11 +35,11 @@ struct statfs {struct statfs64 {unsigned int f_type;unsigned int f_bsize; -unsigned long f_blocks; -unsigned long f_bfree; -unsigned long f_bavail; -unsigned long f_files; -unsigned long f_ffree; +unsigned long long f_blocks; +unsigned long long f_bfree; +unsigned long long f_bavail; +unsigned long long f_files; +unsigned long long f_ffree;__kernel_fsid_t f_fsid;unsigned int f_namelen;unsigned int f_frsize;
Greg Kroah-Hartman
maintainerPATCH 53/104 parport: parport_pc: remove double PCI ID for NetMos
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit d6a484520c5572a4170fa915109ccfc0c38f5008 upstream.
In commit 85747f ("PATCH] parport: add NetMOS 9805 support") Max added the PCI ID for NetMOS 9805 based on a Debian bug report from 2k4 which was at the v2.4.26 time frame. The patch made into 2.6.14. Shortly before that patch akpm merged commit 296d3c783b ("[PATCH] Support NetMOS based PCI cards providing serial and parallel ports") which made into v2.6.9-rc1.
Now we have two different entries for the same PCI id.
I have here the NetMos 9805 which claims to support SPP/EPP/ECP mode. This patch takes Max's entry for titan_1284p1 (base != -1 specifies the ioport for ECP mode) and replaces akpm's entry for netmos_9805 which specified -1 (=none). Both share the same PCI-ID (my card has subsystem 0x1000 / 0x0020 so it should match PCI_ANY).
While here I also drop the entry for titan_1284p2 which is the same as netmos_9815.
--- drivers/parport/parport_pc.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/parport/parport_pc.c +2 -8
@@ -2596,8 +2596,6 @@ enum parport_pc_pci_cards { syba_2p_epp, syba_1p_ecp, titan_010l, - titan_1284p1, - titan_1284p2, avlab_1p, avlab_2p, oxsemi_952,
@@ -2656,8 +2654,6 @@ static struct parport_pc_pci { /* syba_2p_epp AP138B */ { 2, { { 0, 0x078 }, { 0, 0x178 }, } }, /* syba_1p_ecp W83787 */ { 1, { { 0, 0x078 }, } }, /* titan_010l */ { 1, { { 3, -1 }, } }, - /* titan_1284p1 */ { 1, { { 0, 1 }, } }, - /* titan_1284p2 */ { 2, { { 0, 1 }, { 2, 3 }, } }, /* avlab_1p */ { 1, { { 0, 1}, } }, /* avlab_2p */ { 2, { { 0, 1}, { 2, 3 },} }, /* The Oxford Semi cards are unusual: 954 doesn't support ECP,
@@ -2673,8 +2669,8 @@ static struct parport_pc_pci { /* netmos_9705 */ { 1, { { 0, -1 }, } }, /* netmos_9715 */ { 2, { { 0, 1 }, { 2, 3 },} }, /* netmos_9755 */ { 2, { { 0, 1 }, { 2, 3 },} }, - /* netmos_9805 */ { 1, { { 0, -1 }, } }, - /* netmos_9815 */ { 2, { { 0, -1 }, { 2, -1 }, } }, + /* netmos_9805 */ { 1, { { 0, 1 }, } }, + /* netmos_9815 */ { 2, { { 0, 1 }, { 2, 3 }, } }, /* netmos_9901 */ { 1, { { 0, -1 }, } }, /* netmos_9865 */ { 1, { { 0, -1 }, } }, /* quatech_sppxp100 */ { 1, { { 0, 1 }, } },
@@ -2718,8 +2714,6 @@ static const struct pci_device_id parpor PCI_ANY_ID, PCI_ANY_ID, 0, 0, syba_1p_ecp }, { PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_010L, PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_010l }, - { 0x9710, 0x9805, 0x1000, 0x0010, 0, 0, titan_1284p1 }, - { 0x9710, 0x9815, 0x1000, 0x0020, 0, 0, titan_1284p2 },/* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/ /* AFAVLAB_TK9902 */ { 0x14db, 0x2120, PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1p},
Greg Kroah-Hartman
maintainerPATCH 54/104 rtc-cmos: Add an alarm disable quirk
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit d5a1c7e3fc38d9c7d629e1e47f32f863acbdec3d upstream.
41c7f7424259f ("rtc: Disable the alarm in the hardware (v2)") added the functionality to disable the RTC wake alarm when shutting down the box.
However, there are at least two b0rked BIOSes we know about:
https://bugzilla.novell.com/show_bug.cgi?id=812592
https://bugzilla.novell.com/show_bug.cgi?id=805740
where, when wakeup alarm is enabled in the BIOS, the machine reboots automatically right after shutdown, regardless of what wakeup time is programmed.
Bisecting the issue lead to this patch so disable its functionality with a DMI quirk only for those boxes.
--- drivers/rtc/rtc-cmos.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-)
drivers/rtc/rtc-cmos.c +51 -1
@@ -34,11 +34,11 @@#include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/platform_device.h> -#include <linux/mod_devicetable.h> #include <linux/log2.h> #include <linux/pm.h> #include <linux/of.h> #include <linux/of_platform.h> +#include <linux/dmi.h> /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ #include <asm-generic/rtc.h>
@@ -377,6 +377,51 @@ static int cmos_set_alarm(struct devicereturn 0 ; } +/* +* Do not disable RTC alarm on shutdown - workaround for b0rked BIOSes. +*/ +static bool alarm_disable_quirk; + +static int __init set_alarm_disable_quirk (const struct dmi_system_id *id) +{ + alarm_disable_quirk = true; +pr_info ("rtc-cmos: BIOS has alarm-disable quirk. " ); +pr_info ("RTC alarms disabled\n" ); +return 0 ; +} + +static const struct dmi_system_id rtc_quirks[]__initconst = { +/* https://bugzilla.novell.com/show_bug.cgi?id=805740 */ + { + .callback = set_alarm_disable_quirk, + .ident ="IBM Truman" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"4852570" ), + }, + }, +/* https://bugzilla.novell.com/show_bug.cgi?id=812592 */ + { + .callback = set_alarm_disable_quirk, + .ident ="Gigabyte GA-990XA-UD3" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR , +"Gigabyte Technology Co., Ltd." ), +DMI_MATCH (DMI_PRODUCT_NAME ,"GA-990XA-UD3" ), + }, + }, +/* http://permalink.gmane.org/gmane.linux.kernel/1604474 */ + { + .callback = set_alarm_disable_quirk, + .ident ="Toshiba Satellite L300" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"Satellite L300" ), + }, + }, + {} +}; +static int cmos_alarm_irq_enable (struct device *dev,unsigned int enabled) {struct cmos_rtc *cmos =dev_get_drvdata (dev);
@@ -385,6 +430,9 @@ static int cmos_alarm_irq_enable(structif (!is_valid_irq (cmos->irq))return -EINVAL ; +if (alarm_disable_quirk) +return 0 ; +spin_lock_irqsave (&rtc_lock, flags);if (enabled)
@@ -1163,6 +1211,8 @@ static int __init cmos_init(void) platform_driver_registered = true; } +dmi_check_system (rtc_quirks); +if (retval ==0 )return 0 ;
Greg Kroah-Hartman
maintainerPATCH 55/104 rtc: max8907: weekday encoding fixes
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
commit 75ea799df4cb07e505c91b4abaa87bc28aad3e66 upstream.
The current MAX8907 driver has two issues related to weekday value handling:
1)
The HW WEEKDAY register has range 0..6 rather than 1..7 as documented. Note that I validated the actual HW range by observing the HW register roll from 6->0 rather than 6->7->1 as would otherwise be expected.
This matches Linux's tm_wday range of 0..6.
When the CMOS RAM content is lost, the date returned from the device is
2007-01-01 00:00:00, which is a Monday. The WEEKDAY register reads 1 in
this case. This matches the numbering in Linux's tm_wday field.
Hence we should write Linux's tm_wday value to the register without modifying it. Hence, remove the +1/-1 calculations for WEEKDAY/tm_wday.
2)
There's no need to make alarms match on the WEEKDAY register, since the other fields together uniquely define the alarm date/time. Ignoring the WEEKDAY value in the match isolates the driver from any incorrect value in the current time copy of the WEEKDAY register.
Each change individually, or both together, solves an issue that I observed; "hwclock -r" would time out waiting for its alarm to fire if the CMOS RAM content had been lost, and hence the WEEKDAY register value mismatched what the driver expected it to be. "hwclock -w" would solve this by over-writing the HW default WEEKDAY register value with what the driver expected.
--- drivers/rtc/rtc-max8907.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/rtc/rtc-max8907.c +5 -6
@@ -51,7 +51,7 @@ static irqreturn_t max8907_irq_handler(i {struct max8907_rtc *rtc = data; -regmap_update_bits (rtc->regmap,MAX8907_REG_ALARM0_CNTL ,0x7f ,0 ); +regmap_write (rtc->regmap,MAX8907_REG_ALARM0_CNTL ,0 );rtc_update_irq (rtc->rtc_dev,1 ,RTC_IRQF |RTC_AF );
@@ -64,7 +64,7 @@ static void regs_to_tm(u8 *regs, structbcd2bin (regs[RTC_YEAR1 ]) -1900 ; tm->tm_mon =bcd2bin (regs[RTC_MONTH ] &0x1f ) -1 ; tm->tm_mday =bcd2bin (regs[RTC_DATE ] &0x3f ); - tm->tm_wday = (regs[RTC_WEEKDAY ] &0x07 ) -1 ; + tm->tm_wday = (regs[RTC_WEEKDAY ] &0x07 );if (regs[RTC_HOUR ] &HOUR_12 ) { tm->tm_hour =bcd2bin (regs[RTC_HOUR ] &0x01f );if (tm->tm_hour ==12 )
@@ -88,7 +88,7 @@ static void tm_to_regs(struct rtc_time * regs[RTC_YEAR1 ] =bin2bcd (low); regs[RTC_MONTH ] =bin2bcd (tm->tm_mon +1 ); regs[RTC_DATE ] =bin2bcd (tm->tm_mday); - regs[RTC_WEEKDAY ] = tm->tm_wday +1 ; + regs[RTC_WEEKDAY ] = tm->tm_wday; regs[RTC_HOUR ] =bin2bcd (tm->tm_hour); regs[RTC_MIN ] =bin2bcd (tm->tm_min); regs[RTC_SEC ] =bin2bcd (tm->tm_sec);
@@ -153,7 +153,7 @@ static int max8907_rtc_set_alarm(structtm_to_regs (&alrm->time, regs);/* Disable alarm while we update the target time */ - ret =regmap_update_bits (rtc->regmap,MAX8907_REG_ALARM0_CNTL ,0x7f ,0 ); + ret =regmap_write (rtc->regmap,MAX8907_REG_ALARM0_CNTL ,0 );if (ret <0 )return ret;
@@ -163,8 +163,7 @@ static int max8907_rtc_set_alarm(structreturn ret;if (alrm->enabled) - ret =regmap_update_bits (rtc->regmap,MAX8907_REG_ALARM0_CNTL , -0x7f ,0x7f ); + ret =regmap_write (rtc->regmap,MAX8907_REG_ALARM0_CNTL ,0x77 );return ret; }
Greg Kroah-Hartman
maintainerPATCH 56/104 pinctrl: sunxi: Honor GPIO output initial vaules
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit fa8cf57c923e86a693a85aff1df579245a27cbb3 upstream.
Some GPIO users, such as fixed-regulator, request GPIO output with initial value of 1. This was ignored by sunxi driver.
--- drivers/pinctrl/pinctrl-sunxi.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-sunxi.c +7 -6
@@ -1754,12 +1754,6 @@ static int sunxi_pinctrl_gpio_get(structreturn val; } -static int sunxi_pinctrl_gpio_direction_output (struct gpio_chip *chip, -unsigned offset,int value) -{ -return pinctrl_gpio_direction_output (chip->base + offset); -} -static void sunxi_pinctrl_gpio_set (struct gpio_chip *chip,unsigned offset,int value) {
@@ -1770,6 +1764,13 @@ static void sunxi_pinctrl_gpio_set(strucwritel ((value &DATA_PINS_MASK ) << index, pctl->membase + reg); } +static int sunxi_pinctrl_gpio_direction_output (struct gpio_chip *chip, +unsigned offset,int value) +{ +sunxi_pinctrl_gpio_set (chip, offset, value); +return pinctrl_gpio_direction_output (chip->base + offset); +} +static int sunxi_pinctrl_gpio_of_xlate (struct gpio_chip *gc,const struct of_phandle_args *gpiospec,u32 *flags)
Greg Kroah-Hartman
maintainerPATCH 57/104 perf kvm: Fix kvm report without guestmount.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dongsheng Yang <[email protected]>
commit ad85ace07a05062ef6b59c35a5e80b6eaee1eee6 upstream.
Currently, if we use perf kvm --guestkallsyms --guestmodules report, we can not get the perf information from perf data file. All sample are shown as unknown.
Reproducing steps:
# perf kvm --guestkallsyms /tmp/kallsyms --guestmodules /tmp/modules record -a sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.624 MB perf.data.guest (~27260 samples) ] # perf kvm --guestkallsyms /tmp/kallsyms --guestmodules /tmp/modules report |grep % 100.00% [guest/6471] [unknown] [g] 0xffffffff8164f330
This bug was introduced by 207b57926 (perf kvm: Fix regression with guest machine creation). In original code, it uses perf_session__find_machine(), it means we deliver symbol to machine which has the same pid, if no machine found, deliver it to *default* guest. But if we use perf_session__findnew_machine() here, if no machine was found, new machine with pid will be built and added. Then the default guest which with pid == 0 will never get a symbol.
And because the new machine initialized here has no kernel map created, the symbol delivered to it will be marked as "unknown".
This patch here is to revert commit 207b57926 and fix the SEGFAULT bug in another way.
Verification steps:
# ./perf kvm --guestkallsyms /home/kallsyms --guestmodules /home/modules record -a sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.651 MB perf.data.guest (~28437 samples) ] # ./perf kvm --guestkallsyms /home/kallsyms --guestmodules /home/modules report |grep % 22.64% :6471 [guest.kernel.kallsyms] [g] update_rq_clock.part.70 19.99% :6471 [guest.kernel.kallsyms] [g] d_free 18.46% :6471 [guest.kernel.kallsyms] [g] bio_phys_segments 16.25% :6471 [guest.kernel.kallsyms] [g] dequeue_task 12.78% :6471 [guest.kernel.kallsyms] [g] __switch_to 7.91% :6471 [guest.kernel.kallsyms] [g] scheduler_tick 1.75% :6471 [guest.kernel.kallsyms] [g] native_apic_mem_write 0.21% :6471 [guest.kernel.kallsyms] [g] apic_timer_interrupt
--- tools/perf/util/session.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/util/session.c +6 -1
@@ -811,6 +811,7 @@ static struct machine * union perf_event *event) {const u8 cpumode = event->header.misc &PERF_RECORD_MISC_CPUMODE_MASK ; +struct machine *machine; if (perf_guest && ((cpumode == PERF_RECORD_MISC_GUEST_KERNEL) ||
@@ -822,7 +823,11 @@ static struct machine *else pid = event->ip.pid; -return perf_session__findnew_machine (session, pid); + machine =perf_session__find_machine (session, pid); +if (!machine) + machine =perf_session__findnew_machine (session, +DEFAULT_GUEST_KERNEL_ID ); +return machine; }return &session->machines.host;
Greg Kroah-Hartman
maintainerPATCH 58/104 mfd: max77686: Fix regmap resource leak on driver remove
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 74142ffc0b52cfe6f9d2f6f34a5f3eedbfe3ce51 upstream.
The regmap used by max77686 MFD driver was not freed with regmap_exit() on driver exit. This lead to leak of resources.
Replace regmap_init_i2c() call in driver probe with initialization of managed register map so the regmap will be properly freed by the device management code.
--- drivers/mfd/max77686.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/max77686.c +1 -1
@@ -102,7 +102,7 @@ static int max77686_i2c_probe(struct i2c max77686->irq_gpio = pdata->irq_gpio; max77686->irq = i2c->irq; - max77686->regmap =regmap_init_i2c (i2c, &max77686_regmap_config); + max77686->regmap =devm_regmap_init_i2c (i2c, &max77686_regmap_config);if (IS_ERR (max77686->regmap)) { ret =PTR_ERR (max77686->regmap); dev_err(max77686->dev, "Failed to allocate register map: %d\n",
Greg Kroah-Hartman
maintainerPATCH 59/104 ASoC: adau1701: Fix ADAU1701_SEROCTL_WORD_LEN_16 constant
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lars-Peter Clausen <[email protected]>
commit e20970ada3f699c113fe64b04492af083d11a7d8 upstream.
The driver defines ADAU1701_SEROCTL_WORD_LEN_16 as 0x10 while it should be b10, so 0x2. This patch fixes it.
--- sound/soc/codecs/adau1701.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/adau1701.c +1 -1
@@ -64,7 +64,7 @@#define ADAU1701_SEROCTL_WORD_LEN_24 0x0000#define ADAU1701_SEROCTL_WORD_LEN_20 0x0001 -#define ADAU1701_SEROCTL_WORD_LEN_16 0x0010 +#define ADAU1701_SEROCTL_WORD_LEN_16 0x0002#define ADAU1701_SEROCTL_WORD_LEN_MASK 0x0003#define ADAU1701_AUXNPOW_VBPD 0x40
Greg Kroah-Hartman
maintainerPATCH 60/104 ASoC: wm5110: Extend SYSCLK patch file for rev D
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Keepax <[email protected]>
commit 34354792432b6e0a3b156819a1a19716c50d3473 upstream.
Latest evaluation of the the device has given some patch file additions for improved performance.
--- sound/soc/codecs/wm5110.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
sound/soc/codecs/wm5110.c +48 -0
@@ -43,6 +43,54 @@ static const struct reg_default wm5110_s { 0x3133, 0x1201 }, { 0x3183, 0x1501 }, { 0x31D3, 0x1401 }, + { 0x0049, 0x01ea }, + { 0x004a, 0x01f2 }, + { 0x0057, 0x01e7 }, + { 0x0058, 0x01fb }, + { 0x33ce, 0xc4f5 }, + { 0x33cf, 0x1361 }, + { 0x33d0, 0x0402 }, + { 0x33d1, 0x4700 }, + { 0x33d2, 0x026d }, + { 0x33d3, 0xff00 }, + { 0x33d4, 0x026d }, + { 0x33d5, 0x0101 }, + { 0x33d6, 0xc4f5 }, + { 0x33d7, 0x0361 }, + { 0x33d8, 0x0402 }, + { 0x33d9, 0x6701 }, + { 0x33da, 0xc4f5 }, + { 0x33db, 0x136f }, + { 0x33dc, 0xc4f5 }, + { 0x33dd, 0x134f }, + { 0x33de, 0xc4f5 }, + { 0x33df, 0x131f }, + { 0x33e0, 0x026d }, + { 0x33e1, 0x4f01 }, + { 0x33e2, 0x026d }, + { 0x33e3, 0xf100 }, + { 0x33e4, 0x026d }, + { 0x33e5, 0x0001 }, + { 0x33e6, 0xc4f5 }, + { 0x33e7, 0x0361 }, + { 0x33e8, 0x0402 }, + { 0x33e9, 0x6601 }, + { 0x33ea, 0xc4f5 }, + { 0x33eb, 0x136f }, + { 0x33ec, 0xc4f5 }, + { 0x33ed, 0x134f }, + { 0x33ee, 0xc4f5 }, + { 0x33ef, 0x131f }, + { 0x33f0, 0x026d }, + { 0x33f1, 0x4e01 }, + { 0x33f2, 0x026d }, + { 0x33f3, 0xf000 }, + { 0x33f6, 0xc4f5 }, + { 0x33f7, 0x1361 }, + { 0x33f8, 0x0402 }, + { 0x33f9, 0x4600 }, + { 0x33fa, 0x026d }, + { 0x33fb, 0xfe00 }, }; static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
Greg Kroah-Hartman
maintainerPATCH 61/104 ALSA: rme9652: fix a missing comma in channel_map_9636_ds[]
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 770bd4bf2e664939a9dacd3d26ec9ff7a3933210 upstream.
The lack of comma leads to the wrong channel for an SPDIF channel. Unfortunately this wasn't caught by compiler because it's still a valid expression.
--- sound/pci/rme9652/rme9652.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/rme9652/rme9652.c +1 -1
@@ -285,7 +285,7 @@ static char channel_map_9636_ds[26] = {/* ADAT channels are remapped */ 1 ,3 ,5 ,7 ,9 ,11 ,13 ,15 ,/* channels 8 and 9 are S/PDIF */ -24 ,25 +24 ,25 ,/* others don't exist */ -1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 };
Greg Kroah-Hartman
maintainerPATCH 62/104 ALSA: hda - Dont create duplicated ctls for loopback paths
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 43a8e50a46a4e1dd1451e4a4ffa1f7695fb7d287 upstream.
AD1986A mic pins (0x1d and 0x1f) share the same widget for controlling the loopback volume/mute, but the generic parser didn't check it. This ended up with the duplicated controls for the same effect.
This patch adds the check of the duplication for avoiding it.
After this fix, there will be only one control although it affects both paths; this remaining issue should be fixed later in a different patch.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66621
--- sound/pci/hda/hda_generic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/pci/hda/hda_generic.c +4 -2
@@ -2796,9 +2796,11 @@ static bool look_for_mix_leaf_ctls(strucif (num_conns < idx)return false; nid = list[idx]; -if (!*mix_val &&nid_has_volume (codec, nid,HDA_OUTPUT )) +if (!*mix_val &&nid_has_volume (codec, nid,HDA_OUTPUT ) && + !is_ctl_associated (codec, nid,HDA_OUTPUT ,0 ,NID_PATH_VOL_CTL )) *mix_val =HDA_COMPOSE_AMP_VAL (nid,3 ,0 ,HDA_OUTPUT ); -if (!*mute_val &&nid_has_mute (codec, nid,HDA_OUTPUT )) +if (!*mute_val &&nid_has_mute (codec, nid,HDA_OUTPUT ) && + !is_ctl_associated (codec, nid,HDA_OUTPUT ,0 ,NID_PATH_MUTE_CTL )) *mute_val =HDA_COMPOSE_AMP_VAL (nid,3 ,0 ,HDA_OUTPUT );return *mix_val || *mute_val;
Greg Kroah-Hartman
maintainerPATCH 63/104 ALSA: Enable CONFIG_ZONE_DMA for smaller PCI DMA masks
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 80ab8eae70e51d578ebbeb228e0f7a562471b8b7 upstream.
The PCI devices with DMA masks smaller than 32bit should enable CONFIG_ZONE_DMA. Since the recent change of page allocator, page allocations via dma_alloc_coherent() with the limited DMA mask bits may fail more frequently, ended up with no available buffers, when CONFIG_ZONE_DMA isn't enabled. With CONFIG_ZONE_DMA, the system has much more chance to obtain such pages.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=68221
--- sound/pci/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/Kconfig +12 -0
@@ -30,6 +30,7 @@ config SND_ALS300 select SND_PCM select SND_AC97_CODEC select SND_OPL3_LIB + select ZONE_DMA help Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+
@@ -54,6 +55,7 @@ config SND_ALI5451 tristate "ALi M5451 PCI Audio Controller" select SND_MPU401_UART select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for the integrated AC97 sound device on motherboards using the ALi M5451 Audio Controller
@@ -158,6 +160,7 @@ config SND_AZT3328 select SND_PCM select SND_RAWMIDI select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for Aztech AZF3328 (PCI168) soundcards.
@@ -463,6 +466,7 @@ config SND_EMU10K1 select SND_HWDEP select SND_RAWMIDI select SND_AC97_CODEC + select ZONE_DMA help Say Y to include support for Sound Blaster PCI 512, Live!, Audigy and E-mu APS (partially supported) soundcards.
@@ -478,6 +482,7 @@ config SND_EMU10K1X tristate "Emu10k1X (Dell OEM Version)" select SND_AC97_CODEC select SND_RAWMIDI + select ZONE_DMA help Say Y here to include support for the Dell OEM version of the Sound Blaster Live!.
@@ -511,6 +516,7 @@ config SND_ES1938 select SND_OPL3_LIB select SND_MPU401_UART select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for soundcards based on ESS Solo-1 (ES1938, ES1946, ES1969) chips.
@@ -522,6 +528,7 @@ config SND_ES1968 tristate "ESS ES1968/1978 (Maestro-1/2/2E)" select SND_MPU401_UART select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for soundcards based on ESS Maestro 1/2/2E chips.
@@ -603,6 +610,7 @@ config SND_ICE1712 select SND_MPU401_UART select SND_AC97_CODEC select BITREVERSE + select ZONE_DMA help Say Y here to include support for soundcards based on the ICE1712 (Envy24) chip.
@@ -690,6 +698,7 @@ config SND_LX6464ES config SND_MAESTRO3 tristate "ESS Allegro/Maestro3" select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for soundcards based on ESS Maestro 3 (Allegro) chips.
@@ -786,6 +795,7 @@ config SND_SIS7019 tristate "SiS 7019 Audio Accelerator" depends on X86 && !X86_64 select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for the SiS 7019 Audio Accelerator.
@@ -797,6 +807,7 @@ config SND_SONICVIBES select SND_OPL3_LIB select SND_MPU401_UART select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for soundcards based on the S3 SonicVibes chip.
@@ -808,6 +819,7 @@ config SND_TRIDENT tristate "Trident 4D-Wave DX/NX; SiS 7018" select SND_MPU401_UART select SND_AC97_CODEC + select ZONE_DMA help Say Y here to include support for soundcards based on Trident 4D-Wave DX/NX or SiS 7018 chips.
Greg Kroah-Hartman
maintainerPATCH 65/104 tpm/tpm_i2c_stm_st33: Check return code of get_burstcount
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Huewe <[email protected]>
commit 85c5e0d451125c6ddb78663972e40af810b83644 upstream.
The 'get_burstcount' function can in some circumstances 'return -EBUSY' which in tpm_stm_i2c_send is stored in an 'u32 burstcnt'
thus converting the signed value into an unsigned value, resulting in 'burstcnt' being huge.
Changing the type to u32 only does not solve the problem as the signed value is converted to an unsigned in I2C_WRITE_DATA, resulting in the same effect.
Thus
-> Change type of burstcnt to u32 (the return type of get_burstcount) -> Add a check for the return value of 'get_burstcount' and propagate a potential error.
This makes also sense in the 'I2C_READ_DATA' case, where the there is no signed/unsigned conversion.
found by coverity
--- drivers/char/tpm/tpm_i2c_stm_st33.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_i2c_stm_st33.c +6 -1
@@ -410,6 +410,8 @@ static int recv_data(struct tpm_chip *ch &chip->vendor.read_queue) == 0) { burstcnt =get_burstcount (chip); +if (burstcnt <0 ) +return burstcnt; len =min_t (int, burstcnt, count - size);I2C_READ_DATA (client,TPM_DATA_FIFO , buf + size, len); size += len;
@@ -451,7 +453,8 @@ static irqreturn_t tpm_ioserirq_handler(static int tpm_stm_i2c_send (struct tpm_chip *chip,unsigned char *buf,size_t len) { -u32 status, burstcnt =0 , i, size; +u32 status, i, size; +int burstcnt =0 ;int ret;u8 data;struct i2c_client *client;
@@ -482,6 +485,8 @@ static int tpm_stm_i2c_send(struct tpm_cfor (i =0 ; i < len -1 ;) { burstcnt =get_burstcount (chip); +if (burstcnt <0 ) +return burstcnt; size =min_t (int, len - i -1 , burstcnt); ret =I2C_WRITE_DATA (client,TPM_DATA_FIFO , buf, size);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 66/104 tpm/tpm_ppi: Do not compare strcmp(a,b) == -1
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Huewe <[email protected]>
commit 747d35bd9bb4ae6bd74b19baa5bbe32f3e0cee11 upstream.
Depending on the implementation strcmp might return the difference between two strings not only -1,0,1 consequently
if (strcmp (a,b) == -1)
might lead to taking the wrong branch
-> compare with < 0 instead,
which in any case is more canonical.
--- drivers/char/tpm/tpm_ppi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/char/tpm/tpm_ppi.c +4 -4
@@ -172,7 +172,7 @@ static ssize_t tpm_store_ppi_request(str* is updated with function index from SUBREQ to SUBREQ2 since PPI * version 1.1 */ -if (strcmp (version,"1.1" ) ==-1 ) +if (strcmp (version,"1.1" ) <0 ) params[2 ].integer.value =TPM_PPI_FN_SUBREQ ;else params[2 ].integer.value =TPM_PPI_FN_SUBREQ2 ;
@@ -182,7 +182,7 @@ static ssize_t tpm_store_ppi_request(str* string/package type. For PPI version 1.0 and 1.1, use buffer type * for compatibility, and use package type since 1.2 according to spec. */ -if (strcmp (version,"1.2" ) ==-1 ) { +if (strcmp (version,"1.2" ) <0 ) { params[3 ].type =ACPI_TYPE_BUFFER ; params[3 ].buffer.length =sizeof (req);sscanf (buf,"%d" , &req);
@@ -248,7 +248,7 @@ static ssize_t tpm_show_ppi_transition_a* (e.g. Capella with PPI 1.0) need integer/string/buffer type, so for * compatibility, define params[3].type as buffer, if PPI version < 1.2 */ -if (strcmp (version,"1.2" ) ==-1 ) { +if (strcmp (version,"1.2" ) <0 ) { params[3 ].type =ACPI_TYPE_BUFFER ; params[3 ].buffer.length =0 ; params[3 ].buffer.pointer =NULL ;
@@ -390,7 +390,7 @@ static ssize_t show_ppi_operations(charkfree (output.pointer); output.length =ACPI_ALLOCATE_BUFFER ; output.pointer =NULL ; -if (strcmp (version,"1.2" ) ==-1 ) +if (strcmp (version,"1.2" ) <0 )return -EPERM ; params[2 ].integer.value =TPM_PPI_FN_GETOPR ;
Greg Kroah-Hartman
maintainerPATCH 67/104 ata: sata_mv: introduce compatible string "marvell, armada-370-sata"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simon Guinot <[email protected]>
commit b1f5c73bd5a4752efb7d7af019034044b08aafe9 upstream.
The sata_mv driver supports the SATA IP found in several Marvell SoCs. As some new SATA registers have been introduced with the Armada 370/XP SoCs, a way to identify them is needed.
This patch introduces a new compatible string for the SATA IP found in Armada 370/XP SoCs.
--- Documentation/devicetree/bindings/ata/marvell.txt | 2 +- drivers/ata/sata_mv.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/ata/marvell.txt +1 -1
@@ -1,7 +1,7 @@ * Marvell Orion SATA Required Properties: -- compatibility : "marvell,orion-sata" +- compatibility : "marvell,orion-sata" or "marvell,armada-370-sata" - reg : Address range of controller - interrupts : Interrupt controller is using - nr-ports : Number of SATA ports in use.
drivers/ata/sata_mv.c +1 -0
@@ -4216,6 +4216,7 @@ static int mv_platform_resume(struct pla#ifdef CONFIG_OF static struct of_device_id mv_sata_dt_ids[] = { + { .compatible ="marvell,armada-370-sata" , }, { .compatible ="marvell,orion-sata" , }, {}, };
Greg Kroah-Hartman
maintainerPATCH 68/104 ata: sata_mv: fix disk hotplug for Armada 370/XP SoCs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lior Amsalem <[email protected]>
commit 9013d64e661fc2a37a1742670202171c27fef4b5 upstream.
On Armada 370/XP SoCs, once a disk is removed from a SATA port, then the re-plug events are not detected by the sata_mv driver. This patch fixes the issue by updating the PHY speed in the LP_PHY_CTL register (0x58) according to the SControl speed.
Note that this fix is only applied if the compatible string "marvell,armada-370-sata" is found in the SATA DT node.
--- drivers/ata/sata_mv.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/ata/sata_mv.c +24 -0
@@ -304,6 +304,7 @@ enum {MV5_LTMODE =0x30 ,MV5_PHY_CTL =0x0C ,SATA_IFCFG =0x050 , +LP_PHY_CTL =0x058 , MV_M2_PREAMP_MASK = 0x7e0,
@@ -431,6 +432,7 @@ enum {MV_HP_CUT_THROUGH = (1 <<10 ),/* can use EDMA cut-through */ MV_HP_FLAG_SOC = (1 <<11 ),/* SystemOnChip, no PCI */ MV_HP_QUIRK_LED_BLINK_EN = (1 <<12 ),/* is led blinking enabled? */ +MV_HP_FIX_LP_PHY_CTL = (1 <<13 ),/* fix speed in LP_PHY_CTL ? */ /* Port private flags (pp_flags) */ MV_PP_FLAG_EDMA_EN = (1 << 0), /* is EDMA engine enabled? */
@@ -1353,6 +1355,7 @@ static int mv_scr_write(struct ata_linkif (ofs !=0xffffffffU ) {void __iomem *addr =mv_ap_base (link->ap) + ofs; +struct mv_host_priv *hpriv = link->ap->host->private_data;if (sc_reg_in ==SCR_CONTROL ) {/* * Workaround for 88SX60x1 FEr SATA#26:
@@ -1369,6 +1372,18 @@ static int mv_scr_write(struct ata_link*/ if ((val &0xf ) ==1 || (readl (addr) &0xf ) ==1 ) val |=0xf000 ; + +if (hpriv->hp_flags &MV_HP_FIX_LP_PHY_CTL ) { +void __iomem *lp_phy_addr = +mv_ap_base (link->ap) +LP_PHY_CTL ; +/* +* Set PHY speed according to SControl speed. +*/ +if ((val &0xf0 ) ==0x10 ) +writelfl (0x7 , lp_phy_addr); +else +writelfl (0x227 , lp_phy_addr); + } }writelfl (val, addr);return 0 ;
@@ -4111,6 +4126,15 @@ static int mv_platform_probe(struct platif (rc) goto err; +/* +* To allow disk hotplug on Armada 370/XP SoCs, the PHY speed must be +* updated in the LP_PHY_CTL register. +*/ +if (pdev->dev.of_node && +of_device_is_compatible (pdev->dev.of_node, +"marvell,armada-370-sata" )) + hpriv->hp_flags |=MV_HP_FIX_LP_PHY_CTL ; +/* initialize adapter */ rc =mv_init_host (host);if (rc)
Greg Kroah-Hartman
maintainerPATCH 69/104 libata: disable LPM for some WD SATA-I devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit ecd75ad514d73efc1bbcc5f10a13566c3ace5f53 upstream.
For some reason, some early WD drives spin up and down drives erratically when the link is put into slumber mode which can reduce the life expectancy of the device significantly. Unfortunately, we don't have full list of devices and given the nature of the issue it'd be better to err on the side of false positives than the other way around. Let's disable LPM on all WD devices which match one of the known problematic model prefixes and are SATA-I.
As horkage list doesn't support matching SATA capabilities, this is implemented as two horkages - WD_BROKEN_LPM and NOLPM. The former is set for the known prefixes and sets the latter if the matched device is SATA-I.
Note that this isn't optimal as this disables all LPM operations and partial link power state reportedly works fine on these; however, the way LPM is implemented in libata makes it difficult to precisely map libata LPM setting to specific link power state. Well, these devices are already fairly outdated. Let's just disable whole LPM for now.
References: https://bugzilla.kernel.org/show_bug.cgi?id=57211
--- drivers/ata/libata-core.c | 27 +++++++++++++++++++++++++++ drivers/ata/libata-scsi.c | 18 +++++++++++++++--- include/linux/libata.h | 2 ++ 3 files changed, 44 insertions(+), 3 deletions(-)
drivers/ata/libata-core.c +27 -0
@@ -2199,6 +2199,16 @@ int ata_dev_configure(struct ata_deviceif (rc)return rc; +/* some WD SATA-1 drives have issues with LPM, turn on NOLPM for them */ +if ((dev->horkage &ATA_HORKAGE_WD_BROKEN_LPM ) && + (id[ATA_ID_SATA_CAPABILITY ] &0xe ) ==0x2 ) + dev->horkage |=ATA_HORKAGE_NOLPM ; + +if (dev->horkage &ATA_HORKAGE_NOLPM ) { +ata_dev_warn (dev,"LPM support broken, forcing max_power\n" ); + dev->link->ap->target_lpm_policy =ATA_LPM_MAX_POWER ; + } +/* let ACPI work its magic */ rc =ata_acpi_on_devcfg (dev);if (rc)
@@ -4189,6 +4199,23 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, +/* +* Some WD SATA-I drives spin up and down erratically when the link +* is put into the slumber mode. We don't have full list of the +* affected devices. Disable LPM if the device matches one of the +* known prefixes and is SATA-1. As a side effect LPM partial is +* lost too. +* +* https://bugzilla.kernel.org/show_bug.cgi?id=57211 +*/ + { "WDC WD800JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + { "WDC WD1200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + { "WDC WD1600JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + { "WDC WD2000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + { "WDC WD2500JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + { "WDC WD3000JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + { "WDC WD3200JD-*", NULL, ATA_HORKAGE_WD_BROKEN_LPM }, + /* End Marker */ { } };
drivers/ata/libata-scsi.c +15 -3
@@ -112,12 +112,14 @@ static const char *ata_lpm_policy_names[ [ATA_LPM_MIN_POWER] = "min_power", }; -static ssize_t ata_scsi_lpm_store (struct device *dev, +static ssize_t ata_scsi_lpm_store (struct device *device,struct device_attribute *attr,const char *buf,size_t count) { -struct Scsi_Host *shost =class_to_shost (dev); +struct Scsi_Host *shost =class_to_shost (device);struct ata_port *ap =ata_shost_to_port (shost); +struct ata_link *link; +struct ata_device *dev;enum ata_lpm_policy policy;unsigned long flags;
@@ -133,10 +135,20 @@ static ssize_t ata_scsi_lpm_store(structreturn -EINVAL ;spin_lock_irqsave (ap->lock, flags); + +ata_for_each_link (link, ap,EDGE ) { +ata_for_each_dev (dev, &ap->link,ENABLED ) { +if (dev->horkage &ATA_HORKAGE_NOLPM ) { + count = -EOPNOTSUPP ; + goto out_unlock; + } + } + } + ap->target_lpm_policy = policy;ata_port_schedule_eh (ap); +out_unlock:spin_unlock_irqrestore (ap->lock, flags); -return count; }
include/linux/libata.h +2 -0
@@ -400,6 +400,8 @@ enum {ATA_HORKAGE_DUMP_ID = (1 <<16 ),/* dump IDENTIFY data */ ATA_HORKAGE_MAX_SEC_LBA48 = (1 <<17 ),/* Set max sects to 65535 */ ATA_HORKAGE_ATAPI_DMADIR = (1 <<18 ),/* device requires dmadir */ +ATA_HORKAGE_NOLPM = (1 <<20 ),/* don't use LPM */ +ATA_HORKAGE_WD_BROKEN_LPM = (1 <<21 ),/* some WDs have broken LPM */ /* DMA mask for user DMA control: User visible values; DO NOT renumber */
Greg Kroah-Hartman
maintainerPATCH 70/104 ext4: avoid clearing beyond i_blocks when truncating an inline data file
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 09c455aaa8f47a94d5bafaa23d58365768210507 upstream.
A missing cast means that when we are truncating a file which is less than 60 bytes, we don't clear the correct area of memory, and in fact we can end up truncating the next inode in the inode table, or worse yet, some other kernel data structure.
Addresses-Coverity-Id: #751987
--- fs/ext4/inline.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ext4/inline.c +5 -3
@@ -1957,9 +1957,11 @@ void ext4_inline_data_truncate(struct in }/* Clear the content within i_blocks. */ -if (i_size <EXT4_MIN_INLINE_DATA_SIZE ) -memset (ext4_raw_inode (&is.iloc)->i_block + i_size,0 , -EXT4_MIN_INLINE_DATA_SIZE - i_size); +if (i_size <EXT4_MIN_INLINE_DATA_SIZE ) { +void *p = (void *)ext4_raw_inode (&is.iloc)->i_block; +memset (p + i_size,0 , +EXT4_MIN_INLINE_DATA_SIZE - i_size); + }EXT4_I (inode)->i_inline_size = i_size < EXT4_MIN_INLINE_DATA_SIZE ?
Greg Kroah-Hartman
maintainerPATCH 71/104 vfs: Is mounted should be testing mnt_ns for NULL or error.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 260a459d2e39761fbd39803497205ce1690bc7b1 upstream.
A bug was introduced with the is_mounted helper function in commit f7a99c5b7c8bd3d3f533c8b38274e33f3da9096e
Author: Al Viro <[email protected]> Date: Sat Jun 9 00:59:08 2012 -0400
get rid of ->mnt_longterm
it's enough to set ->mnt_ns of internal vfsmounts to something
distinct from all struct mnt_namespace out there; then we can
just use the check for ->mnt_ns != NULL in the fast path of
mntput_no_expire()
Signed-off-by: Al Viro <[email protected]>The intent was to test if the real_mount(vfsmount)->mnt_ns was NULL_OR_ERR but the code is actually testing real_mount(vfsmount) and always returning true.
The result is d_absolute_path returning paths it should be hiding.
--- fs/mount.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/mount.h +1 -1
@@ -73,7 +73,7 @@ static inline int mnt_has_parent(structstatic inline int is_mounted (struct vfsmount *mnt) {/* neither detached nor internal? */ -return !IS_ERR_OR_NULL (real_mount (mnt)); +return !IS_ERR_OR_NULL (real_mount (mnt)->mnt_ns); }extern struct mount *__lookup_mnt (struct vfsmount *,struct dentry *,int );
Greg Kroah-Hartman
maintainerPATCH 72/104 bcache: Data corruption fix
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
commit ef71ec00002d92a08eb27e9d036e3d48835b6597 upstream.
The code that handles overlapping extents that we've just read back in from disk was depending on the behaviour of the code that handles overlapping extents as we're inserting into a btree node in the case of an insert that forced an existing extent to be split: on insert, if we had to split we'd also insert a new extent to represent the top part of the old extent - and then that new extent would get written out.
The code that read the extents back in thus not bother with splitting extents - if it saw an extent that ovelapped in the middle of an older extent, it would trim the old extent to only represent the bottom part, assuming that the original insert would've inserted a new extent to represent the top part.
I still haven't figured out _how_ it can happen, but I'm now pretty convinced (and testing has confirmed) that there's some kind of an obscure corner case (probably involving extent merging, and multiple overwrites in different sets) that breaks this. The fix is to change the mergesort fixup code to split extents itself when required.
--- drivers/md/bcache/bset.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/md/bcache/bset.c +22 -4
@@ -927,7 +927,7 @@ static void sort_key_next(struct btree_i *i = iter->data[--iter->used]; } -static void btree_sort_fixup (struct btree_iter *iter) +static struct bkey *btree_sort_fixup (struct btree_iter *iter,struct bkey *tmp) {while (iter->used >1 ) {struct btree_iter_set *top = iter->data, *i = top +1 ;
@@ -955,9 +955,22 @@ static void btree_sort_fixup(struct btre }else {/* can't happen because of comparison func */ BUG_ON (!bkey_cmp (&START_KEY (top->k), &START_KEY (i->k))); -bch_cut_back (&START_KEY (i->k), top->k); + +if (bkey_cmp (i->k, top->k) <0 ) { +bkey_copy (tmp, top->k); + +bch_cut_back (&START_KEY (i->k), tmp); +bch_cut_front (i->k, top->k); +heap_sift (iter,0 , btree_iter_cmp); + +return tmp; + }else { +bch_cut_back (&START_KEY (i->k), top->k); + } } } + +return NULL ; } static void btree_mergesort(struct btree *b, struct bset *out,
@@ -965,15 +978,20 @@ static void btree_mergesort(struct btree bool fixup, bool remove_stale) {struct bkey *k, *last =NULL ; +BKEY_PADDED (k) tmp;bool (*bad)(struct btree *,const struct bkey *) = remove_stale ? bch_ptr_bad : bch_ptr_invalid;while (!btree_iter_end (iter)) {if (fixup && !b->level) -btree_sort_fixup (iter); + k =btree_sort_fixup (iter, &tmp.k); +else + k =NULL ; + +if (!k) + k =bch_btree_iter_next (iter); - k =bch_btree_iter_next (iter);if (bad (b, k))continue ;
Greg Kroah-Hartman
maintainerPATCH 74/104 bnx2x: fix DMA unmapping of TSO split BDs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit 95e92fd40c967c363ad66b2fd1ce4dcd68132e54 ]
bnx2x triggers warnings with CONFIG_DMA_API_DEBUG=y:
WARNING: CPU: 0 PID: 2253 at lib/dma-debug.c:887 check_unmap+0xf8/0x920() bnx2x 0000:28:00.0: DMA-API: device driver frees DMA memory with different size [device address=0x00000000da2b389e] [map size=1490 bytes] [unmap size=66 bytes]
The reason is that bnx2x splits a TSO BD into two BDs (headers + data) using one DMA mapping for both, but it uses only the length of the first BD when unmapping.
This patch fixes the bug by unmapping the whole length of the two BDs.
--- drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +9 -4
@@ -153,6 +153,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2struct sk_buff *skb = tx_buf->skb;u16 bd_idx =TX_BD (tx_buf->first_bd), new_cons;int nbd; +u16 split_bd_len =0 ;/* prefetch skb end pointer to speedup dev_kfree_skb() */ prefetch (&skb->end);
@@ -160,10 +161,7 @@ static u16 bnx2x_free_tx_pkt(struct bnx2DP (NETIF_MSG_TX_DONE ,"fp[%d]: pkt_idx %d buff @(%p)->skb %p\n" , txdata->txq_index, idx, tx_buf, skb); -/* unmap first bd */ tx_start_bd = &txdata->tx_desc_ring[bd_idx].start_bd; -dma_unmap_single (&bp->pdev->dev,BD_UNMAP_ADDR (tx_start_bd), -BD_UNMAP_LEN (tx_start_bd),DMA_TO_DEVICE ); nbd =le16_to_cpu (tx_start_bd->nbd) -1 ;
@@ -182,12 +180,19 @@ static u16 bnx2x_free_tx_pkt(struct bnx2 --nbd; bd_idx =TX_BD (NEXT_TX_IDX (bd_idx)); -/* ...and the TSO split header bd since they have no mapping */ +/* TSO headers+data bds share a common mapping. See bnx2x_tx_split() */ if (tx_buf->flags &BNX2X_TSO_SPLIT_BD ) { + tx_data_bd = &txdata->tx_desc_ring[bd_idx].reg_bd; + split_bd_len =BD_UNMAP_LEN (tx_data_bd); --nbd; bd_idx =TX_BD (NEXT_TX_IDX (bd_idx)); } +/* unmap first bd */ +dma_unmap_single (&bp->pdev->dev,BD_UNMAP_ADDR (tx_start_bd), +BD_UNMAP_LEN (tx_start_bd) + split_bd_len, +DMA_TO_DEVICE ); +/* now free frags */ while (nbd >0 ) {
Greg Kroah-Hartman
maintainerPATCH 75/104 inet_diag: fix inet_diag_dump_icsk() timewait socket state logic
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Based upon upstream commit 70315d22d3c7383f9a508d0aab21e2eb35b2303a ]
Fix inet_diag_dump_icsk() to reflect the fact that both TIME_WAIT and FIN_WAIT2 connections are represented by inet_timewait_sock (not just TIME_WAIT). Thus:
(a) We need to iterate through the time_wait buckets if the user wants either TIME_WAIT or FIN_WAIT2. (Before fixing this, "ss -nemoi state fin-wait-2" would not return any sockets, even if there were some in FIN_WAIT2.)
(b) We need to check tw_substate to see if the user wants to dump sockets in the particular substate (TIME_WAIT or FIN_WAIT2) that a given connection is in. (Before fixing this, "ss -nemoi state time-wait" would actually return sockets in state FIN_WAIT2.)
An analogous fix is in v3.13: 70315d22d3c7383f9a508d0aab21e2eb35b2303a ("inet_diag: fix inet_diag_dump_icsk() to use correct state for timewait sockets") but that patch is quite different because 3.13 code is very different in this area due to the unification of TCP hash tables in 05dbc7b ("tcp/dccp: remove twchain") in v3.13-rc1.
I tested that this applies cleanly between v3.3 and v3.12, and tested that it works in both 3.3 and 3.12. It does not apply cleanly to 3.2 and earlier (though it makes semantic sense), and semantically is not the right fix for 3.13 and beyond (as mentioned above).
--- net/ipv4/inet_diag.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/inet_diag.c +3 -1
@@ -961,7 +961,7 @@ next_normal: ++num; } -if (r->idiag_states &TCPF_TIME_WAIT ) { +if (r->idiag_states & (TCPF_TIME_WAIT |TCPF_FIN_WAIT2 )) {struct inet_timewait_sock *tw; inet_twsk_for_each(tw, node,
@@ -971,6 +971,8 @@ next_normal:if (num < s_num) goto next_dying; +if (!(r->idiag_states & (1 << tw->tw_substate))) + goto next_dying;if (r->sdiag_family !=AF_UNSPEC && tw->tw_family != r->sdiag_family) goto next_dying;
Greg Kroah-Hartman
maintainerPATCH 76/104 ieee802154: Fix memory leak in ieee802154_add_iface()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Engelmayer <[email protected]>
[ Upstream commit 267d29a69c6af39445f36102a832b25ed483f299 ]
Fix a memory leak in the ieee802154_add_iface() error handling path. Detected by Coverity: CID 710490.
--- net/ieee802154/nl-phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ieee802154/nl-phy.c +4 -2
@@ -224,8 +224,10 @@ static int ieee802154_add_iface(struct sif (info->attrs[IEEE802154_ATTR_DEV_TYPE ]) { type =nla_get_u8 (info->attrs[IEEE802154_ATTR_DEV_TYPE ]); -if (type >= __IEEE802154_DEV_MAX) -return -EINVAL ; +if (type >= __IEEE802154_DEV_MAX) { + rc = -EINVAL ; + goto nla_put_failure; + } } dev = phy->add_iface (phy, devname, type);
Greg Kroah-Hartman
maintainerPATCH 77/104 net: avoid reference counter overflows on fib_rules in multicast forwarding
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 95f4a45de1a0f172b35451fc52283290adb21f6e ]
Bob Falken reported that after 4G packets, multicast forwarding stopped working. This was because of a rule reference counter overflow which freed the rule as soon as the overflow happend.
This patch solves this by adding the FIB_LOOKUP_NOREF flag to fib_rules_lookup calls. This is safe even from non-rcu locked sections as in this case the flag only implies not taking a reference to the rule, which we don't need at all.
Rules only hold references to the namespace, which are guaranteed to be available during the call of the non-rcu protected function reg_vif_xmit because of the interface reference which itself holds a reference to the net namespace.
--- net/ipv4/ipmr.c | 7 +++++-- net/ipv6/ip6mr.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
net/ipv4/ipmr.c +5 -2
@@ -157,9 +157,12 @@ static struct mr_table *ipmr_get_table(sstatic int ipmr_fib_lookup (struct net *net,struct flowi4 *flp4,struct mr_table **mrt) { -struct ipmr_result res; -struct fib_lookup_arg arg = { .result = &res, };int err; +struct ipmr_result res; +struct fib_lookup_arg arg = { + .result = &res, + .flags =FIB_LOOKUP_NOREF , + }; err =fib_rules_lookup (net->ipv4.mr_rules_ops,flowi4_to_flowi (flp4),0 , &arg);
net/ipv6/ip6mr.c +5 -2
@@ -141,9 +141,12 @@ static struct mr6_table *ip6mr_get_tablestatic int ip6mr_fib_lookup (struct net *net,struct flowi6 *flp6,struct mr6_table **mrt) { -struct ip6mr_result res; -struct fib_lookup_arg arg = { .result = &res, };int err; +struct ip6mr_result res; +struct fib_lookup_arg arg = { + .result = &res, + .flags =FIB_LOOKUP_NOREF , + }; err =fib_rules_lookup (net->ipv6.mr6_rules_ops,flowi6_to_flowi (flp6),0 , &arg);
Greg Kroah-Hartman
maintainerPATCH 78/104 net,via-rhine: Fix tx_timeout handling
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Weinberger <[email protected]>
[ Upstream commit a926592f5e4e900f3fa903298c4619a131e60963 ]
rhine_reset_task() misses to disable the tx scheduler upon reset, this can lead to a crash if work is still scheduled while we're resetting the tx queue.
Fixes:
[ 93.591707] BUG: unable to handle kernel NULL pointer dereference at 0000004c [ 93.595514] IP: [<c119d10d>] rhine_napipoll+0x491/0x6
--- drivers/net/ethernet/via/via-rhine.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/via/via-rhine.c +1 -0
@@ -1611,6 +1611,7 @@ static void rhine_reset_task(struct work goto out_unlock;napi_disable (&rp->napi); +netif_tx_disable (dev);spin_lock_bh (&rp->lock);/* clear all descriptors */
Greg Kroah-Hartman
maintainerPATCH 79/104 net: rds: fix per-cpu helper usage
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
[ Upstream commit c196403b79aa241c3fefb3ee5bb328aa7c5cc860 ]
commit ae4b46e9d "net: rds: use this_cpu_* per-cpu helper" broke per-cpu handling for rds. chpfirst is the result of __this_cpu_read(), so it is an absolute pointer and not __percpu. Therefore, __this_cpu_write() should not operate on chpfirst, but rather on cache->percpu->first, just like __this_cpu_read() did before.
Signed-off-byd Gerald Schaefer <[email protected]>
--- net/rds/ib_recv.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/rds/ib_recv.c +3 -4
@@ -421,8 +421,7 @@ static void rds_ib_recv_cache_put(struct struct rds_ib_refill_cache *cache) {unsigned long flags; -struct list_head *old; -struct list_head __percpu *chpfirst; +struct list_head *old, *chpfirst;local_irq_save (flags);
@@ -432,7 +431,7 @@ static void rds_ib_recv_cache_put(structelse /* put on front */ list_add_tail (new_item, chpfirst); -__this_cpu_write (chpfirst, new_item); +__this_cpu_write (cache->percpu->first, new_item);__this_cpu_inc (cache->percpu->count);if (__this_cpu_read (cache->percpu->count) <RDS_IB_RECYCLE_BATCH_COUNT )
@@ -452,7 +451,7 @@ static void rds_ib_recv_cache_put(struct }while (old); -__this_cpu_write (chpfirst,NULL ); +__this_cpu_write (cache->percpu->first,NULL );__this_cpu_write (cache->percpu->count,0 ); end:local_irq_restore (flags);
Greg Kroah-Hartman
maintainerPATCH 80/104 tcp: metrics: Avoid duplicate entries with the same destination-IP
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Paasch <[email protected]>
[ Upstream commit 77f99ad16a07aa062c2d30fae57b1fee456f6ef6 ]
Because the tcp-metrics is an RCU-list, it may be that two soft-interrupts are inside __tcp_get_metrics() for the same destination-IP at the same time. If this destination-IP is not yet part of the tcp-metrics, both soft-interrupts will end up in tcpm_new and create a new entry for this IP.
So, we will have two tcp-metrics with the same destination-IP in the list.
This patch checks twice __tcp_get_metrics(). First without holding the lock, then while holding the lock. The second one is there to confirm that the entry has not been added by another soft-irq while waiting for the spin-lock.
--- net/ipv4/tcp_metrics.c | 51 ++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-)
net/ipv4/tcp_metrics.c +32 -19
@@ -22,6 +22,9 @@int sysctl_tcp_nometrics_save__read_mostly ; +static struct tcp_metrics_block *__tcp_get_metrics (const struct inetpeer_addr *addr, +struct net *net,unsigned int hash); +struct tcp_fastopen_metrics {u16 mss;u16 syn_loss:10 ;/* Recurring Fast Open SYN losses */
@@ -130,16 +133,41 @@ static void tcpm_suck_dst(struct tcp_met } } +#define TCP_METRICS_TIMEOUT (60 * 60 * HZ) + +static void tcpm_check_stamp (struct tcp_metrics_block *tm,struct dst_entry *dst) +{ +if (tm &&unlikely (time_after (jiffies, tm->tcpm_stamp +TCP_METRICS_TIMEOUT ))) +tcpm_suck_dst (tm, dst, false); +} + +#define TCP_METRICS_RECLAIM_DEPTH 5 +#define TCP_METRICS_RECLAIM_PTR (struct tcp_metrics_block *) 0x1UL +static struct tcp_metrics_block *tcpm_new (struct dst_entry *dst,struct inetpeer_addr *addr, -unsigned int hash, -bool reclaim) +unsigned int hash) {struct tcp_metrics_block *tm;struct net *net; +bool reclaim = false;spin_lock_bh (&tcp_metrics_lock); net =dev_net (dst->dev); + +/* While waiting for the spin-lock the cache might have been populated +* with this entry and so we have to check again. +*/ + tm =__tcp_get_metrics (addr, net, hash); +if (tm ==TCP_METRICS_RECLAIM_PTR ) { + reclaim = true; + tm =NULL ; + } +if (tm) { +tcpm_check_stamp (tm, dst); + goto out_unlock; + } +if (unlikely (reclaim)) {struct tcp_metrics_block *oldest;
@@ -169,17 +197,6 @@ out_unlock:return tm; } -#define TCP_METRICS_TIMEOUT (60 * 60 * HZ) - -static void tcpm_check_stamp (struct tcp_metrics_block *tm,struct dst_entry *dst) -{ -if (tm &&unlikely (time_after (jiffies, tm->tcpm_stamp +TCP_METRICS_TIMEOUT ))) -tcpm_suck_dst (tm, dst, false); -} - -#define TCP_METRICS_RECLAIM_DEPTH 5 -#define TCP_METRICS_RECLAIM_PTR (struct tcp_metrics_block *) 0x1UL -static struct tcp_metrics_block *tcp_get_encode (struct tcp_metrics_block *tm,int depth) {if (tm)
@@ -280,7 +297,6 @@ static struct tcp_metrics_block *tcp_getstruct inetpeer_addr addr;unsigned int hash;struct net *net; -bool reclaim; addr.family = sk->sk_family;switch (addr.family) {
@@ -300,13 +316,10 @@ static struct tcp_metrics_block *tcp_get hash =hash_32 (hash, net->ipv4.tcp_metrics_hash_log); tm =__tcp_get_metrics (&addr, net, hash); - reclaim = false; -if (tm ==TCP_METRICS_RECLAIM_PTR ) { - reclaim = true; +if (tm ==TCP_METRICS_RECLAIM_PTR ) tm =NULL ; - }if (!tm && create) - tm =tcpm_new (dst, &addr, hash, reclaim); + tm =tcpm_new (dst, &addr, hash);else tcpm_check_stamp (tm, dst);
Greg Kroah-Hartman
maintainerPATCH 81/104 bpf: do not use reciprocal divide
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit aee636c4809fa54848ff07a899b326eb1f9987a2 ]
At first Jakub Zawadzki noticed that some divisions by reciprocal_divide were not correct. (off by one in some cases)
http://www.wireshark.org/~darkjames/reciprocal-buggy.c
He could also show this with BPF:
http://www.wireshark.org/~darkjames/set-and-dump-filter-k-bug.c
The reciprocal divide in linux kernel is not generic enough, lets remove its use in BPF, as it is not worth the pain with current cpus.
--- arch/arm/net/bpf_jit_32.c | 6 +++--- arch/powerpc/net/bpf_jit_comp.c | 7 ++++--- arch/s390/net/bpf_jit_comp.c | 17 ++++++++++++----- arch/sparc/net/bpf_jit_comp.c | 17 ++++++++++++++--- arch/x86/net/bpf_jit_comp.c | 14 ++++++++++---- net/core/filter.c | 30 ++---------------------------- 6 files changed, 45 insertions(+), 46 deletions(-)
arch/arm/net/bpf_jit_32.c +3 -3
@@ -637,10 +637,10 @@ load_ind:emit (ARM_MUL (r_A, r_A, r_X), ctx);break ;case BPF_S_ALU_DIV_K : -/* current k == reciprocal_value(userspace k) */ +if (k ==1 ) +break ;emit_mov_i (r_scratch, k, ctx); -/* A = top 32 bits of the product */ -emit (ARM_UMULL (r_scratch, r_A, r_A, r_scratch), ctx); +emit_udiv (r_A, r_A, r_scratch, ctx);break ;case BPF_S_ALU_DIV_X :update_on_xread (ctx);
arch/powerpc/net/bpf_jit_comp.c +4 -3
@@ -209,10 +209,11 @@ static int bpf_jit_build_body(struct sk_ }PPC_DIVWU (r_A, r_A, r_X);break ; -case BPF_S_ALU_DIV_K :/* A = reciprocal_divide(A, K); */ +case BPF_S_ALU_DIV_K :/* A /= K */ +if (K ==1 ) +break ;PPC_LI32 (r_scratch1,K ); -/* Top 32 bits of 64bit result -> A */ -PPC_MULHWU (r_A, r_A, r_scratch1); +PPC_DIVWU (r_A, r_A, r_scratch1);break ;case BPF_S_ALU_AND_X : ctx->seen |=SEEN_XREG ;
arch/s390/net/bpf_jit_comp.c +12 -5
@@ -338,11 +338,13 @@ static int bpf_jit_insn(struct bpf_jit */* dr %r4,%r12 */ EMIT2 (0x1d4c );break ; -case BPF_S_ALU_DIV_K :/* A = reciprocal_divide(A, K) */ -/* m %r4,<d(K)>(%r13) */ -EMIT4_DISP (0x5c40d000 ,EMIT_CONST (K )); -/* lr %r5,%r4 */ -EMIT2 (0x1854 ); +case BPF_S_ALU_DIV_K :/* A /= K */ +if (K ==1 ) +break ; +/* lhi %r4,0 */ +EMIT4 (0xa7480000 ); +/* d %r4,<d(K)>(%r13) */ +EMIT4_DISP (0x5d40d000 ,EMIT_CONST (K ));break ;case BPF_S_ALU_MOD_X :/* A %= X */ jit->seen |=SEEN_XREG |SEEN_RET0 ;
@@ -358,6 +360,11 @@ static int bpf_jit_insn(struct bpf_jit *EMIT2 (0x1854 );break ;case BPF_S_ALU_MOD_K :/* A %= K */ +if (K ==1 ) { +/* lhi %r5,0 */ +EMIT4 (0xa7580000 ); +break ; + }/* lhi %r4,0 */ EMIT4 (0xa7480000 );/* d %r4,<d(K)>(%r13) */
arch/sparc/net/bpf_jit_comp.c +14 -3
@@ -497,9 +497,20 @@ void bpf_jit_compile(struct sk_filter *fcase BPF_S_ALU_MUL_K :/* A *= K */ emit_alu_K (MUL ,K );break ; -case BPF_S_ALU_DIV_K :/* A /= K */ -emit_alu_K (MUL ,K ); -emit_read_y (r_A); +case BPF_S_ALU_DIV_K :/* A /= K with K != 0*/ +if (K ==1 ) +break ; +emit_write_y (G0 ); +#ifdef CONFIG_SPARC32 +/* The Sparc v8 architecture requires +* three instructions between a %y +* register write and the first use. +*/ +emit_nop (); +emit_nop (); +emit_nop (); +#endif +emit_alu_K (DIV ,K );break ;case BPF_S_ALU_DIV_X :/* A /= X; */ emit_cmpi (r_X,0 );
arch/x86/net/bpf_jit_comp.c +10 -4
@@ -324,15 +324,21 @@ void bpf_jit_compile(struct sk_filter *fEMIT2 (0x89 ,0xd0 );/* mov %edx,%eax */ break ;case BPF_S_ALU_MOD_K :/* A %= K; */ +if (K ==1 ) { +CLEAR_A (); +break ; + }EMIT2 (0x31 ,0xd2 );/* xor %edx,%edx */ EMIT1 (0xb9 );EMIT (K ,4 );/* mov imm32,%ecx */ EMIT2 (0xf7 ,0xf1 );/* div %ecx */ EMIT2 (0x89 ,0xd0 );/* mov %edx,%eax */ break ; -case BPF_S_ALU_DIV_K :/* A = reciprocal_divide(A, K); */ -EMIT3 (0x48 ,0x69 ,0xc0 );/* imul imm32,%rax,%rax */ -EMIT (K ,4 ); -EMIT4 (0x48 ,0xc1 ,0xe8 ,0x20 );/* shr $0x20,%rax */ +case BPF_S_ALU_DIV_K :/* A /= K */ +if (K ==1 ) +break ; +EMIT2 (0x31 ,0xd2 );/* xor %edx,%edx */ +EMIT1 (0xb9 );EMIT (K ,4 );/* mov imm32,%ecx */ +EMIT2 (0xf7 ,0xf1 );/* div %ecx */ break ;case BPF_S_ALU_AND_X : seen |=SEEN_XREG ;
net/core/filter.c +2 -28
@@ -36,7 +36,6 @@#include <asm/uaccess.h> #include <asm/unaligned.h> #include <linux/filter.h> -#include <linux/reciprocal_div.h> #include <linux/ratelimit.h> #include <linux/seccomp.h> #include <linux/if_vlan.h>
@@ -166,7 +165,7 @@ unsigned int sk_run_filter(const structA /=X ;continue ;case BPF_S_ALU_DIV_K : -A =reciprocal_divide (A ,K ); +A /=K ;continue ;case BPF_S_ALU_MOD_X :if (X ==0 )
@@ -553,11 +552,6 @@ int sk_chk_filter(struct sock_filter *fi/* Some instructions need special checks */ switch (code) {case BPF_S_ALU_DIV_K : -/* check for division by zero */ -if (ftest->k ==0 ) -return -EINVAL ; - ftest->k =reciprocal_value (ftest->k); -break ;case BPF_S_ALU_MOD_K :/* check for division by zero */ if (ftest->k ==0 )
@@ -853,27 +847,7 @@ void sk_decode_filter(struct sock_filter to->code = decodes[code]; to->jt = filt->jt; to->jf = filt->jf; - -if (code ==BPF_S_ALU_DIV_K ) { -/* -* When loaded this rule user gave us X, which was -* translated into R = r(X). Now we calculate the -* RR = r(R) and report it back. If next time this -* value is loaded and RRR = r(RR) is calculated -* then the R == RRR will be true. -* -* One exception. X == 1 translates into R == 0 and -* we can't calculate RR out of it with r(). -*/ - -if (filt->k ==0 ) - to->k =1 ; -else - to->k =reciprocal_value (filt->k); - -BUG_ON (reciprocal_value (to->k) != filt->k); - }else - to->k = filt->k; + to->k = filt->k; }int sk_get_filter (struct sock *sk,struct sock_filter __user *ubuf,unsigned int len)
Greg Kroah-Hartman
maintainerPATCH 82/104 s390/bpf,jit: fix 32 bit divisions, use unsigned divide instructions
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 3af57f78c38131b7a66e2b01e06fdacae01992a3 ]
The s390 bpf jit compiler emits the signed divide instructions "dr" and "d" for unsigned divisions.
This can cause problems: the dividend will be zero extended to a 64 bit value and the divisor is the 32 bit signed value as specified A or X accumulator, even though A and X are supposed to be treated as unsigned values.
The divide instrunctions will generate an exception if the result cannot be expressed with a 32 bit signed value.
This is the case if e.g. the dividend is 0xffffffff and the divisor either 1 or also 0xffffffff (signed: -1).
To avoid all these issues simply use unsigned divide instructions.
--- arch/s390/net/bpf_jit_comp.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/s390/net/bpf_jit_comp.c +8 -8
@@ -335,16 +335,16 @@ static int bpf_jit_insn(struct bpf_jit *EMIT4_PCREL (0xa7840000 , (jit->ret0_ip - jit->prg));/* lhi %r4,0 */ EMIT4 (0xa7480000 ); -/* dr %r4,%r12 */ -EMIT2 (0x1d4c ); +/* dlr %r4,%r12 */ +EMIT4 (0xb997004c );break ;case BPF_S_ALU_DIV_K :/* A /= K */ if (K ==1 )break ;/* lhi %r4,0 */ EMIT4 (0xa7480000 ); -/* d %r4,<d(K)>(%r13) */ -EMIT4_DISP (0x5d40d000 ,EMIT_CONST (K )); +/* dl %r4,<d(K)>(%r13) */ +EMIT6_DISP (0xe340d000 ,0x0097 ,EMIT_CONST (K ));break ;case BPF_S_ALU_MOD_X :/* A %= X */ jit->seen |=SEEN_XREG |SEEN_RET0 ;
@@ -354,8 +354,8 @@ static int bpf_jit_insn(struct bpf_jit *EMIT4_PCREL (0xa7840000 , (jit->ret0_ip - jit->prg));/* lhi %r4,0 */ EMIT4 (0xa7480000 ); -/* dr %r4,%r12 */ -EMIT2 (0x1d4c ); +/* dlr %r4,%r12 */ +EMIT4 (0xb997004c );/* lr %r5,%r4 */ EMIT2 (0x1854 );break ;
@@ -367,8 +367,8 @@ static int bpf_jit_insn(struct bpf_jit * }/* lhi %r4,0 */ EMIT4 (0xa7480000 ); -/* d %r4,<d(K)>(%r13) */ -EMIT4_DISP (0x5d40d000 ,EMIT_CONST (K )); +/* dl %r4,<d(K)>(%r13) */ +EMIT6_DISP (0xe340d000 ,0x0097 ,EMIT_CONST (K ));/* lr %r5,%r4 */ EMIT2 (0x1854 );break ;
Greg Kroah-Hartman
maintainerPATCH 83/104 ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duan Jiong <[email protected]>
[ Upstream commit 11c21a307d79ea5f6b6fc0d3dfdeda271e5e65f6 ]
commit a622260254ee48("ip_tunnel: fix kernel panic with icmp_dest_unreach") clear IPCB in ip_tunnel_xmit() , or else skb->cb[] may contain garbage from GSO segmentation layer.
But commit 0e6fbc5b6c621("ip_tunnels: extend iptunnel_xmit()") refactor codes, and it clear IPCB behind the dst_link_failure().
So clear IPCB in ip_tunnel_xmit() just like commti a622260254ee48("ip_tunnel:
fix kernel panic with icmp_dest_unreach").
--- net/ipv4/ip_tunnel.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/ip_tunnel.c +1 -0
@@ -636,6 +636,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, tunnel->err_time + IPTUNNEL_ERR_TIMEO)) { tunnel->err_count--; +memset (IPCB (skb),0 ,sizeof (*IPCB (skb)));dst_link_failure (skb); } else tunnel->err_count = 0;
Greg Kroah-Hartman
maintainerPATCH 84/104 fib_frontend: fix possible NULL pointer dereference
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
[ Upstream commit a0065f266a9b5d51575535a25c15ccbeed9a9966 ]
The two commits 0115e8e30d (net: remove delay at device dismantle) and 748e2d9396a (net: reinstate rtnl in call_netdevice_notifiers()) silently removed a NULL pointer check for in_dev since Linux 3.7.
This patch re-introduces this check as it causes crashing the kernel when setting small mtu values on non-ip capable netdevices.
--- net/ipv4/fib_frontend.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv4/fib_frontend.c +2 -0
@@ -1049,6 +1049,8 @@ static int fib_netdev_event(struct notif } in_dev =__in_dev_get_rtnl (dev); +if (!in_dev) +return NOTIFY_DONE ;switch (event) {case NETDEV_UP :
Greg Kroah-Hartman
maintainerPATCH 85/104 net: Fix memory leak if TPROXY used with TCP early demux
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Holger Eitzenberger <[email protected]>
[ Upstream commit a452ce345d63ddf92cd101e4196569f8718ad319 ]
I see a memory leak when using a transparent HTTP proxy using TPROXY together with TCP early demux and Kernel v3.8.13.15 (Ubuntu stable):
unreferenced object 0xffff88008cba4a40 (size 1696):
comm "softirq", pid 0, jiffies 4294944115 (age 8907.520s) hex dump (first 32 bytes):
0a e0 20 6a 40 04 1b 37 92 be 32 e2 e8 b4 00 00 .. [email protected]..... 02 00 07 01 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<ffffffff810b710a>] kmem_cache_alloc+0xad/0xb9 [<ffffffff81270185>] sk_prot_alloc+0x29/0xc5 [<ffffffff812702cf>] sk_clone_lock+0x14/0x283 [<ffffffff812aaf3a>] inet_csk_clone_lock+0xf/0x7b [<ffffffff8129a893>] netlink_broadcast+0x14/0x16 [<ffffffff812c1573>] tcp_create_openreq_child+0x1b/0x4c3 [<ffffffff812c033e>] tcp_v4_syn_recv_sock+0x38/0x25d [<ffffffff812c13e4>] tcp_check_req+0x25c/0x3d0 [<ffffffff812bf87a>] tcp_v4_do_rcv+0x287/0x40e [<ffffffff812a08a7>] ip_route_input_noref+0x843/0xa55 [<ffffffff812bfeca>] tcp_v4_rcv+0x4c9/0x725 [<ffffffff812a26f4>] ip_local_deliver_finish+0xe9/0x154 [<ffffffff8127a927>] __netif_receive_skb+0x4b2/0x514 [<ffffffff8127aa77>] process_backlog+0xee/0x1c5 [<ffffffff8127c949>] net_rx_action+0xa7/0x200 [<ffffffff81209d86>] add_interrupt_randomness+0x39/0x157
But there are many more, resulting in the machine going OOM after some days.
Quoted 1 line
Quoted 1 line
From looking at the TPROXY code, and with help from Florian, I see
that the memory leak is introduced in tcp_v4_early_demux():
void tcp_v4_early_demux(struct sk_buff *skb)
{
/* ... */ iph = ip_hdr(skb);
th = tcp_hdr(skb);
if (th->doff < sizeof(struct tcphdr) / 4)
return;
sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
iph->saddr, th->source,
iph->daddr, ntohs(th->dest),
skb->skb_iif);
if (sk) {
skb->sk = sk;where the socket is assigned unconditionally to skb->sk, also bumping the refcnt on it. This is problematic, because in our case the skb has already a socket assigned in the TPROXY target. This then results in the leak I see.
The very same issue seems to be with IPv6, but haven't tested.
--- net/ipv4/ip_input.c | 2 +- net/ipv6/ip6_input.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/ip_input.c +1 -1
@@ -313,7 +313,7 @@ static int ip_rcv_finish(struct sk_buffconst struct iphdr *iph =ip_hdr (skb);struct rtable *rt; -if (sysctl_ip_early_demux && !skb_dst (skb)) { +if (sysctl_ip_early_demux && !skb_dst (skb) && skb->sk ==NULL ) {const struct net_protocol *ipprot;int protocol = iph->protocol;
net/ipv6/ip6_input.c +1 -1
@@ -49,7 +49,7 @@int ip6_rcv_finish (struct sk_buff *skb) { -if (sysctl_ip_early_demux && !skb_dst (skb)) { +if (sysctl_ip_early_demux && !skb_dst (skb) && skb->sk ==NULL ) {const struct inet6_protocol *ipprot; ipprot =rcu_dereference (inet6_protos[ipv6_hdr (skb)->nexthdr]);
Greg Kroah-Hartman
maintainerPATCH 86/104 xen-netfront: fix resource leak in netfront
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Annie Li <[email protected]>
[ Upstream commit cefe0078eea52af17411eb1248946a94afb84ca5 ]
This patch removes grant transfer releasing code from netfront, and uses gnttab_end_foreign_access to end grant access since gnttab_end_foreign_access_ref may fail when the grant entry is currently used for reading or writing.
* clean up grant transfer code kept from old netfront(2.6.18) which grants pages for access/map and transfer. But grant transfer is deprecated in current netfront, so remove corresponding release code for transfer.
* fix resource leak, release grant access (through gnttab_end_foreign_access) and skb for tx/rx path, use get_page to ensure page is released when grant access is completed successfully.
Xen-blkfront/xen-tpmfront/xen-pcifront also have similar issue, but patches for them will be created separately.
V6: Correct subject line and commit message.
V5: Remove unecessary change in xennet_end_access.
V4: Revert put_page in gnttab_end_foreign_access, and keep netfront change in single patch.
V3: Changes as suggestion from David Vrabel, ensure pages are not freed untill grant acess is ended.
V2: Improve patch comments.
--- drivers/net/xen-netfront.c | 88 +++++++++++++-------------------------------- 1 file changed, 26 insertions(+), 62 deletions(-)
drivers/net/xen-netfront.c +26 -62
@@ -107,6 +107,7 @@ struct netfront_info { } tx_skbs[NET_TX_RING_SIZE ];grant_ref_t gref_tx_head;grant_ref_t grant_tx_ref[NET_TX_RING_SIZE ]; +struct page *grant_tx_page[NET_TX_RING_SIZE ];unsigned tx_skb_freelist;spinlock_t rx_lock____cacheline_aligned_in_smp ;
@@ -386,6 +387,7 @@ static void xennet_tx_buf_gc(struct net_gnttab_release_grant_reference ( &np->gref_tx_head, np->grant_tx_ref[id]); np->grant_tx_ref[id] =GRANT_INVALID_REF ; + np->grant_tx_page[id] =NULL ;add_id_to_freelist (&np->tx_skb_freelist, np->tx_skbs, id);dev_kfree_skb_irq (skb); }
@@ -442,6 +444,7 @@ static void xennet_make_frags(struct sk_gnttab_grant_foreign_access_ref (ref, np->xbdev->otherend_id, mfn, GNTMAP_readonly); + np->grant_tx_page[id] =virt_to_page (data); tx->gref = np->grant_tx_ref[id] = ref; tx->offset = offset; tx->size = len;
@@ -487,6 +490,7 @@ static void xennet_make_frags(struct sk_ np->xbdev->otherend_id, mfn, GNTMAP_readonly); + np->grant_tx_page[id] = page; tx->gref = np->grant_tx_ref[id] = ref; tx->offset = offset; tx->size = bytes;
@@ -586,6 +590,7 @@ static int xennet_start_xmit(struct sk_b mfn =virt_to_mfn (data);gnttab_grant_foreign_access_ref ( ref, np->xbdev->otherend_id, mfn, GNTMAP_readonly); + np->grant_tx_page[id] =virt_to_page (data); tx->gref = np->grant_tx_ref[id] = ref; tx->offset = offset; tx->size = len;
@@ -1115,10 +1120,11 @@ static void xennet_release_tx_bufs(struccontinue ; skb = np->tx_skbs[i].skb; -gnttab_end_foreign_access_ref (np->grant_tx_ref[i], - GNTMAP_readonly); -gnttab_release_grant_reference (&np->gref_tx_head, - np->grant_tx_ref[i]); +get_page (np->grant_tx_page[i]); +gnttab_end_foreign_access (np->grant_tx_ref[i], + GNTMAP_readonly, + (unsigned long )page_address (np->grant_tx_page[i])); + np->grant_tx_page[i] =NULL ; np->grant_tx_ref[i] =GRANT_INVALID_REF ;add_id_to_freelist (&np->tx_skb_freelist, np->tx_skbs, i);dev_kfree_skb_irq (skb);
@@ -1127,78 +1133,35 @@ static void xennet_release_tx_bufs(strucstatic void xennet_release_rx_bufs (struct netfront_info *np) { -struct mmu_update *mmu = np->rx_mmu; -struct multicall_entry *mcl = np->rx_mcl; -struct sk_buff_head free_list; -struct sk_buff *skb; -unsigned long mfn; -int xfer =0 , noxfer =0 , unused =0 ;int id, ref; -dev_warn (&np->netdev->dev,"%s: fix me for copying receiver.\n" , - __func__); -return ; - -skb_queue_head_init (&free_list); -spin_lock_bh (&np->rx_lock);for (id =0 ; id <NET_RX_RING_SIZE ; id++) { - ref = np->grant_rx_ref[id]; -if (ref ==GRANT_INVALID_REF ) { - unused++; -continue ; - } +struct sk_buff *skb; +struct page *page; skb = np->rx_skbs[id]; - mfn =gnttab_end_foreign_transfer_ref (ref); -gnttab_release_grant_reference (&np->gref_rx_head, ref); - np->grant_rx_ref[id] =GRANT_INVALID_REF ; - -if (0 == mfn) { -skb_shinfo (skb)->nr_frags =0 ; -dev_kfree_skb (skb); - noxfer++; +if (!skb)continue ; - } -if (!xen_feature (XENFEAT_auto_translated_physmap)) { -/* Remap the page. */ -const struct page *page = -skb_frag_page (&skb_shinfo (skb)->frags[0 ]); -unsigned long pfn =page_to_pfn (page); -void *vaddr =page_address (page); + ref = np->grant_rx_ref[id]; +if (ref ==GRANT_INVALID_REF ) +continue ; -MULTI_update_va_mapping (mcl, (unsigned long )vaddr, -mfn_pte (mfn,PAGE_KERNEL ), -0 ); - mcl++; - mmu->ptr = ((u64 )mfn <<PAGE_SHIFT ) - |MMU_MACHPHYS_UPDATE ; - mmu->val = pfn; - mmu++; + page =skb_frag_page (&skb_shinfo (skb)->frags[0 ]); -set_phys_to_machine (pfn, mfn); - } -__skb_queue_tail (&free_list, skb); - xfer++; - } - -dev_info (&np->netdev->dev,"%s: %d xfer, %d noxfer, %d unused\n" , - __func__, xfer, noxfer, unused); +/* gnttab_end_foreign_access() needs a page ref until +* foreign access is ended (which may be deferred). +*/ +get_page (page); +gnttab_end_foreign_access (ref,0 , + (unsigned long )page_address (page)); + np->grant_rx_ref[id] =GRANT_INVALID_REF ; -if (xfer) { -if (!xen_feature (XENFEAT_auto_translated_physmap)) { -/* Do all the remapping work and M2P updates. */ -MULTI_mmu_update (mcl, np->rx_mmu, mmu - np->rx_mmu, -NULL ,DOMID_SELF ); - mcl++; -HYPERVISOR_multicall (np->rx_mcl, mcl - np->rx_mcl); - } +kfree_skb (skb); } -__skb_queue_purge (&free_list); -spin_unlock_bh (&np->rx_lock); }
@@ -1333,6 +1296,7 @@ static struct net_device *xennet_create_for (i =0 ; i <NET_RX_RING_SIZE ; i++) { np->rx_skbs[i] =NULL ; np->grant_rx_ref[i] =GRANT_INVALID_REF ; + np->grant_tx_page[i] =NULL ; }/* A grant for every tx ring slot */
Greg Kroah-Hartman
maintainerPATCH 87/104 sit: fix double free of fb_tunnel_dev on exit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
[ No relevant upstream commit. ]
This problem was fixed upstream by commit 9434266f2c64 ("sit: fix use after free of fb_tunnel_dev").
The upstream patch depends on upstream commit 5e6700b3bf98 ("sit: add support of x-netns"), which was not backported into 3.10 branch.
First, explain the problem: when the sit module is unloaded, sit_cleanup() is called.
rmmod sit
=> sit_cleanup()
=> rtnl_link_unregister()
=> __rtnl_kill_links()
=> for_each_netdev(net, dev) {
if (dev->rtnl_link_ops == ops)
ops->dellink(dev, &list_kill);
}
At this point, the FB device is deleted (and all sit tunnels).
=> unregister_pernet_device()
=> unregister_pernet_operations()
=> ops_exit_list()
=> sit_exit_net()
=> sit_destroy_tunnels()
In this function, no tunnel is found.
=> unregister_netdevice_queue(sitn->fb_tunnel_dev, &list);We delete the FB device a second time here!
Because we cannot simply remove the second deletion (sit_exit_net() must remove the FB device when a netns is deleted), we add an rtnl ops which delete all sit device excepting the FB device and thus we can keep the explicit deletion in sit_exit_net().
--- net/ipv6/sit.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/ipv6/sit.c +10 -0
@@ -1507,6 +1507,15 @@ static const struct nla_policy ipip6_pol#endif }; +static void ipip6_dellink (struct net_device *dev,struct list_head *head) +{ +struct net *net =dev_net (dev); +struct sit_net *sitn =net_generic (net, sit_net_id); + +if (dev != sitn->fb_tunnel_dev) +unregister_netdevice_queue (dev, head); +} +static struct rtnl_link_ops sit_link_ops__read_mostly = { .kind ="sit" , .maxtype =IFLA_IPTUN_MAX ,
@@ -1517,6 +1526,7 @@ static struct rtnl_link_ops sit_link_ops .changelink = ipip6_changelink, .get_size = ipip6_get_size, .fill_info = ipip6_fill_info, + .dellink = ipip6_dellink, };static struct xfrm_tunnel sit_handler__read_mostly = {
Greg Kroah-Hartman
maintainerPATCH 88/104 Revert "ip6tnl: fix use after free of fb_tnl_dev"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
[ No relevant upstream commit. ]
This reverts commit 22c3ec552c29cf4bd4a75566088950fe57d860c4.
This patch is not the right fix, it introduces a memory leak when a netns is destroyed (the FB device is never deleted).
--- net/ipv6/ip6_tunnel.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_tunnel.c +2 -0
@@ -1711,6 +1711,8 @@ static void __net_exit ip6_tnl_destroy_t } } + t =rtnl_dereference (ip6n->tnls_wc[0 ]); +unregister_netdevice_queue (t->dev, &list);unregister_netdevice_many (&list); }
Greg Kroah-Hartman
maintainerPATCH 89/104 ip6tnl: fix double free of fb_tnl_dev on exit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Dichtel <[email protected]>
[ No relevant upstream commit. ]
This problem was fixed upstream by commit 1e9f3d6f1c40 ("ip6tnl: fix use after free of fb_tnl_dev").
The upstream patch depends on upstream commit 0bd8762824e7 ("ip6tnl: add x-netns support"), which was not backported into 3.10 branch.
First, explain the problem: when the ip6_tunnel module is unloaded, ip6_tunnel_cleanup() is called.
rmmod ip6_tunnel
=> ip6_tunnel_cleanup()
=> rtnl_link_unregister()
=> __rtnl_kill_links()
=> for_each_netdev(net, dev) {
if (dev->rtnl_link_ops == ops)
ops->dellink(dev, &list_kill);
}
At this point, the FB device is deleted (and all ip6tnl tunnels).
=> unregister_pernet_device()
=> unregister_pernet_operations()
=> ops_exit_list()
=> ip6_tnl_exit_net()
=> ip6_tnl_destroy_tunnels()
=> t = rtnl_dereference(ip6n->tnls_wc[0]);
unregister_netdevice_queue(t->dev, &list);We delete the FB device a second time here!
The previous fix removes these lines, which fix this double free. But the patch introduces a memory leak when a netns is destroyed, because the FB device is never deleted. By adding an rtnl ops which delete all ip6tnl device excepting the FB device, we can keep this exlicit removal in ip6_tnl_destroy_tunnels().
--- net/ipv6/ip6_tunnel.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
net/ipv6/ip6_tunnel.c +10 -0
@@ -1617,6 +1617,15 @@ static int ip6_tnl_changelink(struct netreturn ip6_tnl_update (t, &p); } +static void ip6_tnl_dellink (struct net_device *dev,struct list_head *head) +{ +struct net *net =dev_net (dev); +struct ip6_tnl_net *ip6n =net_generic (net, ip6_tnl_net_id); + +if (dev != ip6n->fb_tnl_dev) +unregister_netdevice_queue (dev, head); +} +static size_t ip6_tnl_get_size (const struct net_device *dev) {return
@@ -1681,6 +1690,7 @@ static struct rtnl_link_ops ip6_link_ops .validate = ip6_tnl_validate, .newlink = ip6_tnl_newlink, .changelink = ip6_tnl_changelink, + .dellink = ip6_tnl_dellink, .get_size = ip6_tnl_get_size, .fill_info = ip6_tnl_fill_info, };
Greg Kroah-Hartman
maintainerPATCH 90/104 iwlwifi: pcie: enable oscillator for L1 exit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 2d93aee152b1758a94a18fe15d72153ba73b5679 upstream.
Enabling the oscillator consumes slightly more power (100uA) but allows to make sure that we exit from L1 on time.
Not doing so might lead to a PCIe specification violation since we might wake up from L1 at the wrong time. This issue has been identified on 3160 and 7260 only. On older NICs L1 off is not enabled, on newer NICs (7265), the issue is fixed.
When the bug occurs the user sees that the NIC has disappeared from the PCI bridge, any access to the device returns 0xff.
This fixes:
https://bugzilla.kernel.org/show_bug.cgi?id=64541
and has been extensively discussed here:
http://markmail.org/thread/mfmpzqt3r333n4bo
--- drivers/net/wireless/iwlwifi/iwl-prph.h | 4 ++++ drivers/net/wireless/iwlwifi/pcie/trans.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+)
drivers/net/wireless/iwlwifi/iwl-prph.h +4 -0
@@ -260,4 +260,8 @@ static inline unsigned int SCD_QUEUE_STA/*********************** END TX SCHEDULER *************************************/ +/* Oscillator clock */ +#define OSC_CLK (0xa04068) +#define OSC_CLK_FORCE_CONTROL (0x8) +#endif /* __iwl_prph_h__ */
drivers/net/wireless/iwlwifi/pcie/trans.c +16 -0
@@ -207,6 +207,22 @@ static int iwl_pcie_apm_init(struct iwl_ }/* +* Enable the oscillator to count wake up time for L1 exit. This +* consumes slightly more power (100uA) - but allows to be sure +* that we wake up from L1 on time. +* +* This looks weird: read twice the same register, discard the +* value, set a bit, and yet again, read that same register +* just to discard the value. But that's the way the hardware +* seems to like it. +*/ +iwl_read_prph (trans,OSC_CLK ); +iwl_read_prph (trans,OSC_CLK ); +iwl_set_bits_prph (trans,OSC_CLK ,OSC_CLK_FORCE_CONTROL ); +iwl_read_prph (trans,OSC_CLK ); +iwl_read_prph (trans,OSC_CLK ); + +/* * Enable DMA clock and wait for it to stabilize. * * Write to "CLK_EN_REG"; "1" bits enable clocks, while "0" bits
Greg Kroah-Hartman
maintainerPATCH 91/104 parisc: fix cache-flushing
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 57737c49dd72c96cfbcd4f66559f3ffc399aeb4f upstream.
This commit:f8dae00684d678afa13041ef170cecfd1297ed40: parisc: Ensure full cache coherency for kmap/kunmap caused negative caching side-effects, e.g. hanging processes with expect and too many inequivalent alias messages from flush_dcache_page() on Debian 5 systems.
This patch now partly reverts it and has been in production use on our debian buildd makeservers since a week without any major problems.
--- arch/parisc/include/asm/cacheflush.h | 2 -- arch/parisc/include/asm/page.h | 3 ++- arch/parisc/kernel/cache.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-)
arch/parisc/include/asm/cacheflush.h +0 -2
@@ -132,7 +132,6 @@ void mark_rodata_ro(void);static inline void *kmap (struct page *page) {might_sleep (); -flush_dcache_page (page);return page_address (page); }
@@ -144,7 +143,6 @@ static inline void kunmap(struct page *pstatic inline void *kmap_atomic (struct page *page) {pagefault_disable (); -flush_dcache_page (page);return page_address (page); }
arch/parisc/include/asm/page.h +2 -1
@@ -29,7 +29,8 @@ struct page;void clear_page_asm (void *page);void copy_page_asm (void *to,void *from);#define clear_user_page (vto, vaddr, page) clear_page_asm(vto) -#define copy_user_page (vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom) +void copy_user_page (void *vto,void *vfrom,unsigned long vaddr, +struct page *pg);/* #define CONFIG_PARISC_TMPALIAS */
arch/parisc/kernel/cache.c +14 -0
@@ -388,6 +388,20 @@ void flush_kernel_dcache_page_addr(void }EXPORT_SYMBOL (flush_kernel_dcache_page_addr); +void copy_user_page (void *vto,void *vfrom,unsigned long vaddr, +struct page *pg) +{ +/* Copy using kernel mapping. No coherency is needed (all in +kunmap) for the `to' page. However, the `from' page needs to +be flushed through a mapping equivalent to the user mapping +before it can be accessed through the kernel mapping. */ +preempt_disable (); +flush_dcache_page_asm (__pa (vfrom), vaddr); +preempt_enable (); +copy_page_asm (vto, vfrom); +} +EXPORT_SYMBOL (copy_user_page); +void purge_tlb_entries (struct mm_struct *mm,unsigned long addr) {unsigned long flags;
Greg Kroah-Hartman
maintainerPATCH 92/104 KVM: PPC: Book3S HV: use xics_wake_cpu only when defined
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 48eaef0518a565d3852e301c860e1af6a6db5a84 upstream.
--- arch/powerpc/kvm/book3s_hv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv.c +6 -1
@@ -82,10 +82,13 @@ void kvmppc_fast_vcpu_kick(struct kvm_vc/* CPU points to the first thread of the core */ if (cpu != me && cpu >=0 && cpu < nr_cpu_ids) { +#ifdef CONFIG_KVM_XICS int real_cpu = cpu + vcpu->arch.ptid;if (paca[real_cpu].kvm_hstate.xics_phys)xics_wake_cpu (real_cpu); -else if (cpu_online (cpu)) + else +#endif +if (cpu_online (cpu))smp_send_reschedule (cpu); }put_cpu ();
@@ -1090,7 +1093,9 @@ static void kvmppc_start_thread(struct ksmp_wmb ();#if defined(CONFIG_PPC_ICP_NATIVE ) && defined(CONFIG_SMP )if (vcpu->arch.ptid) { +#ifdef CONFIG_KVM_XICS xics_wake_cpu (cpu); +#endif ++vc->n_woken; }#endif
Greg Kroah-Hartman
maintainerPATCH 93/104 KVM: PPC: e500: Fix bad address type in deliver_tlb_misss()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mihai Caraman <[email protected]>
commit 70713fe315ed14cd1bb07d1a7f33e973d136ae3d upstream.
Use gva_t instead of unsigned int for eaddr in deliver_tlb_miss().
--- arch/powerpc/kvm/e500_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kvm/e500_mmu.c +1 -1
@@ -127,7 +127,7 @@ static int kvmppc_e500_tlb_index(struct }static inline void kvmppc_e500_deliver_tlb_miss (struct kvm_vcpu *vcpu, -unsigned int eaddr,int as) +gva_t eaddr,int as) {struct kvmppc_vcpu_e500 *vcpu_e500 =to_e500 (vcpu);unsigned int victim, tsized;
Greg Kroah-Hartman
maintainerPATCH 94/104 ALSA: hda - hdmi: introduce patch_nvhdmi()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anssi Hannula <[email protected]>
(This is a backport of *part* of upstream 611885bc963a "ALSA: hda -
hdmi: Disallow unsupported 2ch remapping on NVIDIA codecs" to stable 3.10 through 3.12. Later stable already contain all of the original patch.)
Mainline commit 611885bc963a "ALSA: hda - hdmi: Disallow unsupported 2ch remapping on NVIDIA codecs" introduces function patch_nvhdmi(). That function is edited by 75fae117a5db "ALSA: hda/hdmi - allow PIN_OUT to be dynamically enabled". In order to backport the PIN_OUT patch, I am first back-porting just the addition of function patch_nvhdmi(), so that the conflicts applying the PIN_OUT patch are simplified.
Ideally, one might backport all of 611885bc963a. However, that commit doesn't apply to stable kernels, since it relies on a chain of other patches which implement new features.
--- sound/pci/hda/patch_hdmi.c | 60 +++++++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 23 deletions(-)
sound/pci/hda/patch_hdmi.c +37 -23
@@ -2476,6 +2476,20 @@ static int patch_nvhdmi_8ch_7x(struct hdreturn 0 ; } +static int patch_nvhdmi (struct hda_codec *codec) +{ +struct hdmi_spec *spec; +int err; + + err =patch_generic_hdmi (codec); +if (err) +return err; + + spec = codec->spec; + +return 0 ; +} +/* * ATI-specific implementations *
@@ -2548,30 +2562,30 @@ static const struct hda_codec_preset snd { .id = 0x10de0005, .name = "MCP77/78 HDMI", .patch = patch_nvhdmi_8ch_7x }, { .id = 0x10de0006, .name = "MCP77/78 HDMI", .patch = patch_nvhdmi_8ch_7x }, { .id = 0x10de0007, .name = "MCP79/7A HDMI", .patch = patch_nvhdmi_8ch_7x }, -{ .id = 0x10de000a, .name = "GPU 0a HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de000b, .name = "GPU 0b HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de000c, .name = "MCP89 HDMI", .patch = patch_generic_hdmi }, -{ .id = 0x10de000d, .name = "GPU 0d HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0010, .name = "GPU 10 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0011, .name = "GPU 11 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0012, .name = "GPU 12 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0013, .name = "GPU 13 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0014, .name = "GPU 14 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0015, .name = "GPU 15 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0016, .name = "GPU 16 HDMI/DP", .patch = patch_generic_hdmi }, +{ .id = 0x10de000a, .name = "GPU 0a HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de000b, .name = "GPU 0b HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de000c, .name = "MCP89 HDMI", .patch = patch_nvhdmi }, +{ .id = 0x10de000d, .name = "GPU 0d HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0010, .name = "GPU 10 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0011, .name = "GPU 11 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0012, .name = "GPU 12 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0013, .name = "GPU 13 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0014, .name = "GPU 14 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0015, .name = "GPU 15 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0016, .name = "GPU 16 HDMI/DP", .patch = patch_nvhdmi }, /* 17 is known to be absent */ -{ .id = 0x10de0018, .name = "GPU 18 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0019, .name = "GPU 19 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0043, .name = "GPU 43 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0044, .name = "GPU 44 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_generic_hdmi }, -{ .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_generic_hdmi }, +{ .id = 0x10de0018, .name = "GPU 18 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0019, .name = "GPU 19 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de001b, .name = "GPU 1b HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de001c, .name = "GPU 1c HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0040, .name = "GPU 40 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0041, .name = "GPU 41 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0042, .name = "GPU 42 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0043, .name = "GPU 43 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0044, .name = "GPU 44 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_nvhdmi }, +{ .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_nvhdmi }, { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
Greg Kroah-Hartman
maintainerPATCH 95/104 ALSA: hda/hdmi - allow PIN_OUT to be dynamically enabled
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
(This is upstream 75fae117a5db "ALSA: hda/hdmi - allow PIN_OUT to be dynamically enabled", backported to stable 3.10 through 3.12. 3.13 and later can take the original patch.)
Commit 384a48d71520 "ALSA: hda: HDMI: Support codecs with fewer cvts than pins" dynamically enabled each pin widget's PIN_OUT only when the pin was actively in use. This was required on certain NVIDIA CODECs for correct operation. Specifically, if multiple pin widgets each had their mux input select the same audio converter widget and each pin widget had PIN_OUT enabled, then only one of the pin widgets would actually receive the audio, and often not the one the user wanted!
However, this apparently broke some Intel systems, and commit 6169b673618b "ALSA: hda - Always turn on pins for HDMI/DP" reverted the dynamic setting of PIN_OUT. This in turn broke the afore-mentioned NVIDIA CODECs.
This change supports either dynamic or static handling of PIN_OUT, selected by a flag set up during CODEC initialization. This flag is enabled for all recent NVIDIA GPUs.
--- sound/pci/hda/patch_hdmi.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-)
sound/pci/hda/patch_hdmi.c +36 -4
@@ -86,6 +86,9 @@ struct hdmi_spec {unsigned int channels_max;/* max over all cvts */ struct hdmi_eld temp_eld; + +bool dyn_pin_out; +/* * Non-generic ATI/NVIDIA specific */
@@ -450,15 +453,25 @@ static void hdmi_write_dip_byte(struct hstatic void hdmi_init_pin (struct hda_codec *codec,hda_nid_t pin_nid) { +struct hdmi_spec *spec = codec->spec; +int pin_out; +/* Unmute */ if (get_wcaps (codec, pin_nid) &AC_WCAP_OUT_AMP )snd_hda_codec_write (codec, pin_nid,0 ,AC_VERB_SET_AMP_GAIN_MUTE ,AMP_OUT_UNMUTE ); -/* Enable pin out: some machines with GM965 gets broken output when -* the pin is disabled or changed while using with HDMI -*/ + +if (spec->dyn_pin_out) +/* Disable pin out until stream is active */ + pin_out =0 ; +else +/* Enable pin out: some machines with GM965 gets broken output +* when the pin is disabled or changed while using with HDMI +*/ + pin_out =PIN_OUT ; +snd_hda_codec_write (codec, pin_nid,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_OUT ); +AC_VERB_SET_PIN_WIDGET_CONTROL , pin_out); }static int hdmi_get_channel_count (struct hda_codec *codec,hda_nid_t cvt_nid)
@@ -1473,6 +1486,7 @@ static int generic_hdmi_playback_pcm_prestruct hdmi_spec_per_pin *per_pin =get_pin (spec, pin_idx);hda_nid_t pin_nid = per_pin->pin_nid;bool non_pcm; +int pinctl; non_pcm =check_non_pcm_per_cvt (codec, cvt_nid); per_pin->channels = substream->runtime->channels;
@@ -1482,6 +1496,14 @@ static int generic_hdmi_playback_pcm_prehdmi_setup_audio_infoframe (codec, per_pin, non_pcm); +if (spec->dyn_pin_out) { + pinctl =snd_hda_codec_read (codec, pin_nid,0 , +AC_VERB_GET_PIN_WIDGET_CONTROL ,0 ); +snd_hda_codec_write (codec, pin_nid,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL , + pinctl |PIN_OUT ); + } +return hdmi_setup_stream (codec, cvt_nid, pin_nid, stream_tag, format); }
@@ -1501,6 +1523,7 @@ static int hdmi_pcm_close(struct hda_pcmint cvt_idx, pin_idx;struct hdmi_spec_per_cvt *per_cvt;struct hdmi_spec_per_pin *per_pin; +int pinctl;if (hinfo->nid) { cvt_idx =cvt_nid_to_cvt_index (spec, hinfo->nid);
@@ -1517,6 +1540,14 @@ static int hdmi_pcm_close(struct hda_pcmreturn -EINVAL ; per_pin =get_pin (spec, pin_idx); +if (spec->dyn_pin_out) { + pinctl =snd_hda_codec_read (codec, per_pin->pin_nid,0 , +AC_VERB_GET_PIN_WIDGET_CONTROL ,0 ); +snd_hda_codec_write (codec, per_pin->pin_nid,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL , + pinctl & ~PIN_OUT ); + } +snd_hda_spdif_ctls_unassign (codec, pin_idx); per_pin->chmap_set = false;memset (per_pin->chmap,0 ,sizeof (per_pin->chmap));
@@ -2486,6 +2517,7 @@ static int patch_nvhdmi(struct hda_codecreturn err; spec = codec->spec; + spec->dyn_pin_out = true;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 96/104 iwlwifi: pcie: fix interrupt coalescing for 7260 / 3160
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
commit 6960a059b2c618f32fe549f13287b3d2278c09e9 upstream.
We changed the timeout for the interrupt coealescing for calibration, but that wasn't effective since we changed that value back before loading the firmware. Since calibrations are notification from firmware and not Rx packets, this doesn't change anyway - the firmware will fire an interrupt straight away regardless of the interrupt coalescing value.
Also, a HW issue has been discovered in 7000 devices series. The work around is to disable the new interrupt coalescing timeout feature - do this by setting bit 31 in CSR_INT_COALESCING.
This has been fixed in 7265 which means that we can't rely on the device family and must have a hint in the iwl_cfg structure.
--- drivers/net/wireless/iwlwifi/iwl-7000.c | 6 ++++++ drivers/net/wireless/iwlwifi/iwl-config.h | 3 +++ drivers/net/wireless/iwlwifi/iwl-csr.h | 5 +---- drivers/net/wireless/iwlwifi/pcie/rx.c | 4 ++++ drivers/net/wireless/iwlwifi/pcie/trans.c | 3 --- 5 files changed, 14 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlwifi/iwl-7000.c +6 -0
@@ -131,6 +131,7 @@ const struct iwl_cfg iwl7260_2ac_cfg = { .ht_params = &iwl7000_ht_params, .nvm_ver = IWL7260_NVM_VERSION, .nvm_calib_ver = IWL7260_TX_POWER_VERSION, + .host_interrupt_operation_mode = true, };const struct iwl_cfg iwl7260_2n_cfg = {
@@ -140,6 +141,7 @@ const struct iwl_cfg iwl7260_2n_cfg = { .ht_params = &iwl7000_ht_params, .nvm_ver = IWL7260_NVM_VERSION, .nvm_calib_ver = IWL7260_TX_POWER_VERSION, + .host_interrupt_operation_mode = true, };const struct iwl_cfg iwl7260_n_cfg = {
@@ -149,6 +151,7 @@ const struct iwl_cfg iwl7260_n_cfg = { .ht_params = &iwl7000_ht_params, .nvm_ver = IWL7260_NVM_VERSION, .nvm_calib_ver = IWL7260_TX_POWER_VERSION, + .host_interrupt_operation_mode = true, };const struct iwl_cfg iwl3160_2ac_cfg = {
@@ -158,6 +161,7 @@ const struct iwl_cfg iwl3160_2ac_cfg = { .ht_params = &iwl7000_ht_params, .nvm_ver = IWL3160_NVM_VERSION, .nvm_calib_ver = IWL3160_TX_POWER_VERSION, + .host_interrupt_operation_mode = true, };const struct iwl_cfg iwl3160_2n_cfg = {
@@ -167,6 +171,7 @@ const struct iwl_cfg iwl3160_2n_cfg = { .ht_params = &iwl7000_ht_params, .nvm_ver = IWL3160_NVM_VERSION, .nvm_calib_ver = IWL3160_TX_POWER_VERSION, + .host_interrupt_operation_mode = true, };const struct iwl_cfg iwl3160_n_cfg = {
@@ -176,6 +181,7 @@ const struct iwl_cfg iwl3160_n_cfg = { .ht_params = &iwl7000_ht_params, .nvm_ver = IWL3160_NVM_VERSION, .nvm_calib_ver = IWL3160_TX_POWER_VERSION, + .host_interrupt_operation_mode = true, };MODULE_FIRMWARE (IWL7260_MODULE_FIRMWARE (IWL7260_UCODE_API_OK ));
drivers/net/wireless/iwlwifi/iwl-config.h +3 -0
@@ -241,6 +241,8 @@ struct iwl_eeprom_params {* @rx_with_siso_diversity: 1x1 device with rx antenna diversity * @internal_wimax_coex: internal wifi/wimax combo device * @temp_offset_v2: support v2 of temperature offset calibration +* @host_interrupt_operation_mode: device needs host interrupt operation +* mode set * * We enable the driver to be backward compatible wrt. hardware features. * API differences in uCode shouldn't be handled here but through TLVs
@@ -273,6 +275,7 @@ struct iwl_cfg {const bool rx_with_siso_diversity;const bool internal_wimax_coex;const bool temp_offset_v2; +const bool host_interrupt_operation_mode; };/*
drivers/net/wireless/iwlwifi/iwl-csr.h +1 -4
@@ -463,13 +463,10 @@* the CSR_INT_COALESCING is an 8 bit register in 32-usec unit * * default interrupt coalescing timer is 64 x 32 = 2048 usecs -* default interrupt coalescing calibration timer is 16 x 32 = 512 usecs */ #define IWL_HOST_INT_TIMEOUT_MAX (0xFF)#define IWL_HOST_INT_TIMEOUT_DEF (0x40)#define IWL_HOST_INT_TIMEOUT_MIN (0x0) -#define IWL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF) -#define IWL_HOST_INT_CALIB_TIMEOUT_DEF (0x10) -#define IWL_HOST_INT_CALIB_TIMEOUT_MIN (0x0) +#define IWL_HOST_INT_OPER_MODE BIT(31)#endif /* !__iwl_csr_h__ */
drivers/net/wireless/iwlwifi/pcie/rx.c +4 -0
@@ -489,6 +489,10 @@ static void iwl_pcie_rx_hw_init(struct i/* Set interrupt coalescing timer to default (2048 usecs) */ iwl_write8 (trans,CSR_INT_COALESCING ,IWL_HOST_INT_TIMEOUT_DEF ); + +/* W/A for interrupt coalescing bug in 7260 and 3160 */ +if (trans->cfg->host_interrupt_operation_mode) +iwl_set_bit (trans,CSR_INT_COALESCING ,IWL_HOST_INT_OPER_MODE ); }int iwl_pcie_rx_init (struct iwl_trans *trans)
drivers/net/wireless/iwlwifi/pcie/trans.c +0 -3
@@ -292,9 +292,6 @@ static int iwl_pcie_nic_init(struct iwl_spin_lock_irqsave (&trans_pcie->irq_lock, flags);iwl_pcie_apm_init (trans); -/* Set interrupt coalescing calibration timer to default (512 usecs) */ -iwl_write8 (trans,CSR_INT_COALESCING ,IWL_HOST_INT_CALIB_TIMEOUT_DEF ); -spin_unlock_irqrestore (&trans_pcie->irq_lock, flags);iwl_pcie_set_pwr (trans, false);
Greg Kroah-Hartman
maintainerPATCH 97/104 usb: core: get config and string descriptors for unauthorized devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Pugliese <[email protected]>
commit 83e83ecb79a8225e79bc8e54e9aff3e0e27658a2 upstream.
There is no need to skip querying the config and string descriptors for unauthorized WUSB devices when usb_new_device is called. It is allowed by WUSB spec. The only action that needs to be delayed until authorization time is the set config. This change allows user mode tools to see the config and string descriptors earlier in enumeration which is needed for some WUSB devices to function properly on Android systems. It also reduces the amount of divergent code paths needed for WUSB devices.
--- drivers/usb/core/config.c | 7 ------- drivers/usb/core/hub.c | 40 +++++++--------------------------------- 2 files changed, 7 insertions(+), 40 deletions(-)
drivers/usb/core/config.c +0 -7
@@ -651,10 +651,6 @@ void usb_destroy_configuration(struct us* * hub-only!! ... and only in reset path, or usb_new_device() * (used by real hubs and virtual root hubs) -* -* NOTE: if this is a WUSB device and is not authorized, we skip the -* whole thing. A non-authorized USB device has no -* configurations. */ int usb_get_configuration (struct usb_device *dev) {
@@ -666,8 +662,6 @@ int usb_get_configuration(struct usb_devstruct usb_config_descriptor *desc; cfgno =0 ; -if (dev->authorized ==0 )/* Not really an error */ - goto out_not_authorized; result = -ENOMEM ;if (ncfg >USB_MAXCONFIG ) { dev_warn(ddev, "too many configurations: %d, "
@@ -751,7 +745,6 @@ int usb_get_configuration(struct usb_dev err:kfree (desc); -out_not_authorized: dev->descriptor.bNumConfigurations = cfgno; err2:if (result == -ENOMEM )
drivers/usb/core/hub.c +7 -33
@@ -2231,18 +2231,13 @@ static int usb_enumerate_device(struct ureturn err; } } -if (udev->wusb ==1 && udev->authorized ==0 ) { - udev->product =kstrdup ("n/a (unauthorized)" ,GFP_KERNEL ); - udev->manufacturer =kstrdup ("n/a (unauthorized)" ,GFP_KERNEL ); - udev->serial =kstrdup ("n/a (unauthorized)" ,GFP_KERNEL ); - } -else { -/* read the standard strings and cache them if present */ - udev->product =usb_cache_string (udev, udev->descriptor.iProduct); - udev->manufacturer =usb_cache_string (udev, - udev->descriptor.iManufacturer); - udev->serial =usb_cache_string (udev, udev->descriptor.iSerialNumber); - } + +/* read the standard strings and cache them if present */ + udev->product =usb_cache_string (udev, udev->descriptor.iProduct); + udev->manufacturer =usb_cache_string (udev, + udev->descriptor.iManufacturer); + udev->serial =usb_cache_string (udev, udev->descriptor.iSerialNumber); + err =usb_enumerate_device_otg (udev);if (err <0 )return err;
@@ -2421,16 +2416,6 @@ int usb_deauthorize_device(struct usb_de usb_dev->authorized =0 ;usb_set_configuration (usb_dev,-1 ); -kfree (usb_dev->product); - usb_dev->product =kstrdup ("n/a (unauthorized)" ,GFP_KERNEL ); -kfree (usb_dev->manufacturer); - usb_dev->manufacturer =kstrdup ("n/a (unauthorized)" ,GFP_KERNEL ); -kfree (usb_dev->serial); - usb_dev->serial =kstrdup ("n/a (unauthorized)" ,GFP_KERNEL ); - -usb_destroy_configuration (usb_dev); - usb_dev->descriptor.bNumConfigurations =0 ; - out_unauthorized:usb_unlock_device (usb_dev);return 0 ;
@@ -2458,17 +2443,7 @@ int usb_authorize_device(struct usb_devi goto error_device_descriptor; } -kfree (usb_dev->product); - usb_dev->product =NULL ; -kfree (usb_dev->manufacturer); - usb_dev->manufacturer =NULL ; -kfree (usb_dev->serial); - usb_dev->serial =NULL ; - usb_dev->authorized =1 ; - result =usb_enumerate_device (usb_dev); -if (result <0 ) - goto error_enumerate;/* Choose and set the configuration. This registers the interfaces * with the driver core and lets interface drivers bind to them. */
@@ -2484,7 +2459,6 @@ int usb_authorize_device(struct usb_devi }dev_info (&usb_dev->dev,"authorized to connect\n" ); -error_enumerate: error_device_descriptor:usb_autosuspend_device (usb_dev); error_autoresume:
Greg Kroah-Hartman
maintainerPATCH 98/104 SCSI: bfa: Chinook quad port 16G FC HBA claim issue
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vijaya Mohan Guvva <[email protected]>
commit dcaf9aed995c2b2a49fb86bbbcfa2f92c797ab5d upstream.
Bfa driver crash is observed while pushing the firmware on to chinook quad port card due to uninitialized bfi_image_ct2 access which gets initialized only for CT2 ASIC based cards after request_firmware(). For quard port chinook (CT2 ASIC based), bfi_image_ct2 is not getting initialized as there is no check for chinook PCI device ID before request_firmware and instead bfi_image_cb is initialized as it is the default case for card type check.
This patch includes changes to read the right firmware for quad port chinook.
--- drivers/scsi/bfa/bfad.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/bfa/bfad.c +4 -2
@@ -1824,7 +1824,7 @@ out:static u32 *bfad_load_fwimg (struct pci_dev *pdev) { -if (pdev->device ==BFA_PCI_DEVICE_ID_CT2 ) { +if (bfa_asic_id_ct2 (pdev->device)) {if (bfi_image_ct2_size ==0 )bfad_read_firmware (pdev, &bfi_image_ct2, &bfi_image_ct2_size,BFAD_FW_FILE_CT2 );
@@ -1834,12 +1834,14 @@ bfad_load_fwimg(struct pci_dev *pdev)bfad_read_firmware (pdev, &bfi_image_ct, &bfi_image_ct_size,BFAD_FW_FILE_CT );return bfi_image_ct; - }else { + }else if (bfa_asic_id_cb (pdev->device)) {if (bfi_image_cb_size ==0 )bfad_read_firmware (pdev, &bfi_image_cb, &bfi_image_cb_size,BFAD_FW_FILE_CB );return bfi_image_cb; } + +return NULL ; } static void
Greg Kroah-Hartman
maintainerPATCH 99/104 virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Asias He <[email protected]>
commit f466f75385369a181409e46da272db3de6f5c5cb upstream.
vqs are freed in virtscsi_freeze but the hotcpu_notifier is not unregistered. We will have a use-after-free usage when the notifier callback is called after virtscsi_freeze.
("virtio-scsi: reset virtqueue affinity when doing cpu hotplug")
--- drivers/scsi/virtio_scsi.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/scsi/virtio_scsi.c +14 -1
@@ -957,6 +957,10 @@ static void virtscsi_remove(struct virti#ifdef CONFIG_PM static int virtscsi_freeze (struct virtio_device *vdev) { +struct Scsi_Host *sh =virtio_scsi_host (vdev); +struct virtio_scsi *vscsi =shost_priv (sh); + +unregister_hotcpu_notifier (&vscsi->nb);virtscsi_remove_vqs (vdev);return 0 ; }
@@ -965,8 +969,17 @@ static int virtscsi_restore(struct virti {struct Scsi_Host *sh =virtio_scsi_host (vdev);struct virtio_scsi *vscsi =shost_priv (sh); +int err; + + err =virtscsi_init (vdev, vscsi); +if (err) +return err; + + err =register_hotcpu_notifier (&vscsi->nb); +if (err) + vdev->config->del_vqs (vdev); -return virtscsi_init (vdev, vscsi); +return err; }#endif
Greg Kroah-Hartman
maintainerPATCH 100/104 target/iscsi: Fix network portal creation race
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Grover <[email protected]>
commit ee291e63293146db64668e8d65eb35c97e8324f4 upstream.
When creating network portals rapidly, such as when restoring a configuration, LIO's code to reuse existing portals can return a false negative if the thread hasn't run yet and set np_thread_state to ISCSI_NP_THREAD_ACTIVE. This causes an error in the network stack when attempting to bind to the same address/port.
This patch sets NP_THREAD_ACTIVE before the np is placed on g_np_list, so even if the thread hasn't run yet, iscsit_get_np will return the existing np.
Also, convert np_lock -> np_mutex + hold across adding new net portal to g_np_list to prevent a race where two threads may attempt to create the same network portal, resulting in one of them failing.
(nab: Add missing mutex_unlocks in iscsit_add_np failure paths) (DanC: Fix incorrect spin_unlock -> spin_unlock_bh)
--- drivers/target/iscsi/iscsi_target.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-)
drivers/target/iscsi/iscsi_target.c +21 -13
@@ -54,7 +54,7 @@static LIST_HEAD (g_tiqn_list);static LIST_HEAD (g_np_list);static DEFINE_SPINLOCK (tiqn_lock); -static DEFINE_SPINLOCK (np_lock); +static DEFINE_MUTEX (np_lock);static struct idr tiqn_idr;struct idr sess_idr;
@@ -303,6 +303,9 @@ bool iscsit_check_np_match(return false; } +/* +* Called with mutex np_lock held +*/ static struct iscsi_np *iscsit_get_np (struct __kernel_sockaddr_storage *sockaddr,int network_transport)
@@ -310,11 +313,10 @@ static struct iscsi_np *iscsit_get_np(struct iscsi_np *np;bool match; -spin_lock_bh (&np_lock);list_for_each_entry (np, &g_np_list, np_list) { -spin_lock (&np->np_thread_lock); +spin_lock_bh (&np->np_thread_lock);if (np->np_thread_state !=ISCSI_NP_THREAD_ACTIVE ) { -spin_unlock (&np->np_thread_lock); +spin_unlock_bh (&np->np_thread_lock);continue ; }
@@ -326,13 +328,11 @@ static struct iscsi_np *iscsit_get_np(* while iscsi_tpg_add_network_portal() is called. */ np->np_exports++; -spin_unlock (&np->np_thread_lock); -spin_unlock_bh (&np_lock); +spin_unlock_bh (&np->np_thread_lock);return np; } -spin_unlock (&np->np_thread_lock); +spin_unlock_bh (&np->np_thread_lock); } -spin_unlock_bh (&np_lock);return NULL ; }
@@ -346,16 +346,22 @@ struct iscsi_np *iscsit_add_np(struct sockaddr_in6 *sock_in6;struct iscsi_np *np;int ret; + +mutex_lock (&np_lock); +/* * Locate the existing struct iscsi_np if already active.. */ np =iscsit_get_np (sockaddr, network_transport); -if (np) +if (np) { +mutex_unlock (&np_lock);return np; + } np =kzalloc (sizeof (struct iscsi_np ),GFP_KERNEL );if (!np) {pr_err ("Unable to allocate memory for struct iscsi_np\n" ); +mutex_unlock (&np_lock);return ERR_PTR (-ENOMEM ); }
@@ -378,6 +384,7 @@ struct iscsi_np *iscsit_add_np( ret =iscsi_target_setup_login_socket (np, sockaddr);if (ret !=0 ) {kfree (np); +mutex_unlock (&np_lock);return ERR_PTR (ret); }
@@ -386,6 +393,7 @@ struct iscsi_np *iscsit_add_np(pr_err ("Unable to create kthread: iscsi_np\n" ); ret =PTR_ERR (np->np_thread);kfree (np); +mutex_unlock (&np_lock);return ERR_PTR (ret); }/*
@@ -396,10 +404,10 @@ struct iscsi_np *iscsit_add_np(* point because iscsi_np has not been added to g_np_list yet. */ np->np_exports =1 ; + np->np_thread_state =ISCSI_NP_THREAD_ACTIVE ; -spin_lock_bh (&np_lock);list_add_tail (&np->np_list, &g_np_list); -spin_unlock_bh (&np_lock); +mutex_unlock (&np_lock);pr_debug ("CORE[0] - Added Network Portal: %s:%hu on %s\n" , np->np_ip, np->np_port, np->np_transport->name);
@@ -469,9 +477,9 @@ int iscsit_del_np(struct iscsi_np *np) np->np_transport->iscsit_free_np (np); -spin_lock_bh (&np_lock); +mutex_lock (&np_lock);list_del (&np->np_list); -spin_unlock_bh (&np_lock); +mutex_unlock (&np_lock);pr_debug ("CORE[0] - Removed Network Portal: %s:%hu on %s\n" , np->np_ip, np->np_port, np->np_transport->name);
Greg Kroah-Hartman
maintainerPATCH 101/104 Btrfs: handle EAGAIN case properly in btrfs_drop_snapshot()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Shilong <[email protected]>
commit 90515e7f5d7d24cbb2a4038a3f1b5cfa2921aa17 upstream.
We may return early in btrfs_drop_snapshot(), we shouldn't call btrfs_std_err() for this case, fix it.
--- fs/btrfs/extent-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/extent-tree.c +1 -1
@@ -7491,7 +7491,7 @@ out:*/ if (root_dropped == false)btrfs_add_dead_root (root); -if (err) +if (err && err != -EAGAIN )btrfs_std_error (root->fs_info, err);return err; }
Greg Kroah-Hartman
maintainerPATCH 102/104 btrfs: restrict snapshotting to own subvolumes
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit d024206133ce21936b3d5780359afc00247655b7 upstream.
Currently, any user can snapshot any subvolume if the path is accessible and thus indirectly create and keep files he does not own under his direcotries. This is not possible with traditional directories.
In security context, a user can snapshot root filesystem and pin any potentially buggy binaries, even if the updates are applied.
All the snapshots are visible to the administrator, so it's possible to verify if there are suspicious snapshots.
Another more practical problem is that any user can pin the space used by eg. root and cause ENOSPC.
Original report:
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/484786
--- fs/btrfs/ioctl.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/btrfs/ioctl.c +6 -0
@@ -1528,6 +1528,12 @@ static noinline int btrfs_ioctl_snap_creprintk (KERN_INFO "btrfs: Snapshot src from " "another FS\n" ); ret = -EINVAL ; + }else if (!inode_owner_or_capable (src_inode)) { +/* +* Subvolume creation is not restricted, but snapshots +* are limited to own subvolumes only +*/ + ret = -EPERM ; }else { ret = btrfs_mksubvol(&file->f_path, name, namelen, BTRFS_I(src_inode)->root,
Greg Kroah-Hartman
maintainerPATCH 103/104 powerpc: Fix the setup of CPU-to-Node mappings during CPU online
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Srivatsa S. Bhat" <[email protected]>
commit d4edc5b6c480a0917e61d93d55531d7efa6230be upstream.
On POWER platforms, the hypervisor can notify the guest kernel about dynamic changes in the cpu-numa associativity (VPHN topology update). Hence the cpu-to-node mappings that we got from the firmware during boot, may no longer be valid after such updates. This is handled using the arch_update_cpu_topology() hook in the scheduler, and the sched-domains are rebuilt according to the new mappings.
But unfortunately, at the moment, CPU hotplug ignores these updated mappings and instead queries the firmware for the cpu-to-numa relationships and uses them during CPU online. So the kernel can end up assigning wrong NUMA nodes to CPUs during subsequent CPU hotplug online operations (after booting).
Further, a particularly problematic scenario can result from this bug:
On POWER platforms, the SMT mode can be switched between 1, 2, 4 (and even 8) threads per core. The switch to Single-Threaded (ST) mode is performed by offlining all except the first CPU thread in each core. Switching back to SMT mode involves onlining those other threads back, in each core.
Now consider this scenario:
1. During boot, the kernel gets the cpu-to-node mappings from the firmware and assigns the CPUs to NUMA nodes appropriately, during CPU online.
2. Later on, the hypervisor updates the cpu-to-node mappings dynamically and communicates this update to the kernel. The kernel in turn updates its cpu-to-node associations and rebuilds its sched domains. Everything is fine so far.
3. Now, the user switches the machine from SMT to ST mode (say, by running ppc64_cpu --smt=1). This involves offlining all except 1 thread in each core.
4. The user then tries to switch back from ST to SMT mode (say, by running ppc64_cpu --smt=4), and this involves onlining those threads back. Since CPU hotplug ignores the new mappings, it queries the firmware and tries to associate the newly onlined sibling threads to the old NUMA nodes. This results in sibling threads within the same core getting associated with different NUMA nodes, which is incorrect.
The scheduler's build-sched-domains code gets thoroughly confused with this and enters an infinite loop and causes soft-lockups, as explained in detail in commit 3be7db6ab (powerpc: VPHN topology change updates all siblings).
So to fix this, use the numa_cpu_lookup_table to remember the updated cpu-to-node mappings, and use them during CPU hotplug online operations. Further, we also need to ensure that all threads in a core are assigned to a common NUMA node, irrespective of whether all those threads were online during the topology update. To achieve this, we take care not to use cpu_sibling_mask() since it is not hotplug invariant. Instead, we use cpu_first_sibling_thread() and set up the mappings manually using the 'threads_per_core' value for that particular platform. This helps us ensure that we don't hit this bug with any combination of CPU hotplug and SMT mode switching.
--- arch/powerpc/include/asm/topology.h | 10 ++++- arch/powerpc/mm/numa.c | 70 ++++++++++++++++++++++++++++++++++-- 2 files changed, 76 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/topology.h +9 -1
@@ -22,7 +22,15 @@ struct device_node;static inline int cpu_to_node (int cpu) { -return numa_cpu_lookup_table[cpu]; +int nid; + + nid = numa_cpu_lookup_table[cpu]; + +/* +* During early boot, the numa-cpu lookup table might not have been +* setup for all CPUs yet. In such cases, default to node 0. +*/ +return (nid <0 ) ?0 : nid; }#define parent_node (node) (node)
arch/powerpc/mm/numa.c +67 -3
111 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 104/104 powerpc: Make sure "cache" directory is removed when offlining cpu
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Mackerras <[email protected]>
commit 91b973f90c1220d71923e7efe1e61f5329806380 upstream.
The code in remove_cache_dir() is supposed to remove the "cache" subdirectory from the sysfs directory for a CPU when that CPU is being offlined. It tries to do this by calling kobject_put() on the kobject for the subdirectory. However, the subdirectory only gets removed once the last reference goes away, and the reference being put here may well not be the last reference. That means that the "cache" subdirectory may still exist when the offlining operation has finished. If the same CPU subsequently gets onlined, the code tries to add a new "cache" subdirectory. If the old subdirectory has not yet been removed, we get a WARN_ON in the sysfs code, with stack trace, and an error message printed on the console. Further, we ultimately end up with an online cpu with no "cache" subdirectory.
This fixes it by doing an explicit kobject_del() at the point where we want the subdirectory to go away. kobject_del() removes the sysfs directory even though the object still exists in memory. The object will get freed at some point in the future. A subsequent onlining operation can create a new sysfs directory, even if the old object still exists in memory, without causing any problems.
--- arch/powerpc/kernel/cacheinfo.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/kernel/cacheinfo.c +3 -0
@@ -788,6 +788,9 @@ static void remove_cache_dir(struct cach {remove_index_dirs (cache_dir); +/* Remove cache dir from sysfs */ +kobject_del (cache_dir->kobj); +kobject_put (cache_dir->kobj);kfree (cache_dir);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.29 release. There are 104 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Feb 6 21:02:03 UTC 2014. Anything received after that time might be too late.
Version tested: v3.10.28-103
Build results:
total: total: 126 pass: 121 skipped: 4 fail: 1
qemu tests all passed.
Results are as expected.
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.29 release. There are 104 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Feb 6 21:02:03 UTC 2014. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.29-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patch applied cleanly. boot tests passed on all test systems. No dmesg regressions: emerg, crit, alert, err are clean. No regressions in warn.
Minor Note: git apply --index complained about extra white space at the end of patch file. patch -p1 worked just fine.
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658