3.12.44-stable review
Subsystems (3)
cover 3.12.44-stable review
This is the start of the stable review cycle for the 3.12.44 release. There are 111 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 Fri Jun 12 15:30:52 CEST 2015. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.44-rc1.xz
and the diffstat can be found below.
thanks,
js
===============
Al Viro (1):
d_walk() might skip too much
Alex Deucher (1):
drm/radeon: add new bonaire pci id
Alexander Stein (1):
W1: ds2490: Increase timeout when waiting for status
Alexei Starovoitov (1):
x86: bpf_jit: fix compilation of large bpf programs
Alexey Khoroshilov (1):
EDAC: Properly unwind on failure path in edac_init()
Andrew Morton (1):
fs/binfmt_elf.c:load_elf_binary(): return -EINVAL on zero-length
mappings
Andy Grover (1):
target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST
Anton Blanchard (1):
powerpc: Align TOC to 256 bytes
Aravind Gopalakrishnan (4):
amd64_edac: Add support for newer F16h models
hwmon: (k10temp) Add support for AMD F16 M30h processor
hwmon: (k10temp) Add support for F15h M60h perf/x86/amd/ibs: Update IBS MSRs and feature definitions
Arnd Bergmann (1):
staging: rtl8712, rtl8712: avoid lots of build warnings
Axel Lin (1):
ASoC: mc13783: Fix wrong mask value used in mc13xxx_reg_rmw() calls
Behan Webster (2):
staging, rtl8192e, LLVMLinux: Change extern inline to static inline staging, rtl8192e, LLVMLinux: Remove unused inline prototype
Benjamin Tissoires (1):
Input: elantech - fix semi-mt protocol for v3 HW
Cass May (1):
dgnc: Move DG_PART definition from Makefile to dgnc_driver.h
Chen Gang (3):
qla2xxx: remove redundant declaration in 'qla_gbl.h'
drivers: staging: dgap: move DG_NAME and DG_PART from "Makefile" to
"dgap_driver.h"
drivers: staging: rtl8188eu: use 'ccflags-y' instead of EXTRA_CFLAGS
in Makefile
Chris Lesiak (1):
hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGE
Christian König (2):
drm/radeon: fix VM_CONTEXT*_PAGE_TABLE_END_ADDR handling drm/radeon: partially revert "fix VM_CONTEXT*_PAGE_TABLE_END_ADDR
handling"
Dan Carpenter (2):
vhost/scsi: potential memory corruption
isdn: icn: use strlcpy() when parsing setup options
Darrick J. Wong (1):
jbd2: fix r_count overflows leading to buffer overflow in journal
recovery
David Fries (1):
cn: verify msg->len before making callback
David Henningsson (1):
ALSA: hda - Add Conexant codecs CX20721, CX20722, CX20723 and CX20724
David Vrabel (1):
xen/events: don't bind non-percpu VIRQs with percpu chip
Eric Dumazet (1):
udp: fix behavior of wrong checksums
Eric W. Biederman (2):
mnt: Fail collect_mounts when applied to unmounted mounts
ipv4: Avoid crashing in ip_error
Eryu Guan (1):
ext4: check for zero length extent explicitly
Finn Thain (1):
m68k/mac: Fix out-of-bounds array index in OSS IRQ source
initialization
Gabriele Mazzotta (2):
libata: Add helper to determine when PHY events should be ignored
libata: Ignore spurious PHY event on LPM policy change
Greg Kroah-Hartman (1):
staging: wlags49_h2: fix extern inline functions
Guenter Roeck (1):
hwmon: (nct6775) Add missing sysfs attribute initialization
Hans de Goede (1):
usb-storage: Add NO_WP_DETECT quirk for Lacie 059f:0651 devices
Harald Freudenberger (1):
crypto: s390/ghash - Fix incorrect ghash icv buffer handling.
Heinrich Schuchardt (1):
usb: chipidea: debug: avoid out of bound read
Ian Campbell (1):
xen: netback: read hotplug script once at start of day.
Ian Wilson (1):
netfilter: Zero the tuple in nfnl_cthelper_parse_tuple()
Ilya Dryomov (1):
libceph: request a new osdmap if lingering request maps to no osd
Jan Kara (1):
lib: Fix strnlen_user() to not touch memory after specified maximum
Janusz Dziedzic (1):
mac80211: move WEP tailroom size check
Jason A. Donenfeld (2):
USB: visor: Match I330 phone more precisely
USB: pl2303: Remove support for Samsung I330
Jean Delvare (1):
thermal: step_wise: Revert optimization
Jens Axboe (1):
aio: fix serial draining in exit_aio()
Jiri Kosina (1):
HID: debug: fix error handling in hid_debug_events_read()
Joe Lawrence (1):
xhci: gracefully handle xhci_irq dead device
Joerg Roedel (5):
iommu/amd: Return the pte page-size in fetch_pte iommu/amd: Optimize iommu_unmap_page for new fetch_pte interface iommu/amd: Optimize alloc_new_range for new fetch_pte interface iommu/amd: Optimize amd_iommu_iova_to_phys for new fetch_pte interface iommu/amd: Correctly encode huge pages in iommu page tables
Julia Lawall (1):
NFC: pn533: fix error return code
Junling Zheng (1):
net: socket: Fix the wrong returns for recvmsg and sendmsg
K. Y. Srinivasan (1):
storvsc: Set the SRB flags correctly when no data transfer is needed
Kirill A. Shutemov (1):
kernel: use the gnu89 standard explicitly
Konrad Rzeszutek Wilk (1):
config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected
Krzysztof Opasiak (1):
usb: gadget: configfs: Fix interfaces array NULL-termination
Larry Finger (1):
rtlwifi: rtl8192cu: Fix kernel deadlock
Lars Poeschel (1):
Input: usbtouchscreen - add new model from IRTOUCHSYSTEMS
Logan Gunthorpe (1):
Added another USB product ID for ELAN touchscreen quirks.
Ludovic Desroches (1):
mmc: atmel-mci: fix bad variable type for clkdiv
Lukas Czerner (1):
ext4: fix NULL pointer dereference when journal restart fails
Mark Edwards (1):
USB: cp210x: add ID for KCF Technologies PRN device
Mark Hounschell (1):
sd: Disable support for 256 byte/sector disks
Mark Salyzyn (1):
unix/caif: sk_socket can disappear when state is unlocked
Martin K. Petersen (2):
libata: Update Crucial/Micron blacklist
libata: Blacklist queued TRIM on all Samsung 800-series
Martin Kaiser (1):
gpio: squelch a compiler warning
Mathias Nyman (2):
xhci: fix isoc endpoint dequeue from advancing too far on transaction
error
xhci: Solve full event ring by increasing TRBS_PER_SEGMENT to 256
Mel Gorman (2):
mm: numa: initialise numa balancing after jump label initialisation mm, numa: really disable NUMA balancing by default on single node
machines
Michael Brunner (1):
gpio: gpio-kempld: Fix get_direction return value
Michal Hocko (1):
fork: report pid reservation failure properly
Ming-ting Yao Wei (1):
Input: xpad - add rumble support for Xbox One controller
NeilBrown (1):
md/raid5: don't record new size if resize_stripes fails.
Nicholas Mc Guire (1):
MIPS: KVM: Do not sign extend on unsigned MMIO load
Oleg Nesterov (1):
aio: change exit_aio() to load mm->ioctx_table once and avoid
rcu_read_lock()
Paolo Bonzini (1):
KVM: MMU: fix CR4.SMEP=1, CR0.WP=0 with shadow pages
Philippe Reynes (1):
ARM: dts: imx27: only map 4 Kbyte for fec registers
Rafael J. Wysocki (1):
ACPI / init: Fix the ordering of acpi_reserve_resources()
Richard Cochran (1):
net: dp83640: fix broken calibration routine.
Richard Guy Briggs (1):
lsm: copy comm before calling audit_log to avoid race in string
printing
Russell King (1):
ARM: fix missing syscall trace exit
Rusty Russell (1):
lguest: fix out-by-one error in address checking.
Sasha Levin (2):
fs, omfs: add NULL terminator in the end up the token list
vfs: read file_handle only once in handle_to_path
Scott Branden (1):
rt2x00: add new rt2800usb device DWA 130
Scott Mayhew (1):
svcrpc: fix potential GSSX_ACCEPT_SEC_CONTEXT decoding failures
Stephan Mueller (2):
crypto: rng - RNGs must return 0 in success case
crypto: testmgr - fix RNG return code enforcement
Steve French (1):
Fix corrupt SMB2 ioctl requests
Takashi Iwai (1):
ALSA: hda - Add headphone quirk for Lifebook E752
Ted Mielczarek (1):
Input: xpad - add support for Xbox One controllers
Thadeu Lima de Souza Cascardo (1):
bridge: fix parsing of MLDv2 reports
Tomas Henzl (3):
hpsa: refine the pci enable/disable handling
hpsa: add missing pci_set_master in kdump path
hpsa: turn off interrupts when kdump starts
Tomeu Vizoso (1):
Input: cros_ec_keyb - fix clearing keyboard state on wakeup
Tommi Rantala (1):
Input: xpad - add Thrustmaster as Xbox 360 controller vendor
WANG Cong (1):
net_sched: invoke ->attach() after setting dev->qdisc
Zidan Wang (2):
ASoC: wm8960: fix "RINPUT3" audio route error
ASoC: wm8994: correct BCLK DIV 348 to 384
[email protected] (1):
powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds
the allowed address space
Documentation/hwmon/k10temp | 6 +- Makefile | 6 +- arch/arm/boot/dts/imx27.dtsi | 2 +- arch/arm/kernel/entry-common.S | 4 +- arch/m68k/mac/oss.c | 3 +- arch/mips/kvm/kvm_mips_emul.c | 2 +- arch/powerpc/kernel/vmlinux.lds.S | 1 + arch/powerpc/mm/slice.c | 2 +- arch/s390/crypto/ghash_s390.c | 25 +-- arch/x86/Kconfig | 2 +- arch/x86/include/asm/perf_event.h | 3 + arch/x86/include/uapi/asm/msr-index.h | 1 + arch/x86/kernel/amd_nb.c | 2 + arch/x86/kernel/cpu/perf_event_amd_ibs.c | 15 ++ arch/x86/kvm/mmu.c | 2 +- arch/x86/net/bpf_jit_comp.c | 7 +- crypto/ansi_cprng.c | 6 +- crypto/testmgr.c | 6 +- drivers/acpi/osl.c | 6 +- drivers/ata/libahci.c | 3 +- drivers/ata/libata-core.c | 41 ++++- drivers/ata/libata-eh.c | 3 + drivers/connector/connector.c | 6 + drivers/edac/amd64_edac.c | 24 +++ drivers/edac/amd64_edac.h | 3 + drivers/edac/edac_mc_sysfs.c | 4 +- drivers/edac/edac_module.c | 13 +- drivers/gpio/gpio-kempld.c | 2 +- drivers/gpio/gpiolib-of.c | 2 +- drivers/gpu/drm/radeon/cik.c | 2 +- drivers/gpu/drm/radeon/ni.c | 3 +- drivers/gpu/drm/radeon/si.c | 2 +- drivers/hid/hid-debug.c | 3 +- drivers/hwmon/Kconfig | 4 +- drivers/hwmon/k10temp.c | 36 ++++- drivers/hwmon/nct6775.c | 2 + drivers/hwmon/ntc_thermistor.c | 9 ++ drivers/input/joystick/xpad.c | 192 ++++++++++++++++++++++-- drivers/input/keyboard/cros_ec_keyb.c | 2 +- drivers/input/mouse/elantech.c | 2 +- drivers/input/touchscreen/usbtouchscreen.c | 11 ++ drivers/iommu/amd_iommu.c | 109 ++++++-------- drivers/iommu/amd_iommu_types.h | 6 + drivers/isdn/icn/icn.c | 2 +- drivers/lguest/core.c | 2 +- drivers/md/raid5.c | 3 +- drivers/mmc/host/atmel-mci.c | 9 +- drivers/net/phy/dp83640.c | 2 +- drivers/net/wireless/rt2x00/rt2800usb.c | 1 + drivers/net/wireless/rtlwifi/usb.c | 2 +- drivers/net/xen-netback/xenbus.c | 33 ++-- drivers/nfc/pn533.c | 4 +- drivers/scsi/hpsa.c | 52 +++++-- drivers/scsi/qla2xxx/qla_gbl.h | 2 - drivers/scsi/qla2xxx/qla_nx2.c | 2 +- drivers/scsi/sd.c | 19 +-- drivers/scsi/storvsc_drv.c | 3 +- drivers/staging/dgap/Makefile | 2 - drivers/staging/dgap/dgap_driver.h | 3 + drivers/staging/dgnc/Makefile | 2 - drivers/staging/dgnc/dgnc_driver.h | 2 + drivers/staging/rtl8187se/ieee80211/ieee80211.h | 4 +- drivers/staging/rtl8188eu/Makefile | 4 +- drivers/staging/rtl8192e/rtllib.h | 5 +- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 10 +- drivers/staging/rtl8712/ieee80211.h | 4 +- drivers/staging/wlags49_h2/wl_internal.h | 4 +- drivers/target/target_core_pscsi.c | 3 + drivers/target/target_core_pscsi.h | 1 + drivers/thermal/step_wise.c | 3 - drivers/tty/hvc/hvc_xen.c | 2 +- drivers/usb/chipidea/debug.c | 6 +- drivers/usb/core/quirks.c | 3 + drivers/usb/gadget/configfs.c | 1 + drivers/usb/host/xhci-ring.c | 7 +- drivers/usb/host/xhci.h | 2 +- drivers/usb/serial/cp210x.c | 1 + drivers/usb/serial/pl2303.c | 1 - drivers/usb/serial/pl2303.h | 4 - drivers/usb/serial/visor.c | 2 +- drivers/usb/storage/unusual_devs.h | 7 + drivers/vhost/scsi.c | 6 +- drivers/w1/masters/ds2490.c | 2 +- drivers/xen/events.c | 12 +- fs/aio.c | 83 +++++----- fs/binfmt_elf.c | 2 +- fs/cifs/smb2pdu.c | 21 ++- fs/dcache.c | 8 +- fs/ext4/ext4_jbd2.c | 6 + fs/ext4/extents.c | 2 +- fs/fhandle.c | 5 +- fs/jbd2/recovery.c | 10 +- fs/jbd2/revoke.c | 18 ++- fs/jbd2/transaction.c | 25 +-- fs/namespace.c | 7 +- fs/omfs/inode.c | 3 +- include/drm/drm_pciids.h | 1 + include/linux/libata.h | 10 ++ include/linux/pci_ids.h | 2 + include/xen/events.h | 2 +- kernel/fork.c | 5 +- kernel/pid.c | 15 +- lib/strnlen_user.c | 3 +- mm/mempolicy.c | 18 ++- net/bridge/br_multicast.c | 2 +- net/caif/caif_socket.c | 8 + net/ceph/osd_client.c | 31 ++-- net/ipv4/route.c | 4 + net/ipv4/udp.c | 6 +- net/ipv6/udp.c | 6 +- net/mac80211/wep.c | 6 +- net/netfilter/nfnetlink_cthelper.c | 3 + net/sched/sch_api.c | 10 +- net/socket.c | 24 ++- net/sunrpc/auth_gss/gss_rpc_xdr.c | 23 ++- net/unix/af_unix.c | 8 + security/lsm_audit.c | 15 +- sound/pci/hda/patch_conexant.c | 12 ++ sound/pci/hda/patch_realtek.c | 1 + sound/soc/codecs/mc13783.c | 4 +- sound/soc/codecs/wm8960.c | 2 +- sound/soc/codecs/wm8994.c | 2 +- 123 files changed, 857 insertions(+), 382 deletions(-)
Signature · 1 line
2.4.2
PATCH 1/111 netfilter: Zero the tuple in nfnl_cthelper_parse_tuple()
From: Ian Wilson <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ upstream commit 78146572b9cd20452da47951812f35b1ad4906be ]
nfnl_cthelper_parse_tuple() is called from nfnl_cthelper_new(), nfnl_cthelper_get() and nfnl_cthelper_del(). In each case they pass a pointer to an nf_conntrack_tuple data structure local variable:
struct nf_conntrack_tuple tuple;
...
ret = nfnl_cthelper_parse_tuple(&tuple, tb[NFCTH_TUPLE]);The problem is that this local variable is not initialized, and nfnl_cthelper_parse_tuple() only initializes two fields: src.l3num and dst.protonum. This leaves all other fields with undefined values based on whatever is on the stack:
tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM]));
tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]);The symptom observed was that when the rpc and tns helpers were added then traffic to port 1536 was being sent to user-space.
--- net/netfilter/nfnetlink_cthelper.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nfnetlink_cthelper.c +3 -0
@@ -77,6 +77,9 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple,if (!tb[NFCTH_TUPLE_L3PROTONUM ] || !tb[NFCTH_TUPLE_L4PROTONUM ])return -EINVAL ; +/* Not all fields are initialized so first zero the tuple */ +memset (tuple,0 ,sizeof (struct nf_conntrack_tuple )); + tuple->src.l3num =ntohs (nla_get_be16 (tb[NFCTH_TUPLE_L3PROTONUM ])); tuple->dst.protonum =nla_get_u8 (tb[NFCTH_TUPLE_L4PROTONUM ]);
Signature · 1 line
2.4.2
PATCH 2/111 gpio: squelch a compiler warning
From: Martin Kaiser <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
drivers/gpio/gpiolib-of.c: In function 'of_gpiochip_find_and_xlate':drivers/gpio/gpiolib-of.c:52:21: warning: assignment makes integer from pointer without a cast [enabled by default]
gg_data->out_gpio = ERR_PTR(ret);
^This was introduced in 72464765733575dc89c509f16caabc2af47fda79, a backport of upstream commit 7b8792bbdffdff3abda704f89c6a45ea97afdc62.
The upstream kernel changed the type of out_gpio from int to struct gpio_desc * as part of a larger refactoring that wasn't backported
--- drivers/gpio/gpiolib-of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-of.c +1 -1
@@ -49,7 +49,7 @@ static int of_gpiochip_find_and_xlate(struct gpio_chip *gc, void *data)* Return false to keep looking, as more than one gpio chip * could be registered per of-node. */ - gg_data->out_gpio =ERR_PTR (ret); + gg_data->out_gpio = ret;return false; }
Signature · 1 line
2.4.2
PATCH 3/111 libata: Update Crucial/Micron blacklist
In reply to Jiri SlabyFrom: "Martin K. Petersen" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ff7f53fb82a7801a778e5902bdbbc5e195ab0de0 upstream.
Micron has released an updated firmware (MU02) for M510/M550/MX100 drives to fix the issues with queued TRIM. Queued TRIM remains broken on M500 but is working fine on later drives such as M600 and MX200.
Tweak our blacklist to reflect the above.
--- drivers/ata/libata-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/ata/libata-core.c +4 -3
@@ -4225,9 +4225,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {/* devices that don't properly handle queued TRIM commands */ { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Crucial_CT*M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Micron_M5[15]0*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, { "Samsung SSD 850 PRO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },/*
Signature · 1 line
2.4.2
PATCH 4/111 libata: Blacklist queued TRIM on all Samsung 800-series
In reply to Jiri SlabyFrom: "Martin K. Petersen" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9a9324d3969678d44b330e1230ad2c8ae67acf81 upstream.
The queued TRIM problems appear to be generic to Samsung's firmware and not tied to a particular model. A recent update to the 840 EVO firmware introduced the same issue as we saw on 850 Pro.
Blacklist queued TRIM on all 800-series drives while we work this issue with Samsung.
--- drivers/ata/libata-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/libata-core.c +1 -1
@@ -4229,7 +4229,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { { "Micron_M5[15]0*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM, }, - { "Samsung SSD 850 PRO*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, + { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, },/* * Some WD SATA-I drives spin up and down erratically when the link
Signature · 1 line
2.4.2
PATCH 5/111 config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected
In reply to Jiri SlabyFrom: Konrad Rzeszutek Wilk <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a6dfa128ce5c414ab46b1d690f7a1b8decb8526d upstream.
A huge amount of NIC drivers use the DMA API, however if compiled under 32-bit an very important part of the DMA API can be ommitted leading to the drivers not working at all (especially if used with 'swiotlb=force iommu=soft').
As Prashant Sreedharan explains it: "the driver [tg3] uses DEFINE_DMA_UNMAP_ADDR(), dma_unmap_addr_set() to keep a copy of the dma "mapping" and dma_unmap_addr() to get the "mapping" value. On most of the platforms this is a no-op, but ... with "iommu=soft and swiotlb=force" this house keeping is required, ... otherwise we pass 0 while calling pci_unmap_/pci_dma_sync_ instead of the DMA address."
As such enable this even when using 32-bit kernels.
--- arch/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
@@ -156,7 +156,7 @@ config SBUS config NEED_DMA_MAP_STATE def_bool y - depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG + depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB config NEED_SG_DMA_LENGTH def_bool y
Signature · 1 line
2.4.2
PATCH 6/111 hpsa: refine the pci enable/disable handling
In reply to Jiri SlabyFrom: Tomas Henzl <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 132aa220b45d60e9b20def1e9d8be9422eed9616 upstream.
When a second(kdump) kernel starts and the hard reset method is used the driver calls pci_disable_device without previously enabling it, so the kernel shows a warning -
[ 16.876248] WARNING: at drivers/pci/pci.c:1431 pci_disable_device+0x84/0x90() [ 16.882686] Device hpsa
disabling already-disabled device
...
This patch fixes it, in addition to this I tried to balance also some other pairs of enable/disable device in the driver.
Unfortunately I wasn't able to verify the functionality for the case of a sw reset, because of a lack of proper hw.
--- drivers/scsi/hpsa.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
drivers/scsi/hpsa.c +28 -14
@@ -3920,10 +3920,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev)/* Save the PCI command register */ pci_read_config_word (pdev,4 , &command_register); -/* Turn the board off. This is so that later pci_restore_state() -* won't turn the board on before the rest of config space is ready. -*/ -pci_disable_device (pdev);pci_save_state (pdev);/* find the first memory BAR, so we can find the cfg table */
@@ -3971,11 +3967,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) goto unmap_cfgtable;pci_restore_state (pdev); - rc =pci_enable_device (pdev); -if (rc) { -dev_warn (&pdev->dev,"failed to enable device.\n" ); - goto unmap_cfgtable; - }pci_write_config_word (pdev,4 , command_register);/* Some devices (notably the HP Smart Array 5i Controller)
@@ -4470,6 +4461,23 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)if (!reset_devices)return 0 ; +/* kdump kernel is loading, we don't know in which state is +* the pci interface. The dev->enable_cnt is equal zero +* so we call enable+disable, wait a while and switch it on. +*/ + rc =pci_enable_device (pdev); +if (rc) { +dev_warn (&pdev->dev,"Failed to enable PCI device\n" ); +return -ENODEV ; + } +pci_disable_device (pdev); +msleep (260 );/* a randomly chosen number */ + rc =pci_enable_device (pdev); +if (rc) { +dev_warn (&pdev->dev,"failed to enable device.\n" ); +return -ENODEV ; + } +/* Reset the controller with a PCI power-cycle or via doorbell */ rc =hpsa_kdump_hard_reset_controller (pdev);
@@ -4478,10 +4486,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)* "performant mode". Or, it might be 640x, which can't reset * due to concerns about shared bbwc between 6402/6404 pair. */ -if (rc == -ENOTSUPP ) -return rc;/* just try to do the kdump anyhow. */ -if (rc) -return -ENODEV ; +if (rc) { +if (rc != -ENOTSUPP )/* just try to do the kdump anyhow. */ + rc = -ENODEV ; + goto out_disable; + }/* Now try to get the controller to respond to a no-op */ dev_warn (&pdev->dev,"Waiting for controller to respond to no-op\n" );
@@ -4492,7 +4501,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)dev_warn (&pdev->dev,"no-op failed%s\n" , (i <11 ?"; re-trying" :"" )); } -return 0 ; + +out_disable: + +pci_disable_device (pdev); +return rc; }static int hpsa_allocate_cmd_pool (struct ctlr_info *h)
@@ -4635,6 +4648,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h)iounmap (h->transtable);if (h->cfgtable)iounmap (h->cfgtable); +pci_disable_device (h->pdev);pci_release_regions (h->pdev);kfree (h); }
Signature · 1 line
2.4.2
PATCH 7/111 hpsa: add missing pci_set_master in kdump path
In reply to Jiri SlabyFrom: Tomas Henzl <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 859c75aba20264d87dd026bab0d0ca3bff385955 upstream.
Add a call to pci_set_master(...) missing in the previous patch "hpsa: refine the pci enable/disable handling". Found thanks to Rob Elliot.
--- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
@@ -4477,7 +4477,7 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)dev_warn (&pdev->dev,"failed to enable device.\n" );return -ENODEV ; } - +pci_set_master (pdev);/* Reset the controller with a PCI power-cycle or via doorbell */ rc =hpsa_kdump_hard_reset_controller (pdev);
Signature · 1 line
2.4.2
PATCH 8/111 hpsa: turn off interrupts when kdump starts
In reply to Jiri SlabyFrom: Tomas Henzl <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3b747298786355c6934b0892fc9ae4ca44105192 upstream.
Sometimes when the card is restarted it may cause - "irq 16: nobody cared (try booting with the "irqpoll" option)" that is likely caused so, that the card, after the hard reset finishes, pulls on the irq. Disabling the ints before or after the hpsa_kdump_hard_reset_controller fixes it.
At this point we can't know in which state the card is,
so using SA5_INTR_OFF + SA5_REPLY_INTR_MASK_OFFSET defines directly, instead of the function the drivers provides, seems to be apropriate.
--- drivers/scsi/hpsa.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/scsi/hpsa.c +10 -0
@@ -4457,6 +4457,7 @@ static void hpsa_hba_inquiry(struct ctlr_info *h)static int hpsa_init_reset_devices (struct pci_dev *pdev) {int rc, i; +void __iomem *vaddr;if (!reset_devices)return 0 ;
@@ -4478,6 +4479,15 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)return -ENODEV ; }pci_set_master (pdev); + + vaddr =pci_ioremap_bar (pdev,0 ); +if (vaddr ==NULL ) { + rc = -ENOMEM ; + goto out_disable; + } +writel (SA5_INTR_OFF , vaddr +SA5_REPLY_INTR_MASK_OFFSET ); +iounmap (vaddr); +/* Reset the controller with a PCI power-cycle or via doorbell */ rc =hpsa_kdump_hard_reset_controller (pdev);
Signature · 1 line
2.4.2
PATCH 9/111 aio: change exit_aio() to load mm->ioctx_table once and avoid rcu_read_lock()
In reply to Jiri SlabyFrom: Oleg Nesterov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 4b70ac5fd9b58bfaa5f25b4ea48f528aefbf3308 upstream.
Quoted 12 lines · Benjamin LaHaise
Review
Quoted 8 lines
(quoted diff) +4
-3- ctx->mmap_size = 0; - - kill_ioctx(mm, ctx, NULL); + if (ctx) { + ctx->mmap_size = 0; + kill_ioctx(mm, ctx, NULL); + }Rather than indenting and moving the two lines changing
mmap_sizeand thekill_ioctx()call, why not just do "if (!ctx) ... continue;"? That reduces the number of lines changed and avoid excessive indentation.
OK. To me the code looks better/simpler with "if (ctx)", but this is subjective of course, I won't argue.
The patch still removes the empty line between mmap_size = 0 and kill_ioctx(), we reset mmap_size only for kill_ioctx(). But feel free to remove this change.
-------------------------------------------------------------------------------
Subject: [PATCH v3 1/2] aio: change exit_aio() to load mm->ioctx_table once and avoid rcu_read_lock()
1. We can read ->ioctx_table only once and we do not read rcu_read_lock() or even rcu_dereference().
This mm has no users, nobody else can play with ->ioctx_table. Otherwise the code is buggy anyway, if we need rcu_read_lock() in a loop because ->ioctx_table can be updated then kfree(table) is obviously wrong.
2. Update the comment. "exit_mmap(mm) is coming" is the good reason to avoid munmap(), but another reason is that we simply can't do vm_munmap() unless current->mm == mm and this is not true in general, the caller is mmput().
3. We do not really need to nullify mm->ioctx_table before return, probably the current code does this to catch the potential problems. But in this case RCU_INIT_POINTER(NULL) looks better.
--- fs/aio.c | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-)
fs/aio.c +17 -27
@@ -801,38 +801,25 @@ EXPORT_SYMBOL(wait_on_sync_kiocb);*/ void exit_aio (struct mm_struct *mm) { -struct kioctx_table *table; -struct kioctx *ctx; -unsigned i =0 ; +struct kioctx_table *table =rcu_dereference_raw (mm->ioctx_table); +int i; -while (1 ) { +if (!table) +return ; + +for (i =0 ; i < table->nr; ++i) { +struct kioctx *ctx = table->table[i];struct completion requests_done =COMPLETION_INITIALIZER_ONSTACK (requests_done); -rcu_read_lock (); - table =rcu_dereference (mm->ioctx_table); - -do { -if (!table || i >= table->nr) { -rcu_read_unlock (); -rcu_assign_pointer (mm->ioctx_table,NULL ); -if (table) -kfree (table); -return ; - } - - ctx = table->table[i++]; - }while (!ctx); - -rcu_read_unlock (); - +if (!ctx) +continue ;/* -* We don't need to bother with munmap() here - -* exit_mmap(mm) is coming and it'll unmap everything. -* Since aio_free_ring() uses non-zero ->mmap_size -* as indicator that it needs to unmap the area, -* just set it to 0; aio_free_ring() is the only -* place that uses ->mmap_size, so it's safe. +* We don't need to bother with munmap() here - exit_mmap(mm) +* is coming and it'll unmap everything. And we simply can't, +* this is not necessarily our ->mm. +* Since kill_ioctx() uses non-zero ->mmap_size as indicator +* that it needs to unmap the area, just set it to 0. */ ctx->mmap_size =0 ;
@@ -841,6 +828,9 @@ void exit_aio(struct mm_struct *mm)/* Wait until all IO for the context are done. */ wait_for_completion (&requests_done); } + +RCU_INIT_POINTER (mm->ioctx_table,NULL ); +kfree (table); }static void put_reqs_available (struct kioctx *ctx,unsigned nr)
Signature · 1 line
2.4.2
PATCH 10/111 aio: fix serial draining in exit_aio()
In reply to Jiri SlabyFrom: Jens Axboe <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit dc48e56d761610da4ea1088d1bea0a030b8e3e43 upstream.
exit_aio() currently serializes killing io contexts. Each context killing ends up having to do percpu_ref_kill(), which in turns has to wait for an RCU grace period. This can take a long time, depending on the number of contexts. And there's no point in doing them serially, when we could be waiting for all of them in one fell swoop.
This patches makes my fio thread offload test case exit 0.2s instead of almost 6s.
--- fs/aio.c | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-)
fs/aio.c +32 -17
@@ -77,6 +77,11 @@ struct kioctx_cpu {unsigned reqs_available; }; +struct ctx_rq_wait { +struct completion comp; +atomic_t count; +}; +struct kioctx {struct percpu_ref users;atomic_t dead;
@@ -115,7 +120,7 @@ struct kioctx {/* * signals when all in-flight requests are done */ -struct completion *requests_done; +struct ctx_rq_wait *rq_wait;struct {/*
@@ -521,8 +526,8 @@ static void free_ioctx_reqs(struct percpu_ref *ref) struct kioctx *ctx = container_of(ref, struct kioctx, reqs);/* At this point we know that there are no any in-flight requests */ -if (ctx->requests_done) -complete (ctx->requests_done); +if (ctx->rq_wait &&atomic_dec_and_test (&ctx->rq_wait->count)) +complete (&ctx->rq_wait->comp);INIT_WORK (&ctx->free_work, free_ioctx);schedule_work (&ctx->free_work);
@@ -738,7 +743,7 @@ err:* the rapid destruction of the kioctx. */ static void kill_ioctx (struct mm_struct *mm,struct kioctx *ctx, -struct completion *requests_done) +struct ctx_rq_wait *wait) {if (!atomic_xchg (&ctx->dead,1 )) {struct kioctx_table *table;
@@ -767,11 +772,11 @@ static void kill_ioctx(struct mm_struct *mm, struct kioctx *ctx,if (ctx->mmap_size)vm_munmap (ctx->mmap_base, ctx->mmap_size); - ctx->requests_done = requests_done; + ctx->rq_wait = wait;percpu_ref_kill (&ctx->users); }else { -if (requests_done) -complete (requests_done); +if (wait &&atomic_dec_and_test (&wait->count)) +complete (&wait->comp); } }
@@ -802,18 +807,24 @@ EXPORT_SYMBOL(wait_on_sync_kiocb);void exit_aio (struct mm_struct *mm) {struct kioctx_table *table =rcu_dereference_raw (mm->ioctx_table); -int i; +struct ctx_rq_wait wait; +int i, skipped;if (!table)return ; +atomic_set (&wait.count, table->nr); +init_completion (&wait.comp); + + skipped =0 ;for (i =0 ; i < table->nr; ++i) {struct kioctx *ctx = table->table[i]; -struct completion requests_done = -COMPLETION_INITIALIZER_ONSTACK (requests_done); -if (!ctx) +if (!ctx) { + skipped++;continue ; + } +/* * We don't need to bother with munmap() here - exit_mmap(mm) * is coming and it'll unmap everything. And we simply can't,
@@ -823,10 +834,12 @@ void exit_aio(struct mm_struct *mm)*/ ctx->mmap_size =0 ; -kill_ioctx (mm, ctx, &requests_done); +kill_ioctx (mm, ctx, &wait); + } +if (!atomic_sub_and_test (skipped, &wait.count)) {/* Wait until all IO for the context are done. */ -wait_for_completion (&requests_done); +wait_for_completion (&wait.comp); }RCU_INIT_POINTER (mm->ioctx_table,NULL );
@@ -1238,21 +1251,23 @@ SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx) {struct kioctx *ioctx =lookup_ioctx (ctx);if (likely (NULL != ioctx)) { -struct completion requests_done = -COMPLETION_INITIALIZER_ONSTACK (requests_done); +struct ctx_rq_wait wait; + +init_completion (&wait.comp); +atomic_set (&wait.count,1 );/* Pass requests_done to kill_ioctx() where it can be set * in a thread-safe way. If we try to set it here then we have * a race condition if two io_destroy() called simultaneously. */ -kill_ioctx (current->mm, ioctx, &requests_done); +kill_ioctx (current->mm, ioctx, &wait);percpu_ref_put (&ioctx->users);/* Wait until all IO for the context are done. Otherwise kernel * keep using user-space buffers even if user thinks the context * is destroyed. */ -wait_for_completion (&requests_done); +wait_for_completion (&wait.comp);return 0 ; }
Signature · 1 line
2.4.2
PATCH 11/111 mnt: Fail collect_mounts when applied to unmounted mounts
In reply to Jiri SlabyFrom: "Eric W. Biederman" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cd4a40174b71acd021877341684d8bb1dc8ea4ae upstream.
The only users of collect_mounts are in audit_tree.c
In audit_trim_trees and audit_add_tree_rule the path passed into collect_mounts is generated from kern_path passed an audit_tree
pathname which is guaranteed to be an absolute path. In those casescollect_mounts is obviously intended to work on mounted paths and if a race results in paths that are unmounted when collect_mounts it is reasonable to fail early.
The paths passed into audit_tag_tree don't have the absolute path check. But are used to play with fsnotify and otherwise interact with the audit_trees, so again operating only on mounted paths appears reasonable.
Avoid having to worry about what happens when we try and audit unmounted filesystems by restricting collect_mounts to mounts that appear in the mount tree.
--- fs/namespace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/namespace.c +5 -2
@@ -1467,8 +1467,11 @@ struct vfsmount *collect_mounts(struct path *path) {struct mount *tree;namespace_lock (); - tree =copy_tree (real_mount (path->mnt), path->dentry, -CL_COPY_ALL |CL_PRIVATE ); +if (!check_mnt (real_mount (path->mnt))) + tree =ERR_PTR (-EINVAL ); +else + tree =copy_tree (real_mount (path->mnt), path->dentry, +CL_COPY_ALL |CL_PRIVATE );namespace_unlock ();if (IS_ERR (tree))return ERR_CAST (tree);
Signature · 1 line
2.4.2
PATCH 12/111 cn: verify msg->len before making callback
In reply to Jiri SlabyFrom: David Fries <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a30cfa475d1a26c18f1998ba1e034a4e2ab4c7a8 upstream.
The struct cn_msg len field comes from userspace and needs to be validated. More logical to do so here where the cn_msg pointer is pulled out of the sk_buff than the callback which is passed cn_msg * and might assume no validation is needed.
--- drivers/connector/connector.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/connector/connector.c +6 -0
@@ -122,12 +122,18 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);*/ static int cn_call_callback (struct sk_buff *skb) { +struct nlmsghdr *nlh;struct cn_callback_entry *i, *cbq =NULL ;struct cn_dev *dev = &cdev;struct cn_msg *msg =nlmsg_data (nlmsg_hdr (skb));struct netlink_skb_parms *nsp = &NETLINK_CB (skb);int err = -ENODEV ; +/* verify msg->len is within skb */ + nlh =nlmsg_hdr (skb); +if (nlh->nlmsg_len <NLMSG_HDRLEN +sizeof (struct cn_msg ) + msg->len) +return -EINVAL ; +spin_lock_bh (&dev->cbdev->queue_lock);list_for_each_entry (i, &dev->cbdev->queue_list, callback_entry) {if (cn_cb_equal (&i->id.id, &msg->id)) {
Signature · 1 line
2.4.2
PATCH 13/111 HID: debug: fix error handling in hid_debug_events_read()
In reply to Jiri SlabyFrom: Jiri Kosina <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8fec02a73e31407e14986fca67dab48d4f777f0e upstream.
In the unlikely case of hdev vanishing while hid_debug_events_read() was sleeping, we can't really break out of the case switch as with other cases, as on the way out we'll try to remove ourselves from the hdev waitqueue.
Fix this by taking a shortcut exit path and avoiding cleanup that doesn't make sense in case hdev doesn't exist any more anyway.
--- drivers/hid/hid-debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-debug.c +2 -1
@@ -1027,7 +1027,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,if (!list->hdev || !list->hdev->debug) { ret = -EIO ; -break ; +set_current_state (TASK_RUNNING ); + goto out; }/* allow O_NONBLOCK from other threads */
Signature · 1 line
2.4.2
PATCH 14/111 Input: usbtouchscreen - add new model from IRTOUCHSYSTEMS
In reply to Jiri SlabyFrom: Lars Poeschel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit dbea4032f8024e5ea886341f7c39cf023e30e828 upstream.
This adds support for another model of IRTOUCH SYSTEMS Co.,LtD infrared touchscreens. The USB vendorID/deviceID is 6615/0012. It is also sold under the label "Elektrosil".
The datasheet states that coordinates for x and y are in the range from 0 to 32767.
--- drivers/input/touchscreen/usbtouchscreen.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/input/touchscreen/usbtouchscreen.c +11 -0
@@ -133,6 +133,7 @@ enum {DEVTYPE_GUNZE ,DEVTYPE_DMC_TSC10 ,DEVTYPE_IRTOUCH , +DEVTYPE_IRTOUCH_HIRES ,DEVTYPE_IDEALTEK ,DEVTYPE_GENERAL_TOUCH , DEVTYPE_GOTOP,
@@ -199,6 +200,7 @@ static const struct usb_device_id usbtouch_devices[] = { #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH}, + {USB_DEVICE(0x6615, 0x0012), .driver_info = DEVTYPE_IRTOUCH_HIRES}, #endif #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
@@ -1178,6 +1180,15 @@ static struct usbtouch_device_info usbtouch_dev_info[] = { .rept_size = 8, .read_data = irtouch_read_data, }, + + [DEVTYPE_IRTOUCH_HIRES] = { + .min_xc = 0x0, + .max_xc = 0x7fff, + .min_yc = 0x0, + .max_yc = 0x7fff, + .rept_size = 8, + .read_data = irtouch_read_data, + },#endif #ifdef CONFIG_TOUCHSCREEN_USB_IDEALTEK
Signature · 1 line
2.4.2
PATCH 15/111 Input: cros_ec_keyb - fix clearing keyboard state on wakeup
In reply to Jiri SlabyFrom: Tomeu Vizoso <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ef30a406468a3eae007210ae0dc5ed8d5eb59b7d upstream.
As the comment right before explains, the keyboard state is to be cleared only if the EC wasn't a wakeup source in the last suspend.
Without this commit, there's an unneeded delay when resuming from suspend and we also lose the key that was pressed while suspended.
--- drivers/input/keyboard/cros_ec_keyb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/cros_ec_keyb.c +1 -1
@@ -309,7 +309,7 @@ static int cros_ec_keyb_resume(struct device *dev)* wake source (e.g. the lid is open and the user might press a key to * wake) then the key scan buffer should be preserved. */ -if (ckdev->ec->was_wake_device) +if (!ckdev->ec->was_wake_device)cros_ec_keyb_clear_keyboard (ckdev);return 0 ;
Signature · 1 line
2.4.2
PATCH 16/111 Input: xpad - add support for Xbox One controllers
In reply to Jiri SlabyFrom: Ted Mielczarek <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1a48ff81b3912be5fadae3fafde6c2f632246a4c upstream.
Xbox One controllers require an initialization message to start sending data, so xpad_init_output becomes a required function. The Xbox One controller does not have LEDs like the Xbox 360 controller, so that functionality is not implemented. The format of messages controlling rumble is currently undocumented, so rumble support is not yet implemented.
Note that Xbox One controller advertises three interfaces with the same interface class, subclass and protocol, so we have to also match against interface number.
--- drivers/input/joystick/xpad.c | 174 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 157 insertions(+), 17 deletions(-)
drivers/input/joystick/xpad.c +157 -17
@@ -96,7 +96,8 @@#define XTYPE_XBOX 0#define XTYPE_XBOX360 1#define XTYPE_XBOX360W 2 -#define XTYPE_UNKNOWN 3 +#define XTYPE_XBOXONE 3 +#define XTYPE_UNKNOWN 4static bool dpad_to_buttons;module_param (dpad_to_buttons, bool,S_IRUGO );
@@ -122,6 +123,7 @@ static const struct xpad_device { { 0x045e, 0x0287, "Microsoft Xbox Controller S", 0, XTYPE_XBOX }, { 0x045e, 0x0289, "Microsoft X-Box pad v2 (US)", 0, XTYPE_XBOX }, { 0x045e, 0x028e, "Microsoft X-Box 360 pad", 0, XTYPE_XBOX360 }, + { 0x045e, 0x02d1, "Microsoft X-Box One pad", 0, XTYPE_XBOXONE }, { 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, { 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W }, { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
@@ -264,10 +266,12 @@ static const signed short xpad_abs_triggers[] = { -1 }; -/* Xbox 360 has a vendor-specific class, so we cannot match it with only +/* +* Xbox 360 has a vendor-specific class, so we cannot match it with only * USB_INTERFACE_INFO (also specifically refused by USB subsystem), so we * match against vendor id as well. Wired Xbox 360 devices have protocol 1, -* wireless controllers have protocol 129. */ +* wireless controllers have protocol 129. +*/ #define XPAD_XBOX360_VENDOR_PROTOCOL (vend,pr) \ .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, \ .idVendor = (vend), \
@@ -278,9 +282,20 @@ static const signed short xpad_abs_triggers[] = { { XPAD_XBOX360_VENDOR_PROTOCOL(vend,1) }, \ { XPAD_XBOX360_VENDOR_PROTOCOL(vend,129) } +/* The Xbox One controller uses subclass 71 and protocol 208. */ +#define XPAD_XBOXONE_VENDOR_PROTOCOL (vend, pr) \ + .match_flags = USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_INT_INFO, \ + .idVendor = (vend), \ + .bInterfaceClass = USB_CLASS_VENDOR_SPEC, \ + .bInterfaceSubClass = 71, \ + .bInterfaceProtocol = (pr) +#define XPAD_XBOXONE_VENDOR (vend) \ + { XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) } +static struct usb_device_id xpad_table[] = { {USB_INTERFACE_INFO ('X' ,'B' ,0 ) },/* X-Box USB-IF not approved class */ XPAD_XBOX360_VENDOR (0x045e ),/* Microsoft X-Box 360 controllers */ +XPAD_XBOXONE_VENDOR (0x045e ),/* Microsoft X-Box One controllers */ XPAD_XBOX360_VENDOR (0x046d ),/* Logitech X-Box 360 style controllers */ XPAD_XBOX360_VENDOR (0x0738 ),/* Mad Catz X-Box 360 controllers */ {USB_DEVICE (0x0738 ,0x4540 ) },/* Mad Catz Beat Pad */
@@ -314,12 +329,10 @@ struct usb_xpad {struct urb *bulk_out;unsigned char *bdata; -#if defined(CONFIG_JOYSTICK_XPAD_FF ) || defined(CONFIG_JOYSTICK_XPAD_LEDS )struct urb *irq_out;/* urb for interrupt out report */ unsigned char *odata;/* output data */ dma_addr_t odata_dma;struct mutex odata_mutex; -#endif #if defined(CONFIG_JOYSTICK_XPAD_LEDS )struct xpad_led *led;
@@ -506,6 +519,105 @@ static void xpad360w_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned chaxpad360_process_packet (xpad, cmd, &data[4 ]); } +/* +* xpadone_process_buttons +* +* Process a button update packet from an Xbox one controller. +*/ +static void xpadone_process_buttons (struct usb_xpad *xpad, +struct input_dev *dev, +unsigned char *data) +{ +/* menu/view buttons */ +input_report_key (dev,BTN_START , data[4 ] &0x04 ); +input_report_key (dev,BTN_SELECT , data[4 ] &0x08 ); + +/* buttons A,B,X,Y */ +input_report_key (dev,BTN_A , data[4 ] &0x10 ); +input_report_key (dev,BTN_B , data[4 ] &0x20 ); +input_report_key (dev,BTN_X , data[4 ] &0x40 ); +input_report_key (dev,BTN_Y , data[4 ] &0x80 ); + +/* digital pad */ +if (xpad->mapping &MAP_DPAD_TO_BUTTONS ) { +/* dpad as buttons (left, right, up, down) */ +input_report_key (dev,BTN_TRIGGER_HAPPY1 , data[5 ] &0x04 ); +input_report_key (dev,BTN_TRIGGER_HAPPY2 , data[5 ] &0x08 ); +input_report_key (dev,BTN_TRIGGER_HAPPY3 , data[5 ] &0x01 ); +input_report_key (dev,BTN_TRIGGER_HAPPY4 , data[5 ] &0x02 ); + }else { +input_report_abs (dev,ABS_HAT0X , + !!(data[5 ] &0x08 ) - !!(data[5 ] &0x04 )); +input_report_abs (dev,ABS_HAT0Y , + !!(data[5 ] &0x02 ) - !!(data[5 ] &0x01 )); + } + +/* TL/TR */ +input_report_key (dev,BTN_TL , data[5 ] &0x10 ); +input_report_key (dev,BTN_TR , data[5 ] &0x20 ); + +/* stick press left/right */ +input_report_key (dev,BTN_THUMBL , data[5 ] &0x40 ); +input_report_key (dev,BTN_THUMBR , data[5 ] &0x80 ); + +if (!(xpad->mapping &MAP_STICKS_TO_NULL )) { +/* left stick */ +input_report_abs (dev,ABS_X , + (__s16 )le16_to_cpup ((__le16 *)(data +10 ))); +input_report_abs (dev,ABS_Y , + ~(__s16 )le16_to_cpup ((__le16 *)(data +12 ))); + +/* right stick */ +input_report_abs (dev,ABS_RX , + (__s16 )le16_to_cpup ((__le16 *)(data +14 ))); +input_report_abs (dev,ABS_RY , + ~(__s16 )le16_to_cpup ((__le16 *)(data +16 ))); + } + +/* triggers left/right */ +if (xpad->mapping &MAP_TRIGGERS_TO_BUTTONS ) { +input_report_key (dev,BTN_TL2 , + (__u16 )le16_to_cpup ((__le16 *)(data +6 ))); +input_report_key (dev,BTN_TR2 , + (__u16 )le16_to_cpup ((__le16 *)(data +8 ))); + }else { +input_report_abs (dev,ABS_Z , + (__u16 )le16_to_cpup ((__le16 *)(data +6 ))); +input_report_abs (dev,ABS_RZ , + (__u16 )le16_to_cpup ((__le16 *)(data +8 ))); + } + +input_sync (dev); +} + +/* +* xpadone_process_packet +* +* Completes a request by converting the data into events for the +* input subsystem. This version is for the Xbox One controller. +* +* The report format was gleaned from +* https://github.com/kylelemons/xbox/blob/master/xbox.go +*/ + +static void xpadone_process_packet (struct usb_xpad *xpad, +u16 cmd,unsigned char *data) +{ +struct input_dev *dev = xpad->dev; + +switch (data[0 ]) { +case 0x20 : +xpadone_process_buttons (xpad, dev, data); +break ; + +case 0x07 : +/* the xbox button has its own special report */ +input_report_key (dev,BTN_MODE , data[4 ] &0x01 ); +input_sync (dev); +break ; + } +} +static void xpad_irq_in (struct urb *urb) {struct usb_xpad *xpad = urb->context;
@@ -538,6 +650,9 @@ static void xpad_irq_in(struct urb *urb)case XTYPE_XBOX360W :xpad360w_process_packet (xpad,0 , xpad->idata);break ; +case XTYPE_XBOXONE : +xpadone_process_packet (xpad,0 , xpad->idata); +break ;default :xpad_process_packet (xpad,0 , xpad->idata); }
@@ -571,7 +686,6 @@ static void xpad_bulk_out(struct urb *urb) } } -#if defined(CONFIG_JOYSTICK_XPAD_FF ) || defined(CONFIG_JOYSTICK_XPAD_LEDS )static void xpad_irq_out (struct urb *urb) {struct usb_xpad *xpad = urb->context;
@@ -609,6 +723,7 @@ exit:static int xpad_init_output (struct usb_interface *intf,struct usb_xpad *xpad) {struct usb_endpoint_descriptor *ep_irq_out; +int ep_irq_out_idx;int error;if (xpad->xtype ==XTYPE_UNKNOWN )
@@ -629,7 +744,10 @@ static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) goto fail2; } - ep_irq_out = &intf->cur_altsetting->endpoint[1 ].desc; +/* Xbox One controller has in/out endpoints swapped. */ + ep_irq_out_idx = xpad->xtype ==XTYPE_XBOXONE ?0 :1 ; + ep_irq_out = &intf->cur_altsetting->endpoint[ep_irq_out_idx].desc; + usb_fill_int_urb(xpad->irq_out, xpad->udev, usb_sndintpipe(xpad->udev, ep_irq_out->bEndpointAddress), xpad->odata, XPAD_PKT_LEN,
@@ -657,11 +775,6 @@ static void xpad_deinit_output(struct usb_xpad *xpad) xpad->odata, xpad->odata_dma); } } -#else -static int xpad_init_output (struct usb_interface *intf,struct usb_xpad *xpad) {return 0 ; } -static void xpad_deinit_output (struct usb_xpad *xpad) {} -static void xpad_stop_output (struct usb_xpad *xpad) {} -#endif #ifdef CONFIG_JOYSTICK_XPAD_FF static int xpad_play_effect (struct input_dev *dev,void *data,struct ff_effect *effect)
@@ -728,7 +841,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effectstatic int xpad_init_ff (struct usb_xpad *xpad) { -if (xpad->xtype ==XTYPE_UNKNOWN ) +if (xpad->xtype ==XTYPE_UNKNOWN || xpad->xtype ==XTYPE_XBOXONE )return 0 ;input_set_capability (xpad->dev,EV_FF ,FF_RUMBLE );
@@ -837,6 +950,14 @@ static int xpad_open(struct input_dev *dev)if (usb_submit_urb (xpad->irq_in,GFP_KERNEL ))return -EIO ; +if (xpad->xtype ==XTYPE_XBOXONE ) { +/* Xbox one controller needs to be initialized. */ + xpad->odata[0 ] =0x05 ; + xpad->odata[1 ] =0x20 ; + xpad->irq_out->transfer_buffer_length =2 ; +return usb_submit_urb (xpad->irq_out,GFP_KERNEL ); + } +return 0 ; }
@@ -852,6 +973,7 @@ static void xpad_close(struct input_dev *dev)static void xpad_set_up_abs (struct input_dev *input_dev,signed short abs) { +struct usb_xpad *xpad =input_get_drvdata (input_dev);set_bit (abs, input_dev->absbit);switch (abs) {
@@ -863,7 +985,10 @@ static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs)break ;case ABS_Z :case ABS_RZ :/* the triggers (if mapped to axes) */ -input_set_abs_params (input_dev, abs,0 ,255 ,0 ,0 ); +if (xpad->xtype ==XTYPE_XBOXONE ) +input_set_abs_params (input_dev, abs,0 ,1023 ,0 ,0 ); +else +input_set_abs_params (input_dev, abs,0 ,255 ,0 ,0 );break ;case ABS_HAT0X :case ABS_HAT0Y :/* the d-pad (only if dpad is mapped to axes */
@@ -878,6 +1003,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *idstruct usb_xpad *xpad;struct input_dev *input_dev;struct usb_endpoint_descriptor *ep_irq_in; +int ep_irq_in_idx;int i, error;for (i =0 ; xpad_device[i].idVendor; i++) {
@@ -886,6 +1012,16 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *idbreak ; } +if (xpad_device[i].xtype ==XTYPE_XBOXONE && + intf->cur_altsetting->desc.bInterfaceNumber !=0 ) { +/* +* The Xbox One controller lists three interfaces all with the +* same interface class, subclass and protocol. Differentiate by +* interface number. +*/ +return -ENODEV ; + } + xpad =kzalloc (sizeof (struct usb_xpad ),GFP_KERNEL ); input_dev =input_allocate_device ();if (!xpad || !input_dev) {
@@ -956,7 +1092,8 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id__set_bit (xpad_common_btn[i], input_dev->keybit);/* set up model-specific ones */ -if (xpad->xtype ==XTYPE_XBOX360 || xpad->xtype ==XTYPE_XBOX360W ) { +if (xpad->xtype ==XTYPE_XBOX360 || xpad->xtype ==XTYPE_XBOX360W || + xpad->xtype ==XTYPE_XBOXONE ) {for (i =0 ; xpad360_btn[i] >=0 ; i++)__set_bit (xpad360_btn[i], input_dev->keybit); }else {
@@ -969,7 +1106,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id__set_bit (xpad_btn_pad[i], input_dev->keybit); }else {for (i =0 ; xpad_abs_pad[i] >=0 ; i++) -xpad_set_up_abs (input_dev, xpad_abs_pad[i]); +xpad_set_up_abs (input_dev, xpad_abs_pad[i]); }if (xpad->mapping &MAP_TRIGGERS_TO_BUTTONS ) {
@@ -992,7 +1129,10 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *idif (error) goto fail5; - ep_irq_in = &intf->cur_altsetting->endpoint[0 ].desc; +/* Xbox One controller has in/out endpoints swapped. */ + ep_irq_in_idx = xpad->xtype ==XTYPE_XBOXONE ?1 :0 ; + ep_irq_in = &intf->cur_altsetting->endpoint[ep_irq_in_idx].desc; + usb_fill_int_urb(xpad->irq_in, udev, usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), xpad->idata, XPAD_PKT_LEN, xpad_irq_in,
Signature · 1 line
2.4.2
PATCH 17/111 Input: xpad - add Thrustmaster as Xbox 360 controller vendor
In reply to Jiri SlabyFrom: Tommi Rantala <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 4dfb15cd5aaa6682e93854a74b394a1c95b82621 upstream.
Add Thrustmaster as Xbox 360 controller vendor. This is required for example to make the GP XID (044f:b326) gamepad work.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -294,6 +294,7 @@ static const signed short xpad_abs_triggers[] = {static struct usb_device_id xpad_table[] = { {USB_INTERFACE_INFO ('X' ,'B' ,0 ) },/* X-Box USB-IF not approved class */ +XPAD_XBOX360_VENDOR (0x044f ),/* Thrustmaster X-Box 360 controllers */ XPAD_XBOX360_VENDOR (0x045e ),/* Microsoft X-Box 360 controllers */ XPAD_XBOXONE_VENDOR (0x045e ),/* Microsoft X-Box One controllers */ XPAD_XBOX360_VENDOR (0x046d ),/* Logitech X-Box 360 style controllers */
Signature · 1 line
2.4.2
PATCH 18/111 Input: xpad - add rumble support for Xbox One controller
In reply to Jiri SlabyFrom: Ming-ting Yao Wei <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0604949ce3b9a59cff419daf706272620a9a0df0 upstream.
This adds rumble support for Xbox One controller by sending continuous rumble command. Trigger button rumbling is not yet implemented.
--- drivers/input/joystick/xpad.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
drivers/input/joystick/xpad.c +20 -1
@@ -31,12 +31,14 @@* - the iForce driver drivers/char/joystick/iforce.c * - the skeleton-driver drivers/usb/usb-skeleton.c * - Xbox 360 information http://www.free60.org/wiki/Gamepad +* - Xbox One information https://github.com/quantus/xbox-one-controller-protocol * * Thanks to: * - ITO Takayuki for providing essential xpad information on his website * - Vojtech Pavlik - iforce driver / input subsystem * - Greg Kroah-Hartman - usb-skeleton driver * - XBOX Linux project - extra USB id's +* - Pekka Pöyry (quantus) - Xbox One controller reverse engineering * * TODO: * - fine tune axes (especially trigger axes)
@@ -829,6 +831,23 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effectreturn usb_submit_urb (xpad->irq_out,GFP_ATOMIC ); +case XTYPE_XBOXONE : + xpad->odata[0 ] =0x09 ;/* activate rumble */ + xpad->odata[1 ] =0x08 ; + xpad->odata[2 ] =0x00 ; + xpad->odata[3 ] =0x08 ;/* continuous effect */ + xpad->odata[4 ] =0x00 ;/* simple rumble mode */ + xpad->odata[5 ] =0x03 ;/* L and R actuator only */ + xpad->odata[6 ] =0x00 ;/* TODO: LT actuator */ + xpad->odata[7 ] =0x00 ;/* TODO: RT actuator */ + xpad->odata[8 ] = strong /256 ;/* left actuator */ + xpad->odata[9 ] = weak /256 ;/* right actuator */ + xpad->odata[10 ] =0x80 ;/* length of pulse */ + xpad->odata[11 ] =0x00 ;/* stop period of pulse */ + xpad->irq_out->transfer_buffer_length =12 ; + +return usb_submit_urb (xpad->irq_out,GFP_ATOMIC ); +default : dev_dbg(&xpad->dev->dev, "%s - rumble command sent to unsupported xpad type: %d\n",
@@ -842,7 +861,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effectstatic int xpad_init_ff (struct usb_xpad *xpad) { -if (xpad->xtype ==XTYPE_UNKNOWN || xpad->xtype ==XTYPE_XBOXONE ) +if (xpad->xtype ==XTYPE_UNKNOWN )return 0 ;input_set_capability (xpad->dev,EV_FF ,FF_RUMBLE );
Signature · 1 line
2.4.2
PATCH 19/111 usb: chipidea: debug: avoid out of bound read
In reply to Jiri SlabyFrom: Heinrich Schuchardt <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bd5fb0aec3dd7cde7ec4c397b10e55d4c9626d8d upstream.
A string written by the user may not be zero terminated.
sscanf may read memory beyond the buffer if no zero byte is found.
For testing build with CONFIG_USB_CHIPIDEA=y, CONFIG_USB_CHIPIDEA_DEBUG=y.
--- drivers/usb/chipidea/debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/chipidea/debug.c +5 -1
@@ -84,9 +84,13 @@ static ssize_t ci_port_test_write(struct file *file, const char __user *ubuf,char buf[32 ];int ret; -if (copy_from_user (buf, ubuf,min_t (size_t,sizeof (buf) -1 , count))) + count =min_t (size_t,sizeof (buf) -1 , count); +if (copy_from_user (buf, ubuf, count))return -EFAULT ; +/* sscanf requires a zero terminated string */ + buf[count] ='\0' ; +if (sscanf (buf,"%u" , &mode) !=1 )return -EINVAL ;
Signature · 1 line
2.4.2
PATCH 20/111 Added another USB product ID for ELAN touchscreen quirks.
In reply to Jiri SlabyFrom: Logan Gunthorpe <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit dc703ec22074d9c71a12da20670369fac3ea4296 upstream.
I've had the same issue as described in commit
c68929f75dfcb6354918862b91b5778585de1fa5
Except my touchscreen's ID is
ID 04f3:0125 Elan Microelectronics Corp.
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -105,6 +105,9 @@ static const struct usb_device_id usb_quirk_list[] = { { USB_DEVICE(0x04f3, 0x010c), .driver_info = USB_QUIRK_DEVICE_QUALIFIER }, + { USB_DEVICE(0x04f3, 0x0125), .driver_info = + USB_QUIRK_DEVICE_QUALIFIER }, + { USB_DEVICE(0x04f3, 0x016f), .driver_info = USB_QUIRK_DEVICE_QUALIFIER },
Signature · 1 line
2.4.2
PATCH 21/111 staging: wlags49_h2: fix extern inline functions
In reply to Jiri SlabyFrom: Greg Kroah-Hartman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
Patch not upstream as this driver is deleted there.
Fix up some "extern inline" functions as they break the build when using a "modern" complier (i.e. gcc5).
--- drivers/staging/wlags49_h2/wl_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wlags49_h2/wl_internal.h +2 -2
@@ -1013,7 +1013,7 @@ static inline void wl_unlock(struct wl_private *lp,/* Interrupt enable disable functions */ /********************************************************************/ -extern inline void wl_act_int_on (struct wl_private *lp) +static inline void wl_act_int_on (struct wl_private *lp) {/* * Only do something when the driver is handling
@@ -1025,7 +1025,7 @@ extern inline void wl_act_int_on(struct wl_private *lp) } } -extern inline void wl_act_int_off (struct wl_private *lp) +static inline void wl_act_int_off (struct wl_private *lp) {/* * Only do something when the driver is handling
Signature · 1 line
2.4.2
PATCH 22/111 staging, rtl8192e, LLVMLinux: Change extern inline to static inline
In reply to Jiri SlabyFrom: Behan Webster <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6d91857d4826b382b3fd4fad95f52713be646f96 upstream.
With compilers which follow the C99 standard (like modern versions of gcc and clang), "extern inline" does the opposite thing from older versions of gcc (emits code for an externally linkable version of the inline function).
"static inline" does the intended behavior in all cases instead.
--- drivers/staging/rtl8192e/rtllib.h | 4 ++-- drivers/staging/rtl8192e/rtllib_softmac.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8192e/rtllib.h +2 -2
@@ -2943,12 +2943,12 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);extern const long rtllib_wlan_frequencies[]; -extern inline void rtllib_increment_scans (struct rtllib_device *ieee) +static inline void rtllib_increment_scans (struct rtllib_device *ieee) { ieee->scans++; } -extern inline int rtllib_get_scans (struct rtllib_device *ieee) +static inline int rtllib_get_scans (struct rtllib_device *ieee) {return ieee->scans; }
drivers/staging/rtl8192e/rtllib_softmac.c +1 -1
@@ -341,7 +341,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, } } -inline struct sk_buff *rtllib_probe_req (struct rtllib_device *ieee) +static inline struct sk_buff *rtllib_probe_req (struct rtllib_device *ieee) {unsigned int len, rate_len;u8 *tag;
Signature · 1 line
2.4.2
PATCH 23/111 staging: rtl8712, rtl8712: avoid lots of build warnings
In reply to Jiri SlabyFrom: Arnd Bergmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0c9f3a65c5eb7fe1fc611a22eb8a8b71ea865998 upstream.
The rtl8712 driver has an 'extern inline' function that contains an 'if', which causes lots of warnings with CONFIG_PROFILE_ALL_BRANCHES overriding the definition of 'if':
drivers/staging/rtl8712/ieee80211.h:759:229: warning: '______f' is static but declared in inline function 'ieee80211_get_hdrlen' which is not static [enabled by default]
This changes the driver to use 'static inline' instead, which happens to be the correct annotation anyway.
--- drivers/staging/rtl8187se/ieee80211/ieee80211.h | 4 ++-- drivers/staging/rtl8192u/ieee80211/ieee80211.h | 10 +++++----- drivers/staging/rtl8712/ieee80211.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/rtl8187se/ieee80211/ieee80211.h +2 -2
@@ -1447,12 +1447,12 @@ extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, shorextern const long ieee80211_wlan_frequencies[]; -extern inline void ieee80211_increment_scans (struct ieee80211_device *ieee) +static inline void ieee80211_increment_scans (struct ieee80211_device *ieee) { ieee->scans++; } -extern inline int ieee80211_get_scans (struct ieee80211_device *ieee) +static inline int ieee80211_get_scans (struct ieee80211_device *ieee) {return ieee->scans; }
drivers/staging/rtl8192u/ieee80211/ieee80211.h +5 -5
@@ -2250,7 +2250,7 @@ static inline void *ieee80211_priv(struct net_device *dev)return ((struct ieee80211_device *)netdev_priv (dev))->priv; } -extern inline int ieee80211_is_empty_essid (const char *essid,int essid_len) +static inline int ieee80211_is_empty_essid (const char *essid,int essid_len) {/* Single white space is for Linksys APs */ if (essid_len ==1 && essid[0 ] ==' ' )
@@ -2266,7 +2266,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)return 1 ; } -extern inline int ieee80211_is_valid_mode (struct ieee80211_device *ieee,int mode) +static inline int ieee80211_is_valid_mode (struct ieee80211_device *ieee,int mode) {/* * It is possible for both access points and our device to support
@@ -2292,7 +2292,7 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int modreturn 0 ; } -extern inline int ieee80211_get_hdrlen (u16 fc) +static inline int ieee80211_get_hdrlen (u16 fc) {int hdrlen =IEEE80211_3ADDR_LEN ;
@@ -2578,12 +2578,12 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee);extern const long ieee80211_wlan_frequencies[]; -extern inline void ieee80211_increment_scans (struct ieee80211_device *ieee) +static inline void ieee80211_increment_scans (struct ieee80211_device *ieee) { ieee->scans++; } -extern inline int ieee80211_get_scans (struct ieee80211_device *ieee) +static inline int ieee80211_get_scans (struct ieee80211_device *ieee) {return ieee->scans; }
drivers/staging/rtl8712/ieee80211.h +2 -2
@@ -734,7 +734,7 @@ enum ieee80211_state {#define IEEE_G (1<<2)#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) -extern inline int ieee80211_is_empty_essid (const char *essid,int essid_len) +static inline int ieee80211_is_empty_essid (const char *essid,int essid_len) {/* Single white space is for Linksys APs */ if (essid_len ==1 && essid[0 ] ==' ' )
@@ -748,7 +748,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len)return 1 ; } -extern inline int ieee80211_get_hdrlen (u16 fc) +static inline int ieee80211_get_hdrlen (u16 fc) {int hdrlen =24 ;
Signature · 1 line
2.4.2
PATCH 24/111 staging, rtl8192e, LLVMLinux: Remove unused inline prototype
In reply to Jiri SlabyFrom: Behan Webster <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 62ec95f86d2850b7ce6d73fb236a6fcf48411aea upstream.
rtllib_probe_req is defined as "static inline" in rtllib_softmac.c however it is declared differently as "extern inline" in rtllib_softmac.h. Since it isn't used outside of the scope of rtllib_softmac, it makes sense to remove the incorrect declaration.
--- drivers/staging/rtl8192e/rtllib.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/rtl8192e/rtllib.h +0 -1
@@ -2761,7 +2761,6 @@ extern void rtllib_stop_scan(struct rtllib_device *ieee);extern bool rtllib_act_scanning (struct rtllib_device *ieee,bool sync_scan);extern void rtllib_stop_scan_syncro (struct rtllib_device *ieee);extern void rtllib_start_scan_syncro (struct rtllib_device *ieee,u8 is_mesh); -extern inline struct sk_buff *rtllib_probe_req (struct rtllib_device *ieee);extern u8 MgntQuery_MgntFrameTxRate (struct rtllib_device *ieee);extern void rtllib_sta_ps_send_null_frame (struct rtllib_device *ieee,short pwr);
Signature · 1 line
2.4.2
PATCH 25/111 kernel: use the gnu89 standard explicitly
In reply to Jiri SlabyFrom: "Kirill A. Shutemov" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 51b97e354ba9fce1890cf38ecc754aa49677fc89 upstream.
Sasha Levin reports:
"gcc5 changes the default standard to c11, which makes kernel build
unhappy
Explicitly define the kernel standard to be gnu89 which should keep everything working exactly like it was before gcc5"
There are multiple small issues with the new default, but the biggest issue seems to be that the old - and very useful - GNU extension to allow a cast in front of an initializer has gone away.
Patch updated by Kirill:
"I'm pretty sure all gcc versions you can build kernel with supports
-std=gnu89. cc-option is redunrant.
We also need to adjust HOSTCFLAGS otherwise allmodconfig fails for me"
Note by Andrew Pinski:
"Yes it was reported and both problems relating to this extension has
been added to gnu99 and gnu11. Though there are other issues with the kernel dealing with extern inline have different semantics between gnu89 and gnu99/11"
End result: we may be able to move up to a newer stdc model eventually, but right now the newer models have some annoying deficiencies, so the traditional "gnu89" model ends up being the preferred one.
--- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Makefile +4 -2
@@ -241,7 +241,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ HOSTCC = gcc HOSTCXX = g++ -HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer +HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 HOSTCXXFLAGS = -O2 # Decide whether to build built-in, modular, or both.
@@ -373,7 +373,9 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ -Wno-format-security \ - -fno-delete-null-pointer-checks + -fno-delete-null-pointer-checks \ + -std=gnu89 + KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_AFLAGS := -D__ASSEMBLY__
Signature · 1 line
2.4.2
PATCH 26/111 qla2xxx: remove redundant declaration in 'qla_gbl.h'
In reply to Jiri SlabyFrom: Chen Gang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9493c2422cae272d6f1f567cbb424195defe4176 upstream.
Remove 2 redundant extern inline functions: qla8044_set_qsnt_ready() and qla8044_need_reset_handler(). At present, within upstream next kernel source code, they are only used within "drivers/scsi/qla2xxx/qla_nx2.c".
The related error and warnings (with allmodconfig under tile):
CC [M] drivers/scsi/qla2xxx/qla_nx2.o
drivers/scsi/qla2xxx/qla_nx2.c:1633:1: error: static declaration of 'qla8044_need_reset_handler' follows non-static declaration
qla8044_need_reset_handler(struct scsi_qla_host *vha)
^
In file included from drivers/scsi/qla2xxx/qla_def.h:3706:0,
from drivers/scsi/qla2xxx/qla_nx2.c:11:
drivers/scsi/qla2xxx/qla_gbl.h:756:20: note: previous declaration of 'qla8044_need_reset_handler' was here
extern inline void qla8044_need_reset_handler(struct scsi_qla_host *vha);
^ drivers/scsi/qla2xxx/qla_gbl.h:756:20: warning: inline function 'qla8044_need_reset_handler' declared but never defined make[3]: *** [drivers/scsi/qla2xxx/qla_nx2.o] Error 1
make[2]: *** [drivers/scsi/qla2xxx] Error 2
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2
CC [M] drivers/scsi/qla2xxx/qla_tmpl.o
In file included from drivers/scsi/qla2xxx/qla_def.h:3706:0,
from drivers/scsi/qla2xxx/qla_tmpl.c:7:
drivers/scsi/qla2xxx/qla_gbl.h:755:20: warning: inline function 'qla8044_set_qsnt_ready' declared but never defined
extern inline void qla8044_set_qsnt_ready(struct scsi_qla_host *vha);
^--- drivers/scsi/qla2xxx/qla_gbl.h | 2 -- drivers/scsi/qla2xxx/qla_nx2.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_gbl.h +0 -2
@@ -721,8 +721,6 @@ extern void qla8044_set_idc_dontreset(struct scsi_qla_host *ha);extern int qla8044_rd_direct (struct scsi_qla_host *vha,const uint32_t crb_reg);extern void qla8044_wr_direct (struct scsi_qla_host *vha,const uint32_t crb_reg,const uint32_t value); -extern inline void qla8044_set_qsnt_ready (struct scsi_qla_host *vha); -extern inline void qla8044_need_reset_handler (struct scsi_qla_host *vha);extern int qla8044_device_state_handler (struct scsi_qla_host *vha);extern void qla8044_clear_qsnt_ready (struct scsi_qla_host *vha);extern void qla8044_clear_drv_active (struct scsi_qla_host *vha);
drivers/scsi/qla2xxx/qla_nx2.c +1 -1
@@ -146,7 +146,7 @@ qla8044_rmw_crb_reg(struct scsi_qla_host *vha,return ; } -inline void +static inline void qla8044_set_qsnt_ready (struct scsi_qla_host *vha) {uint32_t qsnt_state;
Signature · 1 line
2.4.2
PATCH 27/111 amd64_edac: Add support for newer F16h models
In reply to Jiri SlabyFrom: Aravind Gopalakrishnan <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 85a8885bd0e00569108aa7b5e26b89c752e3cd51 upstream.
Extend ECC decoding support for F16h M30h. Tested on F16h M30h with ECC turned on using mce_amd_inj module and the patch works fine.
--- arch/x86/kernel/amd_nb.c | 2 ++ drivers/edac/amd64_edac.c | 24 ++++++++++++++++++++++++ drivers/edac/amd64_edac.h | 3 +++ include/linux/pci_ids.h | 2 ++ 4 files changed, 31 insertions(+)
arch/x86/kernel/amd_nb.c +2 -0
@@ -22,6 +22,7 @@ const struct pci_device_id amd_nb_misc_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M10H_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F3) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, {} };EXPORT_SYMBOL (amd_nb_misc_ids);
@@ -30,6 +31,7 @@ static const struct pci_device_id amd_nb_link_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, {} };
drivers/edac/amd64_edac.c +24 -0
@@ -1806,6 +1806,17 @@ static struct amd64_family_type amd64_family_types[] = { .read_dct_pci_cfg = f10_read_dct_pci_cfg, } }, + [F16_M30H_CPUS ] = { + .ctl_name ="F16h_M30h" , + .f1_id =PCI_DEVICE_ID_AMD_16H_M30H_NB_F1 , + .f3_id =PCI_DEVICE_ID_AMD_16H_M30H_NB_F3 , + .ops = { + .early_channel_count = f1x_early_channel_count, + .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, + .dbam_to_cs = f16_dbam_to_chip_select, + .read_dct_pci_cfg = f10_read_dct_pci_cfg, + } + }, };/*
@@ -2596,6 +2607,11 @@ static struct amd64_family_type *amd64_per_family_init(struct amd64_pvt *pvt)break ;case 0x16 : +if (pvt->model ==0x30 ) { + fam_type = &amd64_family_types[F16_M30H_CPUS ]; + pvt->ops = &amd64_family_types[F16_M30H_CPUS ].ops; +break ; + } fam_type = &amd64_family_types[F16_CPUS ]; pvt->ops = &amd64_family_types[F16_CPUS ].ops;break ;
@@ -2848,6 +2864,14 @@ static DEFINE_PCI_DEVICE_TABLE(amd64_pci_table) = { .class = 0, .class_mask = 0, }, + { + .vendor = PCI_VENDOR_ID_AMD, + .device = PCI_DEVICE_ID_AMD_16H_M30H_NB_F2, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .class = 0, + .class_mask = 0, + }, {0, } };
drivers/edac/amd64_edac.h +3 -0
@@ -176,6 +176,8 @@#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602#define PCI_DEVICE_ID_AMD_16H_NB_F1 0x1531#define PCI_DEVICE_ID_AMD_16H_NB_F2 0x1532 +#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F1 0x1581 +#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F2 0x1582/* * Function 1 - Address Map
@@ -308,6 +310,7 @@ enum amd_families {F15_CPUS ,F15_M30H_CPUS ,F16_CPUS , +F16_M30H_CPUS , NUM_FAMILIES, };
include/linux/pci_ids.h +2 -0
@@ -528,6 +528,8 @@#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605#define PCI_DEVICE_ID_AMD_16H_NB_F3 0x1533#define PCI_DEVICE_ID_AMD_16H_NB_F4 0x1534 +#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F3 0x1583 +#define PCI_DEVICE_ID_AMD_16H_M30H_NB_F4 0x1584#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
Signature · 1 line
2.4.2
PATCH 28/111 hwmon: (k10temp) Add support for AMD F16 M30h processor
In reply to Jiri SlabyFrom: Aravind Gopalakrishnan <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ec0159503ae74aeb834e78366bdf4b9663ca1129 upstream.
Adding new PCI ID to support AMD F16 M30h processor (Mullins). While at it, modify Kconfig and Doc files to reflect the support for newer processors
Note: PCI ID for this processor will make it into pci_ids.h as part of this patch:
http://marc.info/?l=linux-kernel&m=139291362126057&w=2
which should be pulled into 3.15 when merge window opens (It currently sits in 'for-next' branch of bp.git-
https://git.kernel.org/cgit/linux/kernel/git/bp/bp.git/log/?h=for-next)
--- Documentation/hwmon/k10temp | 6 +++--- drivers/hwmon/Kconfig | 4 ++-- drivers/hwmon/k10temp.c | 1 + 3 files changed, 6 insertions(+), 5 deletions(-)
Documentation/hwmon/k10temp +3 -3
@@ -11,8 +11,8 @@ Supported chips: Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) * AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series) * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series) -* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity" -* AMD Family 16h processors: "Kabini" +* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri" +* AMD Family 16h processors: "Kabini", "Mullins" Prefix: 'k10temp' Addresses scanned: PCI space
@@ -46,7 +46,7 @@ Description ----------- This driver permits reading of the internal temperature sensor of AMD -Family 10h/11h/12h/14h/15h processors. +Family 10h/11h/12h/14h/15h/16h processors. All these processors have a sensor, but on those for Socket F or AM2+, the sensor may return inconsistent values (erratum 319). The driver
drivers/hwmon/Kconfig +2 -2
@@ -296,8 +296,8 @@ config SENSORS_K10TEMP If you say yes here you get support for the temperature sensor(s) inside your CPU. Supported are later revisions of the AMD Family 10h and all revisions of the AMD Family 11h, - 12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity) and - 16h (Kabini) microarchitectures. + 12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity/Kaveri) and + 16h (Kabini/Mullins) microarchitectures. This driver can also be built as a module. If so, the module will be called k10temp.
drivers/hwmon/k10temp.c +1 -0
@@ -212,6 +212,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { { 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) }, + { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, {} };MODULE_DEVICE_TABLE (pci, k10temp_id_table);
Signature · 1 line
2.4.2
PATCH 29/111 hwmon: (k10temp) Add support for F15h M60h
In reply to Jiri SlabyFrom: Aravind Gopalakrishnan <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f89ce2706d8341c921b96e13a00b951a10eed308 upstream.
This patch adds temperature monitoring support for F15h M60h processor.
- Add new pci device id for the relevant processor
- The functionality of REG_REPORTED_TEMPERATURE is moved to D0F0xBC_xD820_0CA4 [Reported Temperature Control]
- So, use this to get CUR_TEMP value
- Since we need an indirect register access, protect this with a mutex lock
- Add Kconfig, Doc entries to indicate support for this processor.
--- Documentation/hwmon/k10temp | 2 +- drivers/hwmon/Kconfig | 4 ++-- drivers/hwmon/k10temp.c | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 6 deletions(-)
Documentation/hwmon/k10temp +1 -1
@@ -11,7 +11,7 @@ Supported chips: Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) * AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series) * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series) -* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri" +* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Kaveri", "Carrizo" * AMD Family 16h processors: "Kabini", "Mullins" Prefix: 'k10temp'
drivers/hwmon/Kconfig +2 -2
@@ -296,8 +296,8 @@ config SENSORS_K10TEMP If you say yes here you get support for the temperature sensor(s) inside your CPU. Supported are later revisions of the AMD Family 10h and all revisions of the AMD Family 11h, - 12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity/Kaveri) and - 16h (Kabini/Mullins) microarchitectures. + 12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity/Kaveri/Carrizo) + and 16h (Kabini/Mullins) microarchitectures. This driver can also be built as a module. If so, the module will be called k10temp.
drivers/hwmon/k10temp.c +32 -3
@@ -33,6 +33,9 @@ static bool force;module_param (force, bool,0444 );MODULE_PARM_DESC (force,"force loading on processors with erratum 319" ); +/* Provide lock for writing to NB_SMU_IND_ADDR */ +static DEFINE_MUTEX (nb_smu_ind_mutex); +/* CPUID function 0x80000001, ebx */ #define CPUID_PKGTYPE_MASK 0xf0000000#define CPUID_PKGTYPE_F 0x00000000
@@ -51,13 +54,38 @@ MODULE_PARM_DESC(force, "force loading on processors with erratum 319");#define REG_NORTHBRIDGE_CAPABILITIES 0xe8#define NB_CAP_HTC 0x00000400 +/* +* For F15h M60h, functionality of REG_REPORTED_TEMPERATURE +* has been moved to D0F0xBC_xD820_0CA4 [Reported Temperature +* Control] +*/ +#define F15H_M60H_REPORTED_TEMP_CTRL_OFFSET 0xd8200ca4 +#define PCI_DEVICE_ID_AMD_15H_M60H_NB_F3 0x1573 + +static void amd_nb_smu_index_read (struct pci_dev *pdev,unsigned int devfn, +int offset,u32 *val) +{ +mutex_lock (&nb_smu_ind_mutex); +pci_bus_write_config_dword (pdev->bus, devfn, +0xb8 , offset); +pci_bus_read_config_dword (pdev->bus, devfn, +0xbc , val); +mutex_unlock (&nb_smu_ind_mutex); +} +static ssize_t show_temp (struct device *dev,struct device_attribute *attr,char *buf) {u32 regval; - -pci_read_config_dword (to_pci_dev (dev), -REG_REPORTED_TEMPERATURE , ®val); +struct pci_dev *pdev =to_pci_dev (dev); + +if (boot_cpu_data.x86 ==0x15 && boot_cpu_data.x86_model ==0x60 ) { +amd_nb_smu_index_read (pdev,PCI_DEVFN (0 ,0 ), +F15H_M60H_REPORTED_TEMP_CTRL_OFFSET , + ®val); + }else { +pci_read_config_dword (pdev,REG_REPORTED_TEMPERATURE , ®val); + }return sprintf (buf,"%u\n" , (regval >>21 ) *125 ); }
@@ -211,6 +239,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { { 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_15H_M60H_NB_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F3) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, {}
Signature · 1 line
2.4.2
PATCH 30/111 storvsc: Set the SRB flags correctly when no data transfer is needed
In reply to Jiri SlabyFrom: "K. Y. Srinivasan" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit dc45708ca9988656d706940df5fd102672c5de92 upstream.
Set the SRB flags correctly when there is no data transfer. Without this change some IHV drivers will fail valid commands such as TEST_UNIT_READY.
--- drivers/scsi/storvsc_drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/storvsc_drv.c +1 -2
@@ -1625,8 +1625,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)break ;default : vm_srb->data_in =UNKNOWN_TYPE ; - vm_srb->win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN | -SRB_FLAGS_DATA_OUT ); + vm_srb->win8_extension.srb_flags |=SRB_FLAGS_NO_DATA_TRANSFER ;break ; }
Signature · 1 line
2.4.2
PATCH 31/111 perf/x86/amd/ibs: Update IBS MSRs and feature definitions
In reply to Jiri SlabyFrom: Aravind Gopalakrishnan <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 904cb3677f3adcd3d837be0a0d0b14251ba8d6f7 upstream.
New Fam15h models carry extra feature bits and extend the MSR register space for IBS ops. Adding them here.
While at it, add functionality to read IbsBrTarget and OpData4 depending on their availability if user wants a PERF_SAMPLE_RAW.
--- arch/x86/include/asm/perf_event.h | 3 +++ arch/x86/include/uapi/asm/msr-index.h | 1 + arch/x86/kernel/cpu/perf_event_amd_ibs.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+)
arch/x86/include/asm/perf_event.h +3 -0
@@ -169,6 +169,9 @@ struct x86_pmu_capability {#define IBS_CAPS_BRNTRGT (1U<<5)#define IBS_CAPS_OPCNTEXT (1U<<6)#define IBS_CAPS_RIPINVALIDCHK (1U<<7) +#define IBS_CAPS_OPBRNFUSE (1U<<8) +#define IBS_CAPS_FETCHCTLEXTD (1U<<9) +#define IBS_CAPS_OPDATA4 (1U<<10)#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \ | IBS_CAPS_FETCHSAM \
arch/x86/include/uapi/asm/msr-index.h +1 -0
@@ -201,6 +201,7 @@#define MSR_AMD64_IBSOP_REG_MASK ((1UL<<MSR_AMD64_IBSOP_REG_COUNT)-1)#define MSR_AMD64_IBSCTL 0xc001103a#define MSR_AMD64_IBSBRTARGET 0xc001103b +#define MSR_AMD64_IBSOPDATA4 0xc001103d#define MSR_AMD64_IBS_REG_COUNT_MAX 8/* includes MSR_AMD64_IBSBRTARGET */ /* Fam 16h MSRs */
arch/x86/kernel/cpu/perf_event_amd_ibs.c +15 -0
@@ -565,6 +565,21 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) perf_ibs->offset_max, offset + 1); }while (offset < offset_max); +if (event->attr.sample_type &PERF_SAMPLE_RAW ) { +/* +* Read IbsBrTarget and IbsOpData4 separately +* depending on their availability. +* Can't add to offset_max as they are staggered +*/ +if (ibs_caps &IBS_CAPS_BRNTRGT ) { +rdmsrl (MSR_AMD64_IBSBRTARGET , *buf++); + size++; + } +if (ibs_caps &IBS_CAPS_OPDATA4 ) { +rdmsrl (MSR_AMD64_IBSOPDATA4 , *buf++); + size++; + } + } ibs_data.size =sizeof (u64) * size; regs = *iregs;
Signature · 1 line
2.4.2
PATCH 32/111 powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed address space
In reply to Jiri SlabyFrom: "[email protected]" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 19751c07b3728748c1253627ce94e6906fa5e273 upstream.
According to Posix, if MAP_FIXED is specified mmap shall set ENOMEM if the requested mapping exceeds the allowed range for address space of the process. The generic code set it right, but the specific powerpc slice_get_unmapped_area() function currently returns -EINVAL in that case.
This patch corrects it.
--- arch/powerpc/mm/slice.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/mm/slice.c +1 -1
@@ -408,7 +408,7 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,if (fixed && (addr & ((1ul << pshift) -1 )))return -EINVAL ;if (fixed && addr > (mm->task_size - len)) -return -EINVAL ; +return -ENOMEM ;/* If hint, make sure it matches our alignment restrictions */ if (!fixed && addr) {
Signature · 1 line
2.4.2
PATCH 33/111 vhost/scsi: potential memory corruption
In reply to Jiri SlabyFrom: Dan Carpenter <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 59c816c1f24df0204e01851431d3bab3eb76719c upstream.
This code in vhost_scsi_make_tpg() is confusing because we limit "tpgt" to UINT_MAX but the data type of "tpg->tport_tpgt" and that is a u16.
I looked at the context and it turns out that in vhost_scsi_set_endpoint(), "tpg->tport_tpgt" is used as an offset into the vs_tpg[] array which has VHOST_SCSI_MAX_TARGET (256) elements so anything higher than 255 then it is invalid. I have made that the limit now.
In vhost_scsi_send_evt() we mask away values higher than 255, but now that the limit has changed, we don't need the mask.
--- drivers/vhost/scsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/vhost/scsi.c +3 -3
@@ -1132,7 +1132,7 @@ tcm_vhost_send_evt(struct vhost_scsi *vs,* lun[4-7] need to be zero according to virtio-scsi spec. */ evt->event.lun[0 ] =0x01 ; - evt->event.lun[1 ] = tpg->tport_tpgt &0xFF ; + evt->event.lun[1 ] = tpg->tport_tpgt;if (lun->unpacked_lun >=256 ) evt->event.lun[2 ] = lun->unpacked_lun >>8 |0x40 ; evt->event.lun[3 ] = lun->unpacked_lun &0xFF ;
@@ -2002,12 +2002,12 @@ tcm_vhost_make_tpg(struct se_wwn *wwn, struct tcm_vhost_tport, tport_wwn);struct tcm_vhost_tpg *tpg; -unsigned long tpgt; +u16 tpgt;int ret;if (strstr (name,"tpgt_" ) != name)return ERR_PTR (-EINVAL ); -if (kstrtoul (name +5 ,10 , &tpgt) || tpgt >UINT_MAX ) +if (kstrtou16 (name +5 ,10 , &tpgt) || tpgt >=VHOST_SCSI_MAX_TARGET )return ERR_PTR (-EINVAL ); tpg =kzalloc (sizeof (struct tcm_vhost_tpg ),GFP_KERNEL );
Signature · 1 line
2.4.2
PATCH 34/111 Fix corrupt SMB2 ioctl requests
In reply to Jiri SlabyFrom: Steve French <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7ff8d45c9dccf0744404d6fe44468ede7c1b9533 upstream.
We were off by one calculating the length of ioctls in some cases because the protocol specification for SMB2 ioctl includes a mininum one byte payload but not all SMB2 ioctl requests actually have a data buffer to send. We were also not zeroing out the return buffer (in case of error this is helpful).
--- fs/cifs/smb2pdu.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
fs/cifs/smb2pdu.c +17 -4
@@ -1228,6 +1228,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,cifs_dbg (FYI ,"SMB2 IOCTL\n" ); + *out_data =NULL ;/* zero out returned data len, in case of error */ if (plen) *plen =0 ;
@@ -1273,11 +1274,23 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, req->Flags =0 ; iov[0 ].iov_base = (char *)req; -/* 4 for rfc1002 length field */ - iov[0 ].iov_len =get_rfc1002_length (req) +4 ; -if (indatalen) -inc_rfc1001_len (req, indatalen); +/* +* If no input data, the size of ioctl struct in +* protocol spec still includes a 1 byte data buffer, +* but if input data passed to ioctl, we do not +* want to double count this, so we do not send +* the dummy one byte of data in iovec[0] if sending +* input data (in iovec[1]). We also must add 4 bytes +* in first iovec to allow for rfc1002 length field. +*/ + +if (indatalen) { + iov[0 ].iov_len =get_rfc1002_length (req) +4 -1 ; +inc_rfc1001_len (req, indatalen -1 ); + }else + iov[0 ].iov_len =get_rfc1002_length (req) +4 ; + rc =SendReceive2 (xid, ses, iov, num_iovecs, &resp_buftype,0 ); rsp = (struct smb2_ioctl_rsp *)iov[0 ].iov_base;
Signature · 1 line
2.4.2
PATCH 35/111 rtlwifi: rtl8192cu: Fix kernel deadlock
In reply to Jiri SlabyFrom: Larry Finger <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 414b7e3b9ce8b0577f613e656fdbc36b34b444dd upstream.
The USB mini-driver in rtlwifi, which is used by rtl8192cu, issues a call to usb_control_msg() with a timeout value of 0. In some instances where the interface is shutting down, this infinite wait results in a CPU deadlock. A one second timeout fixes this problem without affecting any normal operations.
This bug is reported at https://bugzilla.novell.com/show_bug.cgi?id=927786.
--- drivers/net/wireless/rtlwifi/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rtlwifi/usb.c +1 -1
@@ -126,7 +126,7 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, do { status = usb_control_msg(udev, pipe, request, reqtype, value, - index, pdata, len, 0); /*max. timeout*/ + index, pdata, len, 1000); if (status < 0) { /* firmware download is checksumed, don't retry */ if ((value >= FW_8192C_START_ADDRESS &&
Signature · 1 line
2.4.2
PATCH 36/111 ARM: fix missing syscall trace exit
In reply to Jiri SlabyFrom: Russell King <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1b97937246d8b97c0760d16d8992c7937bdf5e6a upstream.
Josh Stone reports:
I've discovered a case where both arm and arm64 will miss a ptrace syscall-exit that they should report. If the syscall is entered without TIF_SYSCALL_TRACE set, then it goes on the fast path. It's then possible to have TIF_SYSCALL_TRACE added in the middle of the syscall, but ret_fast_syscall doesn't check this flag again.
Fix this by always checking for a syscall trace in the fast exit path.
--- arch/arm/kernel/entry-common.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/kernel/entry-common.S +3 -1
@@ -32,7 +32,9 @@ ret_fast_syscall: UNWIND(.fnstart ) UNWIND(.cantunwind ) disable_irq @ disable interrupts - ldr r1, [tsk, #TI_FLAGS] + ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing + tst r1, #_TIF_SYSCALL_WORK + bne __sys_trace_return tst r1, #_TIF_WORK_MASK bne fast_work_pending asm_trace_hardirqs_on
Signature · 1 line
2.4.2
PATCH 37/111 mm: numa: initialise numa balancing after jump label initialisation
In reply to Jiri SlabyFrom: Mel Gorman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c297663c0b3930491a3cb2aba4b6e5a7159c3503 upstream.
The command line parsing takes place before jump labels are initialised which generates a warning if numa_balancing= is specified and CONFIG_JUMP_LABEL is set.
On older kernels before commit c4b2c0c5f647 ("static_key: WARN on usage before jump_label_init was called") the kernel would have crashed. This patch enables automatic numa balancing later in the initialisation process if numa_balancing= is specified.
--- mm/mempolicy.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
mm/mempolicy.c +10 -6
@@ -2576,7 +2576,7 @@ void mpol_free_shared_policy(struct shared_policy *p) }#ifdef CONFIG_NUMA_BALANCING -static bool __initdata numabalancing_override; +static int __initdata numabalancing_override;static void __init check_numabalancing_enable (void ) {
@@ -2585,9 +2585,14 @@ static void __init check_numabalancing_enable(void)if (IS_ENABLED (CONFIG_NUMA_BALANCING_DEFAULT_ENABLED )) numabalancing_default = true; +/* Parsed by setup_numabalancing. override == 1 enables, -1 disables */ +if (numabalancing_override) +set_numabalancing_state (numabalancing_override ==1 ); +if (nr_node_ids >1 && !numabalancing_override) { -printk (KERN_INFO "Enabling automatic NUMA balancing. " -"Configure with numa_balancing= or sysctl" ); +printk (KERN_INFO "%s automatic NUMA balancing. " +"Configure with numa_balancing= or sysctl" , + numabalancing_default ?"Enabling" :"Disabling" );set_numabalancing_state (numabalancing_default); } }
@@ -2597,13 +2602,12 @@ static int __init setup_numabalancing(char *str)int ret =0 ;if (!str) goto out; - numabalancing_override = true;if (!strcmp (str,"enable" )) { -set_numabalancing_state (true); + numabalancing_override =1 ; ret =1 ; }else if (!strcmp (str,"disable" )) { -set_numabalancing_state (false); + numabalancing_override =-1 ; ret =1 ; } out:
Signature · 1 line
2.4.2
PATCH 38/111 KVM: MMU: fix CR4.SMEP=1, CR0.WP=0 with shadow pages
In reply to Jiri SlabyFrom: Paolo Bonzini <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 898761158be7682082955e3efa4ad24725305fc7 upstream.
smep_andnot_wp is initialized in kvm_init_shadow_mmu and shadow pages should not be reused for different values of it. Thus, it has to be added to the mask in kvm_mmu_pte_write.
--- arch/x86/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu.c +1 -1
@@ -4123,7 +4123,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, ++vcpu->kvm->stat.mmu_pte_write;kvm_mmu_audit (vcpu,AUDIT_PRE_PTE_WRITE ); - mask.cr0_wp = mask.cr4_pae = mask.nxe =1 ; + mask.cr0_wp = mask.cr4_pae = mask.nxe = mask.smep_andnot_wp =1 ;for_each_gfn_indirect_valid_sp (vcpu->kvm, sp, gfn) {if (detect_write_misaligned (sp, gpa, bytes) ||detect_write_flooding (sp)) {
Signature · 1 line
2.4.2
PATCH 39/111 net: socket: Fix the wrong returns for recvmsg and sendmsg
In reply to Jiri SlabyFrom: Junling Zheng <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
Based on 08adb7dabd4874cc5666b4490653b26534702ce0 upstream.
We found that after v3.10.73, recvmsg might return -EFAULT while -EINVAL was expected.
We tested it through the recvmsg01 testcase come from LTP testsuit. It set msg->msg_namelen to -1 and the recvmsg syscall returned errno 14, which is unexpected (errno 22 is expected):
recvmsg01 4 TFAIL : invalid socket length ; returned -1 (expected -1),
errno 14 (expected 22)
Linux mainline has no this bug for commit 08adb7dab fixes it accidentally. However, it is too large and complex to be backported to LTS 3.10.
Commit 281c9c36 (net: compat: Update get_compat_msghdr() to match copy_msghdr_from_user() behaviour) made get_compat_msghdr() return error if msg_sys->msg_namelen was negative, which changed the behaviors of recvmsg and sendmsg syscall in a lib32 system:
Before commit 281c9c36, get_compat_msghdr() wouldn't fail and it would return -EINVAL in move_addr_to_user() or somewhere if msg_sys->msg_namelen was invalid and then syscall returned -EINVAL, which is correct.
And now, when msg_sys->msg_namelen is negative, get_compat_msghdr() will fail and wants to return -EINVAL, however, the outer syscall will return -EFAULT directly, which is unexpected.
This patch gets the return value of get_compat_msghdr() as well as copy_msghdr_from_user(), then returns this expected value if get_compat_msghdr() fails.
--- net/socket.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
net/socket.c +10 -14
@@ -1993,14 +1993,12 @@ static int ___sys_sendmsg(struct socket *sock, struct msghdr __user *msg,int err, ctl_len, total_len; err = -EFAULT ; -if (MSG_CMSG_COMPAT & flags) { -if (get_compat_msghdr (msg_sys, msg_compat)) -return -EFAULT ; - }else { +if (MSG_CMSG_COMPAT & flags) + err =get_compat_msghdr (msg_sys, msg_compat); +else err =copy_msghdr_from_user (msg_sys, msg); -if (err) -return err; - } +if (err) +return err;if (msg_sys->msg_iovlen >UIO_FASTIOV ) { err = -EMSGSIZE ;
@@ -2205,14 +2203,12 @@ static int ___sys_recvmsg(struct socket *sock, struct msghdr __user *msg,struct sockaddr __user *uaddr;int __user *uaddr_len; -if (MSG_CMSG_COMPAT & flags) { -if (get_compat_msghdr (msg_sys, msg_compat)) -return -EFAULT ; - }else { +if (MSG_CMSG_COMPAT & flags) + err =get_compat_msghdr (msg_sys, msg_compat); +else err =copy_msghdr_from_user (msg_sys, msg); -if (err) -return err; - } +if (err) +return err;if (msg_sys->msg_iovlen >UIO_FASTIOV ) { err = -EMSGSIZE ;
Signature · 1 line
2.4.2
PATCH 40/111 fs, omfs: add NULL terminator in the end up the token list
In reply to Jiri SlabyFrom: Sasha Levin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit dcbff39da3d815f08750552fdd04f96b51751129 upstream.
match_token() expects a NULL terminator at the end of the token list so that it would know where to stop. Not having one causes it to overrun to invalid memory.
In practice, passing a mount option that omfs didn't recognize would sometimes panic the system.
--- fs/omfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/omfs/inode.c +2 -1
@@ -361,7 +361,7 @@ nomem: }enum { - Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask + Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask, Opt_err };static const match_table_t tokens = {
@@ -370,6 +370,7 @@ static const match_table_t tokens = { {Opt_umask, "umask=%o"}, {Opt_dmask, "dmask=%o"}, {Opt_fmask, "fmask=%o"}, + {Opt_err, NULL}, };static int parse_options (char *options,struct omfs_sb_info *sbi)
Signature · 1 line
2.4.2
PATCH 41/111 lguest: fix out-by-one error in address checking.
In reply to Jiri SlabyFrom: Rusty Russell <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 83a35114d0e4583e6b0ca39502e68b6a92e2910c upstream.
This bug has been there since day 1; addresses in the top guest physical page weren't considered valid. You could map that page (the check in check_gpte() is correct), but if a guest tried to put a pagetable there we'd check that address manually when walking it, and kill the guest.
--- drivers/lguest/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lguest/core.c +1 -1
@@ -176,7 +176,7 @@ static void unmap_switcher(void)bool lguest_address_ok (const struct lguest *lg,unsigned long addr,unsigned long len) { -return (addr+len) /PAGE_SIZE < lg->pfn_limit && (addr+len >= addr); +return addr+len <= lg->pfn_limit *PAGE_SIZE && (addr+len >= addr); }/*
Signature · 1 line
2.4.2
PATCH 42/111 libceph: request a new osdmap if lingering request maps to no osd
In reply to Jiri SlabyFrom: Ilya Dryomov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b0494532214bdfbf241e94fabab5dd46f7b82631 upstream.
This commit does two things. First, if there are any homeless lingering requests, we now request a new osdmap even if the osdmap that is being processed brought no changes, i.e. if a given lingering request turned homeless in one of the previous epochs and remained homeless in the current epoch. Not doing so leaves us with a stale osdmap and as a result we may miss our window for reestablishing the watch and lose notifies.
MON=1 OSD=1:
# cat linger-needmap.sh
#!/bin/bash
rbd create --size 1 test
DEV=$(rbd map test)
ceph osd out 0
rbd map dne/dne # obtain a new osdmap as a side effect (!)
sleep 1
ceph osd in 0
rbd resize --size 2 test
# rbd info test | grep size -> 2M
# blockdev --getsize $DEV -> 1MN.B.: Not obtaining a new osdmap in between "osd out" and "osd in" above is enough to make it miss that resize notify, but that is a bug^Wlimitation of ceph watch/notify v1.
Second, homeless lingering requests are now kicked just like those lingering requests whose mapping has changed. This is mainly to recognize that a homeless lingering request makes no sense and to preserve the invariant that a registered lingering request is not sitting on any of r_req_lru_item lists. This spares us a WARN_ON, which commit ba9d114ec557 ("libceph: clear r_req_lru_item in __unregister_linger_request()") tried to fix the _wrong_ way.
--- net/ceph/osd_client.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-)
net/ceph/osd_client.c +20 -11
@@ -1709,20 +1709,29 @@ static void kick_requests(struct ceph_osd_client *osdc, bool force_resend, err =__map_request (osdc, req, force_resend || force_resend_writes);dout ("__map_request returned %d\n" , err); -if (err ==0 ) -continue ;/* no change and no osd was specified */ if (err <0 )continue ;/* hrm! */ -if (req->r_osd ==NULL ) { -dout ("tid %llu maps to no valid osd\n" , req->r_tid); - needmap++;/* request a newer map */ -continue ; - } +if (req->r_osd ==NULL || err >0 ) { +if (req->r_osd ==NULL ) { +dout ("lingering %p tid %llu maps to no osd\n" , + req, req->r_tid); +/* +* A homeless lingering request makes +* no sense, as it's job is to keep +* a particular OSD connection open. +* Request a newer map and kick the +* request, knowing that it won't be +* resent until we actually get a map +* that can tell us where to send it. +*/ + needmap++; + } -dout ("kicking lingering %p tid %llu osd%d\n" , req, req->r_tid, - req->r_osd ? req->r_osd->o_osd :-1 ); -__register_request (osdc, req); -__unregister_linger_request (osdc, req); +dout ("kicking lingering %p tid %llu osd%d\n" , req, + req->r_tid, req->r_osd ? req->r_osd->o_osd :-1 ); +__register_request (osdc, req); +__unregister_linger_request (osdc, req); + } }reset_changed_osds (osdc);mutex_unlock (&osdc->request_mutex);
Signature · 1 line
2.4.2
PATCH 43/111 xen/events: don't bind non-percpu VIRQs with percpu chip
In reply to Jiri SlabyFrom: David Vrabel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 77bb3dfdc0d554befad58fdefbc41be5bc3ed38a upstream.
A non-percpu VIRQ (e.g., VIRQ_CONSOLE) may be freed on a different VCPU than it is bound to. This can result in a race between handle_percpu_irq() and removing the action in __free_irq() because handle_percpu_irq() does not take desc->lock. The interrupt handler sees a NULL action and oopses.
Only use the percpu chip/handler for per-CPU VIRQs (like VIRQ_TIMER).
# cat /proc/interrupts | grep virq 40: 87246 0 xen-percpu-virq timer0 44: 0 0 xen-percpu-virq debug0 47: 0 20995 xen-percpu-virq timer1 51: 0 0 xen-percpu-virq debug1 69: 0 0 xen-dyn-virq xen-pcpu 74: 0 0 xen-dyn-virq mce 75: 29 0 xen-dyn-virq hvc_console
--- drivers/tty/hvc/hvc_xen.c | 2 +- drivers/xen/events.c | 12 ++++++++---- include/xen/events.h | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/tty/hvc/hvc_xen.c +1 -1
@@ -289,7 +289,7 @@ static int xen_initial_domain_console_init(void)return -ENOMEM ; } - info->irq =bind_virq_to_irq (VIRQ_CONSOLE ,0 ); + info->irq =bind_virq_to_irq (VIRQ_CONSOLE ,0 , false); info->vtermno =HVC_COOKIE ;spin_lock (&xencons_lock);
drivers/xen/events.c +8 -4
@@ -959,7 +959,7 @@ static int find_virq(unsigned int virq, unsigned int cpu)return rc; } -int bind_virq_to_irq (unsigned int virq,unsigned int cpu) +int bind_virq_to_irq (unsigned int virq,unsigned int cpu,bool percpu) {struct evtchn_bind_virq bind_virq;int evtchn, irq, ret;
@@ -973,8 +973,12 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu)if (irq <0 ) goto out; -irq_set_chip_and_handler_name (irq, &xen_percpu_chip, - handle_percpu_irq,"virq" ); +if (percpu) +irq_set_chip_and_handler_name (irq, &xen_percpu_chip, + handle_percpu_irq,"virq" ); +else +irq_set_chip_and_handler_name (irq, &xen_dynamic_chip, + handle_edge_irq,"virq" ); bind_virq.virq = virq; bind_virq.vcpu = cpu;
@@ -1101,7 +1105,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, {int irq, retval; - irq =bind_virq_to_irq (virq, cpu); + irq =bind_virq_to_irq (virq, cpu, irqflags &IRQF_PERCPU );if (irq <0 )return irq; retval =request_irq (irq, handler, irqflags, devname, dev_id);
include/xen/events.h +1 -1
@@ -12,7 +12,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn,irq_handler_t handler, unsigned long irqflags, const char *devname, void *dev_id); -int bind_virq_to_irq (unsigned int virq,unsigned int cpu); +int bind_virq_to_irq (unsigned int virq,unsigned int cpu,bool percpu); int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, irq_handler_t handler, unsigned long irqflags, const char *devname,
Signature · 1 line
2.4.2
PATCH 44/111 hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGE
In reply to Jiri SlabyFrom: Chris Lesiak <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit adba657533bdd255f7b78bc8a324091f46b294cd upstream.
When configured via device tree, the associated iio device needs to be measuring voltage for the conversion to resistance to be correct. Return -EINVAL if that is not the case.
--- drivers/hwmon/ntc_thermistor.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/hwmon/ntc_thermistor.c +9 -0
@@ -181,8 +181,10 @@ static struct ntc_thermistor_platform_data * ntc_thermistor_parse_dt(struct platform_device *pdev) {struct iio_channel *chan; +enum iio_chan_type type;struct device_node *np = pdev->dev.of_node;struct ntc_thermistor_platform_data *pdata; +int ret;if (!np)return NULL ;
@@ -195,6 +197,13 @@ ntc_thermistor_parse_dt(struct platform_device *pdev)if (IS_ERR (chan))return ERR_CAST (chan); + ret =iio_get_channel_type (chan, &type); +if (ret <0 ) +return ERR_PTR (ret); + +if (type !=IIO_VOLTAGE ) +return ERR_PTR (-EINVAL ); +if (of_property_read_u32 (np,"pullup-uv" , &pdata->pullup_uv))return ERR_PTR (-ENODEV );if (of_property_read_u32 (np,"pullup-ohm" , &pdata->pullup_ohm))
Signature · 1 line
2.4.2
PATCH 45/111 hwmon: (nct6775) Add missing sysfs attribute initialization
In reply to Jiri SlabyFrom: Guenter Roeck <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1b63bf617206ff35b93c57c67bbe067ac735a85a upstream.
The following error message is seen when loading the nct6775 driver with DEBUG_LOCK_ALLOC enabled.
BUG: key ffff88040b2f0030 not in .data! ------------[ cut here ]------------ WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988 lockdep_init_map+0x469/0x630()
DEBUG_LOCKS_WARN_ON(1)
Caused by a missing call to sysfs_attr_init() when initializing sysfs attributes.
--- drivers/hwmon/nct6775.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hwmon/nct6775.c +2 -0
@@ -978,6 +978,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg, (*t)->dev_attr.attr.name, tg->base + i);if ((*t)->s2) { a2 = &su->u.a2; +sysfs_attr_init (&a2->dev_attr.attr); a2->dev_attr.attr.name = su->name; a2->nr = (*t)->u.s.nr + i; a2->index = (*t)->u.s.index;
@@ -988,6 +989,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg, *attrs = &a2->dev_attr.attr; }else { a = &su->u.a1; +sysfs_attr_init (&a->dev_attr.attr); a->dev_attr.attr.name = su->name; a->index = (*t)->u.index + i; a->dev_attr.attr.mode =
Signature · 1 line
2.4.2
PATCH 46/111 lib: Fix strnlen_user() to not touch memory after specified maximum
In reply to Jiri SlabyFrom: Jan Kara <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f18c34e483ff6b1d9866472221e4015b3a4698e4 upstream.
If the specified maximum length of the string is a multiple of unsigned long, we would load one long behind the specified maximum. If that happens to be in a next page, we can hit a page fault although we were not expected to.
Fix the off-by-one bug in the test whether we are at the end of the specified range.
--- lib/strnlen_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/strnlen_user.c +2 -1
@@ -57,7 +57,8 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count,return res +find_zero (data) +1 - align; } res +=sizeof (unsigned long ); -if (unlikely (max <sizeof (unsigned long ))) +/* We already handled 'unsigned long' bytes. Did we do it all ? */ +if (unlikely (max <=sizeof (unsigned long )))break ; max -=sizeof (unsigned long );if (unlikely (__get_user (c,(unsigned long __user *)(src+res))))
Signature · 1 line
2.4.2
PATCH 47/111 d_walk() might skip too much
In reply to Jiri SlabyFrom: Al Viro <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 2159184ea01e4ae7d15f2017e296d4bc82d5aeb0 upstream.
when we find that a child has died while we'd been trying to ascend, we should go into the first live sibling itself, rather than its sibling.
Off-by-one in question had been introduced in "deal with deadlock in d_walk()" and the fix needs to be backported to all branches this one has been backported to.
--- fs/dcache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/dcache.c +4 -4
@@ -1154,13 +1154,13 @@ ascend:/* might go back up the wrong parent if we have had a rename. */ if (need_seqretry (&rename_lock, seq)) goto rename_retry; - next = child->d_child.next; -while (unlikely (child->d_flags &DCACHE_DENTRY_KILLED )) { +/* go into the first sibling still alive */ +do { + next = child->d_child.next;if (next == &this_parent->d_subdirs) goto ascend; child = list_entry(next, struct dentry, d_child); - next = next->next; - } + }while (unlikely (child->d_flags &DCACHE_DENTRY_KILLED ));rcu_read_unlock (); goto resume; }
Signature · 1 line
2.4.2
PATCH 48/111 ALSA: hda - Add Conexant codecs CX20721, CX20722, CX20723 and CX20724
In reply to Jiri SlabyFrom: David Henningsson <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6ffc0898b29a2811a6c0569c5dd9b581980110df upstream.
This patch adds support for Conexant HD Audio codecs CX20721, CX20722, CX20723 and CX20724.
--- sound/pci/hda/patch_conexant.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_conexant.c +12 -0
@@ -3575,6 +3575,14 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { .patch = patch_conexant_auto }, { .id = 0x14f150b9, .name = "CX20665", .patch = patch_conexant_auto }, + { .id = 0x14f150f1, .name = "CX20721", + .patch = patch_conexant_auto }, + { .id = 0x14f150f2, .name = "CX20722", + .patch = patch_conexant_auto }, + { .id = 0x14f150f3, .name = "CX20723", + .patch = patch_conexant_auto }, + { .id = 0x14f150f4, .name = "CX20724", + .patch = patch_conexant_auto }, { .id = 0x14f1510f, .name = "CX20751/2", .patch = patch_conexant_auto }, { .id = 0x14f15110, .name = "CX20751/2",
@@ -3609,6 +3617,10 @@ MODULE_ALIAS("snd-hda-codec-id:14f150ab");MODULE_ALIAS ("snd-hda-codec-id:14f150ac" );MODULE_ALIAS ("snd-hda-codec-id:14f150b8" );MODULE_ALIAS ("snd-hda-codec-id:14f150b9" ); +MODULE_ALIAS ("snd-hda-codec-id:14f150f1" ); +MODULE_ALIAS ("snd-hda-codec-id:14f150f2" ); +MODULE_ALIAS ("snd-hda-codec-id:14f150f3" ); +MODULE_ALIAS ("snd-hda-codec-id:14f150f4" );MODULE_ALIAS ("snd-hda-codec-id:14f1510f" );MODULE_ALIAS ("snd-hda-codec-id:14f15110" );MODULE_ALIAS ("snd-hda-codec-id:14f15111" );
Signature · 1 line
2.4.2
PATCH 49/111 ALSA: hda - Add headphone quirk for Lifebook E752
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 88776f366ede7d9cdce60bd2c9753dd6d6fa8b77 upstream.
Fujitsu Lifebook E752 laptop needs a similar quirk done for Lifebook T731. Otherwise the headphone is always muted.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -4142,6 +4142,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK_VENDOR (0x104d ,"Sony VAIO" ,ALC269_FIXUP_SONY_VAIO ),SND_PCI_QUIRK (0x10cf ,0x1475 ,"Lifebook" ,ALC269_FIXUP_LIFEBOOK ),SND_PCI_QUIRK (0x10cf ,0x15dc ,"Lifebook T731" ,ALC269_FIXUP_LIFEBOOK_HP_PIN ), +SND_PCI_QUIRK (0x10cf ,0x1757 ,"Lifebook E752" ,ALC269_FIXUP_LIFEBOOK_HP_PIN ),SND_PCI_QUIRK (0x10cf ,0x1845 ,"Lifebook U904" ,ALC269_FIXUP_LIFEBOOK_EXTMIC ),SND_PCI_QUIRK (0x17aa ,0x20f2 ,"Thinkpad SL410/510" ,ALC269_FIXUP_SKU_IGNORE ), SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
Signature · 1 line
2.4.2
PATCH 50/111 ASoC: mc13783: Fix wrong mask value used in mc13xxx_reg_rmw() calls
In reply to Jiri SlabyFrom: Axel Lin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 545774bd6e1427d98dde77244329d2311c5eca6f upstream.
mc13xxx_reg_rmw() won't change any bit if passing 0 to the mask field. Pass AUDIO_SSI_SEL instead of 0 for the mask field to set AUDIO_SSI_SEL bit.
--- sound/soc/codecs/mc13783.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/mc13783.c +2 -2
@@ -603,14 +603,14 @@ static int mc13783_probe(struct snd_soc_codec *codec) AUDIO_SSI_SEL, 0); else mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, - 0, AUDIO_SSI_SEL); +AUDIO_SSI_SEL ,AUDIO_SSI_SEL );if (priv->dac_ssi_port ==MC13783_SSI1_PORT )mc13xxx_reg_rmw (priv->mc13xxx,MC13783_AUDIO_DAC ,AUDIO_SSI_SEL ,0 );else mc13xxx_reg_rmw (priv->mc13xxx,MC13783_AUDIO_DAC , -0 ,AUDIO_SSI_SEL ); +AUDIO_SSI_SEL ,AUDIO_SSI_SEL );mc13xxx_unlock (priv->mc13xxx);
Signature · 1 line
2.4.2
PATCH 51/111 ASoC: wm8960: fix "RINPUT3" audio route error
In reply to Jiri SlabyFrom: Zidan Wang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 85e36a1f4a735d991ba5106781ea48e89a0b8901 upstream.
It should be "RINPUT3" instead of "LINPUT3" route to "Right Input Mixer".
--- sound/soc/codecs/wm8960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8960.c +1 -1
@@ -392,7 +392,7 @@ static const struct snd_soc_dapm_route audio_paths[] = { { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ { "Right Input Mixer", NULL, "RINPUT2" }, - { "Right Input Mixer", NULL, "LINPUT3" }, + { "Right Input Mixer", NULL, "RINPUT3" }, { "Left ADC", NULL, "Left Input Mixer" }, { "Right ADC", NULL, "Right Input Mixer" },
Signature · 1 line
2.4.2
PATCH 52/111 ASoC: wm8994: correct BCLK DIV 348 to 384
In reply to Jiri SlabyFrom: Zidan Wang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 17fc2e0a3db11889e942c5ab15a1fcb876638f25 upstream.
According to the RM of wm8958, BCLK DIV 348 doesn't exist, correct it to 384.
--- sound/soc/codecs/wm8994.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8994.c +1 -1
@@ -2740,7 +2740,7 @@ static struct { };static int fs_ratios[] = { -64 ,128 ,192 ,256 ,348 ,512 ,768 ,1024 ,1408 ,1536 +64 ,128 ,192 ,256 ,384 ,512 ,768 ,1024 ,1408 ,1536 };static int bclk_divs[] = {
Signature · 1 line
2.4.2
PATCH 53/111 target/pscsi: Don't leak scsi_host if hba is VIRTUAL_HOST
In reply to Jiri SlabyFrom: Andy Grover <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5a7125c64def3b21f8147eca8b54949a60963942 upstream.
See https://bugzilla.redhat.com/show_bug.cgi?id=1025672
We need to put() the reference to the scsi host that we got in pscsi_configure_device(). In VIRTUAL_HOST mode it is associated with the dev_virt, not the hba_virt.
--- drivers/target/target_core_pscsi.c | 3 +++ drivers/target/target_core_pscsi.h | 1 + 2 files changed, 4 insertions(+)
drivers/target/target_core_pscsi.c +3 -0
@@ -520,6 +520,7 @@ static int pscsi_configure_device(struct se_device *dev) " pdv_host_id: %d\n", pdv->pdv_host_id);return -EINVAL ; } + pdv->pdv_lld_host = sh; } }else {if (phv->phv_mode ==PHV_VIRTUAL_HOST_ID ) {
@@ -602,6 +603,8 @@ static void pscsi_free_device(struct se_device *dev)if ((phv->phv_mode ==PHV_LLD_SCSI_HOST_NO ) && (phv->phv_lld_host !=NULL ))scsi_host_put (phv->phv_lld_host); +else if (pdv->pdv_lld_host) +scsi_host_put (pdv->pdv_lld_host);if ((sd->type ==TYPE_DISK ) || (sd->type ==TYPE_ROM ))scsi_device_put (sd);
drivers/target/target_core_pscsi.h +1 -0
@@ -45,6 +45,7 @@ struct pscsi_dev_virt {int pdv_lun_id;struct block_device *pdv_bd;struct scsi_device *pdv_sd; +struct Scsi_Host *pdv_lld_host; }____cacheline_aligned ; typedef enum phv_modes {
Signature · 1 line
2.4.2
PATCH 54/111 xhci: fix isoc endpoint dequeue from advancing too far on transaction error
In reply to Jiri SlabyFrom: Mathias Nyman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d104d0152a97fade389f47635b73a9ccc7295d0b upstream.
Isoc TDs usually consist of one TRB, sometimes two. When all goes well we receive only one success event for a TD, and move the dequeue pointer to the next TD.
This fails if the TD consists of two TRBs and we get a transfer error on the first TRB, we will then see two events for that TD.
Fix this by making sure the event we get is for the last TRB in that TD before moving the dequeue pointer to the next TD. This will resolve some of the uvc and dvb issues with the
"ERROR Transfer event TRB DMA ptr not part of current TD" error message
--- drivers/usb/host/xhci-ring.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/host/xhci-ring.c +5 -0
@@ -2180,8 +2180,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,break ;case COMP_DEV_ERR :case COMP_STALL : + frame->status = -EPROTO ; + skip_td = true; +break ;case COMP_TX_ERR : frame->status = -EPROTO ; +if (event_trb != td->last_trb) +return 0 ; skip_td = true;break ;case COMP_STOP :
Signature · 1 line
2.4.2
PATCH 55/111 xhci: Solve full event ring by increasing TRBS_PER_SEGMENT to 256
In reply to Jiri SlabyFrom: Mathias Nyman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 18cc2f4cbbaf825a4fedcf2d60fd388d291e0a38 upstream.
Our event ring consists of only one segment, and we risk filling the event ring in case we get isoc transfers with short intervals such as webcams that fill a TD every microframe (125us)
With 64 TRB segment size one usb camera could fill the event ring in 8ms. A setup with several cameras and other devices can fill up the event ring as it is shared between all devices.
This has occurred when uvcvideo queues 5 * 32TD URBs which then get cancelled when the video mode changes. The cancelled URBs are returned in the xhci interrupt context and blocks the interrupt handler from handling the new events.
A full event ring will block xhci from scheduling traffic and affect all devices conneted to the xhci, will see errors such as Missed Service Intervals for isoc devices, and and Split transaction errors for LS/FS interrupt devices.
Increasing the TRB_PER_SEGMENT will also increase the default endpoint ring size, which is welcome as for most isoc transfer we had to dynamically expand the endpoint ring anyway to be able to queue the 5 * 32TDs uvcvideo queues.
The default size used to be 64 TRBs per segment
--- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci.h +1 -1
@@ -1262,7 +1262,7 @@ union xhci_trb {* since the command ring is 64-byte aligned. * It must also be greater than 16. */ -#define TRBS_PER_SEGMENT 64 +#define TRBS_PER_SEGMENT 256/* Allow two commands + a link TRB, along with any reserved command TRBs */ #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3)#define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16)
Signature · 1 line
2.4.2
PATCH 56/111 xhci: gracefully handle xhci_irq dead device
In reply to Jiri SlabyFrom: Joe Lawrence <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 948fa13504f80b9765d2b753691ab94c83a10341 upstream.
If the xHCI host controller has died (ie, device removed) or suffered other serious fatal error (STS_FATAL), then xhci_irq should handle this condition with IRQ_HANDLED instead of -ESHUTDOWN.
--- drivers/usb/host/xhci-ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +1 -1
@@ -2794,7 +2794,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)xhci_halt (xhci); hw_died:spin_unlock (&xhci->lock); -return -ESHUTDOWN ; +return IRQ_HANDLED ; }/*
Signature · 1 line
2.4.2
PATCH 57/111 USB: visor: Match I330 phone more precisely
In reply to Jiri SlabyFrom: "Jason A. Donenfeld" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 82ee3aeb9295c5fc37fd2ddf20f13ac2b40ec97d upstream.
Samsung has just released a portable USB3 SSD, coming in a very small and nice form factor. It's USB ID is 04e8:8001, which unfortunately is already used by the Palm Visor driver for the Samsung I330 phone cradle. Having pl2303 or visor pick up this device ID results in conflicts with the usb-storage driver, which handles the newly released portable USB3 SSD.
To work around this conflict, I've dug up a mailing list post [1] from a long time ago, in which a user posts the full USB descriptor information. The most specific value in this appears to be the interface class, which has value 255 (0xff). Since usb-storage requires an interface class of 0x8, I believe it's correct to disambiguate the two devices by matching on 0xff inside visor.
[1] http://permalink.gmane.org/gmane.linux.usb.user/4264
--- drivers/usb/serial/visor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/serial/visor.c +1 -1
@@ -96,7 +96,7 @@ static struct usb_device_id id_table [] = { .driver_info = (kernel_ulong_t)&palm_os_4_probe }, { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID), .driver_info = (kernel_ulong_t)&palm_os_4_probe }, - { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID), + { USB_DEVICE_INTERFACE_CLASS(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID, 0xff), .driver_info = (kernel_ulong_t)&palm_os_4_probe }, { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), .driver_info = (kernel_ulong_t)&palm_os_4_probe },
Signature · 1 line
2.4.2
PATCH 58/111 USB: pl2303: Remove support for Samsung I330
In reply to Jiri SlabyFrom: "Jason A. Donenfeld" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 48ef23a4f686b1e4519d4193c20d26834ff810ff upstream.
This phone is already supported by the visor driver.
--- drivers/usb/serial/pl2303.c | 1 - drivers/usb/serial/pl2303.h | 4 ---- 2 files changed, 5 deletions(-)
drivers/usb/serial/pl2303.c +0 -1
@@ -64,7 +64,6 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, - { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1) }, { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) },
drivers/usb/serial/pl2303.h +0 -4
@@ -62,10 +62,6 @@#define ALCATEL_VENDOR_ID 0x11f7#define ALCATEL_PRODUCT_ID 0x02df -/* Samsung I330 phone cradle */ -#define SAMSUNG_VENDOR_ID 0x04e8 -#define SAMSUNG_PRODUCT_ID 0x8001 -#define SIEMENS_VENDOR_ID 0x11f5#define SIEMENS_PRODUCT_ID_SX1 0x0001#define SIEMENS_PRODUCT_ID_X65 0x0003
Signature · 1 line
2.4.2
PATCH 59/111 USB: cp210x: add ID for KCF Technologies PRN device
In reply to Jiri SlabyFrom: Mark Edwards <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c735ed74d83f8ecb45c4c4c95a16853c9c3c8157 upstream.
Added the USB serial console device ID for KCF Technologies PRN device which has a USB port for its serial console.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -127,6 +127,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ + { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
Signature · 1 line
2.4.2
PATCH 60/111 usb-storage: Add NO_WP_DETECT quirk for Lacie 059f:0651 devices
In reply to Jiri SlabyFrom: Hans de Goede <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 172115090f5e739660b97694618a2ba86457063a upstream.
Without this flag some versions of these enclosures do not work.
--- drivers/usb/storage/unusual_devs.h | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/storage/unusual_devs.h +7 -0
@@ -766,6 +766,13 @@ UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_GO_SLOW ), +/* Reported by Christian Schaller <[email protected]> */ +UNUSUAL_DEV (0x059f ,0x0651 ,0x0000 ,0x0000 , +"LaCie" , +"External HDD" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , + US_FL_NO_WP_DETECT ), +/* Submitted by Joel Bourquard <[email protected]> * Some versions of this device need the SubClass and Protocol overrides * while others don't.
Signature · 1 line
2.4.2
PATCH 61/111 usb: gadget: configfs: Fix interfaces array NULL-termination
In reply to Jiri SlabyFrom: Krzysztof Opasiak <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 903124fe1aa284f61745a9dd4fbfa0184e569fff upstream.
memset() to 0 interfaces array before reusingusb_configuration structure.
This commit fix bug:
ln -s functions/acm.1 configs/c.1
ln -s functions/acm.2 configs/c.1
ln -s functions/acm.3 configs/c.1
echo "UDC name" > UDC
echo "" > UDC
rm configs/c.1/acm.*
rmdir functions/*
mkdir functions/ecm.usb0
ln -s functions/ecm.usb0 configs/c.1
echo "UDC name" > UDC
[ 82.220969] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 82.229009] pgd = c0004000 [ 82.231698] [00000000] *pgd=00000000 [ 82.235260] Internal error: Oops: 17 [#1] PREEMPT SMP ARM [ 82.240638] Modules linked in: [ 82.243681] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.0.0-rc2 #39 [ 82.249926] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 82.256003] task: c07cd2f0 ti: c07c8000 task.ti: c07c8000 [ 82.261393] PC is at composite_setup+0xe3c/0x1674 [ 82.266073] LR is at composite_setup+0xf20/0x1674 [ 82.270760] pc : [<c03510d4>] lr : [<c03511b8>] psr: 600001d3 [ 82.270760] sp : c07c9df0 ip : c0806448 fp : ed8c9c9c [ 82.282216] r10: 00000001 r9 : 00000000 r8 : edaae918 [ 82.287425] r7 : ed551cc0 r6 : 00007fff r5 : 00000000 r4 : ed799634 [ 82.293934] r3 : 00000003 r2 : 00010002 r1 : edaae918 r0 : 0000002e [ 82.300446] Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel [ 82.307910] Control: 10c5387d Table: 6bc1804a DAC: 00000015 [ 82.313638] Process swapper/0 (pid: 0, stack limit = 0xc07c8210) [ 82.319627] Stack: (0xc07c9df0 to 0xc07ca000) [ 82.323969] 9de0: 00000000 c06e65f4 00000000 c07c9f68 [ 82.332130] 9e00: 00000067 c07c59ac 000003f7 edaae918 ed8c9c98 ed799690 eca2f140 200001d3 [ 82.340289] 9e20: ee79a2d8 c07c9e88 c07c5304 ffff55db 00010002 edaae810 edaae860 eda96d50 [ 82.348448] 9e40: 00000009 ee264510 00000007 c07ca444 edaae860 c0340890 c0827a40 ffff55e0 [ 82.356607] 9e60: c0827a40 eda96e40 ee264510 edaae810 00000000 edaae860 00000007 c07ca444 [ 82.364766] 9e80: edaae860 c0354170 c03407dc c033db4c edaae810 00000000 00000000 00000010 [ 82.372925] 9ea0: 00000032 c0341670 00000000 00000000 00000001 eda96e00 00000000 00000000 [ 82.381084] 9ec0: 00000000 00000032 c0803a23 ee1aa840 00000001 c005d54c 249e2450 00000000 [ 82.389244] 9ee0: 200001d3 ee1aa840 ee1aa8a0 ed84f4c0 00000000 c07c9f68 00000067 c07c59ac [ 82.397403] 9f00: 00000000 c005d688 ee1aa840 ee1aa8a0 c07db4b4 c006009c 00000032 00000000 [ 82.405562] 9f20: 00000001 c005ce20 c07c59ac c005cf34 f002000c c07ca780 c07c9f68 00000057 [ 82.413722] 9f40: f0020000 413fc090 00000001 c00086b4 c000f804 60000053 ffffffff c07c9f9c [ 82.421880] 9f60: c0803a20 c0011fc0 00000000 00000000 c07c9fb8 c001bee0 c07ca4f0 c057004c [ 82.430040] 9f80: c07ca4fc c0803a20 c0803a20 413fc090 00000001 00000000 01000000 c07c9fb0 [ 82.438199] 9fa0: c000f800 c000f804 60000053 ffffffff 00000000 c0050e70 c0803bc0 c0783bd8 [ 82.446358] 9fc0: ffffffff ffffffff c0783664 00000000 00000000 c07b13e8 00000000 c0803e54 [ 82.454517] 9fe0: c07ca480 c07b13e4 c07ce40c 4000406a 00000000 40008074 00000000 00000000 [ 82.462689] [<c03510d4>] (composite_setup) from [<c0340890>] (s3c_hsotg_complete_setup+0xb4/0x418) [ 82.471626] [<c0340890>] (s3c_hsotg_complete_setup) from [<c0354170>] (usb_gadget_giveback_request+0xc/0x10) [ 82.481429] [<c0354170>] (usb_gadget_giveback_request) from [<c033db4c>] (s3c_hsotg_complete_request+0xcc/0x12c) [ 82.491583] [<c033db4c>] (s3c_hsotg_complete_request) from [<c0341670>] (s3c_hsotg_irq+0x4fc/0x558) [ 82.500614] [<c0341670>] (s3c_hsotg_irq) from [<c005d54c>] (handle_irq_event_percpu+0x50/0x150) [ 82.509291] [<c005d54c>] (handle_irq_event_percpu) from [<c005d688>] (handle_irq_event+0x3c/0x5c) [ 82.518145] [<c005d688>] (handle_irq_event) from [<c006009c>] (handle_fasteoi_irq+0xd4/0x18c) [ 82.526650] [<c006009c>] (handle_fasteoi_irq) from [<c005ce20>] (generic_handle_irq+0x20/0x30) [ 82.535242] [<c005ce20>] (generic_handle_irq) from [<c005cf34>] (__handle_domain_irq+0x6c/0xdc) [ 82.543923] [<c005cf34>] (__handle_domain_irq) from [<c00086b4>] (gic_handle_irq+0x2c/0x6c) [ 82.552256] [<c00086b4>] (gic_handle_irq) from [<c0011fc0>] (__irq_svc+0x40/0x74) [ 82.559716] Exception stack(0xc07c9f68 to 0xc07c9fb0) [ 82.564753] 9f60: 00000000 00000000 c07c9fb8 c001bee0 c07ca4f0 c057004c [ 82.572913] 9f80: c07ca4fc c0803a20 c0803a20 413fc090 00000001 00000000 01000000 c07c9fb0 [ 82.581069] 9fa0: c000f800 c000f804 60000053 ffffffff [ 82.586113] [<c0011fc0>] (__irq_svc) from [<c000f804>] (arch_cpu_idle+0x30/0x3c) [ 82.593491] [<c000f804>] (arch_cpu_idle) from [<c0050e70>] (cpu_startup_entry+0x128/0x1a4) [ 82.601740] [<c0050e70>] (cpu_startup_entry) from [<c0783bd8>] (start_kernel+0x350/0x3bc) [ 82.609890] Code: 0a000002 e3530005 05975010 15975008 (e5953000) [ 82.615965] ---[ end trace f57d5f599a5f1bfa ]---
Most of kernel code assume that interface array in struct usb_configuration is NULL terminated.
When gadget is composed with configfs configuration structure may be reused for different functions set.
This bug happens because purge_configs_funcs() sets only next_interface_id to 0. Interface array still contains pointers to already freed interfaces. If in second try we add less interfaces than earlier we may access unallocated memory when trying to get interface descriptors.
--- drivers/usb/gadget/configfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/configfs.c +1 -0
@@ -757,6 +757,7 @@ static void purge_configs_funcs(struct gadget_info *gi) } } c->next_interface_id =0 ; +memset (c->interface,0 ,sizeof (c->interface)); c->superspeed =0 ; c->highspeed =0 ; c->fullspeed =0 ;
Signature · 1 line
2.4.2
PATCH 62/111 powerpc: Align TOC to 256 bytes
In reply to Jiri SlabyFrom: Anton Blanchard <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5e95235ccd5442d4a4fe11ec4eb99ba1b7959368 upstream.
Recent toolchains force the TOC to be 256 byte aligned. We need to enforce this alignment in our linker script, otherwise pointers to our TOC variables (__toc_start, __prom_init_toc_start) could be incorrect.
If they are bad, we die a few hundred instructions into boot.
--- arch/powerpc/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kernel/vmlinux.lds.S +1 -0
@@ -213,6 +213,7 @@ SECTIONS *(.opd) } + . = ALIGN(256); .got : AT(ADDR(.got) - LOAD_OFFSET) { __toc_start = .; #ifndef CONFIG_RELOCATABLE
Signature · 1 line
2.4.2
PATCH 63/111 mmc: atmel-mci: fix bad variable type for clkdiv
In reply to Jiri SlabyFrom: Ludovic Desroches <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 60c8f783a18feb95ad967c87e9660caf09fb4700 upstream.
clkdiv is declared as an u32 but it can be set to a negative value causing a huge divisor value. Change its type to int to avoid this case.
--- drivers/mmc/host/atmel-mci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/atmel-mci.c +7 -2
@@ -1301,7 +1301,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)if (ios->clock) {unsigned int clock_min = ~0U ; -u32 clkdiv; +int clkdiv;clk_prepare (host->mck); unprepare_clk = true;
@@ -1330,7 +1330,12 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)/* Calculate clock divider */ if (host->caps.has_odd_clk_div) { clkdiv =DIV_ROUND_UP (host->bus_hz, clock_min) -2 ; -if (clkdiv >511 ) { +if (clkdiv <0 ) { +dev_warn (&mmc->class_dev, +"clock %u too fast; using %lu\n" , + clock_min, host->bus_hz /2 ); + clkdiv =0 ; + }else if (clkdiv >511 ) {dev_warn (&mmc->class_dev,"clock %u too slow; using %lu\n" , clock_min, host->bus_hz / (511 +2 ));
Signature · 1 line
2.4.2
PATCH 64/111 ext4: fix NULL pointer dereference when journal restart fails
In reply to Jiri SlabyFrom: Lukas Czerner <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9d506594069355d1fb2de3f9104667312ff08ed3 upstream.
Currently when journal restart fails, we'll have the h_transaction of the handle set to NULL to indicate that the handle has been effectively aborted. We handle this situation quietly in the jbd2_journal_stop() and just free the handle and exit because everything else has been done before we attempted (and failed) to restart the journal.
Unfortunately there are a number of problems with that approach introduced with commit
41a5b913197c "jbd2: invalidate handle if jbd2_journal_restart() fails"
First of all in ext4 jbd2_journal_stop() will be called through __ext4_journal_stop() where we would try to get a hold of the superblock by dereferencing h_transaction which in this case would lead to NULL pointer dereference and crash.
In addition we're going to free the handle regardless of the refcount which is bad as well, because others up the call chain will still reference the handle so we might potentially reference already freed memory.
Moreover it's expected that we'll get aborted handle as well as detached handle in some of the journalling function as the error propagates up the stack, so it's unnecessary to call WARN_ON every time we get detached handle.
And finally we might leak some memory by forgetting to free reserved handle in jbd2_journal_stop() in the case where handle was detached from the transaction (h_transaction is NULL).
Fix the NULL pointer dereference in __ext4_journal_stop() by just calling jbd2_journal_stop() quietly as suggested by Jan Kara. Also fix the potential memory leak in jbd2_journal_stop() and use proper handle refcounting before we attempt to free it to avoid use-after-free issues.
And finally remove all WARN_ON(!transaction) from the code so that we do not get random traces when something goes wrong because when journal restart fails we will get to some of those functions.
--- fs/ext4/ext4_jbd2.c | 6 ++++++ fs/jbd2/transaction.c | 25 ++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-)
fs/ext4/ext4_jbd2.c +6 -0
@@ -87,6 +87,12 @@ int __ext4_journal_stop(const char *where, unsigned int line, handle_t *handle)ext4_put_nojournal (handle);return 0 ; } + +if (!handle->h_transaction) { + err =jbd2_journal_stop (handle); +return handle->h_err ? handle->h_err : err; + } + sb = handle->h_transaction->t_journal->j_private; err = handle->h_err; rc =jbd2_journal_stop (handle);
fs/jbd2/transaction.c +16 -9
@@ -551,7 +551,6 @@ int jbd2_journal_extend(handle_t *handle, int nblocks)int result;int wanted; -WARN_ON (!transaction);if (is_handle_aborted (handle))return -EROFS ; journal = transaction->t_journal;
@@ -627,7 +626,6 @@ int jbd2__journal_restart(handle_t *handle, int nblocks, gfp_t gfp_mask)tid_t tid;int need_to_start, ret; -WARN_ON (!transaction);/* If we've had an abort of any type, don't even think about * actually doing the restart! */ if (is_handle_aborted (handle))
@@ -791,7 +789,6 @@ do_get_write_access(handle_t *handle, struct journal_head *jh,int need_copy =0 ;unsigned long start_lock, time_lock; -WARN_ON (!transaction);if (is_handle_aborted (handle))return -EROFS ; journal = transaction->t_journal;
@@ -1057,7 +1054,6 @@ int jbd2_journal_get_create_access(handle_t *handle, struct buffer_head *bh)int err;jbd_debug (5 ,"journal_head %p\n" , jh); -WARN_ON (!transaction); err = -EROFS ;if (is_handle_aborted (handle)) goto out;
@@ -1271,7 +1267,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)struct journal_head *jh;int ret =0 ; -WARN_ON (!transaction);if (is_handle_aborted (handle))return -EROFS ; journal = transaction->t_journal;
@@ -1407,7 +1402,6 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh)int err =0 ;int was_modified =0 ; -WARN_ON (!transaction);if (is_handle_aborted (handle))return -EROFS ; journal = transaction->t_journal;
@@ -1538,8 +1532,22 @@ int jbd2_journal_stop(handle_t *handle)tid_t tid;pid_t pid; -if (!transaction) - goto free_and_exit; +if (!transaction) { +/* +* Handle is already detached from the transaction so +* there is nothing to do other than decrease a refcount, +* or free the handle if refcount drops to zero +*/ +if (--handle->h_ref >0 ) { +jbd_debug (4 ,"h_ref %d -> %d\n" , handle->h_ref +1 , + handle->h_ref); +return err; + }else { +if (handle->h_rsv_handle) +jbd2_free_handle (handle->h_rsv_handle); + goto free_and_exit; + } + } journal = transaction->t_journal;J_ASSERT (journal_current_handle () == handle);
@@ -2381,7 +2389,6 @@ int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *jinode)transaction_t *transaction = handle->h_transaction;journal_t *journal; -WARN_ON (!transaction);if (is_handle_aborted (handle))return -EROFS ; journal = transaction->t_journal;
Signature · 1 line
2.4.2
PATCH 65/111 ext4: check for zero length extent explicitly
In reply to Jiri SlabyFrom: Eryu Guan <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 2f974865ffdfe7b9f46a9940836c8b167342563d upstream.
The following commit introduced a bug when checking for zero length extent
5946d08 ext4: check for overlapping extents in ext4_valid_extent_entries()
Zero length extent could pass the check if lblock is zero.
Adding the explicit check for zero length back.
--- fs/ext4/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/extents.c +1 -1
@@ -361,7 +361,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)ext4_lblk_t lblock =le32_to_cpu (ext->ee_block);ext4_lblk_t last = lblock + len -1 ; -if (lblock > last) +if (len ==0 || lblock > last)return 0 ;return ext4_data_block_valid (EXT4_SB (inode->i_sb), block, len); }
Signature · 1 line
2.4.2
PATCH 66/111 jbd2: fix r_count overflows leading to buffer overflow in journal recovery
In reply to Jiri SlabyFrom: "Darrick J. Wong" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e531d0bceb402e643a4499de40dd3fa39d8d2e43 upstream.
The journal revoke block recovery code does not check r_count for sanity, which means that an evil value of r_count could result in the kernel reading off the end of the revoke table and into whatever garbage lies beyond. This could crash the kernel, so fix that.
However, in testing this fix, I discovered that the code to write out the revoke tables also was not correctly checking to see if the block was full -- the current offset check is fine so long as the revoke table space size is a multiple of the record size, but this is not true when either journal_csum_v[23] are set.
--- fs/jbd2/recovery.c | 10 +++++++++- fs/jbd2/revoke.c | 18 ++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-)
fs/jbd2/recovery.c +9 -1
@@ -839,15 +839,23 @@ static int scan_revoke_records(journal_t *journal, struct buffer_head *bh, {jbd2_journal_revoke_header_t *header;int offset, max; +int csum_size =0 ; +__u32 rcount;int record_len =4 ; header = (jbd2_journal_revoke_header_t *) bh->b_data; offset =sizeof (jbd2_journal_revoke_header_t); - max =be32_to_cpu (header->r_count); + rcount =be32_to_cpu (header->r_count);if (!jbd2_revoke_block_csum_verify (journal, header))return -EINVAL ; +if (jbd2_journal_has_csum_v2or3 (journal)) + csum_size =sizeof (struct jbd2_journal_revoke_tail ); +if (rcount > journal->j_blocksize - csum_size) +return -EINVAL ; + max = rcount; +if (JBD2_HAS_INCOMPAT_FEATURE (journal,JBD2_FEATURE_INCOMPAT_64BIT )) record_len =8 ;
fs/jbd2/revoke.c +10 -8
@@ -583,7 +583,7 @@ static void write_one_revoke_record(journal_t *journal, {int csum_size =0 ;struct buffer_head *descriptor; -int offset; +int sz, offset;journal_header_t *header;/* If we are already aborting, this all becomes a noop. We
@@ -600,9 +600,14 @@ static void write_one_revoke_record(journal_t *journal,if (jbd2_journal_has_csum_v2or3 (journal)) csum_size =sizeof (struct jbd2_journal_revoke_tail ); +if (JBD2_HAS_INCOMPAT_FEATURE (journal,JBD2_FEATURE_INCOMPAT_64BIT )) + sz =8 ; +else + sz =4 ; +/* Make sure we have a descriptor with space left for the record */ if (descriptor) { -if (offset >= journal->j_blocksize - csum_size) { +if (offset + sz > journal->j_blocksize - csum_size) {flush_descriptor (journal, descriptor, offset, write_op); descriptor =NULL ; }
@@ -625,16 +630,13 @@ static void write_one_revoke_record(journal_t *journal, *descriptorp = descriptor; } -if (JBD2_HAS_INCOMPAT_FEATURE (journal,JBD2_FEATURE_INCOMPAT_64BIT )) { +if (JBD2_HAS_INCOMPAT_FEATURE (journal,JBD2_FEATURE_INCOMPAT_64BIT )) * ((__be64 *)(&descriptor->b_data[offset])) =cpu_to_be64 (record->blocknr); - offset +=8 ; - - }else { +else * ((__be32 *)(&descriptor->b_data[offset])) =cpu_to_be32 (record->blocknr); - offset +=4 ; - } + offset += sz; *offsetp = offset; }
Signature · 1 line
2.4.2
PATCH 67/111 libata: Add helper to determine when PHY events should be ignored
In reply to Jiri SlabyFrom: Gabriele Mazzotta <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8393b811f38acdf7fd8da2028708edad3e68ce1f upstream.
This is a preparation commit that will allow to add other criteria according to which PHY events should be dropped.
--- drivers/ata/libahci.c | 3 +-- drivers/ata/libata-core.c | 19 +++++++++++++++++++ include/linux/libata.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)
drivers/ata/libahci.c +1 -2
@@ -1693,8 +1693,7 @@ static void ahci_handle_port_interrupt(struct ata_port *ap,if (unlikely (resetting)) status &= ~PORT_IRQ_BAD_PMP ; -/* if LPM is enabled, PHYRDY doesn't mean anything */ -if (ap->link.lpm_policy >ATA_LPM_MAX_POWER ) { +if (sata_lpm_ignore_phy_events (&ap->link)) { status &= ~PORT_IRQ_PHYRDY ;ahci_scr_write (&ap->link,SCR_ERROR ,SERR_PHYRDY_CHG ); }
drivers/ata/libata-core.c +19 -0
@@ -6828,6 +6828,25 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val,return tmp; } +/** +* sata_lpm_ignore_phy_events - test if PHY event should be ignored +* @link: Link receiving the event +* +* Test whether the received PHY event has to be ignored or not. +* +* LOCKING: +* None: +* +* RETURNS: +* True if the event has to be ignored. +*/ +bool sata_lpm_ignore_phy_events (struct ata_link *link) +{ +/* if LPM is enabled, PHYRDY doesn't mean anything */ +return !!(link->lpm_policy >ATA_LPM_MAX_POWER ); +} +EXPORT_SYMBOL_GPL (sata_lpm_ignore_phy_events); +/* * Dummy port_ops */
include/linux/libata.h +1 -0
@@ -1201,6 +1201,7 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev);extern int ata_do_set_mode (struct ata_link *link,struct ata_device **r_failed_dev);extern void ata_scsi_port_error_handler (struct Scsi_Host *host,struct ata_port *ap);extern void ata_scsi_cmd_error_handler (struct Scsi_Host *host,struct ata_port *ap,struct list_head *eh_q); +extern bool sata_lpm_ignore_phy_events (struct ata_link *link);extern int ata_cable_40wire (struct ata_port *ap);extern int ata_cable_80wire (struct ata_port *ap);
Signature · 1 line
2.4.2
PATCH 68/111 libata: Ignore spurious PHY event on LPM policy change
In reply to Jiri SlabyFrom: Gabriele Mazzotta <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 09c5b4803a80a5451d950d6a539d2eb311dc0fb1 upstream.
When the LPM policy is set to ATA_LPM_MAX_POWER, the device might generate a spurious PHY event that cuases errors on the link. Ignore this event if it occured within 10s after the policy change.
The timeout was chosen observing that on a Dell XPS13 9333 these spurious events can occur up to roughly 6s after the policy change.
--- drivers/ata/libata-core.c | 15 ++++++++++++++- drivers/ata/libata-eh.c | 3 +++ include/linux/libata.h | 9 +++++++++ 3 files changed, 26 insertions(+), 1 deletion(-)
drivers/ata/libata-core.c +14 -1
@@ -6842,8 +6842,21 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val,*/ bool sata_lpm_ignore_phy_events (struct ata_link *link) { +unsigned long lpm_timeout = link->last_lpm_change + +msecs_to_jiffies (ATA_TMOUT_SPURIOUS_PHY ); +/* if LPM is enabled, PHYRDY doesn't mean anything */ -return !!(link->lpm_policy >ATA_LPM_MAX_POWER ); +if (link->lpm_policy >ATA_LPM_MAX_POWER ) +return true; + +/* ignore the first PHY event after the LPM policy changed +* as it is might be spurious +*/ +if ((link->flags &ATA_LFLAG_CHANGED ) && +time_before (jiffies, lpm_timeout)) +return true; + +return false; }EXPORT_SYMBOL_GPL (sata_lpm_ignore_phy_events);
drivers/ata/libata-eh.c +3 -0
@@ -3481,6 +3481,9 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, } } + link->last_lpm_change = jiffies; + link->flags |=ATA_LFLAG_CHANGED ; +return 0 ; fail:
include/linux/libata.h +9 -0
@@ -204,6 +204,7 @@ enum {ATA_LFLAG_SW_ACTIVITY = (1 <<7 ),/* keep activity stats */ ATA_LFLAG_NO_LPM = (1 <<8 ),/* disable LPM on this link */ ATA_LFLAG_RST_ONCE = (1 <<9 ),/* limit recovery to one reset */ +ATA_LFLAG_CHANGED = (1 <<10 ),/* LPM state changed on this link */ /* struct ata_port flags */ ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
@@ -307,6 +308,12 @@ enum {*/ ATA_TMOUT_PMP_SRST_WAIT =5000 , +/* When the LPM policy is set to ATA_LPM_MAX_POWER, there might +* be a spurious PHY event, so ignore the first PHY event that +* occurs within 10s after the policy change. +*/ +ATA_TMOUT_SPURIOUS_PHY =10000 , +/* ATA bus states */ BUS_UNKNOWN =0 , BUS_DMA = 1,
@@ -785,6 +792,8 @@ struct ata_link {struct ata_eh_context eh_context;struct ata_device device[ATA_MAX_DEVICES ]; + +unsigned long last_lpm_change;/* when last LPM change happened */ };#define ATA_LINK_CLEAR_BEGIN offsetof(struct ata_link, active_tag)#define ATA_LINK_CLEAR_END offsetof(struct ata_link, device[0])
Signature · 1 line
2.4.2
PATCH 69/111 rt2x00: add new rt2800usb device DWA 130
In reply to Jiri SlabyFrom: Scott Branden <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ea345c145ff23197eab34d0c4d0c8a93d7bea8c6 upstream.
Add the USB Id to link the D-Link DWA 130 USB Wifi adapter to the rt2830 driver.
--- drivers/net/wireless/rt2x00/rt2800usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rt2x00/rt2800usb.c +1 -0
@@ -994,6 +994,7 @@ static struct usb_device_id rt2800usb_device_table[] = { { USB_DEVICE(0x07d1, 0x3c17) }, { USB_DEVICE(0x2001, 0x3317) }, { USB_DEVICE(0x2001, 0x3c1b) }, + { USB_DEVICE(0x2001, 0x3c25) },/* Draytek */ { USB_DEVICE(0x07fa, 0x7712) },/* DVICO */
Signature · 1 line
2.4.2
PATCH 70/111 gpio: gpio-kempld: Fix get_direction return value
In reply to Jiri SlabyFrom: Michael Brunner <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f230e8ffc03f17bd9d6b90ea890b8252a8cc1821 upstream.
This patch fixes an inverted return value of the gpio get_direction function.
The wrong value causes the direction sysfs entry and GPIO debugfs file to indicate incorrect GPIO direction settings. In some cases it also prevents setting GPIO output values.
The problem is also present in all other stable kernel versions since linux-3.12.
--- drivers/gpio/gpio-kempld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-kempld.c +1 -1
@@ -117,7 +117,7 @@ static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset) = container_of(chip, struct kempld_gpio_data, chip);struct kempld_device_data *pld = gpio->pld; -return kempld_gpio_get_bit (pld,KEMPLD_GPIO_DIR_NUM (offset), offset); +return !kempld_gpio_get_bit (pld,KEMPLD_GPIO_DIR_NUM (offset), offset); }static int kempld_gpio_pincount (struct kempld_device_data *pld)
Signature · 1 line
2.4.2
PATCH 71/111 crypto: s390/ghash - Fix incorrect ghash icv buffer handling.
In reply to Jiri SlabyFrom: Harald Freudenberger <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a1cae34e23b1293eccbcc8ee9b39298039c3952a upstream.
Multitheaded tests showed that the icv buffer in the current ghash implementation is not handled correctly. A move of this working ghash buffer value to the descriptor context fixed this. Code is tested and verified with an multithreaded application via af_alg interface.
--- arch/s390/crypto/ghash_s390.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
arch/s390/crypto/ghash_s390.c +13 -12
@@ -16,11 +16,12 @@#define GHASH_DIGEST_SIZE 16struct ghash_ctx { -u8 icv[16 ]; -u8 key[16 ]; +u8 key[GHASH_BLOCK_SIZE ]; };struct ghash_desc_ctx { +u8 icv[GHASH_BLOCK_SIZE ]; +u8 key[GHASH_BLOCK_SIZE ];u8 buffer[GHASH_BLOCK_SIZE ];u32 bytes; };
@@ -28,8 +29,10 @@ struct ghash_desc_ctx {static int ghash_init (struct shash_desc *desc) {struct ghash_desc_ctx *dctx =shash_desc_ctx (desc); +struct ghash_ctx *ctx =crypto_shash_ctx (desc->tfm);memset (dctx,0 ,sizeof (*dctx)); +memcpy (dctx->key, ctx->key,GHASH_BLOCK_SIZE );return 0 ; }
@@ -45,7 +48,6 @@ static int ghash_setkey(struct crypto_shash *tfm, }memcpy (ctx->key, key,GHASH_BLOCK_SIZE ); -memset (ctx->icv,0 ,GHASH_BLOCK_SIZE );return 0 ; }
@@ -54,7 +56,6 @@ static int ghash_update(struct shash_desc *desc, const u8 *src, unsigned int srclen) {struct ghash_desc_ctx *dctx =shash_desc_ctx (desc); -struct ghash_ctx *ctx =crypto_shash_ctx (desc->tfm);unsigned int n;u8 *buf = dctx->buffer;int ret;
@@ -70,7 +71,7 @@ static int ghash_update(struct shash_desc *desc, src += n;if (!dctx->bytes) { - ret =crypt_s390_kimd (KIMD_GHASH , ctx, buf, + ret =crypt_s390_kimd (KIMD_GHASH , dctx, buf,GHASH_BLOCK_SIZE );if (ret !=GHASH_BLOCK_SIZE )return -EIO ;
@@ -79,7 +80,7 @@ static int ghash_update(struct shash_desc *desc, n = srclen & ~(GHASH_BLOCK_SIZE -1 );if (n) { - ret =crypt_s390_kimd (KIMD_GHASH , ctx, src, n); + ret =crypt_s390_kimd (KIMD_GHASH , dctx, src, n);if (ret != n)return -EIO ; src += n;
@@ -94,7 +95,7 @@ static int ghash_update(struct shash_desc *desc,return 0 ; } -static int ghash_flush (struct ghash_ctx *ctx,struct ghash_desc_ctx *dctx) +static int ghash_flush (struct ghash_desc_ctx *dctx) {u8 *buf = dctx->buffer;int ret;
@@ -104,24 +105,24 @@ static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx)memset (pos,0 , dctx->bytes); - ret =crypt_s390_kimd (KIMD_GHASH , ctx, buf,GHASH_BLOCK_SIZE ); + ret =crypt_s390_kimd (KIMD_GHASH , dctx, buf,GHASH_BLOCK_SIZE );if (ret !=GHASH_BLOCK_SIZE )return -EIO ; + + dctx->bytes =0 ; } - dctx->bytes =0 ;return 0 ; }static int ghash_final (struct shash_desc *desc,u8 *dst) {struct ghash_desc_ctx *dctx =shash_desc_ctx (desc); -struct ghash_ctx *ctx =crypto_shash_ctx (desc->tfm);int ret; - ret =ghash_flush (ctx, dctx); + ret =ghash_flush (dctx);if (!ret) -memcpy (dst, ctx->icv,GHASH_BLOCK_SIZE ); +memcpy (dst, dctx->icv,GHASH_BLOCK_SIZE );return ret; }
Signature · 1 line
2.4.2
PATCH 72/111 mac80211: move WEP tailroom size check
In reply to Jiri SlabyFrom: Janusz Dziedzic <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 47b4e1fc4972cc43a19121bc2608a60aef3bf216 upstream.
Remove checking tailroom when adding IV as it uses only headroom, and move the check to the ICV generation that actually needs the tailroom.
In other case I hit such warning and datapath don't work, when testing:
- IBSS + WEP
- ath9k with hw crypt enabled
- IPv6 data (ping6)
WARNING: CPU: 3 PID: 13301 at net/mac80211/wep.c:102 ieee80211_wep_add_iv+0x129/0x190 [mac80211]() [...] Call Trace: [<ffffffff817bf491>] dump_stack+0x45/0x57 [<ffffffff8107746a>] warn_slowpath_common+0x8a/0xc0 [<ffffffff8107755a>] warn_slowpath_null+0x1a/0x20 [<ffffffffc09ae109>] ieee80211_wep_add_iv+0x129/0x190 [mac80211] [<ffffffffc09ae7ab>] ieee80211_crypto_wep_encrypt+0x6b/0xd0 [mac80211] [<ffffffffc09d3fb1>] invoke_tx_handlers+0xc51/0xf30 [mac80211]
[...]
--- net/mac80211/wep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/mac80211/wep.c +4 -2
@@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, hdr->frame_control |=cpu_to_le16 (IEEE80211_FCTL_PROTECTED ); -if (WARN_ON (skb_tailroom (skb) <IEEE80211_WEP_ICV_LEN || -skb_headroom (skb) <IEEE80211_WEP_IV_LEN )) +if (WARN_ON (skb_headroom (skb) <IEEE80211_WEP_IV_LEN ))return NULL ; hdrlen =ieee80211_hdrlen (hdr->frame_control);
@@ -169,6 +168,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local,size_t len;u8 rc4key[3 +WLAN_KEY_LEN_WEP104 ]; +if (WARN_ON (skb_tailroom (skb) <IEEE80211_WEP_ICV_LEN )) +return -1 ; + iv =ieee80211_wep_add_iv (local, skb, keylen, keyidx);if (!iv)return -1 ;
Signature · 1 line
2.4.2
PATCH 73/111 ARM: dts: imx27: only map 4 Kbyte for fec registers
In reply to Jiri SlabyFrom: Philippe Reynes <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a29ef819f3f34f89a1b9b6a939b4c1cdfe1e85ce upstream.
According to the imx27 documentation, fec has a 4 Kbyte memory space map. Moreover, the actual 16 Kbyte mapping overlaps the SCC (Security Controller) memory register space. So, we reduce the memory register space to 4 Kbyte.
--- arch/arm/boot/dts/imx27.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx27.dtsi +1 -1
@@ -427,7 +427,7 @@ fec: ethernet@1002b000 { compatible = "fsl,imx27-fec"; - reg = <0x1002b000 0x4000>; + reg = <0x1002b000 0x1000>; interrupts = <50>; clocks = <&clks 48>, <&clks 67>; clock-names = "ipg", "ahb";
Signature · 1 line
2.4.2
PATCH 74/111 mm, numa: really disable NUMA balancing by default on single node machines
In reply to Jiri SlabyFrom: Mel Gorman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b0dc2b9bb4ab782115b964310518ee0b17784277 upstream.
NUMA balancing is meant to be disabled by default on UMA machines but the check is using nr_node_ids (highest node) instead of num_online_nodes (online nodes).
The consequences are that a UMA machine with a node ID of 1 or higher will enable NUMA balancing. This will incur useless overhead due to minor faults with the impact depending on the workload. These are the impact on the stats when running a kernel build on a single node machine whose node ID happened to be 1:
vanilla patched
NUMA base PTE updates 5113158 0 NUMA huge PMD updates 643 0 NUMA page range updates 5442374 0 NUMA hint faults 2109622 0 NUMA hint local faults 2109622 0
NUMA hint local percent 100 100
NUMA pages migrated 0 0
--- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mempolicy.c +1 -1
@@ -2589,7 +2589,7 @@ static void __init check_numabalancing_enable(void)if (numabalancing_override)set_numabalancing_state (numabalancing_override ==1 ); -if (nr_node_ids >1 && !numabalancing_override) { +if (num_online_nodes () >1 && !numabalancing_override) {printk (KERN_INFO "%s automatic NUMA balancing. " "Configure with numa_balancing= or sysctl" , numabalancing_default ?"Enabling" :"Disabling" );
Signature · 1 line
2.4.2
PATCH 75/111 svcrpc: fix potential GSSX_ACCEPT_SEC_CONTEXT decoding failures
In reply to Jiri SlabyFrom: Scott Mayhew <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9507271d960a1911a51683888837d75c171cd91f upstream.
In an environment where the KDC is running Active Directory, the exported composite name field returned in the context could be large enough to span a page boundary. Attaching a scratch buffer to the decoding xdr_stream helps deal with those cases.
The case where we saw this was actually due to behavior that's been fixed in newer gss-proxy versions, but we're fixing it here too.
--- net/sunrpc/auth_gss/gss_rpc_xdr.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
net/sunrpc/auth_gss/gss_rpc_xdr.c +16 -7
@@ -794,20 +794,26 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, {u32 value_follows;int err; +struct page *scratch; + + scratch =alloc_page (GFP_KERNEL ); +if (!scratch) +return -ENOMEM ; +xdr_set_scratch_buffer (xdr,page_address (scratch),PAGE_SIZE );/* res->status */ err =gssx_dec_status (xdr, &res->status);if (err) -return err; + goto out_free;/* res->context_handle */ err =gssx_dec_bool (xdr, &value_follows);if (err) -return err; + goto out_free;if (value_follows) { err =gssx_dec_ctx (xdr, res->context_handle);if (err) -return err; + goto out_free; }else { res->context_handle =NULL ; }
@@ -815,11 +821,11 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp,/* res->output_token */ err =gssx_dec_bool (xdr, &value_follows);if (err) -return err; + goto out_free;if (value_follows) { err =gssx_dec_buffer (xdr, res->output_token);if (err) -return err; + goto out_free; }else { res->output_token =NULL ; }
@@ -827,14 +833,17 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp,/* res->delegated_cred_handle */ err =gssx_dec_bool (xdr, &value_follows);if (err) -return err; + goto out_free;if (value_follows) {/* we do not support upcall servers sending this data. */ -return -EINVAL ; + err = -EINVAL ; + goto out_free; }/* res->options */ err =gssx_dec_option_array (xdr, &res->options); +out_free: +__free_page (scratch);return err; }
Signature · 1 line
2.4.2
PATCH 76/111 thermal: step_wise: Revert optimization
In reply to Jiri SlabyFrom: Jean Delvare <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
Commit 178c2490b99f898efc06d1ad75cadc84f13021a6 ("thermal: step_wise:
cdev only needs update on a new target state") broke driver acerhdf. That driver abused the step_wise thermal governor until the bang_bang governor was available, and the optimization broke this usage model.
Kernels v3.12 to v3.18 are affected. In v3.19 the acerhdf driver was switched to the bang_bang governor and that solved the problem.
For kernels v3.12 to v3.17, the bang_bang governor isn't available yet so the easiest fix is to revert the optimization.
--- drivers/thermal/step_wise.c | 3 --- 1 file changed, 3 deletions(-)
drivers/thermal/step_wise.c +0 -3
@@ -140,9 +140,6 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) old_target = instance->target; instance->target =get_target_state (instance, trend, throttle); -if (old_target == instance->target) -continue ; -/* Activate a passive thermal instance */ if (old_target ==THERMAL_NO_TARGET && instance->target !=THERMAL_NO_TARGET )
Signature · 1 line
2.4.2
PATCH 77/111 md/raid5: don't record new size if resize_stripes fails.
In reply to Jiri SlabyFrom: NeilBrown <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6e9eac2dcee5e19f125967dd2be3e36558c42fff upstream.
If any memory allocation in resize_stripes fails we will return -ENOMEM, but in some cases we update conf->pool_size anyway.
This means that if we try again, the allocations will be assumed to be larger than they are, and badness results.
So only update pool_size if there is no error.
This bug was introduced in 2.6.17 and the patch is suitable for -stable.
--- drivers/md/raid5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/raid5.c +2 -1
@@ -1812,7 +1812,8 @@ static int resize_stripes(struct r5conf *conf, int newsize) conf->slab_cache = sc; conf->active_name =1 -conf->active_name; - conf->pool_size = newsize; +if (!err) + conf->pool_size = newsize;return err; }
Signature · 1 line
2.4.2
PATCH 78/111 Input: elantech - fix semi-mt protocol for v3 HW
In reply to Jiri SlabyFrom: Benjamin Tissoires <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3c0213d17a09601e0c6c0ae0e27caf70d988290f upstream.
When the v3 hardware sees more than one finger, it uses the semi-mt protocol to report the touches. However, it currently works when num_fingers is 0, 1 or 2, but when it is 3 and above, it sends only 1 finger as if num_fingers was 1.
This confuses userspace which knows how to deal with extra fingers when all the slots are used, but not when some are missing.
--- drivers/input/mouse/elantech.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/mouse/elantech.c +1 -1
@@ -314,7 +314,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev, unsigned int x2, unsigned int y2) { elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); -elantech_set_slot (dev,1 , num_fingers ==2 , x2, y2); +elantech_set_slot (dev,1 , num_fingers >=2 , x2, y2); }/*
Signature · 1 line
2.4.2
PATCH 79/111 sd: Disable support for 256 byte/sector disks
In reply to Jiri SlabyFrom: Mark Hounschell <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 74856fbf441929918c49ff262ace9835048e4e6a upstream.
256 bytes per sector support has been broken since 2.6.X, and no-one stepped up to fix this.
So disable support for it.
--- drivers/scsi/sd.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/scsi/sd.c +5 -14
@@ -1580,6 +1580,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) {u64 start_lba =blk_rq_pos (scmd->request);u64 end_lba =blk_rq_pos (scmd->request) + (scsi_bufflen (scmd) /512 ); +u64 factor = scmd->device->sector_size /512 ;u64 bad_lba;int info_valid;/*
@@ -1601,16 +1602,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)if (scsi_bufflen (scmd) <= scmd->device->sector_size)return 0 ; -if (scmd->device->sector_size <512 ) { -/* only legitimate sector_size here is 256 */ - start_lba <<=1 ; - end_lba <<=1 ; - }else { -/* be careful ... don't want any overflows */ -u64 factor = scmd->device->sector_size /512 ; -do_div (start_lba, factor); -do_div (end_lba, factor); - } +/* be careful ... don't want any overflows */ +do_div (start_lba, factor); +do_div (end_lba, factor);/* The bad lba was reported incorrectly, we have no idea where * the error is.
@@ -2177,8 +2171,7 @@ got_data:if (sector_size !=512 && sector_size !=1024 && sector_size !=2048 && - sector_size !=4096 && - sector_size !=256 ) { + sector_size !=4096 ) {sd_printk (KERN_NOTICE , sdkp,"Unsupported sector size %d.\n" , sector_size);/*
@@ -2229,8 +2222,6 @@ got_data: sdkp->capacity <<=2 ; else if (sector_size == 1024) sdkp->capacity <<= 1; - else if (sector_size == 256) - sdkp->capacity >>= 1; blk_queue_physical_block_size(sdp->request_queue, sdkp->physical_block_size);
Signature · 1 line
2.4.2
PATCH 80/111 ACPI / init: Fix the ordering of acpi_reserve_resources()
In reply to Jiri SlabyFrom: "Rafael J. Wysocki" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b9a5e5e18fbf223502c0b2264c15024e393da928 upstream.
Since acpi_reserve_resources() is defined as a device_initcall(), there's no guarantee that it will be executed in the right order with respect to the rest of the ACPI initialization code. On some systems this leads to breakage if, for example, the address range that should be reserved for the ACPI fixed registers is given to the PCI host bridge instead if the race is won by the wrong code path.
Fix this by turning acpi_reserve_resources() into a void function and calling it directly from within the ACPI initialization sequence.
--- drivers/acpi/osl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/acpi/osl.c +2 -4
@@ -177,7 +177,7 @@ static void __init acpi_request_region (struct acpi_generic_address *gas,request_mem_region (addr, length, desc); } -static int __init acpi_reserve_resources (void ) +static void __init acpi_reserve_resources (void ) {acpi_request_region (&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length,"ACPI PM1a_EVT_BLK" );
@@ -206,10 +206,7 @@ static int __init acpi_reserve_resources(void)if (!(acpi_gbl_FADT.gpe1_block_length &0x1 ))acpi_request_region (&acpi_gbl_FADT.xgpe1_block, acpi_gbl_FADT.gpe1_block_length,"ACPI GPE1_BLK" ); - -return 0 ; } -device_initcall (acpi_reserve_resources);void acpi_os_printf (const char *fmt, ...) {
@@ -1764,6 +1761,7 @@ acpi_status __init acpi_os_initialize(void)acpi_status __init acpi_os_initialize1 (void ) { +acpi_reserve_resources (); kacpid_wq =alloc_workqueue ("kacpid" ,0 ,1 ); kacpi_notify_wq =alloc_workqueue ("kacpi_notify" ,0 ,1 ); kacpi_hotplug_wq =alloc_workqueue ("kacpi_hotplug" ,0 ,1 );
Signature · 1 line
2.4.2
PATCH 81/111 drm/radeon: add new bonaire pci id
In reply to Jiri SlabyFrom: Alex Deucher <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit fcf3b54282e4c5a95a1f45f67558bc105acdbc6a upstream.
--- include/drm/drm_pciids.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_pciids.h +1 -0
@@ -186,6 +186,7 @@ {0x1002, 0x6658, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x665c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x665d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x665f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6660, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6663, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ {0x1002, 0x6664, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_HAINAN|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
Signature · 1 line
2.4.2
PATCH 82/111 drm/radeon: fix VM_CONTEXT*_PAGE_TABLE_END_ADDR handling
In reply to Jiri SlabyFrom: Christian König <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 607d48063512707a414e346972e2210dc71ab491 upstream.
The mapping range is inclusive between starting and ending addresses.
--- drivers/gpu/drm/radeon/cik.c | 4 ++-- drivers/gpu/drm/radeon/evergreen.c | 2 +- drivers/gpu/drm/radeon/ni.c | 5 +++-- drivers/gpu/drm/radeon/r600.c | 2 +- drivers/gpu/drm/radeon/rv770.c | 2 +- drivers/gpu/drm/radeon/si.c | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-)
drivers/gpu/drm/radeon/cik.c +2 -2
@@ -4557,7 +4557,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) L2_CACHE_BIGK_FRAGMENT_SIZE(6));/* setup context0 */ WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR , (u32)(rdev->dummy_page.addr >>12 ));
@@ -4575,7 +4575,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev)*/ /* set vm size, must be a multiple of 4 */ WREG32 (VM_CONTEXT1_PAGE_TABLE_START_ADDR ,0 ); -WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn); +WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn -1 );for (i =1 ; i <16 ; i++) {if (i <8 ) WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2),
drivers/gpu/drm/radeon/evergreen.c +1 -1
@@ -2424,7 +2424,7 @@ static int evergreen_pcie_gart_enable(struct radeon_device *rdev)WREG32 (MC_VM_MB_L1_TLB2_CNTL , tmp);WREG32 (MC_VM_MB_L1_TLB3_CNTL , tmp);WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_CNTL ,ENABLE_CONTEXT |PAGE_TABLE_DEPTH (0 ) |RANGE_PROTECTION_FAULT_ENABLE_DEFAULT );
drivers/gpu/drm/radeon/ni.c +3 -2
@@ -1241,7 +1241,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) L2_CACHE_BIGK_FRAGMENT_SIZE(6));/* setup context0 */ WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR , (u32)(rdev->dummy_page.addr >>12 ));
@@ -1260,7 +1260,8 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev)*/ for (i =1 ; i <8 ; i++) {WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR + (i <<2 ),0 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i <<2 ), rdev->vm_manager.max_pfn); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR + (i <<2 ), + rdev->vm_manager.max_pfn -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i <<2 ), rdev->gart.table_addr >>12 ); }
drivers/gpu/drm/radeon/r600.c +1 -1
@@ -942,7 +942,7 @@ static int r600_pcie_gart_enable(struct radeon_device *rdev)WREG32 (MC_VM_L1_TLB_MCB_RD_SEM_CNTL , tmp |ENABLE_SEMAPHORE_MODE );WREG32 (MC_VM_L1_TLB_MCB_WR_SEM_CNTL , tmp |ENABLE_SEMAPHORE_MODE );WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_CNTL ,ENABLE_CONTEXT |PAGE_TABLE_DEPTH (0 ) |RANGE_PROTECTION_FAULT_ENABLE_DEFAULT );
drivers/gpu/drm/radeon/rv770.c +1 -1
@@ -916,7 +916,7 @@ static int rv770_pcie_gart_enable(struct radeon_device *rdev)WREG32 (MC_VM_MB_L1_TLB2_CNTL , tmp);WREG32 (MC_VM_MB_L1_TLB3_CNTL , tmp);WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_CNTL ,ENABLE_CONTEXT |PAGE_TABLE_DEPTH (0 ) |RANGE_PROTECTION_FAULT_ENABLE_DEFAULT );
drivers/gpu/drm/radeon/si.c +2 -2
@@ -3961,7 +3961,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) L2_CACHE_BIGK_FRAGMENT_SIZE(0));/* setup context0 */ WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR , (u32)(rdev->dummy_page.addr >>12 ));
@@ -3976,7 +3976,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev)/* empty context1-15 */ /* set vm size, must be a multiple of 4 */ WREG32 (VM_CONTEXT1_PAGE_TABLE_START_ADDR ,0 ); -WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn); +WREG32 (VM_CONTEXT1_PAGE_TABLE_END_ADDR , rdev->vm_manager.max_pfn -1 );/* Assign the pt base to something valid for now; the pts used for * the VMs are determined by the application and setup and assigned * on the fly in the vm part of radeon_gart.c
Signature · 1 line
2.4.2
PATCH 83/111 drm/radeon: partially revert "fix VM_CONTEXT*_PAGE_TABLE_END_ADDR handling"
In reply to Jiri SlabyFrom: Christian König <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7c0411d2fabc2e2702c9871ffb603e251158b317 upstream.
We have that bug for years and some users report side effects when fixing it on older hardware.
So revert it for VM_CONTEXT0_PAGE_TABLE_END_ADDR, but keep it for VM 1-15.
--- drivers/gpu/drm/radeon/cik.c | 2 +- drivers/gpu/drm/radeon/evergreen.c | 2 +- drivers/gpu/drm/radeon/ni.c | 2 +- drivers/gpu/drm/radeon/r600.c | 2 +- drivers/gpu/drm/radeon/rv770.c | 2 +- drivers/gpu/drm/radeon/si.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/cik.c +1 -1
@@ -4557,7 +4557,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) L2_CACHE_BIGK_FRAGMENT_SIZE(6));/* setup context0 */ WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR , (u32)(rdev->dummy_page.addr >>12 ));
drivers/gpu/drm/radeon/evergreen.c +1 -1
@@ -2424,7 +2424,7 @@ static int evergreen_pcie_gart_enable(struct radeon_device *rdev)WREG32 (MC_VM_MB_L1_TLB2_CNTL , tmp);WREG32 (MC_VM_MB_L1_TLB3_CNTL , tmp);WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_CNTL ,ENABLE_CONTEXT |PAGE_TABLE_DEPTH (0 ) |RANGE_PROTECTION_FAULT_ENABLE_DEFAULT );
drivers/gpu/drm/radeon/ni.c +1 -1
@@ -1241,7 +1241,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) L2_CACHE_BIGK_FRAGMENT_SIZE(6));/* setup context0 */ WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR , (u32)(rdev->dummy_page.addr >>12 ));
drivers/gpu/drm/radeon/r600.c +1 -1
@@ -942,7 +942,7 @@ static int r600_pcie_gart_enable(struct radeon_device *rdev)WREG32 (MC_VM_L1_TLB_MCB_RD_SEM_CNTL , tmp |ENABLE_SEMAPHORE_MODE );WREG32 (MC_VM_L1_TLB_MCB_WR_SEM_CNTL , tmp |ENABLE_SEMAPHORE_MODE );WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_CNTL ,ENABLE_CONTEXT |PAGE_TABLE_DEPTH (0 ) |RANGE_PROTECTION_FAULT_ENABLE_DEFAULT );
drivers/gpu/drm/radeon/rv770.c +1 -1
@@ -916,7 +916,7 @@ static int rv770_pcie_gart_enable(struct radeon_device *rdev)WREG32 (MC_VM_MB_L1_TLB2_CNTL , tmp);WREG32 (MC_VM_MB_L1_TLB3_CNTL , tmp);WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_CNTL ,ENABLE_CONTEXT |PAGE_TABLE_DEPTH (0 ) |RANGE_PROTECTION_FAULT_ENABLE_DEFAULT );
drivers/gpu/drm/radeon/si.c +1 -1
@@ -3961,7 +3961,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) L2_CACHE_BIGK_FRAGMENT_SIZE(0));/* setup context0 */ WREG32 (VM_CONTEXT0_PAGE_TABLE_START_ADDR , rdev->mc.gtt_start >>12 ); -WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , (rdev->mc.gtt_end >>12 ) -1 ); +WREG32 (VM_CONTEXT0_PAGE_TABLE_END_ADDR , rdev->mc.gtt_end >>12 );WREG32 (VM_CONTEXT0_PAGE_TABLE_BASE_ADDR , rdev->gart.table_addr >>12 );WREG32 (VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR , (u32)(rdev->dummy_page.addr >>12 ));
Signature · 1 line
2.4.2
PATCH 84/111 vfs: read file_handle only once in handle_to_path
In reply to Jiri SlabyFrom: Sasha Levin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 161f873b89136eb1e69477c847d5a5033239d9ba upstream.
We used to read file_handle twice. Once to get the amount of extra bytes, and once to fetch the entire structure.
This may be problematic since we do size verifications only after the first read, so if the number of extra bytes changes in userspace between the first and second calls, we'll have an incoherent view of file_handle.
Instead, read the constant size once, and copy that over to the final structure without having to re-read it again.
--- fs/fhandle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fhandle.c +3 -2
@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, goto out_err; }/* copy the full handle */ -if (copy_from_user (handle, ufh, -sizeof (struct file_handle ) + + *handle = f_handle; +if (copy_from_user (&handle->f_handle, + &ufh->f_handle, f_handle.handle_bytes)) { retval = -EFAULT ; goto out_handle;
Signature · 1 line
2.4.2
PATCH 85/111 fs/binfmt_elf.c:load_elf_binary(): return -EINVAL on zero-length mappings
In reply to Jiri SlabyFrom: Andrew Morton <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 2b1d3ae940acd11be44c6eced5873d47c2e00ffa upstream.
load_elf_binary() returns retval', not error'.
--- fs/binfmt_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_elf.c +1 -1
@@ -822,7 +822,7 @@ static int load_elf_binary(struct linux_binprm *bprm) total_size =total_mapping_size (elf_phdata, loc->elf_ex.e_phnum);if (!total_size) { - error = -EINVAL ; + retval = -EINVAL ; goto out_free_dentry; } }
Signature · 1 line
2.4.2
PATCH 86/111 drivers: staging: dgap: move DG_NAME and DG_PART from "Makefile" to "dgap_driver.h"
In reply to Jiri SlabyFrom: Chen Gang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6319c61aecc7acaf39a1dc0e81a8aac6a17499ee upstream.
Normally, the macros from command line are system specific macros (e.g __linux, __KERNEL__ ...), and module own macros are usually defined in their header files.
DG_NAME and DG_PART are driver 'dgap' owned macros which are used by multiple files within driver, and need be defined in the driver main header file.
So move DG_NAME and DG_PART to "dgap_driver.h", it not only can make code clearer, but also can avoid compiling failure when EXTRA_CFLAGS appended to make command line (e.g. "EXTRA_CFLAGS=-W").
--- drivers/staging/dgap/Makefile | 2 -- drivers/staging/dgap/dgap_driver.h | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/dgap/Makefile +0 -2
@@ -1,5 +1,3 @@ -EXTRA_CFLAGS += -DDG_NAME=\"dgap-1.3-16\" -DDG_PART=\"40002347_C\" - obj-$(CONFIG_DGAP) += dgap.o
drivers/staging/dgap/dgap_driver.h +3 -0
@@ -53,6 +53,9 @@* DPR((fmt, args, ...)); Only prints if DGAP_TRACER is defined at * compile time and dgap_debug!=0 */ +#define DG_NAME "dgap-1.3-16" +#define DG_PART "40002347_C" +#define PROCSTR "dgap"/* /proc entries */ #define DEVSTR "/dev/dg/dgap"/* /dev entries */ #define DRVSTR "dgap"/* Driver name string
Signature · 1 line
2.4.2
PATCH 87/111 drivers: staging: rtl8188eu: use 'ccflags-y' instead of EXTRA_CFLAGS in Makefile
In reply to Jiri SlabyFrom: Chen Gang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 97b0b6ca4c0f0f964d3c6918301ca45353ef8bc5 upstream.
If command line use EXTRA_CFLAGS (e.g. "EXTRA_CFLAGS=-mmedium-calls" for arc architecture, with allmodconfig), it can not pass compiling, the related error:
drivers/staging/rtl8188eu/core/rtw_ap.c:22:27: fatal error: osdep_service.h: No such file or directory
--- drivers/staging/rtl8188eu/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8188eu/Makefile +1 -3
@@ -1,5 +1,3 @@ -EXTRA_CFLAGS += -I$(src)/include - r8188eu-y := \ core/rtw_ap.o \ core/rtw_br_ext.o \
@@ -67,4 +65,4 @@ r8188eu-y := \ obj-$(CONFIG_R8188EU) := r8188eu.o -ccflags-y += -D__CHECK_ENDIAN__ +ccflags-y += -D__CHECK_ENDIAN__ -I$(src)/include
Signature · 1 line
2.4.2
PATCH 88/111 dgnc: Move DG_PART definition from Makefile to dgnc_driver.h
In reply to Jiri SlabyFrom: Cass May <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f11cc568758f23088c1f7a8369100c59e4c07bd6 upstream.
Avoid deprecated usage of EXTRA_CFLAGS by moving definition of DG_PART into dgnc_driver.h
--- drivers/staging/dgnc/Makefile | 2 -- drivers/staging/dgnc/dgnc_driver.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/dgnc/Makefile +0 -2
@@ -1,5 +1,3 @@ -EXTRA_CFLAGS += -DDG_NAME=\"dgnc-1.3-16\" -DDG_PART=\"40002369_F\" - obj-$(CONFIG_DGNC) += dgnc.o dgnc-objs := dgnc_cls.o dgnc_driver.o\
drivers/staging/dgnc/dgnc_driver.h +2 -0
@@ -59,6 +59,8 @@#define APR (args) do { PRINTF_TO_KMEM(args); printk(DRVSTR": "); printk args; \ } while (0)#define RAPR (args) do { PRINTF_TO_KMEM(args); printk args; } while (0) +#define DG_NAME "dgnc-1.3-16" +#define DG_PART "40002369_F"/* RPM part number */ #define TRC_TO_CONSOLE 1
Signature · 1 line
2.4.2
PATCH 89/111 x86: bpf_jit: fix compilation of large bpf programs
In reply to Jiri SlabyFrom: Alexei Starovoitov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 3f7352bf21f8fd7ba3e2fcef9488756f188e12be ]
x86 has variable length encoding. x86 JIT compiler is trying to pick the shortest encoding for given bpf instruction. While doing so the jump targets are changing, so JIT is doing multiple passes over the program. Typical program needs 3 passes. Some very short programs converge with 2 passes. Large programs may need 4 or 5. But specially crafted bpf programs may hit the pass limit and if the program converges on the last iteration the JIT compiler will be producing an image full of 'int 3' insns. Fix this corner case by doing final iteration over bpf program.
--- arch/x86/net/bpf_jit_comp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +6 -1
@@ -211,7 +211,12 @@ void bpf_jit_compile(struct sk_filter *fp) } cleanup_addr = proglen;/* epilogue address */ -for (pass =0 ; pass <10 ; pass++) { +/* JITed image shrinks with every pass and the loop iterates +* until the image stops shrinking. Very large bpf programs +* may converge on the last pass. In such case do one more +* pass to emit the final image +*/ +for (pass =0 ; pass <10 || image; pass++) {u8 seen_or_pass0 = (pass ==0 ) ? (SEEN_XREG |SEEN_DATAREF |SEEN_MEM ) : seen;/* no prologue/epilogue for trivial filters (RET something) */ proglen =0 ;
Signature · 1 line
2.4.2
PATCH 90/111 ipv4: Avoid crashing in ip_error
In reply to Jiri SlabyFrom: "Eric W. Biederman" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 381c759d9916c42959515ad34a6d467e24a88e93 ]
ip_error does not check if in_dev is NULL before dereferencing it.
IThe following sequence of calls is possible:
CPU A CPU Bip_rcv_finish
ip_route_input_noref()
ip_route_input_slow()
inetdev_destroy()
dst_input()With the result that a network device can be destroyed while processing an input packet.
A crash was triggered with only unicast packets in flight, and
forwarding enabled on the only network device. The error condition
was created by the removal of the network device.
As such it is likely the that error code was -EHOSTUNREACH, and the action taken by ip_error (if in_dev had been accessible) would have been to not increment any counters and to have tried and likely failed to send an icmp error as the network device is going away.
Therefore handle this weird case by just dropping the packet if !in_dev. It will result in dropping the packet sooner, and will not result in an actual change of behavior.
--- net/ipv4/route.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv4/route.c +4 -0
@@ -921,6 +921,10 @@ static int ip_error(struct sk_buff *skb)bool send;int code; +/* IP on this device is disabled. */ +if (!in_dev) + goto out; + net =dev_net (rt->dst.dev);if (!IN_DEV_FORWARD (in_dev)) {switch (rt->dst.error) {
Signature · 1 line
2.4.2
PATCH 91/111 bridge: fix parsing of MLDv2 reports
In reply to Jiri SlabyFrom: Thadeu Lima de Souza Cascardo <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 47cc84ce0c2fe75c99ea5963c4b5704dd78ead54 ]
When more than a multicast address is present in a MLDv2 report, all but the first address is ignored, because the code breaks out of the loop if there has not been an error adding that address.
This has caused failures when two guests connected through the bridge tried to communicate using IPv6. Neighbor discoveries would not be transmitted to the other guest when both used a link-local address and a static address.
This only happens when there is a MLDv2 querier in the network.
The fix will only break out of the loop when there is a failure adding a multicast address.
The mdb before the patch:
dev ovirtmgmt port vnet0 grp ff02::1:ff7d:6603 temp dev ovirtmgmt port vnet1 grp ff02::1:ff7d:6604 temp dev ovirtmgmt port bond0.86 grp ff02::2 temp
After the patch:
dev ovirtmgmt port vnet0 grp ff02::1:ff7d:6603 temp dev ovirtmgmt port vnet1 grp ff02::1:ff7d:6604 temp dev ovirtmgmt port bond0.86 grp ff02::fb temp dev ovirtmgmt port bond0.86 grp ff02::2 temp dev ovirtmgmt port bond0.86 grp ff02::d temp dev ovirtmgmt port vnet0 grp ff02::1:ff00:76 temp dev ovirtmgmt port bond0.86 grp ff02::16 temp dev ovirtmgmt port vnet1 grp ff02::1:ff00:77 temp dev ovirtmgmt port bond0.86 grp ff02::1:ff00:def temp dev ovirtmgmt port bond0.86 grp ff02::1:ffa1:40bf temp
--- net/bridge/br_multicast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_multicast.c +1 -1
@@ -1058,7 +1058,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, err =br_ip6_multicast_add_group (br, port, &grec->grec_mca, vid); -if (!err) +if (err)break ; }
Signature · 1 line
2.4.2
PATCH 92/111 net: dp83640: fix broken calibration routine.
In reply to Jiri SlabyFrom: Richard Cochran <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 397a253af5031de4a4612210055935309af4472c ]
Currently, the calibration function that corrects the initial offsets among multiple devices only works the first time. If the function is called more than once, the calibration fails and bogus offsets will be programmed into the devices.
In a well hidden spot, the device documentation tells that trigger indexes 0 and 1 are special in allowing the TRIG_IF_LATE flag to actually work.
This patch fixes the issue by using one of the special triggers during the recalibration method.
--- drivers/net/phy/dp83640.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/dp83640.c +1 -1
@@ -45,7 +45,7 @@#define PSF_TX 0x1000#define EXT_EVENT 1#define CAL_EVENT 7 -#define CAL_TRIGGER 7 +#define CAL_TRIGGER 1#define PER_TRIGGER 6#define MII_DP83640_MICR 0x11
Signature · 1 line
2.4.2
PATCH 93/111 unix/caif: sk_socket can disappear when state is unlocked
In reply to Jiri SlabyFrom: Mark Salyzyn <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit b48732e4a48d80ed4a14812f0bab09560846514e ]
got a rare NULL pointer dereference in clear_bit
----
v2: switch to sock_flag(sk, SOCK_DEAD) and added net/caif/caif_socket.c
v3: return -ECONNRESET in upstream caller of wait function for SOCK_DEAD
--- net/caif/caif_socket.c | 8 ++++++++ net/unix/af_unix.c | 8 ++++++++ 2 files changed, 16 insertions(+)
net/caif/caif_socket.c +8 -0
@@ -332,6 +332,10 @@ static long caif_stream_data_wait(struct sock *sk, long timeo)release_sock (sk); timeo =schedule_timeout (timeo);lock_sock (sk); + +if (sock_flag (sk,SOCK_DEAD )) +break ; +clear_bit (SOCK_ASYNC_WAITDATA , &sk->sk_socket->flags); }
@@ -376,6 +380,10 @@ static int caif_stream_recvmsg(struct kiocb *iocb, struct socket *sock,struct sk_buff *skb;lock_sock (sk); +if (sock_flag (sk,SOCK_DEAD )) { + err = -ECONNRESET ; + goto unlock; + } skb =skb_dequeue (&sk->sk_receive_queue);caif_check_flow_release (sk);
net/unix/af_unix.c +8 -0
@@ -1891,6 +1891,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo,unix_state_unlock (sk); timeo =freezable_schedule_timeout (timeo);unix_state_lock (sk); + +if (sock_flag (sk,SOCK_DEAD )) +break ; +clear_bit (SOCK_ASYNC_WAITDATA , &sk->sk_socket->flags); }
@@ -1955,6 +1959,10 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,struct sk_buff *skb, *last;unix_state_lock (sk); +if (sock_flag (sk,SOCK_DEAD )) { + err = -ECONNRESET ; + goto unlock; + } last = skb =skb_peek (&sk->sk_receive_queue); again:if (skb ==NULL ) {
Signature · 1 line
2.4.2
PATCH 94/111 net_sched: invoke ->attach() after setting dev->qdisc
In reply to Jiri SlabyFrom: WANG Cong <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 86e363dc3b50bfd50a1f315934583fbda673ab8d ]
For mq qdisc, we add per tx queue qdisc to root qdisc for display purpose, however, that happens too early, before the new dev->qdisc is finally set, this causes q->list points to an old root qdisc which is going to be freed right before assigning with a new one.
Fix this by moving ->attach() after setting dev->qdisc.
For the record, this fixes the following crash:
------------[ cut here ]------------ WARNING: CPU: 1 PID: 975 at lib/list_debug.c:59 __list_del_entry+0x5a/0x98() list_del corruption. prev->next should be ffff8800d1998ae8, but was 6b6b6b6b6b6b6b6b CPU: 1 PID: 975 Comm: tc Not tainted 4.1.0-rc4+ #1019 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 0000000000000009 ffff8800d73fb928 ffffffff81a44e7f 0000000047574756 ffff8800d73fb978 ffff8800d73fb968 ffffffff810790da ffff8800cfc4cd20 ffffffff814e725b ffff8800d1998ae8 ffffffff82381250 0000000000000000 Call Trace: [<ffffffff81a44e7f>] dump_stack+0x4c/0x65 [<ffffffff810790da>] warn_slowpath_common+0x9c/0xb6 [<ffffffff814e725b>] ? __list_del_entry+0x5a/0x98 [<ffffffff81079162>] warn_slowpath_fmt+0x46/0x48 [<ffffffff81820eb0>] ? dev_graft_qdisc+0x5e/0x6a [<ffffffff814e725b>] __list_del_entry+0x5a/0x98 [<ffffffff814e72a7>] list_del+0xe/0x2d [<ffffffff81822f05>] qdisc_list_del+0x1e/0x20 [<ffffffff81820cd1>] qdisc_destroy+0x30/0xd6 [<ffffffff81822676>] qdisc_graft+0x11d/0x243 [<ffffffff818233c1>] tc_get_qdisc+0x1a6/0x1d4 [<ffffffff810b5eaf>] ? mark_lock+0x2e/0x226 [<ffffffff817ff8f5>] rtnetlink_rcv_msg+0x181/0x194 [<ffffffff817ff72e>] ? rtnl_lock+0x17/0x19 [<ffffffff817ff72e>] ? rtnl_lock+0x17/0x19 [<ffffffff817ff774>] ? __rtnl_unlock+0x17/0x17 [<ffffffff81855dc6>] netlink_rcv_skb+0x4d/0x93 [<ffffffff817ff756>] rtnetlink_rcv+0x26/0x2d [<ffffffff818544b2>] netlink_unicast+0xcb/0x150 [<ffffffff81161db9>] ? might_fault+0x59/0xa9 [<ffffffff81854f78>] netlink_sendmsg+0x4fa/0x51c [<ffffffff817d6e09>] sock_sendmsg_nosec+0x12/0x1d [<ffffffff817d8967>] sock_sendmsg+0x29/0x2e [<ffffffff817d8cf3>] ___sys_sendmsg+0x1b4/0x23a [<ffffffff8100a1b8>] ? native_sched_clock+0x35/0x37 [<ffffffff810a1d83>] ? sched_clock_local+0x12/0x72 [<ffffffff810a1fd4>] ? sched_clock_cpu+0x9e/0xb7 [<ffffffff810def2a>] ? current_kernel_time+0xe/0x32 [<ffffffff810b4bc5>] ? lock_release_holdtime.part.29+0x71/0x7f [<ffffffff810ddebf>] ? read_seqcount_begin.constprop.27+0x5f/0x76 [<ffffffff810b6292>] ? trace_hardirqs_on_caller+0x17d/0x199 [<ffffffff811b14d5>] ? __fget_light+0x50/0x78 [<ffffffff817d9808>] __sys_sendmsg+0x42/0x60 [<ffffffff817d9838>] SyS_sendmsg+0x12/0x1c [<ffffffff81a50e97>] system_call_fastpath+0x12/0x6f ---[ end trace ef29d3fb28e97ae7 ]---
For long term, we probably need to clean up the qdisc_graft() code in case it hides other bugs like this.
--- net/sched/sch_api.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/sched/sch_api.c +6 -4
@@ -804,10 +804,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,if (dev->flags &IFF_UP )dev_deactivate (dev); -if (new && new->ops->attach) { - new->ops->attach (new); - num_q =0 ; - } +if (new && new->ops->attach) + goto skip;for (i =0 ; i < num_q; i++) {struct netdev_queue *dev_queue =dev_ingress_queue (dev);
@@ -823,12 +821,16 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,qdisc_destroy (old); } +skip:if (!ingress) {notify_and_destroy (net, skb, n, classid, dev->qdisc, new);if (new && !new->ops->attach)atomic_inc (&new->refcnt); dev->qdisc = new ? : &noop_qdisc; + +if (new && new->ops->attach) + new->ops->attach (new); }else {notify_and_destroy (net, skb, n, classid, old, new); }
Signature · 1 line
2.4.2
PATCH 95/111 udp: fix behavior of wrong checksums
In reply to Jiri SlabyFrom: Eric Dumazet <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit beb39db59d14990e401e235faf66a6b9b31240b0 ]
We have two problems in UDP stack related to bogus checksums :
1) We return -EAGAIN to application even if receive queue is not empty. This breaks applications using edge trigger epoll()
2) Under UDP flood, we can loop forever without yielding to other processes, potentially hanging the host, especially on non SMP.
This patch is an attempt to make things better.
We might in the future add extra support for rt applications wanting to better control time spent doing a recv() in a hostile environment. For example we could validate checksums before queuing packets in socket receive queue.
--- net/ipv4/udp.c | 6 ++---- net/ipv6/udp.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)
net/ipv4/udp.c +2 -4
@@ -1295,10 +1295,8 @@ csum_copy_err: }unlock_sock_fast (sk, slow); -if (noblock) -return -EAGAIN ; - -/* starting over for a new packet */ +/* starting over for a new packet, but check if we need to yield */ +cond_resched (); msg->msg_flags &= ~MSG_TRUNC ; goto try_again; }
net/ipv6/udp.c +2 -4
@@ -495,10 +495,8 @@ csum_copy_err: }unlock_sock_fast (sk, slow); -if (noblock) -return -EAGAIN ; - -/* starting over for a new packet */ +/* starting over for a new packet, but check if we need to yield */ +cond_resched (); msg->msg_flags &= ~MSG_TRUNC ; goto try_again; }
Signature · 1 line
2.4.2
PATCH 96/111 xen: netback: read hotplug script once at start of day.
In reply to Jiri SlabyFrom: Ian Campbell <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 31a418986a5852034d520a5bab546821ff1ccf3d ]
When we come to tear things down in netback_remove() and generate the uevent it is possible that the xenstore directory has already been removed (details below).
In such cases netback_uevent() won't be able to read the hotplug script and will write a xenstore error node.
A recent change to the hypervisor exposed this race such that we now sometimes lose it (where apparently we didn't ever before).
Instead read the hotplug script configuration during setup and use it for the lifetime of the backend device.
The apparently more obvious fix of moving the transition to state=Closed in netback_remove() to after the uevent does not work because it is possible that we are already in state=Closed (in reaction to the guest having disconnected as it shutdown). Being already in Closed means the toolstack is at liberty to start tearing down the xenstore directories. In principal it might be possible to arrange to unregister the device sooner (e.g on transition to Closing) such that xenstore would still be there but this state machine is fragile and prone to anger...
A modern Xen system only relies on the hotplug uevent for driver domains, when the backend is in the same domain as the toolstack it will run the necessary setup/teardown directly in the correct sequence wrt xenstore changes.
--- drivers/net/xen-netback/xenbus.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/net/xen-netback/xenbus.c +19 -14
@@ -33,6 +33,8 @@ struct backend_info {enum xenbus_state frontend_state;struct xenbus_watch hotplug_status_watch; u8 have_hotplug_status_watch:1; + +const char *hotplug_script; };static int connect_rings (struct backend_info *);
@@ -55,6 +57,7 @@ static int netback_remove(struct xenbus_device *dev)xenvif_free (be->vif); be->vif =NULL ; } +kfree (be->hotplug_script);kfree (be);dev_set_drvdata (&dev->dev,NULL );return 0 ;
@@ -72,6 +75,7 @@ static int netback_probe(struct xenbus_device *dev,struct xenbus_transaction xbt;int err;int sg; +const char *script;struct backend_info *be =kzalloc (sizeof (struct backend_info ),GFP_KERNEL );if (!be) {
@@ -142,6 +146,15 @@ static int netback_probe(struct xenbus_device *dev,if (err)pr_debug ("Error writing feature-split-event-channels\n" ); + script =xenbus_read (XBT_NIL , dev->nodename,"script" ,NULL ); +if (IS_ERR (script)) { + err =PTR_ERR (script); +xenbus_dev_fatal (dev, err,"reading script" ); + goto fail; + } + + be->hotplug_script = script; + err =xenbus_switch_state (dev, XenbusStateInitWait);if (err) goto fail;
@@ -172,22 +185,14 @@ static int netback_uevent(struct xenbus_device *xdev, struct kobj_uevent_env *env) {struct backend_info *be =dev_get_drvdata (&xdev->dev); -char *val; - val =xenbus_read (XBT_NIL , xdev->nodename,"script" ,NULL ); -if (IS_ERR (val)) { -int err =PTR_ERR (val); -xenbus_dev_fatal (xdev, err,"reading script" ); -return err; - }else { -if (add_uevent_var (env,"script=%s" , val)) { -kfree (val); -return -ENOMEM ; - } -kfree (val); - } +if (!be) +return 0 ; + +if (add_uevent_var (env,"script=%s" , be->hotplug_script)) +return -ENOMEM ; -if (!be || !be->vif) +if (!be->vif)return 0 ;return add_uevent_var (env,"vif=%s" , be->vif->dev->name);
Signature · 1 line
2.4.2
PATCH 97/111 iommu/amd: Return the pte page-size in fetch_pte
In reply to Jiri SlabyFrom: Joerg Roedel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3039ca1b1c37e61cc9239dbb3903db55141ecabd upstream.
Extend the fetch_pte function to also return the page-size that is mapped by the returned pte.
--- drivers/iommu/amd_iommu.c | 52 ++++++++++++++++++++++++----------------- drivers/iommu/amd_iommu_types.h | 6 +++++ 2 files changed, 36 insertions(+), 22 deletions(-)
drivers/iommu/amd_iommu.c +30 -22
@@ -1376,7 +1376,9 @@ static u64 *alloc_pte(struct protection_domain *domain,* This function checks if there is a PTE for a given dma address. If * there is one, it returns the pointer to it. */ -static u64 *fetch_pte (struct protection_domain *domain,unsigned long address) +static u64 *fetch_pte (struct protection_domain *domain, +unsigned long address, +unsigned long *page_size) {int level;u64 *pte;
@@ -1384,8 +1386,9 @@ static u64 *fetch_pte(struct protection_domain *domain, unsigned long address)if (address >PM_LEVEL_SIZE (domain->mode))return NULL ; - level = domain->mode -1 ; - pte = &domain->pt_root[PM_LEVEL_INDEX (level, address)]; + level = domain->mode -1 ; + pte = &domain->pt_root[PM_LEVEL_INDEX (level, address)]; + *page_size =PTE_LEVEL_PAGE_SIZE (level);while (level >0 ) {
@@ -1394,19 +1397,9 @@ static u64 *fetch_pte(struct protection_domain *domain, unsigned long address)return NULL ;/* Large PTE */ -if (PM_PTE_LEVEL (*pte) ==0x07 ) { -unsigned long pte_mask, __pte; - -/* -* If we have a series of large PTEs, make -* sure to return a pointer to the first one. -*/ - pte_mask =PTE_PAGE_SIZE (*pte); - pte_mask = ~((PAGE_SIZE_PTE_COUNT (pte_mask) <<3 ) -1 ); - __pte = ((unsigned long )pte) & pte_mask; - -return (u64 *)__pte; - } +if (PM_PTE_LEVEL (*pte) ==7 || +PM_PTE_LEVEL (*pte) ==0 ) +break ;/* No level skipping support yet */ if (PM_PTE_LEVEL (*pte) != level)
@@ -1415,8 +1408,21 @@ static u64 *fetch_pte(struct protection_domain *domain, unsigned long address) level -=1 ;/* Walk to the next level */ - pte =IOMMU_PTE_PAGE (*pte); - pte = &pte[PM_LEVEL_INDEX (level, address)]; + pte =IOMMU_PTE_PAGE (*pte); + pte = &pte[PM_LEVEL_INDEX (level, address)]; + *page_size =PTE_LEVEL_PAGE_SIZE (level); + } + +if (PM_PTE_LEVEL (*pte) ==0x07 ) { +unsigned long pte_mask; + +/* +* If we have a series of large PTEs, make +* sure to return a pointer to the first one. +*/ + *page_size = pte_mask =PTE_PAGE_SIZE (*pte); + pte_mask = ~((PAGE_SIZE_PTE_COUNT (pte_mask) <<3 ) -1 ); + pte = (u64 *)(((unsigned long )pte) & pte_mask); }return pte;
@@ -1474,6 +1480,7 @@ static unsigned long iommu_unmap_page(struct protection_domain *dom, unsigned long page_size) {unsigned long long unmap_size, unmapped; +unsigned long pte_pgsize;u64 *pte;BUG_ON (!is_power_of_2 (page_size));
@@ -1482,7 +1489,7 @@ static unsigned long iommu_unmap_page(struct protection_domain *dom,while (unmapped < page_size) { - pte =fetch_pte (dom, bus_addr); + pte =fetch_pte (dom, bus_addr, &pte_pgsize);if (!pte) {/*
@@ -1725,7 +1732,8 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,for (i = dma_dom->aperture[index]->offset; i < dma_dom->aperture_size; i +=PAGE_SIZE ) { -u64 *pte =fetch_pte (&dma_dom->domain, i); +unsigned long pte_pgsize; +u64 *pte =fetch_pte (&dma_dom->domain, i, &pte_pgsize);if (!pte || !IOMMU_PTE_PRESENT (*pte))continue ;
@@ -3439,14 +3447,14 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, dma_addr_t iova) {struct protection_domain *domain = dom->priv; -unsigned long offset_mask; +unsigned long offset_mask, pte_pgsize;phys_addr_t paddr;u64 *pte, __pte;if (domain->mode ==PAGE_MODE_NONE )return iova; - pte =fetch_pte (domain, iova); + pte =fetch_pte (domain, iova, &pte_pgsize);if (!pte || !IOMMU_PTE_PRESENT (*pte))return 0 ;
drivers/iommu/amd_iommu_types.h +6 -0
@@ -276,6 +276,12 @@#define PTE_PAGE_SIZE (pte) \ (1ULL << (1 + ffz(((pte) | 0xfffULL)))) +/* +* Takes a page-table level and returns the default page-size for this level +*/ +#define PTE_LEVEL_PAGE_SIZE (level) \ + (1ULL << (12 + (9 * (level)))) +#define IOMMU_PTE_P (1ULL << 0)#define IOMMU_PTE_TV (1ULL << 1)#define IOMMU_PTE_U (1ULL << 59)
Signature · 1 line
2.4.2
PATCH 98/111 iommu/amd: Optimize iommu_unmap_page for new fetch_pte interface
In reply to Jiri SlabyFrom: Joerg Roedel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 71b390e9bec5121d25c45326ff0b0b96a143f9a8 upstream.
Now that fetch_pte returns the page-size of the pte, this function can be optimized a lot.
--- drivers/iommu/amd_iommu.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-)
drivers/iommu/amd_iommu.c +8 -24
@@ -1479,8 +1479,8 @@ static unsigned long iommu_unmap_page(struct protection_domain *dom, unsigned long bus_addr, unsigned long page_size) { -unsigned long long unmap_size, unmapped; -unsigned long pte_pgsize; +unsigned long long unmapped; +unsigned long unmap_size;u64 *pte;BUG_ON (!is_power_of_2 (page_size));
@@ -1489,28 +1489,12 @@ static unsigned long iommu_unmap_page(struct protection_domain *dom,while (unmapped < page_size) { - pte =fetch_pte (dom, bus_addr, &pte_pgsize); - -if (!pte) { -/* -* No PTE for this address -* move forward in 4kb steps -*/ - unmap_size =PAGE_SIZE ; - }else if (PM_PTE_LEVEL (*pte) ==0 ) { -/* 4kb PTE found for this address */ - unmap_size =PAGE_SIZE ; - *pte =0ULL ; - }else { -int count, i; - -/* Large PTE found which maps this address */ - unmap_size =PTE_PAGE_SIZE (*pte); - -/* Only unmap from the first pte in the page */ -if ((unmap_size -1 ) & bus_addr) -break ; - count =PAGE_SIZE_PTE_COUNT (unmap_size); + pte =fetch_pte (dom, bus_addr, &unmap_size); + +if (pte) { +int i, count; + + count =PAGE_SIZE_PTE_COUNT (unmap_size);for (i =0 ; i < count; i++) pte[i] =0ULL ; }
Signature · 1 line
2.4.2
PATCH 99/111 iommu/amd: Optimize alloc_new_range for new fetch_pte interface
In reply to Jiri SlabyFrom: Joerg Roedel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5d7c94c3f4f20964b217d64ee44a9a08320c315a upstream.
Now that fetch_pte returns the page-size of the pte, the call in this function can also be optimized a little bit.
--- drivers/iommu/amd_iommu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu.c +4 -4
@@ -1642,7 +1642,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom, {int index = dma_dom->aperture_size >>APERTURE_RANGE_SHIFT ;struct amd_iommu *iommu; -unsigned long i, old_size; +unsigned long i, old_size, pte_pgsize;#ifdef CONFIG_IOMMU_STRESS populate = false;
@@ -1715,13 +1715,13 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,*/ for (i = dma_dom->aperture[index]->offset; i < dma_dom->aperture_size; - i +=PAGE_SIZE ) { -unsigned long pte_pgsize; + i += pte_pgsize) {u64 *pte =fetch_pte (&dma_dom->domain, i, &pte_pgsize);if (!pte || !IOMMU_PTE_PRESENT (*pte))continue ; -dma_ops_reserve_addresses (dma_dom, i >>PAGE_SHIFT ,1 ); +dma_ops_reserve_addresses (dma_dom, i >>PAGE_SHIFT , + pte_pgsize >>12 ); }update_domain (&dma_dom->domain);
Signature · 1 line
2.4.2
PATCH 100/111 iommu/amd: Optimize amd_iommu_iova_to_phys for new fetch_pte interface
In reply to Jiri SlabyFrom: Joerg Roedel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b24b1b63a37d05d61601d643ef30f95dd2452048 upstream.
Now that fetch_pte returns the page-size of the pte, this function can be optimized too.
--- drivers/iommu/amd_iommu.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iommu/amd_iommu.c +3 -9
@@ -3432,7 +3432,6 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, {struct protection_domain *domain = dom->priv;unsigned long offset_mask, pte_pgsize; -phys_addr_t paddr;u64 *pte, __pte;if (domain->mode ==PAGE_MODE_NONE )
@@ -3443,15 +3442,10 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,if (!pte || !IOMMU_PTE_PRESENT (*pte))return 0 ; -if (PM_PTE_LEVEL (*pte) ==0 ) - offset_mask =PAGE_SIZE -1 ; -else - offset_mask =PTE_PAGE_SIZE (*pte) -1 ; - - __pte = *pte &PM_ADDR_MASK ; - paddr = (__pte & ~offset_mask) | (iova & offset_mask); + offset_mask = pte_pgsize -1 ; + __pte = *pte &PM_ADDR_MASK ; -return paddr; +return (__pte & ~offset_mask) | (iova & offset_mask); } static int amd_iommu_domain_has_cap(struct iommu_domain *domain,
Signature · 1 line
2.4.2
PATCH 101/111 iommu/amd: Correctly encode huge pages in iommu page tables
In reply to Jiri SlabyFrom: Joerg Roedel <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d4b036648402bb4ef6d4a0df51375a2fb705b6cc upstream.
When a default page-size for given level should be mapped, the level encoding must be 0 rather than 7. This fixes an issue seen on IOMMUv2 hardware, where this encoding is enforced.
--- drivers/iommu/amd_iommu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/iommu/amd_iommu.c +6 -5
@@ -1444,19 +1444,20 @@ static int iommu_map_page(struct protection_domain *dom,u64 __pte, *pte;int i, count; +BUG_ON (!IS_ALIGNED (bus_addr, page_size)); +BUG_ON (!IS_ALIGNED (phys_addr, page_size)); +if (!(prot &IOMMU_PROT_MASK ))return -EINVAL ; - bus_addr =PAGE_ALIGN (bus_addr); - phys_addr =PAGE_ALIGN (phys_addr); - count =PAGE_SIZE_PTE_COUNT (page_size); - pte =alloc_pte (dom, bus_addr, page_size,NULL ,GFP_KERNEL ); + count =PAGE_SIZE_PTE_COUNT (page_size); + pte =alloc_pte (dom, bus_addr, page_size,NULL ,GFP_KERNEL );for (i =0 ; i < count; ++i)if (IOMMU_PTE_PRESENT (pte[i]))return -EBUSY ; -if (page_size >PAGE_SIZE ) { +if (count >1 ) { __pte =PAGE_SIZE_PTE (phys_addr, page_size); __pte |=PM_LEVEL_ENC (7 ) |IOMMU_PTE_P |IOMMU_PTE_FC ; }else
Signature · 1 line
2.4.2
PATCH 102/111 isdn: icn: use strlcpy() when parsing setup options
In reply to Jiri SlabyFrom: Dan Carpenter <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 10640d34552ccd8fabe7b15b0c4e3a102247952d upstream.
If you pass an invalid string here then you probably deserve the memory corruption, but it annoys static analysis tools so lets fix it.
--- drivers/isdn/icn/icn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/icn/icn.c +1 -1
@@ -1611,7 +1611,7 @@ icn_setup(char *line)if (ints[0 ] >1 ) membase = (unsigned long )ints[2 ];if (str && *str) { -strcpy (sid, str); +strlcpy (sid, str,sizeof (sid)); icn_id = sid;if ((p =strchr (sid,',' ))) { *p++ =0 ;
Signature · 1 line
2.4.2
PATCH 103/111 EDAC: Properly unwind on failure path in edac_init()
In reply to Jiri SlabyFrom: Alexey Khoroshilov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c6b97bcf8e3ee6643a7f90a54d1ef3f9e12ec245 upstream.
edac_init() does not deallocate already allocated resources on failure path.
Found by Linux Driver Verification project (linuxtesting.org).
[ Boris: The unwind path functions have __exit annotation but are being
used in an __init function, leading to section mismatches. Drop the section annotation and make them normal functions. ]
--- drivers/edac/edac_mc_sysfs.c | 4 ++-- drivers/edac/edac_module.c | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/edac/edac_mc_sysfs.c +2 -2
@@ -911,7 +911,7 @@ int __init edac_debugfs_init(void)return 0 ; } -void __exit edac_debugfs_exit(void) +void edac_debugfs_exit (void ) {debugfs_remove (edac_debugfs); }
@@ -1165,7 +1165,7 @@ int __init edac_mc_sysfs_init(void)return err; } -void __exit edac_mc_sysfs_exit(void) +void edac_mc_sysfs_exit (void ) {device_unregister (mci_pdev);edac_put_sysfs_subsys ();
drivers/edac/edac_module.c +8 -5
@@ -112,20 +112,23 @@ static int __init edac_init(void) err =edac_mc_sysfs_init ();if (err) - goto error; + goto err_sysfs;edac_debugfs_init (); -/* Setup/Initialize the workq for this core */ err =edac_workqueue_setup ();if (err) { -edac_printk (KERN_ERR ,EDAC_MC ,"init WorkQueue failure\n" ); - goto error; +edac_printk (KERN_ERR ,EDAC_MC ,"Failure initializing workqueue\n" ); + goto err_wq; }return 0 ; -error: +err_wq: +edac_debugfs_exit (); +edac_mc_sysfs_exit (); + +err_sysfs:return err; }
Signature · 1 line
2.4.2
PATCH 104/111 NFC: pn533: fix error return code
In reply to Jiri SlabyFrom: Julia Lawall <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5df848f37b1d20e5dd64bea16ba9f69ed321e11b upstream.
Return a negative error code on failure.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
--- drivers/nfc/pn533.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nfc/pn533.c +3 -1
@@ -2352,8 +2352,10 @@ static int pn533_data_exchange_complete(struct pn533 *dev, void *_arg, } skb =pn533_build_response (dev); -if (!skb) +if (!skb) { + rc = -ENOMEM ; goto error; + } arg->cb (arg->cb_context, skb,0 );kfree (arg);
Signature · 1 line
2.4.2
PATCH 105/111 crypto: rng - RNGs must return 0 in success case
In reply to Jiri SlabyFrom: Stephan Mueller <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit cde001e4c3c3625c60b68a83eb1f1c2572dee07a upstream.
Change the RNGs to always return 0 in success case.
This patch ensures that seqiv.c works with RNGs other than krng. seqiv expects that any return code other than 0 is an error. Without the patch, rfc4106(gcm(aes)) will not work when using a DRBG or an ANSI X9.31 RNG.
--- crypto/ansi_cprng.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
crypto/ansi_cprng.c +5 -1
@@ -210,7 +210,11 @@ static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, byte_count =DEFAULT_BLK_SZ ; } - err = byte_count; +/* +* Return 0 in case of success as mandated by the kernel +* crypto API interface definition. +*/ + err =0 ;dbgprint (KERN_CRIT "getting %d random bytes for context %p\n" , byte_count, ctx);
Signature · 1 line
2.4.2
PATCH 106/111 crypto: testmgr - fix RNG return code enforcement
In reply to Jiri SlabyFrom: Stephan Mueller <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 19e60e1392d110be03d794e2286dd6cfd779cbe3 upstream.
Due to the change to RNGs to always return zero in success case, the invocation of the RNGs in the test manager must be updated as otherwise the RNG self tests are not properly executed any more.
--- crypto/testmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
crypto/testmgr.c +3 -3
@@ -1460,11 +1460,11 @@ static int test_cprng(struct crypto_rng *tfm, struct cprng_testvec *template,for (j =0 ; j < template[i].loops; j++) { err =crypto_rng_get_bytes (tfm, result, template[i].rlen); -if (err != template[i].rlen) { +if (err <0 ) {printk (KERN_ERR "alg: cprng: Failed to obtain " "the correct amount of random data for " -"%s (requested %d, got %d)\n" , algo, - template[i].rlen, err); +"%s (requested %d)\n" , algo, + template[i].rlen); goto out; } }
Signature · 1 line
2.4.2
PATCH 107/111 fork: report pid reservation failure properly
In reply to Jiri SlabyFrom: Michal Hocko <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 35f71bc0a09a45924bed268d8ccd0d3407bc476f upstream.
copy_process will report any failure in alloc_pid as ENOMEM currently which is misleading because the pid allocation might fail not only when the memory is short but also when the pid space is consumed already.
The current man page even mentions this case:
: EAGAIN
:
: A system-imposed limit on the number of threads was encountered. : There are a number of limits that may trigger this error: the : RLIMIT_NPROC soft resource limit (set via setrlimit(2)), which : limits the number of processes and threads for a real user ID, was : reached; the kernel's system-wide limit on the number of processes : and threads, /proc/sys/kernel/threads-max, was reached (see : proc(5)); or the maximum number of PIDs, /proc/sys/kernel/pid_max, : was reached (see proc(5)).
so the current behavior is also incorrect wrt. documentation. POSIX man page also suggest returing EAGAIN when the process count limit is reached.
This patch simply propagates error code from alloc_pid and makes sure we return -EAGAIN due to reservation failure. This will make behavior of fork closer to both our documentation and POSIX.
alloc_pid might alsoo fail when the reaper in the pid namespace is dead (the namespace basically disallows all new processes) and there is no good error code which would match documented ones. We have traditionally returned ENOMEM for this case which is misleading as well but as per Eric W. Biederman this behavior is documented in man pid_namespaces(7)
: If the "init" process of a PID namespace terminates, the kernel : terminates all of the processes in the namespace via a SIGKILL signal. : This behavior reflects the fact that the "init" process is essential for : the correct operation of a PID namespace. In this case, a subsequent : fork(2) into this PID namespace will fail with the error ENOMEM; it is : not possible to create a new processes in a PID namespace whose "init" : process has terminated.
and introducing a new error code would be too risky so let's stick to ENOMEM for this case.
--- kernel/fork.c | 5 +++-- kernel/pid.c | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-)
kernel/fork.c +3 -2
@@ -1362,10 +1362,11 @@ static struct task_struct *copy_process(unsigned long clone_flags, goto bad_fork_cleanup_io;if (pid != &init_struct_pid) { - retval = -ENOMEM ; pid =alloc_pid (p->nsproxy->pid_ns_for_children); -if (!pid) +if (IS_ERR (pid)) { + retval =PTR_ERR (pid); goto bad_fork_cleanup_io; + } } p->set_child_tid = (clone_flags &CLONE_CHILD_SETTID ) ? child_tidptr :NULL ;
kernel/pid.c +8 -7
@@ -179,7 +179,7 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)spin_unlock_irq (&pidmap_lock);kfree (page);if (unlikely (!map->page)) -break ; +return -ENOMEM ; }if (likely (atomic_read (&map->nr_free))) {for ( ; ; ) {
@@ -207,7 +207,7 @@ static int alloc_pidmap(struct pid_namespace *pid_ns) } pid =mk_pid (pid_ns, map, offset); } -return -1 ; +return -EAGAIN ; }int next_pidmap (struct pid_namespace *pid_ns,unsigned int last)
@@ -298,17 +298,20 @@ struct pid *alloc_pid(struct pid_namespace *ns)int i, nr;struct pid_namespace *tmp;struct upid *upid; +int retval = -ENOMEM ; pid =kmem_cache_alloc (ns->pid_cachep,GFP_KERNEL );if (!pid) - goto out; +return ERR_PTR (retval); tmp = ns; pid->level = ns->level;for (i = ns->level; i >=0 ; i--) { nr =alloc_pidmap (tmp); -if (nr <0 ) +if (IS_ERR_VALUE (nr)) { + retval = nr; goto out_free; + } pid->numbers[i].nr = nr; pid->numbers[i].ns = tmp;
@@ -336,7 +339,6 @@ struct pid *alloc_pid(struct pid_namespace *ns) }spin_unlock_irq (&pidmap_lock); -out:return pid; out_unlock:
@@ -348,8 +350,7 @@ out_free:free_pidmap (pid->numbers + i);kmem_cache_free (ns->pid_cachep, pid); - pid =NULL ; - goto out; +return ERR_PTR (retval); }void disable_pid_allocation (struct pid_namespace *ns)
Signature · 1 line
2.4.2
PATCH 108/111 MIPS: KVM: Do not sign extend on unsigned MMIO load
In reply to Jiri SlabyFrom: Nicholas Mc Guire <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ced upstream.
Fix possible unintended sign extension in unsigned MMIO loads by casting to uint16_t in the case of mmio_needed != 2.
Patchwork: https://patchwork.linux-mips.org/patch/9985/
--- arch/mips/kvm/kvm_mips_emul.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kvm/kvm_mips_emul.c +1 -1
@@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run)if (vcpu->mmio_needed ==2 ) *gpr = *(int16_t *) run->mmio.data;else - *gpr = *(int16_t *) run->mmio.data; + *gpr = *(uint16_t *)run->mmio.data;break ;case 1 :
Signature · 1 line
2.4.2
PATCH 109/111 W1: ds2490: Increase timeout when waiting for status
In reply to Jiri SlabyFrom: Alexander Stein <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d25221525e0e2cfd70e4ec7216549c06609a8bd2 upstream.
Adjust the bulk message timeout to the other ones (1000ms). Otherwise the following dmesg errors can be seen on a Raspberry Pi:
[ 31.492386] Failed to read 1-wire data from 0x81: err=-110. [ 31.504168] 0x81: count=-110, status: [ 31.613404] Failed to read 1-wire data from 0x81: err=-110. [ 31.621915] 0x81: count=-110, status: [ 43.260968] Failed to read 1-wire data from 0x81: err=-110. [ 43.270998] 0x81: count=-110, status: [ 43.379959] Failed to read 1-wire data from 0x81: err=-110. [ 43.388854] 0x81: count=-110, status:
--- drivers/w1/masters/ds2490.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/w1/masters/ds2490.c +1 -1
@@ -246,7 +246,7 @@ static int ds_recv_status_nodump(struct ds_device *dev, struct ds_status *st,memset (st,0 ,sizeof (*st)); count =0 ; - err =usb_bulk_msg (dev->udev,usb_rcvbulkpipe (dev->udev, dev->ep[EP_STATUS ]), buf, size, &count,100 ); + err =usb_bulk_msg (dev->udev,usb_rcvbulkpipe (dev->udev, dev->ep[EP_STATUS ]), buf, size, &count,1000 );if (err <0 ) {printk (KERN_ERR "Failed to read 1-wire data from 0x%x: err=%d.\n" , dev->ep[EP_STATUS ], err);return err;
Signature · 1 line
2.4.2
PATCH 110/111 lsm: copy comm before calling audit_log to avoid race in string printing
In reply to Jiri SlabyFrom: Richard Guy Briggs <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5deeb5cece3f9b30c8129786726b9d02c412c8ca upstream.
When task->comm is passed directly to audit_log_untrustedstring() without getting a copy or using the task_lock, there is a race that could happen that would output a NULL (\0) in the middle of the output string that would effectively truncate the rest of the report text after the comm= field in the audit log message, losing fields.
Using get_task_comm() to get a copy while acquiring the task_lock to prevent this and to prevent the result from being a mixture of old and new values of comm would incur potentially unacceptable overhead, considering that the value can be influenced by userspace and therefore untrusted anyways.
Copy the value before passing it to audit_log_untrustedstring() ensures that a local copy is used to calculate the length *and* subsequently printed. Even if this value contains a mix of old and new values, it will only calculate and copy up to the first NULL, preventing the rest of the audit log message being truncated.
Use a second local copy of comm to avoid a race between the first and second calls to audit_log_untrustedstring() with comm.
--- security/lsm_audit.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
security/lsm_audit.c +9 -6
@@ -211,7 +211,7 @@ static inline void print_ipv4_addr(struct audit_buffer *ab, __be32 addr,static void dump_common_audit_data (struct audit_buffer *ab,struct common_audit_data *a) { -struct task_struct *tsk = current; +char comm[sizeof (current->comm)];/* * To keep stack sizes in check force programers to notice if they
@@ -220,8 +220,8 @@ static void dump_common_audit_data(struct audit_buffer *ab,*/ BUILD_BUG_ON (sizeof (a->u) >sizeof (void *)*2 ); -audit_log_format (ab," pid=%d comm=" , tsk->pid); -audit_log_untrustedstring (ab, tsk->comm); +audit_log_format (ab," pid=%d comm=" , current->pid); +audit_log_untrustedstring (ab,memcpy (comm, current->comm,sizeof (comm)));switch (a->type) {case LSM_AUDIT_DATA_NONE :
@@ -276,13 +276,16 @@ static void dump_common_audit_data(struct audit_buffer *ab,audit_log_format (ab," ino=%lu" , inode->i_ino);break ; } -case LSM_AUDIT_DATA_TASK : - tsk = a->u.tsk; +case LSM_AUDIT_DATA_TASK : { +struct task_struct *tsk = a->u.tsk;if (tsk && tsk->pid) { +char comm[sizeof (tsk->comm)];audit_log_format (ab," pid=%d comm=" , tsk->pid); -audit_log_untrustedstring (ab, tsk->comm); +audit_log_untrustedstring (ab, +memcpy (comm, tsk->comm,sizeof (comm))); }break ; + }case LSM_AUDIT_DATA_NET :if (a->u.net->sk) {struct sock *sk = a->u.net->sk;
Signature · 1 line
2.4.2
PATCH 111/111 m68k/mac: Fix out-of-bounds array index in OSS IRQ source initialization
In reply to Jiri SlabyFrom: Finn Thain <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b24f670b7f5b2058b95370caa9f104b3cefb9f1d upstream.
--- arch/m68k/mac/oss.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/m68k/mac/oss.c +1 -2
@@ -48,9 +48,8 @@ void __init oss_init(void)/* Disable all interrupts. Unlike a VIA it looks like we */ /* do this by setting the source's interrupt level to zero. */ -for (i =0 ; i <=OSS_NUM_SOURCES ; i++) { +for (i =0 ; i <OSS_NUM_SOURCES ; i++) oss->irq_level[i] =0 ; - } }/*
Signature · 1 line
2.4.2
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.44 release. There are 111 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 Fri Jun 12 15:30:52 CEST 2015. Anything received after that time might be too late.
Build results:
total: 117 pass: 117 fail: 0 Qemu test results: total: 27 pass: 27 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter
Quoted 16 lines · Guenter Roeck
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.44 release. There are 111 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 Fri Jun 12 15:30:52 CEST 2015. Anything received after that time might be too late.
Build results:
total: 117 pass: 117 fail: 0 Qemu test results: total: 27 pass: 27 fail: 0Details are available at http://server.roeck-us.net:8010/builders.
Quoted 1 line · Shuah Khan
Compiled and booted on my test system. No dmesg regressions.
Thank you both!
Signature · 2 lines
js suse labs
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.44 release. There are 111 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 Fri Jun 12 15:30:52 CEST 2015. Anything received after that time might be too late.
Quoted 7 lines
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.44-rc1.xzand the diffstat can be found below.
thanks,
js
Compiled and booted on my test system. No dmesg regressions.
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978