3.12.49-stable review
cover 3.12.49-stable review
This is the start of the stable review cycle for the 3.12.49 release. There are 84 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 Tue Oct 6 15:25:04 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.49-rc1.xz
and the diffstat can be found below.
thanks,
js
===============
Adrien Schildknecht (1):
rtlwifi: rtl8192cu: Add new device ID
Alexey Brodkin (1):
stmmac: troubleshoot unexpected bits in des0 & des1
Andrey Ryabinin (1):
crypto: ghash-clmulni: specify context size for ghash async algorithm
Andy Lutomirski (3):
x86/nmi/64: Improve nested NMI comments
x86/nmi/64: Reorder nested NMI checks
x86/nmi/64: Use DF to avoid userspace RSP confusing nested NMI
detection
Aneesh Kumar K.V (1):
powerpc/mm: Recompute hash value after a failed update
Bart Van Assche (1):
libfc: Fix fc_fcp_cleanup_each_cmd()
Bjorn Helgaas (1):
PCI: Fix TI816X class code quirk
Bob Copeland (1):
mac80211: enable assoc check for mesh interfaces
Christoph Hellwig (1):
IB/uverbs: reject invalid or unknown opcodes
Dan Carpenter (1):
clk: versatile: off by one in clk_sp810_timerclken_of_get()
Daniel Borkmann (2):
ipv6: fix exthdrs offload registration in out_rt path netlink, mmap: transform mmap skb into full skb on taps
David Daney (1):
of/address: Don't loop forever in of_find_matching_node_by_address().
David Härdeman (1):
rc-core: fix remove uevent generation
David Vrabel (1):
xen/gntdev: convert priv->lock to a mutex
Davide Italiano (1):
ext4: move check under lock scope to close a race.
Don Zickus (1):
HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error
Eric W. Biederman (3):
unshare: Unsharing a thread does not require unsharing a vm
dcache: Handle escaped paths in prepend_path
vfs: Test for and handle paths that are unreachable from their
mnt_root
Eugene Shatokhin (1):
usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared
Filipe Manana (1):
Btrfs: check if previous transaction aborted to avoid fs corruption
Grant Likely (1):
drivercore: Fix unregistration path of platform devices
Guenter Roeck (1):
regmap: regcache-rbtree: Clean new present bits on present bitmap
resize
Helge Deller (1):
parisc: Filter out spurious interrupts in PA-RISC irq handler
Hin-Tak Leung (2):
hfs: fix B-tree corruption after insertion at position 0 hfs,hfsplus: cache pages correctly between bnode_create and bnode_free
Horia Geant? (1):
crypto: caam - fix memory corruption in ahash_final_ctx
Ian Abbott (3):
staging: comedi: usbduxsigma: don't clobber ai_timer in command test
staging: comedi: usbduxsigma: don't clobber ao_timer in command test
staging: comedi: adl_pci7x3x: fix digital output on PCI-7230
Imre Deak (1):
tty/vt: don't set font mappings on vc not supporting this
Jack Morgenstein (1):
IB/mlx4: Forbid using sysfs to change RoCE pkeys
Jaewon Kim (1):
vmscan: fix increasing nr_isolated incurred by putback unevictable
pages
Jann Horn (1):
fs: if a coredump already exists, unlink and recreate with O_EXCL
Jean Delvare (1):
tg3: Fix temperature reporting
Jeff Vander Stoep (1):
arm64: kconfig: Move LIST_POISON to a safe value
Jeffery Miller (1):
Add radeon suspend/resume quirk for HP Compaq dc5750.
Jesse Gross (1):
openvswitch: Zero flows on allocation.
Jialing Fu (1):
mmc: core: fix race condition in mmc_wait_data_done
Jonathon Jongsma (1):
drm/qxl: validate monitors config modes
Kishon Vijay Abraham I (1):
usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512
bytes
Lars-Peter Clausen (2):
iio: Add inverse unit conversion macros
iio: adis16480: Fix scale factors
Maciej S. Szmigiero (1):
serial: 8250: don't bind to SMSC IrCC IR port
Marc Zyngier (2):
arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
arm64: KVM: Disable virtual timer even if the guest is not using it
Marcelo Ricardo Leitner (1):
sctp: fix race on protocol/netns initialization
Mark Rustad (2):
PCI: Add dev_flags bit to access VPD through function 0
PCI: Add VPD function 0 quirk for Intel Ethernet devices
Masahiro Yamada (1):
devres: fix devres_get()
Matthijs Kooijman (1):
USB: ftdi_sio: Added custom PID for CustomWare products
Max Filippov (2):
xtensa: fix threadptr reload on return to userspace
xtensa: fix kernel register spilling
Michael Ellerman (1):
powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash
Mike Marciniszyn (1):
IB/qib: Change lkey table allocation to support more MRs
Mikulas Patocka (1):
hpfs: update ctime and mtime on directory modification
Minfei Huang (1):
x86/mm: Initialize pmd_idx in page_table_range_init_count()
Neil Brown (1):
md: flush ->event_work before stopping array.
NeilBrown (2):
NFSv4: don't set SETATTR for O_RDONLY|O_EXCL
md/raid10: always set reshape_safe when initializing reshape_position.
Noa Osherovich (1):
IB/mlx4: Use correct SL on AH query under RoCE
Paul Mackerras (1):
powerpc/MSI: Fix race condition in tearing down MSI interrupts
Peter Chen (1):
usb: host: ehci-sys: delete useless bus_to_hcd conversion
Philipp Hachtmann (1):
USB: symbolserial: Use usb_get_serial_port_data
Richard Laing (1):
net/ipv6: Correct PIM6 mrt_lock handling
Sakari Ailus (1):
v4l: omap3isp: Fix sub-device power management code
Stephen Chandler Paul (1):
DRM - radeon: Don't link train DisplayPort on HPD until we get the
dpcd
Sudip Mukherjee (1):
auxdisplay: ks0108: fix refcount
Takashi Iwai (3):
Input: evdev - do not report errors form flush()
ALSA: hda - Enable headphone jack detect on old Fujitsu laptops
ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437
Thomas Huth (1):
powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
Trond Myklebust (1):
NFS: nfs_set_pgio_error sometimes misses errors
Vignesh R (1):
ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP
Will Deacon (3):
arm64: compat: fix vfp save/restore across signal handlers in
big-endian
arm64: head.S: initialise mdcr_el2 in el2_setup
arm64: errata: add module build workaround for erratum #843419
Wilson Kok (1):
fib_rules: fix fib rule dumps across multiple skbs
Xiao Guangrong (1):
KVM: MMU: fix validation of mmio page fault
Yishai Hadas (1):
IB/uverbs: Fix race between ib_uverbs_open and remove_one
huaibin Wang (1):
ip6_gre: release cached dst on tunnel removal
arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +- arch/arm64/Kconfig | 20 +++ arch/arm64/Makefile | 4 + arch/arm64/kernel/head.S | 5 + arch/arm64/kernel/module.c | 2 + arch/arm64/kernel/signal32.c | 47 +++-- arch/arm64/kvm/hyp.S | 5 +- arch/arm64/kvm/inject_fault.c | 12 +- arch/parisc/kernel/irq.c | 8 +- arch/powerpc/include/asm/pgtable-ppc64.h | 14 +- arch/powerpc/include/asm/rtas.h | 1 + arch/powerpc/kernel/rtas.c | 17 ++ arch/powerpc/mm/hugepage-hash64.c | 3 +- arch/powerpc/platforms/powernv/pci.c | 5 +- arch/powerpc/platforms/pseries/ras.c | 3 +- arch/powerpc/sysdev/fsl_msi.c | 5 +- arch/powerpc/sysdev/mpic_pasemi_msi.c | 6 +- arch/powerpc/sysdev/mpic_u3msi.c | 5 +- arch/powerpc/sysdev/ppc4xx_msi.c | 5 +- arch/x86/crypto/ghash-clmulni-intel_glue.c | 1 + arch/x86/kernel/entry_64.S | 201 +++++++++++++--------- arch/x86/kernel/nmi.c | 4 +- arch/x86/kvm/mmu.c | 45 ----- arch/x86/mm/init_32.c | 1 + arch/xtensa/include/asm/traps.h | 29 ++-- arch/xtensa/kernel/entry.S | 7 +- drivers/auxdisplay/ks0108.c | 1 + drivers/base/devres.c | 4 +- drivers/base/platform.c | 8 +- drivers/base/regmap/regcache-rbtree.c | 19 +- drivers/clk/versatile/clk-sp810.c | 4 +- drivers/crypto/caam/caamhash.c | 7 +- drivers/gpu/drm/qxl/qxl_display.c | 66 ++++--- drivers/gpu/drm/qxl/qxl_drv.h | 2 + drivers/gpu/drm/radeon/radeon_combios.c | 8 + drivers/gpu/drm/radeon/radeon_connectors.c | 5 + drivers/hid/usbhid/hid-core.c | 2 +- drivers/iio/imu/adis16480.c | 39 ++++- drivers/infiniband/core/uverbs.h | 3 +- drivers/infiniband/core/uverbs_cmd.c | 10 +- drivers/infiniband/core/uverbs_main.c | 43 +++-- drivers/infiniband/hw/mlx4/ah.c | 6 +- drivers/infiniband/hw/mlx4/sysfs.c | 5 +- drivers/infiniband/hw/qib/qib_keys.c | 4 + drivers/infiniband/hw/qib/qib_verbs.c | 14 +- drivers/infiniband/hw/qib/qib_verbs.h | 2 + drivers/input/evdev.c | 13 +- drivers/md/md.c | 2 + drivers/md/raid10.c | 5 +- drivers/media/platform/omap3isp/isp.c | 4 +- drivers/media/rc/rc-main.c | 3 - drivers/mmc/core/core.c | 6 +- drivers/net/ethernet/broadcom/tg3.c | 2 +- drivers/net/ethernet/stmicro/stmmac/descs.h | 2 + drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 3 +- drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 3 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 44 ++--- drivers/net/usb/usbnet.c | 7 +- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 + drivers/of/address.c | 6 +- drivers/pci/access.c | 61 ++++++- drivers/pci/quirks.c | 18 +- drivers/scsi/libfc/fc_fcp.c | 19 +- drivers/staging/comedi/drivers/adl_pci7x3x.c | 15 +- drivers/staging/comedi/drivers/usbduxsigma.c | 99 +++++------ drivers/tty/serial/8250/8250_pnp.c | 5 + drivers/tty/vt/consolemap.c | 7 + drivers/usb/dwc3/ep0.c | 12 +- drivers/usb/host/ehci-sysfs.c | 8 +- drivers/usb/serial/ftdi_sio.c | 4 + drivers/usb/serial/ftdi_sio_ids.h | 8 + drivers/usb/serial/symbolserial.c | 6 +- drivers/xen/gntdev.c | 40 ++--- fs/btrfs/transaction.c | 3 + fs/coredump.c | 38 +++- fs/dcache.c | 7 + fs/ext4/extents.c | 17 +- fs/hfs/bnode.c | 9 +- fs/hfs/brec.c | 20 ++- fs/hfsplus/bnode.c | 3 - fs/hpfs/namei.c | 25 ++- fs/namei.c | 31 +++- fs/nfs/nfs4proc.c | 2 +- fs/nfs/pagelist.c | 4 +- include/linux/iio/iio.h | 17 ++ include/linux/pci.h | 2 + kernel/fork.c | 28 +-- mm/vmscan.c | 2 +- net/core/fib_rules.c | 14 +- net/ipv6/exthdrs_offload.c | 2 +- net/ipv6/ip6_gre.c | 1 + net/ipv6/ip6mr.c | 2 +- net/mac80211/tx.c | 3 - net/netlink/af_netlink.c | 30 +++- net/netlink/af_netlink.h | 9 + net/openvswitch/datapath.c | 2 +- net/openvswitch/flow.c | 21 ++- net/openvswitch/flow.h | 2 +- net/sctp/protocol.c | 64 ++++--- sound/pci/hda/patch_realtek.c | 6 +- 100 files changed, 991 insertions(+), 485 deletions(-)
Signature · 1 line
2.6.0
PATCH 1/84 PCI: Add dev_flags bit to access VPD through function 0
From: Mark Rustad <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 932c435caba8a2ce473a91753bad0173269ef334 upstream.
Add a dev_flags bit, PCI_DEV_FLAGS_VPD_REF_F0, to access VPD through function 0 to provide VPD access on other functions. This is for hardware devices that provide copies of the same VPD capability registers in multiple functions. Because the kernel expects that each function has its own registers, both the locking and the state tracking are affected by VPD accesses to different functions.
On such devices for example, if a VPD write is performed on function 0, *any* later attempt to read VPD from any other function of that device will hang. This has to do with how the kernel tracks the expected value of the F bit per function.
Concurrent accesses to different functions of the same device can not only hang but also corrupt both read and write VPD data.
When hangs occur, typically the error message:
vpd r/w failed. This is likely a firmware bug on this device.
will be seen.
Never set this bit on function 0 or there will be an infinite recursion.
--- drivers/pci/access.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++- include/linux/pci.h | 2 ++ 2 files changed, 62 insertions(+), 1 deletion(-)
drivers/pci/access.c +60 -1
@@ -359,6 +359,56 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = { .release = pci_vpd_pci22_release, }; +static ssize_t pci_vpd_f0_read (struct pci_dev *dev,loff_t pos,size_t count, +void *arg) +{ +struct pci_dev *tdev =pci_get_slot (dev->bus,PCI_SLOT (dev->devfn)); +ssize_t ret; + +if (!tdev) +return -ENODEV ; + + ret =pci_read_vpd (tdev, pos, count, arg); +pci_dev_put (tdev); +return ret; +} + +static ssize_t pci_vpd_f0_write (struct pci_dev *dev,loff_t pos,size_t count, +const void *arg) +{ +struct pci_dev *tdev =pci_get_slot (dev->bus,PCI_SLOT (dev->devfn)); +ssize_t ret; + +if (!tdev) +return -ENODEV ; + + ret =pci_write_vpd (tdev, pos, count, arg); +pci_dev_put (tdev); +return ret; +} + +static const struct pci_vpd_ops pci_vpd_f0_ops = { + .read = pci_vpd_f0_read, + .write = pci_vpd_f0_write, + .release = pci_vpd_pci22_release, +}; + +static int pci_vpd_f0_dev_check (struct pci_dev *dev) +{ +struct pci_dev *tdev =pci_get_slot (dev->bus,PCI_SLOT (dev->devfn)); +int ret =0 ; + +if (!tdev) +return -ENODEV ; +if (!tdev->vpd || !tdev->multifunction || + dev->class != tdev->class || dev->vendor != tdev->vendor || + dev->device != tdev->device) + ret = -ENODEV ; + +pci_dev_put (tdev); +return ret; +} +int pci_vpd_pci22_init (struct pci_dev *dev) {struct pci_vpd_pci22 *vpd;
@@ -367,12 +417,21 @@ int pci_vpd_pci22_init(struct pci_dev *dev) cap =pci_find_capability (dev,PCI_CAP_ID_VPD );if (!cap)return -ENODEV ; +if (dev->dev_flags &PCI_DEV_FLAGS_VPD_REF_F0 ) { +int ret =pci_vpd_f0_dev_check (dev); + +if (ret) +return ret; + } vpd =kzalloc (sizeof (*vpd),GFP_ATOMIC );if (!vpd)return -ENOMEM ; vpd->base.len =PCI_VPD_PCI22_SIZE ; - vpd->base.ops = &pci_vpd_pci22_ops; +if (dev->dev_flags &PCI_DEV_FLAGS_VPD_REF_F0 ) + vpd->base.ops = &pci_vpd_f0_ops; +else + vpd->base.ops = &pci_vpd_pci22_ops;mutex_init (&vpd->lock); vpd->cap = cap; vpd->busy = false;
include/linux/pci.h +2 -0
@@ -170,6 +170,8 @@ enum pci_dev_flags {PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t )2 ,/* Provide indication device is assigned by a Virtual Machine Manager */ PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t )4 , +/* Get VPD from function 0 VPD */ + PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8), }; enum pci_irq_reroute_variant {
Signature · 1 line
2.6.0
PATCH 2/84 PCI: Add VPD function 0 quirk for Intel Ethernet devices
From: Mark Rustad <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7aa6ca4d39edf01f997b9e02cf6d2fdeb224f351 upstream.
Set the PCI_DEV_FLAGS_VPD_REF_F0 flag on all Intel Ethernet device functions other than function 0, so that on multi-function devices, we will always read VPD from function 0 instead of from the other functions.
--- drivers/pci/quirks.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/pci/quirks.c +9 -0
@@ -1849,6 +1849,15 @@ static void quirk_netmos(struct pci_dev *dev)DECLARE_PCI_FIXUP_CLASS_HEADER (PCI_VENDOR_ID_NETMOS ,PCI_ANY_ID ,PCI_CLASS_COMMUNICATION_SERIAL ,8 , quirk_netmos); +static void quirk_f0_vpd_link (struct pci_dev *dev) +{ +if (!dev->multifunction || !PCI_FUNC (dev->devfn)) +return ; + dev->dev_flags |=PCI_DEV_FLAGS_VPD_REF_F0 ; +} +DECLARE_PCI_FIXUP_CLASS_EARLY (PCI_VENDOR_ID_INTEL ,PCI_ANY_ID , +PCI_CLASS_NETWORK_ETHERNET ,8 , quirk_f0_vpd_link); +static void quirk_e100_interrupt (struct pci_dev *dev) {u16 command, pmcsr;
Signature · 1 line
2.6.0
PATCH 3/84 staging: comedi: usbduxsigma: don't clobber ai_timer in command test
In reply to Jiri SlabyFrom: Ian Abbott <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 423b24c37dd5794a674c74b0ed56392003a69891 upstream
devpriv->ai_timer is used while an asynchronous command is running on the AI subdevice. It also gets modified by the subdevice's cmdtest handler for checking new asynchronous commands (usbduxsigma_ai_cmdtest()), which is not correct as it's allowed to check new commands while an old command is still running. Fix it by moving the code which sets up devpriv->ai_timer and devpriv->ai_interval into the subdevice's cmd handler, usbduxsigma_ai_cmd().
** This backported patch also moves the code that sets up devpriv->ai_sample_count and devpriv->ai_continuous from usbduxsigma_ai_cmdtest() to usbduxsigma_ai_cmd() for the same reason as above. (This was not needed in the upstream commit.) **
Note that the removed code in usbduxsigma_ai_cmdtest() checked that devpriv->ai_timer did not end up less than than 1, but that could not happen because cmd->scan_begin_arg had already been checked to be at least the minimum required value (at least when cmd->scan_begin_src == TRIG_TIMER, which had also been checked to be the case).
--- drivers/staging/comedi/drivers/usbduxsigma.c | 58 +++++++++++++--------------- 1 file changed, 27 insertions(+), 31 deletions(-)
drivers/staging/comedi/drivers/usbduxsigma.c +27 -31
@@ -575,37 +575,6 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev,if (err)return 3 ; -/* Step 4: fix up any arguments */ - -if (high_speed) { -/* -* every 2 channels get a time window of 125us. Thus, if we -* sample all 16 channels we need 1ms. If we sample only one -* channel we need only 125us -*/ - devpriv->ai_interval = interval; - devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval); - }else { -/* interval always 1ms */ - devpriv->ai_interval =1 ; - devpriv->ai_timer = cmd->scan_begin_arg /1000000 ; - } -if (devpriv->ai_timer <1 ) - err |= -EINVAL ; - -if (cmd->stop_src ==TRIG_COUNT ) { -/* data arrives as one packet */ - devpriv->ai_sample_count = cmd->stop_arg; - devpriv->ai_continuous =0 ; - }else { -/* continuous acquisition */ - devpriv->ai_continuous =1 ; - devpriv->ai_sample_count =0 ; - } - -if (err) -return 4 ; -return 0 ; }
@@ -704,6 +673,33 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev,/* set current channel of the running acquisition to zero */ s->async->cur_chan =0 ; + +if (devpriv->high_speed) { +/* +* every 2 channels get a time window of 125us. Thus, if we +* sample all 16 channels we need 1ms. If we sample only one +* channel we need only 125us +*/ +unsigned int interval =usbduxsigma_chans_to_interval (len); + + devpriv->ai_interval = interval; + devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval); + }else { +/* interval always 1ms */ + devpriv->ai_interval =1 ; + devpriv->ai_timer = cmd->scan_begin_arg /1000000 ; + } + +if (cmd->stop_src ==TRIG_COUNT ) { +/* data arrives as one packet */ + devpriv->ai_sample_count = cmd->stop_arg; + devpriv->ai_continuous =0 ; + }else { +/* continuous acquisition */ + devpriv->ai_continuous =1 ; + devpriv->ai_sample_count =0 ; + } +for (i =0 ; i < len; i++) {unsigned int chan =CR_CHAN (cmd->chanlist[i]);
Signature · 1 line
2.6.0
PATCH 4/84 staging: comedi: usbduxsigma: don't clobber ao_timer in command test
In reply to Jiri SlabyFrom: Ian Abbott <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c04a1f17803e0d3eeada586ca34a6b436959bc20 upstream
devpriv->ao_timer is used while an asynchronous command is running on the AO subdevice. It also gets modified by the subdevice's cmdtest handler for checking new asynchronous commands, usbduxsigma_ao_cmdtest(), which is not correct as it's allowed to check new commands while an old command is still running. Fix it by moving the code which sets up devpriv->ao_timer into the subdevice's cmd handler, usbduxsigma_ao_cmd().
** This backported patch also moves the code that sets up devpriv->ao_sample_count and devpriv->ao_continuous from usbduxsigma_ao_cmdtest() to usbduxsigma_ao_cmd() for the same reason as above. (This was not needed in the upstream commit.) **
Note that the removed code in usbduxsigma_ao_cmdtest() checked that devpriv->ao_timer did not end up less that 1, but that could not happen due because cmd->scan_begin_arg or cmd->convert_arg had already been range-checked.
Also note that we tested the high_speed variable in the old code, but that is currently always 0 and means that we always use "scan" timing (cmd->scan_begin_src == TRIG_TIMER and cmd->convert_src == TRIG_NOW) and never "convert" (individual sample) timing (cmd->scan_begin_src == TRIG_FOLLOW and cmd->convert_src == TRIG_TIMER). The moved code tests cmd->convert_src instead to decide whether "scan" or "convert" timing is being used, although currently only "scan" timing is supported.
--- drivers/staging/comedi/drivers/usbduxsigma.c | 41 ++++++++++++---------------- 1 file changed, 17 insertions(+), 24 deletions(-)
drivers/staging/comedi/drivers/usbduxsigma.c +17 -24
@@ -950,10 +950,24 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,if (err)return 3 ; -/* Step 4: fix up any arguments */ +return 0 ; +} + +static int usbduxsigma_ao_cmd (struct comedi_device *dev, +struct comedi_subdevice *s) +{ +struct usbduxsigma_private *devpriv = dev->private; +struct comedi_cmd *cmd = &s->async->cmd; +int ret; +int i; + +down (&devpriv->sem); + +/* set current channel of the running acquisition to zero */ + s->async->cur_chan =0 ;/* we count in timer steps */ -if (high_speed) { +if (cmd->convert_src ==TRIG_TIMER ) {/* timing of the conversion itself: every 125 us */ devpriv->ao_timer = cmd->convert_arg /125000 ; }else {
@@ -963,12 +977,9 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,*/ devpriv->ao_timer = cmd->scan_begin_arg /1000000 ; } -if (devpriv->ao_timer <1 ) - err |= -EINVAL ; -if (cmd->stop_src ==TRIG_COUNT ) {/* not continuous, use counter */ -if (high_speed) { +if (cmd->convert_src ==TRIG_TIMER ) {/* high speed also scans everything at once */ devpriv->ao_sample_count = cmd->stop_arg * cmd->scan_end_arg;
@@ -987,24 +998,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, devpriv->ao_sample_count =0 ; } -if (err) -return 4 ; - -return 0 ; -} - -static int usbduxsigma_ao_cmd (struct comedi_device *dev, -struct comedi_subdevice *s) -{ -struct usbduxsigma_private *devpriv = dev->private; -struct comedi_cmd *cmd = &s->async->cmd; -int ret; -int i; - -down (&devpriv->sem); - -/* set current channel of the running acquisition to zero */ - s->async->cur_chan =0 ;for (i =0 ; i < cmd->chanlist_len; ++i) devpriv->ao_chanlist[i] =CR_CHAN (cmd->chanlist[i]);
Signature · 1 line
2.6.0
PATCH 5/84 staging: comedi: adl_pci7x3x: fix digital output on PCI-7230
In reply to Jiri SlabyFrom: Ian Abbott <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ad83dbd974feb2e2a8cc071a1d28782bd4d2c70e upstream
The "adl_pci7x3x" driver replaced the "adl_pci7230" and "adl_pci7432" drivers in commits 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver") and 657f77d173d3 ("staging: comedi: remove adl_pci7230 and adl_pci7432 drivers"). Although the new driver code agrees with the user manuals for the respective boards, digital outputs stopped working on the PCI-7230. This has 16 digital output channels and the previous adl_pci7230 driver shifted the 16 bit output state left by 16 bits before writing to the hardware register. The new adl_pci7x3x driver doesn't do that. Fix it in adl_pci7x3x_do_insn_bits() by checking for the special case of the subdevice having only 16 channels and duplicating the 16 bit output state into both halves of the 32-bit register. That should work both for what the board actually does and for what the user manual says it should do.
--- drivers/staging/comedi/drivers/adl_pci7x3x.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/staging/comedi/drivers/adl_pci7x3x.c +13 -2
@@ -116,10 +116,21 @@ static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev,unsigned int bits = data[1 ];if (mask) { +unsigned int val; + s->state &= ~mask; s->state |= (bits & mask); - -outl (s->state, dev->iobase + reg); + val = s->state; +if (s->n_chan ==16 ) { +/* +* It seems the PCI-7230 needs the 16-bit DO state +* to be shifted left by 16 bits before being written +* to the 32-bit register. Set the value in both +* halves of the register to be sure. +*/ + val |= val <<16 ; + } +outl (val, dev->iobase + reg); }/*
Signature · 1 line
2.6.0
PATCH 6/84 ext4: move check under lock scope to close a race.
In reply to Jiri SlabyFrom: Davide Italiano <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 280227a75b56ab5d35854f3a77ef74a7ad56a203 upstream
fallocate() checks that the file is extent-based and returns EOPNOTSUPP in case is not. Other tasks can convert from and to indirect and extent so it's safe to check only after grabbing the inode mutex.
[Nikolay Borisov: Bakported to 3.12.47
- Adjusted context
- Add the 'out' label]
--- fs/ext4/extents.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
fs/ext4/extents.c +11 -6
@@ -4634,12 +4634,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)if (ret)return ret; -/* -* currently supporting (pre)allocate mode for extent-based -* files _only_ -*/ -if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) -return -EOPNOTSUPP ;trace_ext4_fallocate_enter (inode, offset, len, mode); map.m_lblk = offset >> blkbits;
@@ -4654,6 +4648,16 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)*/ credits =ext4_chunk_trans_blocks (inode, max_blocks);mutex_lock (&inode->i_mutex); + +/* +* currently supporting (pre)allocate mode for extent-based +* files _only_ +*/ +if (!(ext4_test_inode_flag (inode,EXT4_INODE_EXTENTS ))) { + ret = -EOPNOTSUPP ; + goto out; + } + ret =inode_newsize_ok (inode, (len + offset));if (ret) {mutex_unlock (&inode->i_mutex);
@@ -4714,6 +4718,7 @@ retry: ret =0 ; goto retry; } +out:mutex_unlock (&inode->i_mutex);trace_ext4_fallocate_exit (inode, offset, max_blocks, ret >0 ? ret2 : ret);
Signature · 1 line
2.6.0
PATCH 7/84 libfc: Fix fc_fcp_cleanup_each_cmd()
In reply to Jiri SlabyFrom: Bart Van Assche <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8f2777f53e3d5ad8ef2a176a4463a5c8e1a16431 upstream.
Since fc_fcp_cleanup_cmd() can sleep this function must not be called while holding a spinlock. This patch avoids that fc_fcp_cleanup_each_cmd() triggers the following bug:
BUG: scheduling while atomic: sg_reset/1512/0x00000202
1 lock held by sg_reset/1512:
#0: (&(&fsp->scsi_pkt_lock)->rlock){+.-...}, at: [<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Preemption disabled at:[<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Call Trace:
[<ffffffff816c612c>] dump_stack+0x4f/0x7b
[<ffffffff810828bc>] __schedule_bug+0x6c/0xd0
[<ffffffff816c87aa>] __schedule+0x71a/0xa10
[<ffffffff816c8ad2>] schedule+0x32/0x80
[<ffffffffc0217eac>] fc_seq_set_resp+0xac/0x100 [libfc]
[<ffffffffc0218b11>] fc_exch_done+0x41/0x60 [libfc]
[<ffffffffc0225cff>] fc_fcp_cleanup_each_cmd.isra.21+0xcf/0x150 [libfc]
[<ffffffffc0225f43>] fc_eh_device_reset+0x1c3/0x270 [libfc]
[<ffffffff814a2cc9>] scsi_try_bus_device_reset+0x29/0x60
[<ffffffff814a3908>] scsi_ioctl_reset+0x258/0x2d0
[<ffffffff814a2650>] scsi_ioctl+0x150/0x440
[<ffffffff814b3a9d>] sd_ioctl+0xad/0x120
[<ffffffff8132f266>] blkdev_ioctl+0x1b6/0x810
[<ffffffff811da608>] block_ioctl+0x38/0x40
[<ffffffff811b4e08>] do_vfs_ioctl+0x2f8/0x530
[<ffffffff811b50c1>] SyS_ioctl+0x81/0xa0
[<ffffffff816cf8b2>] system_call_fastpath+0x16/0x7a--- drivers/scsi/libfc/fc_fcp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/scsi/libfc/fc_fcp.c +17 -2
@@ -1039,11 +1039,26 @@ restart:fc_fcp_pkt_hold (fsp);spin_unlock_irqrestore (&si->scsi_queue_lock, flags); -if (!fc_fcp_lock_pkt (fsp)) { +spin_lock_bh (&fsp->scsi_pkt_lock); +if (!(fsp->state &FC_SRB_COMPL )) { + fsp->state |=FC_SRB_COMPL ; +/* +* TODO: dropping scsi_pkt_lock and then reacquiring +* again around fc_fcp_cleanup_cmd() is required, +* since fc_fcp_cleanup_cmd() calls into +* fc_seq_set_resp() and that func preempts cpu using +* schedule. May be schedule and related code should be +* removed instead of unlocking here to avoid scheduling +* while atomic bug. +*/ +spin_unlock_bh (&fsp->scsi_pkt_lock); +fc_fcp_cleanup_cmd (fsp, error); + +spin_lock_bh (&fsp->scsi_pkt_lock);fc_io_compl (fsp); -fc_fcp_unlock_pkt (fsp); } +spin_unlock_bh (&fsp->scsi_pkt_lock);fc_fcp_pkt_release (fsp);spin_lock_irqsave (&si->scsi_queue_lock, flags);
Signature · 1 line
2.6.0
PATCH 8/84 regmap: regcache-rbtree: Clean new present bits on present bitmap resize
In reply to Jiri SlabyFrom: Guenter Roeck <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8ef9724bf9718af81cfc5132253372f79c71b7e2 upstream.
When inserting a new register into a block, the present bit map size is increased using krealloc. krealloc does not clear the additionally allocated memory, leaving it filled with random values. Result is that some registers are considered cached even though this is not the case.
Fix the problem by clearing the additionally allocated memory. Also, if the bitmap size does not increase, do not reallocate the bitmap at all to reduce overhead.
--- drivers/base/regmap/regcache-rbtree.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/base/regmap/regcache-rbtree.c +14 -5
@@ -302,11 +302,20 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,if (!blk)return -ENOMEM ; - present =krealloc (rbnode->cache_present, -BITS_TO_LONGS (blklen) *sizeof (*present),GFP_KERNEL ); -if (!present) { -kfree (blk); -return -ENOMEM ; +if (BITS_TO_LONGS (blklen) >BITS_TO_LONGS (rbnode->blklen)) { + present =krealloc (rbnode->cache_present, +BITS_TO_LONGS (blklen) *sizeof (*present), +GFP_KERNEL ); +if (!present) { +kfree (blk); +return -ENOMEM ; + } + +memset (present +BITS_TO_LONGS (rbnode->blklen),0 , + (BITS_TO_LONGS (blklen) -BITS_TO_LONGS (rbnode->blklen)) + *sizeof (*present)); + }else { + present = rbnode->cache_present; }/* insert the register value in the correct place in the rbnode block */
Signature · 1 line
2.6.0
PATCH 9/84 crypto: caam - fix memory corruption in ahash_final_ctx
In reply to Jiri SlabyFrom: Horia Geant? <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b310c178e6d897f82abb9da3af1cd7c02b09f592 upstream.
When doing pointer operation for accessing the HW S/G table, a value representing number of entries (and not number of bytes) must be used.
--- drivers/crypto/caam/caamhash.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/caam/caamhash.c +4 -3
@@ -897,13 +897,14 @@ static int ahash_final_ctx(struct ahash_request *req) state->buflen_1;u32 *sh_desc = ctx->sh_desc_fin, *desc;dma_addr_t ptr = ctx->sh_desc_fin_dma; -int sec4_sg_bytes; +int sec4_sg_bytes, sec4_sg_src_index;int digestsize =crypto_ahash_digestsize (ahash);struct ahash_edesc *edesc;int ret =0 ;int sh_len; - sec4_sg_bytes = (1 + (buflen ?1 :0 )) *sizeof (struct sec4_sg_entry ); + sec4_sg_src_index =1 + (buflen ?1 :0 ); + sec4_sg_bytes = sec4_sg_src_index *sizeof (struct sec4_sg_entry );/* allocate space for base edesc and hw desc commands, link tables */ edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN +
@@ -930,7 +931,7 @@ static int ahash_final_ctx(struct ahash_request *req) state->buf_dma =try_buf_map_to_sec4_sg (jrdev, edesc->sec4_sg +1 , buf, state->buf_dma, buflen, last_buflen); - (edesc->sec4_sg + sec4_sg_bytes -1 )->len |=SEC4_SG_LEN_FIN ; + (edesc->sec4_sg + sec4_sg_src_index -1 )->len |=SEC4_SG_LEN_FIN ;append_seq_in_ptr (desc, edesc->sec4_sg_dma, ctx->ctx_len + buflen,LDST_SGF );
Signature · 1 line
2.6.0
PATCH 10/84 arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
In reply to Jiri SlabyFrom: Marc Zyngier <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 126c69a0bd0e441bf6766a5d9bf20de011be9f68 upstream.
When injecting a fault into a misbehaving 32bit guest, it seems rather idiotic to also inject a 64bit fault that is only going to corrupt the guest state. This leads to a situation where we perform an illegal exception return at EL2 causing the host to crash instead of killing the guest.
Just fix the stupid bug that has been there from day 1.
--- arch/arm64/kvm/inject_fault.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/kvm/inject_fault.c +6 -6
@@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr) {if (!(vcpu->arch.hcr_el2 &HCR_RW ))inject_abt32 (vcpu, false, addr); - -inject_abt64 (vcpu, false, addr); +else +inject_abt64 (vcpu, false, addr); }/**
@@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr) {if (!(vcpu->arch.hcr_el2 &HCR_RW ))inject_abt32 (vcpu, true, addr); - -inject_abt64 (vcpu, true, addr); +else +inject_abt64 (vcpu, true, addr); }/**
@@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu) {if (!(vcpu->arch.hcr_el2 &HCR_RW ))inject_undef32 (vcpu); - -inject_undef64 (vcpu); +else +inject_undef64 (vcpu); }
Signature · 1 line
2.6.0
PATCH 11/84 DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd
In reply to Jiri SlabyFrom: Stephen Chandler Paul <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 924f92bf12bfbef3662619e3ed24a1cea7c1cbcd upstream.
Most of the time this isn't an issue since hotplugging an adaptor will trigger a crtc mode change which in turn, causes the driver to probe every DisplayPort for a dpcd. However, in cases where hotplugging doesn't cause a mode change (specifically when one unplugs a monitor from a DisplayPort connector, then plugs that same monitor back in seconds later on the same port without any other monitors connected), we never probe for the dpcd before starting the initial link training. What happens from there looks like this:
- GPU has only one monitor connected. It's connected via DisplayPort, and does not go through an adaptor of any sort.
- User unplugs DisplayPort connector from GPU.
- Change in HPD is detected by the driver, we probe every DisplayPort for a possible connection.
- Probe the port the user originally had the monitor connected on for it's dpcd. This fails, and we clear the first (and only the first) byte of the dpcd to indicate we no longer have a dpcd for this port.
- User plugs the previously disconnected monitor back into the same DisplayPort.
- radeon_connector_hotplug() is called before everyone else, and tries to handle the link training. Since only the first byte of the dpcd is zeroed, the driver is able to complete link training but does so against the wrong dpcd, causing it to initialize the link with the wrong settings.
- Display stays blank (usually), dpcd is probed after the initial link training, and the driver prints no obvious messages to the log.
In theory, since only one byte of the dpcd is chopped off (specifically, the byte that contains the revision information for DisplayPort), it's not entirely impossible that this bug may not show on certain monitors. For instance, the only reason this bug was visible on my ASUS PB238 monitor was due to the fact that this monitor using the enhanced framing symbol sequence, the flag for which is ignored if the radeon driver thinks that the DisplayPort version is below 1.1.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/radeon/radeon_connectors.c +5 -0
@@ -78,6 +78,11 @@ void radeon_connector_hotplug(struct drm_connector *connector)if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); }else if (radeon_dp_needs_link_train (radeon_connector)) { +/* Don't try to start link training before we +* have the dpcd */ +if (!radeon_dp_getdpcd (radeon_connector)) +return ; +/* set it to OFF so that drm_helper_connector_dpms() * won't return immediately since the current state * is ON at this point.
Signature · 1 line
2.6.0
PATCH 12/84 drm/qxl: validate monitors config modes
In reply to Jiri SlabyFrom: Jonathon Jongsma <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bd3e1c7c6de9f5f70d97cdb6c817151c0477c5e3 upstream.
Due to some recent changes in drm_helper_probe_single_connector_modes_merge_bits(), old custom modes were not being pruned properly. In current kernels, drm_mode_validate_basic() is called to sanity-check each mode in the list. If the sanity-check passes, the mode's status gets set to to MODE_OK. In older kernels this check was not done, so old custom modes would still have a status of MODE_UNVERIFIED at this point, and would therefore be pruned later in the function.
As a result of this new behavior, the list of modes for a device always includes every custom mode ever configured for the device, with the largest one listed first. Since desktop environments usually choose the first preferred mode when a hotplug event is emitted, this had the result of making it very difficult for the user to reduce the size of the display.
The qxl driver did implement the mode_valid connector function, but it was empty. In order to restore the old behavior where old custom modes are pruned, we implement a proper mode_valid function for the qxl driver. This function now checks each mode against the last configured custom mode and the list of standard modes. If the mode doesn't match any of these, its status is set to MODE_BAD so that it will be pruned as expected.
--- drivers/gpu/drm/qxl/qxl_display.c | 66 ++++++++++++++++++++++++--------------- drivers/gpu/drm/qxl/qxl_drv.h | 2 ++ 2 files changed, 42 insertions(+), 26 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +40 -26
@@ -127,37 +127,40 @@ static int qxl_add_monitors_config_modes(struct drm_connector *connector) false); mode->type |=DRM_MODE_TYPE_PREFERRED ;drm_mode_probed_add (connector, mode); +/* remember the last custom size for mode validation */ + qdev->monitors_config_width = mode->hdisplay; + qdev->monitors_config_height = mode->vdisplay;return 1 ; } +static struct mode_size { +int w; +int h; +} common_modes[] = { + {640 ,480 }, + {720 ,480 }, + {800 ,600 }, + {848 ,480 }, + {1024 ,768 }, + {1152 ,768 }, + {1280 ,720 }, + {1280 ,800 }, + {1280 ,854 }, + {1280 ,960 }, + {1280 ,1024 }, + {1440 ,900 }, + {1400 ,1050 }, + {1680 ,1050 }, + {1600 ,1200 }, + {1920 ,1080 }, + {1920 ,1200 } +}; +static int qxl_add_common_modes (struct drm_connector *connector) {struct drm_device *dev = connector->dev;struct drm_display_mode *mode =NULL ;int i; -struct mode_size { -int w; -int h; - } common_modes[] = { - {640 ,480 }, - {720 ,480 }, - {800 ,600 }, - {848 ,480 }, - {1024 ,768 }, - {1152 ,768 }, - {1280 ,720 }, - {1280 ,800 }, - {1280 ,854 }, - {1280 ,960 }, - {1280 ,1024 }, - {1440 ,900 }, - {1400 ,1050 }, - {1680 ,1050 }, - {1600 ,1200 }, - {1920 ,1080 }, - {1920 ,1200 } - }; -for (i =0 ; i <ARRAY_SIZE (common_modes); i++) {if (common_modes[i].w <320 || common_modes[i].h <200 )continue ;
@@ -736,11 +739,22 @@ static int qxl_conn_get_modes(struct drm_connector *connector)static int qxl_conn_mode_valid (struct drm_connector *connector,struct drm_display_mode *mode) { +struct drm_device *ddev = connector->dev; +struct qxl_device *qdev = ddev->dev_private; +int i; +/* TODO: is this called for user defined modes? (xrandr --add-mode) * TODO: check that the mode fits in the framebuffer */ -DRM_DEBUG ("%s: %dx%d status=%d\n" , mode->name, mode->hdisplay, - mode->vdisplay, mode->status); -return MODE_OK ; + +if (qdev->monitors_config_width == mode->hdisplay && + qdev->monitors_config_height == mode->vdisplay) +return MODE_OK ; + +for (i =0 ; i <ARRAY_SIZE (common_modes); i++) { +if (common_modes[i].w == mode->hdisplay && common_modes[i].h == mode->vdisplay) +return MODE_OK ; + } +return MODE_BAD ; }static struct drm_encoder *qxl_best_encoder (struct drm_connector *connector)
drivers/gpu/drm/qxl/qxl_drv.h +2 -0
@@ -323,6 +323,8 @@ struct qxl_device {struct work_struct gc_work;struct work_struct fb_work; +int monitors_config_width; +int monitors_config_height; };/* forward declaration for QXL_INFO_IO */
Signature · 1 line
2.6.0
PATCH 13/84 iio: Add inverse unit conversion macros
In reply to Jiri SlabyFrom: Lars-Peter Clausen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c689a923c867eac40ed3826c1d9328edea8b6bc7 upstream.
Add inverse unit conversion macro to convert from standard IIO units to units that might be used by some devices.
Those are useful in combination with scale factors that are specified as IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will contain the maximum raw value the sensor will generate and the numerator the value it maps to in a specific unit. Sometimes datasheets specify those in different units than the standard IIO units (e.g. degree/s instead of rad/s) and so we need to do a unit conversion.
Quoted 1 line
From a mathematical point of view it does not make a difference whether we
apply the unit conversion to the numerator or the inverse unit conversion to the denominator since (x / y) / z = x / (y * z). But as the denominator is typically a larger value and we are rounding both the numerator and denominator to integer values using the later method gives us a better precision (E.g. the relative error is smaller if we round 8000.3 to 8000 rather than rounding 8.3 to 8).
This is where in inverse unit conversion macros will be used.
Marked for stable as used by some upcoming fixes.
--- include/linux/iio/iio.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
include/linux/iio/iio.h +17 -0
@@ -623,6 +623,15 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,#define IIO_DEGREE_TO_RAD (deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)/** +* IIO_RAD_TO_DEGREE() - Convert rad to degree +* @rad: A value in rad +* +* Returns the given value converted from rad to degree +*/ +#define IIO_RAD_TO_DEGREE (rad) \ + (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL) + +/** * IIO_G_TO_M_S_2() - Convert g to meter / second**2 * @g: A value in g *
@@ -630,4 +639,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,*/ #define IIO_G_TO_M_S_2 (g) ((g) * 980665ULL / 100000ULL) +/** +* IIO_M_S_2_TO_G() - Convert meter / second**2 to g +* @ms2: A value in meter / second**2 +* +* Returns the given value converted from meter / second**2 to g +*/ +#define IIO_M_S_2_TO_G (ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL) +#endif /* _INDUSTRIAL_IO_H_ */
Signature · 1 line
2.6.0
PATCH 14/84 iio: adis16480: Fix scale factors
In reply to Jiri SlabyFrom: Lars-Peter Clausen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7abad1063deb0f77d275c61f58863ec319c58c5c upstream.
The different devices support by the adis16480 driver have slightly different scales for the gyroscope and accelerometer channels.
--- drivers/iio/imu/adis16480.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-)
drivers/iio/imu/adis16480.c +33 -6
@@ -110,6 +110,10 @@struct adis16480_chip_info {unsigned int num_channels;const struct iio_chan_spec *channels; +unsigned int gyro_max_val; +unsigned int gyro_max_scale; +unsigned int accel_max_val; +unsigned int accel_max_scale; };struct adis16480 {
@@ -533,19 +537,21 @@ static int adis16480_set_filter_freq(struct iio_dev *indio_dev,static int adis16480_read_raw (struct iio_dev *indio_dev,const struct iio_chan_spec *chan,int *val,int *val2,long info) { +struct adis16480 *st =iio_priv (indio_dev); +switch (info) {case IIO_CHAN_INFO_RAW :return adis_single_conversion (indio_dev, chan,0 , val);case IIO_CHAN_INFO_SCALE :switch (chan->type) {case IIO_ANGL_VEL : - *val =0 ; - *val2 =IIO_DEGREE_TO_RAD (20000 );/* 0.02 degree/sec */ -return IIO_VAL_INT_PLUS_MICRO ; + *val = st->chip_info->gyro_max_scale; + *val2 = st->chip_info->gyro_max_val; +return IIO_VAL_FRACTIONAL ;case IIO_ACCEL : - *val =0 ; - *val2 =IIO_G_TO_M_S_2 (800 );/* 0.8 mg */ -return IIO_VAL_INT_PLUS_MICRO ; + *val = st->chip_info->accel_max_scale; + *val2 = st->chip_info->accel_max_val; +return IIO_VAL_FRACTIONAL ;case IIO_MAGN : *val =0 ; *val2 =100 ;/* 0.0001 gauss */
@@ -702,18 +708,39 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { [ADIS16375 ] = { .channels = adis16485_channels, .num_channels =ARRAY_SIZE (adis16485_channels), +/* +* storing the value in rad/degree and the scale in degree +* gives us the result in rad and better precession than +* storing the scale directly in rad. +*/ + .gyro_max_val =IIO_RAD_TO_DEGREE (22887 ), + .gyro_max_scale =300 , + .accel_max_val =IIO_M_S_2_TO_G (21973 ), + .accel_max_scale =18 , }, [ADIS16480 ] = { .channels = adis16480_channels, .num_channels =ARRAY_SIZE (adis16480_channels), + .gyro_max_val =IIO_RAD_TO_DEGREE (22500 ), + .gyro_max_scale =450 , + .accel_max_val =IIO_M_S_2_TO_G (12500 ), + .accel_max_scale =5 , }, [ADIS16485 ] = { .channels = adis16485_channels, .num_channels =ARRAY_SIZE (adis16485_channels), + .gyro_max_val =IIO_RAD_TO_DEGREE (22500 ), + .gyro_max_scale =450 , + .accel_max_val =IIO_M_S_2_TO_G (20000 ), + .accel_max_scale =5 , }, [ADIS16488 ] = { .channels = adis16480_channels, .num_channels =ARRAY_SIZE (adis16480_channels), + .gyro_max_val =IIO_RAD_TO_DEGREE (22500 ), + .gyro_max_scale =450 , + .accel_max_val =IIO_M_S_2_TO_G (22500 ), + .accel_max_scale =18 , }, };
Signature · 1 line
2.6.0
PATCH 15/84 clk: versatile: off by one in clk_sp810_timerclken_of_get()
In reply to Jiri SlabyFrom: Dan Carpenter <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3294bee87091be5f179474f6c39d1d87769635e2 upstream.
The ">" should be ">=" or we end up reading beyond the end of the array.
--- drivers/clk/versatile/clk-sp810.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/versatile/clk-sp810.c +2 -2
@@ -128,8 +128,8 @@ struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec, {struct clk_sp810 *sp810 = data; -if (WARN_ON (clkspec->args_count !=1 || clkspec->args[0 ] > -ARRAY_SIZE (sp810->timerclken))) +if (WARN_ON (clkspec->args_count !=1 || + clkspec->args[0 ] >=ARRAY_SIZE (sp810->timerclken)))return NULL ;return sp810->timerclken[clkspec->args[0 ]].clk;
Signature · 1 line
2.6.0
PATCH 16/84 PCI: Fix TI816X class code quirk
In reply to Jiri SlabyFrom: Bjorn Helgaas <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d1541dc977d376406f4584d8eb055488655c98ec upstream.
In fixup_ti816x_class(), we assigned "class = PCI_CLASS_MULTIMEDIA_VIDEO". But PCI_CLASS_MULTIMEDIA_VIDEO is only the two-byte base class/sub-class and needs to be shifted to make space for the low-order interface byte.
Shift PCI_CLASS_MULTIMEDIA_VIDEO to set the correct class code.
--- drivers/pci/quirks.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/pci/quirks.c +6 -3
@@ -2803,12 +2803,15 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);static void fixup_ti816x_class (struct pci_dev *dev) { +u32 class = dev->class; +/* TI 816x devices do not have class code set when in PCIe boot mode */ -dev_info (&dev->dev,"Setting PCI class for 816x PCIe device\n" ); - dev->class =PCI_CLASS_MULTIMEDIA_VIDEO ; + dev->class =PCI_CLASS_MULTIMEDIA_VIDEO <<8 ; +dev_info (&dev->dev,"PCI class overridden (%#08x -> %#08x)\n" , + class, dev->class); }DECLARE_PCI_FIXUP_CLASS_EARLY (PCI_VENDOR_ID_TI ,0xb800 , -PCI_CLASS_NOT_DEFINED ,0 , fixup_ti816x_class); +PCI_CLASS_NOT_DEFINED ,0 , fixup_ti816x_class);/* Some PCIe devices do not work reliably with the claimed maximum * payload size supported.
Signature · 1 line
2.6.0
PATCH 17/84 USB: symbolserial: Use usb_get_serial_port_data
In reply to Jiri SlabyFrom: Philipp Hachtmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 951d3793bbfc0a441d791d820183aa3085c83ea9 upstream.
The driver used usb_get_serial_data(port->serial) which compiled but resulted in a NULL pointer being returned (and subsequently used). I did not go deeper into this but I guess this is a regression.
port_probe")
--- drivers/usb/serial/symbolserial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/serial/symbolserial.c +3 -3
@@ -97,7 +97,7 @@ exit:static int symbol_open (struct tty_struct *tty,struct usb_serial_port *port) { -struct symbol_private *priv =usb_get_serial_data (port->serial); +struct symbol_private *priv =usb_get_serial_port_data (port);unsigned long flags;int result =0 ;
@@ -123,7 +123,7 @@ static void symbol_close(struct usb_serial_port *port)static void symbol_throttle (struct tty_struct *tty) {struct usb_serial_port *port = tty->driver_data; -struct symbol_private *priv =usb_get_serial_data (port->serial); +struct symbol_private *priv =usb_get_serial_port_data (port);spin_lock_irq (&priv->lock); priv->throttled = true;
@@ -133,7 +133,7 @@ static void symbol_throttle(struct tty_struct *tty)static void symbol_unthrottle (struct tty_struct *tty) {struct usb_serial_port *port = tty->driver_data; -struct symbol_private *priv =usb_get_serial_data (port->serial); +struct symbol_private *priv =usb_get_serial_port_data (port);int result;bool was_throttled;
Signature · 1 line
2.6.0
PATCH 18/84 USB: ftdi_sio: Added custom PID for CustomWare products
In reply to Jiri SlabyFrom: Matthijs Kooijman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1fb8dc36384ae1140ee6ccc470de74397606a9d5 upstream.
CustomWare uses the FTDI VID with custom PIDs for their ShipModul MiniPlex products.
--- drivers/usb/serial/ftdi_sio.c | 4 ++++ drivers/usb/serial/ftdi_sio_ids.h | 8 ++++++++ 2 files changed, 12 insertions(+)
drivers/usb/serial/ftdi_sio.c +4 -0
@@ -619,6 +619,10 @@ static struct usb_device_id id_table_combined [] = { { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2WI_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX3_PID) },/* * ELV devices: */
drivers/usb/serial/ftdi_sio_ids.h +8 -0
@@ -568,6 +568,14 @@*/ #define FTDI_SYNAPSE_SS200_PID 0x9090/* SS200 - SNAP Stick 200 */ +/* +* CustomWare / ShipModul NMEA multiplexers product ids (FTDI_VID) +*/ +#define FTDI_CUSTOMWARE_MINIPLEX_PID 0xfd48/* MiniPlex first generation NMEA Multiplexer */ +#define FTDI_CUSTOMWARE_MINIPLEX2_PID 0xfd49/* MiniPlex-USB and MiniPlex-2 series */ +#define FTDI_CUSTOMWARE_MINIPLEX2WI_PID 0xfd4a/* MiniPlex-2Wi */ +#define FTDI_CUSTOMWARE_MINIPLEX3_PID 0xfd4b/* MiniPlex-3 series */ +/********************************/ /** third-party VID/PID combos **/
Signature · 1 line
2.6.0
PATCH 19/84 usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes
In reply to Jiri SlabyFrom: Kishon Vijay Abraham I <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b2fb5b1a0f50d3ebc12342c8d8dead245e9c9d4e upstream.
DWC3 uses bounce buffer to handle non max packet aligned OUT transfers and the size of bounce buffer is 512 bytes. However if the host initiates OUT transfers of size more than 512 bytes (and non max packet aligned), the driver throws a WARN dump but still programs the TRB to receive more than 512 bytes. This will cause bounce buffer to overflow and corrupt the adjacent memory locations which can be fatal.
Fix it by programming the TRB to receive a maximum of DWC3_EP0_BOUNCE_SIZE
(512) bytes.
--- drivers/usb/dwc3/ep0.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/usb/dwc3/ep0.c +10 -2
@@ -793,6 +793,11 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,unsigned maxp = ep0->endpoint.maxpacket; transfer_size += (maxp - (transfer_size % maxp)); + +/* Maximum of DWC3_EP0_BOUNCE_SIZE can only be received */ +if (transfer_size >DWC3_EP0_BOUNCE_SIZE ) + transfer_size =DWC3_EP0_BOUNCE_SIZE ; + transferred =min_t (u32, ur->length, transfer_size - length);memcpy (ur->buf, dwc->ep0_bounce, transferred);
@@ -905,11 +910,14 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,return ; } -WARN_ON (req->request.length >DWC3_EP0_BOUNCE_SIZE ); - maxpacket = dep->endpoint.maxpacket; transfer_size =roundup (req->request.length, maxpacket); +if (transfer_size >DWC3_EP0_BOUNCE_SIZE ) { +dev_WARN (dwc->dev,"bounce buf can't handle req len\n" ); + transfer_size =DWC3_EP0_BOUNCE_SIZE ; + } + dwc->ep0_bounced = true;/*
Signature · 1 line
2.6.0
PATCH 20/84 usb: host: ehci-sys: delete useless bus_to_hcd conversion
In reply to Jiri SlabyFrom: Peter Chen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0521cfd06e1ebcd575e7ae36aab068b38df23850 upstream.
The ehci platform device's drvdata is the pointer of struct usb_hcd already, so we doesn't need to call bus_to_hcd conversion again.
--- drivers/usb/host/ehci-sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/host/ehci-sysfs.c +4 -4
@@ -29,7 +29,7 @@ static ssize_t show_companion(struct device *dev,int count =PAGE_SIZE ;char *ptr = buf; - ehci =hcd_to_ehci (bus_to_hcd (dev_get_drvdata (dev))); + ehci =hcd_to_ehci (dev_get_drvdata (dev)); nports =HCS_N_PORTS (ehci->hcs_params);for (index =0 ; index < nports; ++index) {
@@ -54,7 +54,7 @@ static ssize_t store_companion(struct device *dev,struct ehci_hcd *ehci;int portnum, new_owner; - ehci =hcd_to_ehci (bus_to_hcd (dev_get_drvdata (dev))); + ehci =hcd_to_ehci (dev_get_drvdata (dev)); new_owner =PORT_OWNER ;/* Owned by companion */ if (sscanf (buf,"%d" , &portnum) !=1 )return -EINVAL ;
@@ -85,7 +85,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev,struct ehci_hcd *ehci;int n; - ehci =hcd_to_ehci (bus_to_hcd (dev_get_drvdata (dev))); + ehci =hcd_to_ehci (dev_get_drvdata (dev)); n =scnprintf (buf,PAGE_SIZE ,"%d\n" , ehci->uframe_periodic_max);return n; }
@@ -102,7 +102,7 @@ static ssize_t store_uframe_periodic_max(struct device *dev,unsigned long flags;ssize_t ret; - ehci =hcd_to_ehci (bus_to_hcd (dev_get_drvdata (dev))); + ehci =hcd_to_ehci (dev_get_drvdata (dev));if (kstrtouint (buf,0 , &uframe_periodic_max) <0 )return -EINVAL ;
Signature · 1 line
2.6.0
PATCH 21/84 serial: 8250: don't bind to SMSC IrCC IR port
In reply to Jiri SlabyFrom: "Maciej S. Szmigiero" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ffa34de03bcfbfa88d8352942bc238bb48e94e2d upstream.
SMSC IrCC SIR/FIR port should not be bound to by (legacy) serial driver so its own driver (smsc-ircc2) can bind to it.
--- drivers/tty/serial/8250/8250_pnp.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/8250/8250_pnp.c +5 -0
@@ -365,6 +365,11 @@ static const struct pnp_device_id pnp_dev_table[] = {/* Winbond CIR port, should not be probed. We should keep track of it to prevent the legacy serial driver from probing it */ { "WEC1022", CIR_PORT }, +/* +* SMSC IrCC SIR/FIR port, should not be probed by serial driver +* as well so its own driver can bind to it. +*/ + { "SMCF010", CIR_PORT }, { "", 0 } };
Signature · 1 line
2.6.0
PATCH 22/84 crypto: ghash-clmulni: specify context size for ghash async algorithm
In reply to Jiri SlabyFrom: Andrey Ryabinin <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 71c6da846be478a61556717ef1ee1cea91f5d6a8 upstream.
Currently context size (cra_ctxsize) doesn't specified for ghash_async_alg. Which means it's zero. Thus crypto_create_tfm() doesn't allocate needed space for ghash_async_ctx, so any read/write to ctx (e.g. in ghash_async_init_tfm()) is not valid.
--- arch/x86/crypto/ghash-clmulni-intel_glue.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/crypto/ghash-clmulni-intel_glue.c +1 -0
@@ -291,6 +291,7 @@ static struct ahash_alg ghash_async_alg = { .cra_name = "ghash", .cra_driver_name = "ghash-clmulni", .cra_priority = 400, + .cra_ctxsize = sizeof(struct ghash_async_ctx), .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, .cra_blocksize = GHASH_BLOCK_SIZE, .cra_type = &crypto_ahash_type,
Signature · 1 line
2.6.0
PATCH 23/84 HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error
In reply to Jiri SlabyFrom: Don Zickus <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3af4e5a95184d6d3c1c6a065f163faa174a96a1d upstream.
It was reported that after 10-20 reboots, a usb keyboard plugged into a docking station would not work unless it was replugged in.
Using usbmon, it turns out the interrupt URBs were streaming with callback errors of -71 for some reason. The hid-core.c::hid_io_error was supposed to retry and then reset, but the reset wasn't really happening.
The check for HID_NO_BANDWIDTH was inverted. Fix was simple.
Tested by reporter and locally by me by unplugging a keyboard halfway until I could recreate a stream of errors but no disconnect.
--- drivers/hid/usbhid/hid-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/hid-core.c +1 -1
@@ -180,7 +180,7 @@ static void hid_io_error(struct hid_device *hid)if (time_after (jiffies, usbhid->stop_retry)) {/* Retries failed, so do a port reset unless we lack bandwidth*/ -if (test_bit (HID_NO_BANDWIDTH , &usbhid->iofl) +if (!test_bit (HID_NO_BANDWIDTH , &usbhid->iofl) && !test_and_set_bit (HID_RESET_PENDING , &usbhid->iofl)) {schedule_work (&usbhid->reset_work);
Signature · 1 line
2.6.0
PATCH 24/84 KVM: MMU: fix validation of mmio page fault
In reply to Jiri SlabyFrom: Xiao Guangrong <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6f691251c0350ac52a007c54bf3ef62e9d8cdc5e upstream.
We got the bug that qemu complained with "KVM: unknown exit, hardware reason 31" and KVM shown these info:
[84245.284948] EPT: Misconfiguration. [84245.285056] EPT: GPA: 0xfeda848 [84245.285154] ept_misconfig_inspect_spte: spte 0x5eaef50107 level 4 [84245.285344] ept_misconfig_inspect_spte: spte 0x5f5fadc107 level 3 [84245.285532] ept_misconfig_inspect_spte: spte 0x5141d18107 level 2 [84245.285723] ept_misconfig_inspect_spte: spte 0x52e40dad77 level 1
This is because we got a mmio #PF and the handler see the mmio spte becomes normal (points to the ram page)
However, this is valid after introducing fast mmio spte invalidation which increases the generation-number instead of zapping mmio sptes, a example is as follows:
1. QEMU drops mmio region by adding a new memslot
2. invalidate all mmio sptes
3.
VCPU 0 VCPU 1
access the invalid mmio spte
access the region originally was MMIO before set the spte to the normal ram map
mmio #PF
check the spte and see it becomes normal ram mapping !!!
This patch fixes the bug just by dropping the check in mmio handler, it's good for backport. Full check will be introduced in later patches
--- arch/x86/kvm/mmu.c | 45 --------------------------------------------- 1 file changed, 45 deletions(-)
arch/x86/kvm/mmu.c +0 -45
@@ -381,12 +381,6 @@ static u64 __get_spte_lockless(u64 *sptep) { return ACCESS_ONCE(*sptep); } - -static bool __check_direct_spte_mmio_pf(u64 spte) -{ - /* It is valid if the spte is zapped. */ - return spte == 0ull; -} #else union split_spte { struct {
@@ -502,23 +496,6 @@ retry: return spte.spte; } - -static bool __check_direct_spte_mmio_pf (u64 spte) -{ -union split_spte sspte = (union split_spte )spte; -u32 high_mmio_mask = shadow_mmio_mask >>32 ; - -/* It is valid if the spte is zapped. */ -if (spte ==0ull ) -return true; - -/* It is valid if the spte is being zapped. */ -if (sspte.spte_low ==0ull && - (sspte.spte_high & high_mmio_mask) == high_mmio_mask) -return true; - -return false; -}#endif static bool spte_is_locklessly_modifiable (u64 spte)
@@ -3219,21 +3196,6 @@ static bool quickly_check_mmio_pf(struct kvm_vcpu *vcpu, u64 addr, bool direct)return vcpu_match_mmio_gva (vcpu, addr); } - -/* -* On direct hosts, the last spte is only allows two states -* for mmio page fault: -* - It is the mmio spte -* - It is zapped or it is being zapped. -* -* This function completely checks the spte when the last spte -* is not the mmio spte. -*/ -static bool check_direct_spte_mmio_pf (u64 spte) -{ -return __check_direct_spte_mmio_pf (spte); -} -static u64 walk_shadow_page_get_mmio_spte (struct kvm_vcpu *vcpu,u64 addr) {struct kvm_shadow_walk_iterator iterator;
@@ -3276,13 +3238,6 @@ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct) }/* -* It's ok if the gva is remapped by other cpus on shadow guest, -* it's a BUG if the gfn is not a mmio page. -*/ -if (direct && !check_direct_spte_mmio_pf (spte)) -return RET_MMIO_PF_BUG ; - -/* * If the page table is zapped by other cpus, let CPU fault again on * the address. */
Signature · 1 line
2.6.0
PATCH 25/84 xtensa: fix threadptr reload on return to userspace
In reply to Jiri SlabyFrom: Max Filippov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 4229fb12a03e5da5882b420b0aa4a02e77447b86 upstream.
Userspace return code may skip restoring THREADPTR register if there are no registers that need to be zeroed. This leads to spurious failures in libc NPTL tests.
Always restore THREADPTR on return to userspace.
--- arch/xtensa/kernel/entry.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/xtensa/kernel/entry.S +2 -1
@@ -568,12 +568,13 @@ user_exception_exit: * (if we have restored WSBITS-1 frames). */ +2: #if XCHAL_HAVE_THREADPTR l32i a3, a1, PT_THREADPTR wur a3, threadptr #endif -2: j common_exception_exit + j common_exception_exit /* This is the kernel exception exit. * We avoided to do a MOVSP when we entered the exception, but we
Signature · 1 line
2.6.0
PATCH 26/84 xtensa: fix kernel register spilling
In reply to Jiri SlabyFrom: Max Filippov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 77d6273e79e3a86552fcf10cdd31a69b46ed2ce6 upstream.
call12 can't be safely used as the first call in the inline function, because the compiler does not extend the stack frame of the bounding function accordingly, which may result in corruption of local variables.
If a call needs to be done, do call8 first followed by call12.
For pure assembly code in _switch_to increase stack frame size of the bounding function.
--- arch/xtensa/include/asm/traps.h | 29 +++++++++++++++++++---------- arch/xtensa/kernel/entry.S | 4 ++-- 2 files changed, 21 insertions(+), 12 deletions(-)
arch/xtensa/include/asm/traps.h +19 -10
@@ -24,30 +24,39 @@ static inline void spill_registers(void) {#if XCHAL_NUM_AREGS >16 __asm__ __volatile__ ( -" call12 1f\n" + " call8 1f\n" " _j 2f\n" " retw\n" " .align 4\n" "1:\n" +#if XCHAL_NUM_AREGS ==32 +" _entry a1, 32\n" +" addi a8, a0, 3\n" +" _entry a1, 16\n" +" mov a12, a12\n" + " retw\n" +#else " _entry a1, 48\n" -" addi a12, a0, 3\n" -#if XCHAL_NUM_AREGS > 32 - " .rept (" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n" +" call12 1f\n" +" retw\n" +" .align 4\n" +"1:\n" + " .rept (" __stringify(XCHAL_NUM_AREGS) " - 16) / 12\n"" _entry a1, 48\n" " mov a12, a0\n" " .endr\n" -#endif - " _entry a1, 48\n" + " _entry a1, 16\n"#if XCHAL_NUM_AREGS %12 ==0 - " mov a8, a8\n" -#elif XCHAL_NUM_AREGS %12 ==4 " mov a12, a12\n" -#elif XCHAL_NUM_AREGS %12 ==8 +#elif XCHAL_NUM_AREGS %12 ==4 " mov a4, a4\n" +#elif XCHAL_NUM_AREGS %12 ==8 +" mov a8, a8\n" #endif " retw\n" +#endif "2:\n" - : : : "a12", "a13", "memory"); + : : : "a8", "a9", "memory");#else __asm__ __volatile__ ( " mov a12, a12\n"
arch/xtensa/kernel/entry.S +2 -2
@@ -1828,7 +1828,7 @@ ENDPROC(system_call) mov a12, a0 .endr #endif - _entry a1, 48 + _entry a1, 16 #if XCHAL_NUM_AREGS % 12 == 0 mov a8, a8 #elif XCHAL_NUM_AREGS % 12 == 4
@@ -1852,7 +1852,7 @@ ENDPROC(system_call) ENTRY(_switch_to) - entry a1, 16 + entry a1, 48 mov a11, a3 # and 'next' (a3)
Signature · 1 line
2.6.0
PATCH 27/84 devres: fix devres_get()
In reply to Jiri SlabyFrom: Masahiro Yamada <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 64526370d11ce8868ca495723d595b61e8697fbf upstream.
Currently, devres_get() passes devres_free() the pointer to devres, but devres_free() should be given with the pointer to resource data.
--- drivers/base/devres.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/devres.c +2 -2
@@ -296,10 +296,10 @@ void * devres_get(struct device *dev, void *new_res,if (!dr) {add_dr (dev, &new_dr->node); dr = new_dr; - new_dr =NULL ; + new_res =NULL ; }spin_unlock_irqrestore (&dev->devres_lock, flags); -devres_free (new_dr); +devres_free (new_res);return dr->data; }
Signature · 1 line
2.6.0
PATCH 28/84 auxdisplay: ks0108: fix refcount
In reply to Jiri SlabyFrom: Sudip Mukherjee <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bab383de3b84e584b0f09227151020b2a43dc34c upstream.
parport_find_base() will implicitly do parport_get_port() which increases the refcount. Then parport_register_device() will again increment the refcount. But while unloading the module we are only doing parport_unregister_device() decrementing the refcount only once. We add an parport_put_port() to neutralize the effect of parport_get_port().
--- drivers/auxdisplay/ks0108.c | 1 + 1 file changed, 1 insertion(+)
drivers/auxdisplay/ks0108.c +1 -0
@@ -139,6 +139,7 @@ static int __init ks0108_init(void) ks0108_pardevice =parport_register_device (ks0108_parport,KS0108_NAME ,NULL ,NULL ,NULL ,PARPORT_DEV_EXCL ,NULL ); +parport_put_port (ks0108_parport);if (ks0108_pardevice ==NULL ) { printk(KERN_ERR KS0108_NAME ": ERROR: " "parport didn't register new device\n");
Signature · 1 line
2.6.0
PATCH 29/84 of/address: Don't loop forever in of_find_matching_node_by_address().
In reply to Jiri SlabyFrom: David Daney <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3a496b00b6f90c41bd21a410871dfc97d4f3c7ab upstream.
If the internal call to of_address_to_resource() fails, we end up looping forever in of_find_matching_node_by_address(). This can be caused by a defective device tree, or calling with an incorrect matches argument.
Fix by calling of_find_matching_node() unconditionally at the end of the loop.
--- drivers/of/address.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/address.c +3 -3
@@ -696,10 +696,10 @@ struct device_node *of_find_matching_node_by_address(struct device_node *from,struct resource res;while (dn) { -if (of_address_to_resource (dn,0 , &res)) -continue ; -if (res.start == base_address) +if (!of_address_to_resource (dn,0 , &res) && + res.start == base_address)return dn; + dn =of_find_matching_node (dn, matches); }
Signature · 1 line
2.6.0
PATCH 30/84 ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP
In reply to Jiri SlabyFrom: Vignesh R <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b9e23f321940d2db2c9def8ff723b8464fb86343 upstream.
Legacy IPs like PWMSS, present under l4per2_7xx_clkdm, cannot support smart-idle when its clock domain is in HW_AUTO on DRA7 SoCs. Hence, program clock domain to SW_WKUP.
--- arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/clockdomains7xx_data.c +1 -1
@@ -331,7 +331,7 @@ static struct clockdomain l4per2_7xx_clkdm = { .dep_bit = DRA7XX_L4PER2_STATDEP_SHIFT, .wkdep_srcs = l4per2_wkup_sleep_deps, .sleepdep_srcs = l4per2_wkup_sleep_deps, - .flags = CLKDM_CAN_HWSUP_SWSUP, + .flags = CLKDM_CAN_SWSUP, };static struct clockdomain mpu0_7xx_clkdm = {
Signature · 1 line
2.6.0
PATCH 31/84 drivercore: Fix unregistration path of platform devices
In reply to Jiri SlabyFrom: Grant Likely <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7f5dcaf1fdf289767a126a0a5cc3ef39b5254b06 upstream.
The unregister path of platform_device is broken. On registration, it will register all resources with either a parent already set, or type==IORESOURCE_{IO,MEM}. However, on unregister it will release everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There are also cases where resources don't get registered in the first place, like with devices created by of_platform_populate()*.
Fix the unregister path to be symmetrical with the register path by checking the parent pointer instead of the type field to decide which resources to unregister. This is safe because the upshot of the registration path algorithm is that registered resources have a parent pointer, and non-registered resources do not.
* It can be argued that of_platform_populate() should be registering it's resources, and they argument has some merit. However, there are quite a few platforms that end up broken if we try to do that due to overlapping resources in the device tree. Until that is fixed, we need to solve the immediate problem.
--- drivers/base/platform.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/base/platform.c +2 -6
@@ -344,9 +344,7 @@ int platform_device_add(struct platform_device *pdev)while (--i >=0 ) {struct resource *r = &pdev->resource[i]; -unsigned long type =resource_type (r); - -if (type ==IORESOURCE_MEM || type ==IORESOURCE_IO ) +if (r->parent)release_resource (r); }
@@ -377,9 +375,7 @@ void platform_device_del(struct platform_device *pdev)for (i =0 ; i < pdev->num_resources; i++) {struct resource *r = &pdev->resource[i]; -unsigned long type =resource_type (r); - -if (type ==IORESOURCE_MEM || type ==IORESOURCE_IO ) +if (r->parent)release_resource (r); } }
Signature · 1 line
2.6.0
PATCH 32/84 hpfs: update ctime and mtime on directory modification
In reply to Jiri SlabyFrom: Mikulas Patocka <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f49a26e7718dd30b49e3541e3e25aecf5e7294e2 upstream.
Update ctime and mtime when a directory is modified. (though OS/2 doesn't update them anyway)
--- fs/hpfs/namei.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
fs/hpfs/namei.c +24 -1
@@ -8,6 +8,17 @@#include <linux/sched.h> #include "hpfs_fn.h" +static void hpfs_update_directory_times (struct inode *dir) +{ +time_t t =get_seconds (); +if (t == dir->i_mtime.tv_sec && + t == dir->i_ctime.tv_sec) +return ; + dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t; + dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec =0 ; +hpfs_write_inode_nolock (dir); +} +static int hpfs_mkdir (struct inode *dir,struct dentry *dentry,umode_t mode) {const unsigned char *name = dentry->d_name.name;
@@ -99,6 +110,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) result->i_mode = mode |S_IFDIR ;hpfs_write_inode_nolock (result); } +hpfs_update_directory_times (dir);d_instantiate (dentry, result);hpfs_unlock (dir->i_sb);return 0 ;
@@ -187,6 +199,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b result->i_mode = mode |S_IFREG ;hpfs_write_inode_nolock (result); } +hpfs_update_directory_times (dir);d_instantiate (dentry, result);hpfs_unlock (dir->i_sb);return 0 ;
@@ -262,6 +275,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, deinsert_inode_hash (result);hpfs_write_inode_nolock (result); +hpfs_update_directory_times (dir);d_instantiate (dentry, result);brelse (bh);hpfs_unlock (dir->i_sb);
@@ -340,6 +354,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *syinsert_inode_hash (result);hpfs_write_inode_nolock (result); +hpfs_update_directory_times (dir);d_instantiate (dentry, result);hpfs_unlock (dir->i_sb);return 0 ;
@@ -423,6 +438,8 @@ again: out1:hpfs_brelse4 (&qbh); out: +if (!err) +hpfs_update_directory_times (dir);hpfs_unlock (dir->i_sb);return err; }
@@ -477,6 +494,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) out1:hpfs_brelse4 (&qbh); out: +if (!err) +hpfs_update_directory_times (dir);hpfs_unlock (dir->i_sb);return err; }
@@ -595,7 +614,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, goto end1; } - end: +end:hpfs_i (i)->i_parent_dir = new_dir->i_ino;if (S_ISDIR (i->i_mode)) {inc_nlink (new_dir);
@@ -610,6 +629,10 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,brelse (bh); } end1: +if (!err) { +hpfs_update_directory_times (old_dir); +hpfs_update_directory_times (new_dir); + }hpfs_unlock (i->i_sb);return err; }
Signature · 1 line
2.6.0
PATCH 33/84 tty/vt: don't set font mappings on vc not supporting this
In reply to Jiri SlabyFrom: Imre Deak <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9e326f78713a4421fe11afc2ddeac07698fac131 upstream.
We can call this function for a dummy console that doesn't support setting the font mapping, which will result in a null ptr BUG. So check for this case and return error for consoles w/o font mapping support.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=59321
--- drivers/tty/vt/consolemap.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/tty/vt/consolemap.c +7 -0
@@ -540,6 +540,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)/* Save original vc_unipagdir_loc in case we allocate a new one */ p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; + +if (!p) { + err = -EINVAL ; + + goto out_unlock; + }if (p->readonly) {console_unlock ();return -EIO ;
@@ -633,6 +639,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)set_inverse_transl (vc, p, i);/* Update inverse translations */ set_inverse_trans_unicode (vc, p); +out_unlock:console_unlock ();return err; }
Signature · 1 line
2.6.0
PATCH 34/84 unshare: Unsharing a thread does not require unsharing a vm
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 12c641ab8270f787dfcce08b5f20ce8b65008096 upstream.
In the logic in the initial commit of unshare made creating a new thread group for a process, contingent upon creating a new memory address space for that process. That is wrong. Two separate processes in different thread groups can share a memory address space and clone allows creation of such proceses.
This is significant because it was observed that mm_users > 1 does not mean that a process is multi-threaded, as reading /proc/PID/maps temporarily increments mm_users, which allows other processes to (accidentally) interfere with unshare() calls.
Correct the check in check_unshare_flags() to test for !thread_group_empty() for CLONE_THREAD, CLONE_SIGHAND, and CLONE_VM. For sighand->count > 1 for CLONE_SIGHAND and CLONE_VM.
For !current_is_single_threaded instead of mm_users > 1 for CLONE_VM.
By using the correct checks in unshare this removes the possibility of an accidental denial of service attack.
Additionally using the correct checks in unshare ensures that only an explicit unshare(CLONE_VM) can possibly trigger the slow path of current_is_single_threaded(). As an explict unshare(CLONE_VM) is pointless it is not expected there are many applications that make that call.
--- kernel/fork.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
kernel/fork.c +18 -10
@@ -1762,13 +1762,21 @@ static int check_unshare_flags(unsigned long unshare_flags) CLONE_NEWUSER|CLONE_NEWPID))return -EINVAL ;/* -* Not implemented, but pretend it works if there is nothing to -* unshare. Note that unsharing CLONE_THREAD or CLONE_SIGHAND -* needs to unshare vm. +* Not implemented, but pretend it works if there is nothing +* to unshare. Note that unsharing the address space or the +* signal handlers also need to unshare the signal queues (aka +* CLONE_THREAD). */ if (unshare_flags & (CLONE_THREAD |CLONE_SIGHAND |CLONE_VM )) { -/* FIXME: get_task_mm() increments ->mm_users */ -if (atomic_read (¤t->mm->mm_users) >1 ) +if (!thread_group_empty (current)) +return -EINVAL ; + } +if (unshare_flags & (CLONE_SIGHAND |CLONE_VM )) { +if (atomic_read (¤t->sighand->count) >1 ) +return -EINVAL ; + } +if (unshare_flags &CLONE_VM ) { +if (!current_is_single_threaded ())return -EINVAL ; }
@@ -1837,16 +1845,16 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)if (unshare_flags &CLONE_NEWUSER ) unshare_flags |=CLONE_THREAD |CLONE_FS ;/* -* If unsharing a thread from a thread group, must also unshare vm. -*/ -if (unshare_flags &CLONE_THREAD ) - unshare_flags |=CLONE_VM ; -/* * If unsharing vm, must also unshare signal handlers. */ if (unshare_flags &CLONE_VM ) unshare_flags |=CLONE_SIGHAND ;/* +* If unsharing a signal handlers, must also unshare the signal queues. +*/ +if (unshare_flags &CLONE_SIGHAND ) + unshare_flags |=CLONE_THREAD ; +/* * If unsharing namespace, must also unshare filesystem information. */ if (unshare_flags &CLONE_NEWNS )
Signature · 1 line
2.6.0
PATCH 35/84 rtlwifi: rtl8192cu: Add new device ID
In reply to Jiri SlabyFrom: Adrien Schildknecht <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1642d09fb9b128e8e538b2a4179962a34f38dff9 upstream.
The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043
--- drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +1 -0
@@ -313,6 +313,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ + {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/ {RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
Signature · 1 line
2.6.0
PATCH 36/84 tg3: Fix temperature reporting
In reply to Jiri SlabyFrom: Jean Delvare <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d3d11fe08ccc9bff174fc958722b5661f0932486 upstream.
The temperature registers appear to report values in degrees Celsius while the hwmon API mandates values to be exposed in millidegrees Celsius. Do the conversion so that the values reported by "sensors" are correct.
--- drivers/net/ethernet/broadcom/tg3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +1 -1
@@ -10650,7 +10650,7 @@ static ssize_t tg3_show_temp(struct device *dev,tg3_ape_scratchpad_read (tp, &temperature, attr->index,sizeof (temperature));spin_unlock_bh (&tp->lock); -return sprintf (buf,"%u\n" , temperature); +return sprintf (buf,"%u\n" , temperature *1000 ); }
Signature · 1 line
2.6.0
PATCH 37/84 mac80211: enable assoc check for mesh interfaces
In reply to Jiri SlabyFrom: Bob Copeland <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3633ebebab2bbe88124388b7620442315c968e8f upstream.
We already set a station to be associated when peering completes, both in user space and in the kernel. Thus we should always have an associated sta before sending data frames to that station.
Failure to check assoc state can cause crashes in the lower-level driver due to transmitting unicast data frames before driver sta structures (e.g. ampdu state in ath9k) are initialized. This occurred when forwarding in the presence of fixed mesh paths: frames were transmitted to stations with whom we hadn't yet completed peering.
--- net/mac80211/tx.c | 3 --- 1 file changed, 3 deletions(-)
net/mac80211/tx.c +0 -3
@@ -296,9 +296,6 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)if (tx->sdata->vif.type ==NL80211_IFTYPE_WDS )return TX_CONTINUE ; -if (tx->sdata->vif.type ==NL80211_IFTYPE_MESH_POINT ) -return TX_CONTINUE ; -if (tx->flags &IEEE80211_TX_PS_BUFFERED )return TX_CONTINUE ;
Signature · 1 line
2.6.0
PATCH 38/84 arm64: kconfig: Move LIST_POISON to a safe value
In reply to Jiri SlabyFrom: Jeff Vander Stoep <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bf0c4e04732479f650ff59d1ee82de761c0071f0 upstream.
Move the poison pointer offset to 0xdead000000000000, a recognized value that is not mappable by user-space exploits.
--- arch/arm64/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/Kconfig +4 -0
@@ -56,6 +56,10 @@ config NO_IOPORT config STACKTRACE_SUPPORT def_bool y +config ILLEGAL_POINTER_VALUE + hex + default 0xdead000000000000 + config LOCKDEP_SUPPORT def_bool y
Signature · 1 line
2.6.0
PATCH 39/84 arm64: compat: fix vfp save/restore across signal handlers in big-endian
In reply to Jiri SlabyFrom: Will Deacon <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bdec97a855ef1e239f130f7a11584721c9a1bf04 upstream.
When saving/restoring the VFP registers from a compat (AArch32) signal frame, we rely on the compat registers forming a prefix of the native register file and therefore make use of copy_{to,from}_user to transfer between the native fpsimd_state and the compat_vfp_sigframe.
Unfortunately, this doesn't work so well in a big-endian environment. Our fpsimd save/restore code operates directly on 128-bit quantities (Q registers) whereas the compat_vfp_sigframe represents the registers as an array of 64-bit (D) registers. The architecture packs the compat D registers into the Q registers, with the least significant bytes holding the lower register. Consequently, we need to swap the 64-bit halves when converting between these two representations on a big-endian machine.
This patch replaces the __copy_{to,from}_user invocations in our compat VFP signal handling code with explicit __put_user loops that operate on 64-bit values and swap them accordingly.
--- arch/arm64/kernel/signal32.c | 47 +++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-)
arch/arm64/kernel/signal32.c +36 -11
@@ -231,14 +231,32 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)/* * VFP save/restore code. +* +* We have to be careful with endianness, since the fpsimd context-switch +* code operates on 128-bit (Q) register values whereas the compat ABI +* uses an array of 64-bit (D) registers. Consequently, we need to swap +* the two halves of each Q register when running on a big-endian CPU. */ +union __fpsimd_vreg { +__uint128_t raw; +struct { +#ifdef __AARCH64EB__ +u64 hi; +u64 lo; +#else +u64 lo; +u64 hi; +#endif + }; +}; +static int compat_preserve_vfp_context (struct compat_vfp_sigframe __user *frame) {struct fpsimd_state *fpsimd = ¤t->thread.fpsimd_state;compat_ulong_t magic =VFP_MAGIC ;compat_ulong_t size =VFP_STORAGE_SIZE ;compat_ulong_t fpscr, fpexc; -int err =0 ; +int i, err =0 ;/* * Save the hardware registers to the fpsimd_state structure.
@@ -254,10 +272,15 @@ static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)/* * Now copy the FP registers. Since the registers are packed, * we can copy the prefix we want (V0-V15) as it is. -* FIXME: Won't work if big endian. */ - err |=__copy_to_user (&frame->ufp.fpregs, fpsimd->vregs, -sizeof (frame->ufp.fpregs)); +for (i =0 ; i <ARRAY_SIZE (frame->ufp.fpregs); i +=2 ) { +union __fpsimd_vreg vreg = { + .raw = fpsimd->vregs[i >>1 ], + }; + +__put_user_error (vreg.lo, &frame->ufp.fpregs[i], err); +__put_user_error (vreg.hi, &frame->ufp.fpregs[i +1 ], err); + }/* Create an AArch32 fpscr from the fpsr and the fpcr. */ fpscr = (fpsimd->fpsr & VFP_FPSCR_STAT_MASK) |
@@ -282,7 +305,7 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame)compat_ulong_t magic =VFP_MAGIC ;compat_ulong_t size =VFP_STORAGE_SIZE ;compat_ulong_t fpscr; -int err =0 ; +int i, err =0 ;__get_user_error (magic, &frame->magic, err);__get_user_error (size, &frame->size, err);
@@ -292,12 +315,14 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame)if (magic !=VFP_MAGIC || size !=VFP_STORAGE_SIZE )return -EINVAL ; -/* -* Copy the FP registers into the start of the fpsimd_state. -* FIXME: Won't work if big endian. -*/ - err |=__copy_from_user (fpsimd.vregs, frame->ufp.fpregs, -sizeof (frame->ufp.fpregs)); +/* Copy the FP registers into the start of the fpsimd_state. */ +for (i =0 ; i <ARRAY_SIZE (frame->ufp.fpregs); i +=2 ) { +union __fpsimd_vreg vreg; + +__get_user_error (vreg.lo, &frame->ufp.fpregs[i], err); +__get_user_error (vreg.hi, &frame->ufp.fpregs[i +1 ], err); + fpsimd.vregs[i >>1 ] = vreg.raw; + }/* Extract the fpsr and the fpcr from the fpscr */ __get_user_error (fpscr, &frame->ufp.fpscr, err);
Signature · 1 line
2.6.0
PATCH 40/84 arm64: head.S: initialise mdcr_el2 in el2_setup
In reply to Jiri SlabyFrom: Will Deacon <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d10bcd473301888f957ec4b6b12aa3621be78d59 upstream.
When entering the kernel at EL2, we fail to initialise the MDCR_EL2 register which controls debug access and PMU capabilities at EL1.
This patch ensures that the register is initialised so that all traps are disabled and all the PMU counters are available to the host. When a guest is scheduled, KVM takes care to configure trapping appropriately.
--- arch/arm64/kernel/head.S | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/kernel/head.S +5 -0
@@ -192,6 +192,11 @@ ENTRY(el2_setup) msr hstr_el2, xzr // Disable CP15 traps to EL2 #endif + /* EL2 debug */ + mrs x0, pmcr_el0 // Disable debug access traps + ubfx x0, x0, #11, #5 // to EL2 and allow access to + msr mdcr_el2, x0 // all PMU counters from EL1 + /* Stage-2 translation */ msr vttbr_el2, xzr
Signature · 1 line
2.6.0
PATCH 41/84 arm64: errata: add module build workaround for erratum #843419
In reply to Jiri SlabyFrom: Will Deacon <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit df057cc7b4fa59e9b55f07ffdb6c62bf02e99a00 upstream.
Cortex-A53 processors <= r0p4 are affected by erratum #843419 which can lead to a memory access using an incorrect address in certain sequences headed by an ADRP instruction.
There is a linker fix to generate veneers for ADRP instructions, but this doesn't work for kernel modules which are built as unlinked ELF objects.
This patch adds a new config option for the erratum which, when enabled, builds kernel modules with the mcmodel=large flag. This uses absolute addressing for all kernel symbols, thereby removing the use of ADRP as a PC-relative form of addressing. The ADRP relocs are removed from the module loader so that we fail to load any potentially affected modules.
--- arch/arm64/Kconfig | 16 ++++++++++++++++ arch/arm64/Makefile | 4 ++++ arch/arm64/kernel/module.c | 2 ++ 3 files changed, 22 insertions(+)
arch/arm64/Kconfig +16 -0
@@ -269,6 +269,22 @@ config SYSVIPC_COMPAT def_bool y depends on COMPAT && SYSVIPC +config ARM64_ERRATUM_843419 + bool "Cortex-A53: 843419: A load or store might access an incorrect address" + depends on MODULES + default y + help + This option builds kernel modules using the large memory model in + order to avoid the use of the ADRP instruction, which can cause + a subsequent memory access to use an incorrect address on Cortex-A53 + parts up to r0p4. + + Note that the kernel itself must be linked with a version of ld + which fixes potentially affected ADRP instructions through the + use of veneers. + + If unsure, say Y. + endmenu source "net/Kconfig"
arch/arm64/Makefile +4 -0
@@ -28,6 +28,10 @@ comma = , CHECKFLAGS += -D__aarch64__ +ifeq ($(CONFIG_ARM64_ERRATUM_843419), y) +CFLAGS_MODULE += -mcmodel=large +endif + # Default value head-y := arch/arm64/kernel/head.o
arch/arm64/kernel/module.c +2 -0
@@ -390,12 +390,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, ovf =reloc_insn_imm (RELOC_OP_PREL , loc, val,0 ,21 ,INSN_IMM_ADR );break ; +#ifndef CONFIG_ARM64_ERRATUM_843419 case R_AARCH64_ADR_PREL_PG_HI21_NC : overflow_check = false;case R_AARCH64_ADR_PREL_PG_HI21 : ovf =reloc_insn_imm (RELOC_OP_PAGE , loc, val,12 ,21 ,INSN_IMM_ADR );break ; +#endif case R_AARCH64_ADD_ABS_LO12_NC :case R_AARCH64_LDST8_ABS_LO12_NC : overflow_check = false;
Signature · 1 line
2.6.0
PATCH 42/84 arm64: KVM: Disable virtual timer even if the guest is not using it
In reply to Jiri SlabyFrom: Marc Zyngier <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c4cbba9fa078f55d9f6d081dbb4aec7cf969e7c7 upstream.
When running a guest with the architected timer disabled (with QEMU and the kernel_irqchip=off option, for example), it is important to make sure the timer gets turned off. Otherwise, the guest may try to enable it anyway, leading to a screaming HW interrupt.
The fix is to unconditionally turn off the virtual timer on guest exit.
--- arch/arm64/kvm/hyp.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/kvm/hyp.S +3 -2
@@ -472,8 +472,6 @@ __kvm_hyp_code_start: mrs x3, cntv_ctl_el0 and x3, x3, #3 str w3, [x0, #VCPU_TIMER_CNTV_CTL] - bic x3, x3, #1 // Clear Enable - msr cntv_ctl_el0, x3 isb
@@ -481,6 +479,9 @@ __kvm_hyp_code_start: str x3, [x0, #VCPU_TIMER_CNTV_CVAL] 1: + // Disable the virtual timer + msr cntv_ctl_el0, xzr + // Allow physical timer/counter access for the host mrs x2, cnthctl_el2 orr x2, x2, #3
Signature · 1 line
2.6.0
PATCH 43/84 Input: evdev - do not report errors form flush()
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae upstream.
We've got bug reports showing the old systemd-logind (at least system-210) aborting unexpectedly, and this turned out to be because of an invalid error code from close() call to evdev devices. close() is supposed to return only either EINTR or EBADFD, while the device returned ENODEV. logind was overreacting to it and decided to kill itself when an unexpected error code was received. What a tragedy.
The bad error code comes from flush fops, and actually evdev_flush() returns ENODEV when device is disconnected or client's access to it is revoked. But in these cases the fact that flush did not actually happen is not an error, but rather normal behavior. For non-disconnected devices result of flush is also not that interesting as there is no potential of data loss and even if it fails application has no way of handling the error. Because of that we are better off always returning success from evdev_flush().
Also returning EINTR from flush()/close() is discouraged (as it is not clear how application should handle this error), so let's stop taking evdev->mutex interruptibly.
Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
--- drivers/input/evdev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/input/evdev.c +4 -9
@@ -240,19 +240,14 @@ static int evdev_flush(struct file *file, fl_owner_t id) {struct evdev_client *client = file->private_data;struct evdev *evdev = client->evdev; -int retval; - retval =mutex_lock_interruptible (&evdev->mutex); -if (retval) -return retval; +mutex_lock (&evdev->mutex); -if (!evdev->exist || client->revoked) - retval = -ENODEV ; -else - retval =input_flush_device (&evdev->handle, file); +if (evdev->exist && !client->revoked) +input_flush_device (&evdev->handle, file);mutex_unlock (&evdev->mutex); -return retval; +return 0 ; }static void evdev_free (struct device *dev)
Signature · 1 line
2.6.0
PATCH 44/84 ALSA: hda - Enable headphone jack detect on old Fujitsu laptops
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bb148bdeb0ab16fc0ae8009799471e4d7180073b upstream.
According to the bug report, FSC Amilo laptops with ALC880 can detect the headphone jack but currently the driver disables it. It's partly intentionally, as non-working jack detect was reported in the past. Let's enable now.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
--- sound/pci/hda/patch_realtek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_realtek.c +2 -2
@@ -1144,7 +1144,7 @@ static const struct hda_fixup alc880_fixups[] = {/* override all pins as BIOS on old Amilo is broken */ .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x0121411f },/* HP */ + {0x14 ,0x0121401f },/* HP */ {0x15 ,0x99030120 },/* speaker */ {0x16 ,0x99030130 },/* bass speaker */ {0x17 ,0x411111f0 },/* N/A */
@@ -1164,7 +1164,7 @@ static const struct hda_fixup alc880_fixups[] = {/* almost compatible with FUJITSU, but no bass and SPDIF */ .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) { - {0x14 ,0x0121411f },/* HP */ + {0x14 ,0x0121401f },/* HP */ {0x15 ,0x99030120 },/* speaker */ {0x16 ,0x411111f0 },/* N/A */ {0x17 ,0x411111f0 },/* N/A */
Signature · 1 line
2.6.0
PATCH 45/84 ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a161574e200ae63a5042120e0d8c36830e81bde3 upstream.
It turned out that the machine has a bass speaker, so take a correct fixup entry.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
--- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +1 -1
@@ -1372,7 +1372,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = {SND_PCI_QUIRK (0x161f ,0x203d ,"W810" ,ALC880_FIXUP_W810 ),SND_PCI_QUIRK (0x161f ,0x205d ,"Medion Rim 2150" ,ALC880_FIXUP_MEDION_RIM ),SND_PCI_QUIRK (0x1631 ,0xe011 ,"PB 13201056" ,ALC880_FIXUP_6ST_AUTOMUTE ), -SND_PCI_QUIRK (0x1734 ,0x107c ,"FSC F1734" ,ALC880_FIXUP_F1734 ), +SND_PCI_QUIRK (0x1734 ,0x107c ,"FSC Amilo M1437" ,ALC880_FIXUP_FUJITSU ),SND_PCI_QUIRK (0x1734 ,0x1094 ,"FSC Amilo M1451G" ,ALC880_FIXUP_FUJITSU ),SND_PCI_QUIRK (0x1734 ,0x10ac ,"FSC AMILO Xi 1526" ,ALC880_FIXUP_F1734 ), SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Signature · 1 line
2.6.0
PATCH 46/84 powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash
In reply to Jiri SlabyFrom: Michael Ellerman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 74b5037baa2011a2799e2c43adde7d171b072f9e upstream.
The powerpc kernel can be built to have either a 4K PAGE_SIZE or a 64K PAGE_SIZE.
However when built with a 4K PAGE_SIZE there is an additional config option which can be enabled, PPC_HAS_HASH_64K, which means the kernel also knows how to hash a 64K page even though the base PAGE_SIZE is 4K.
This is used in one obscure configuration, to support 64K pages for SPU local store on the Cell processor when the rest of the kernel is using 4K pages.
In this configuration, pte_pagesize_index() is defined to just pass through its arguments to get_slice_psize(). However pte_pagesize_index() is called for both user and kernel addresses, whereas get_slice_psize() only knows how to handle user addresses.
This has been broken forever, however until recently it happened to work. That was because in get_slice_psize() the large kernel address would cause the right shift of the slice mask to return zero.
However in commit 7aa0727f3302 ("powerpc/mm: Increase the slice range to 64TB"), the get_slice_psize() code was changed so that instead of a right shift we do an array lookup based on the address. When passed a kernel address this means we index way off the end of the slice array and return random junk.
That is only fatal if we happen to hit something non-zero, but when we do return a non-zero value we confuse the MMU code and eventually cause a check stop.
This fix is ugly, but simple. When we're called for a kernel address we return 4K, which is always correct in this configuration, otherwise we use the slice mask.
--- arch/powerpc/include/asm/pgtable-ppc64.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/pgtable-ppc64.h +13 -1
@@ -135,7 +135,19 @@#define pte_iterate_hashed_end () } while(0)#ifdef CONFIG_PPC_HAS_HASH_64K -#define pte_pagesize_index (mm, addr, pte) get_slice_psize(mm, addr) +/* +* We expect this to be called only for user addresses or kernel virtual +* addresses other than the linear mapping. +*/ +#define pte_pagesize_index (mm, addr, pte) \ + ({ \ + unsigned int psize; \ + if (is_kernel_addr(addr)) \ + psize = MMU_PAGE_4K; \ + else \ + psize = get_slice_psize(mm, addr); \ + psize; \ + })#else #define pte_pagesize_index (mm, addr, pte) MMU_PAGE_4K#endif
Signature · 1 line
2.6.0
PATCH 47/84 powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
In reply to Jiri SlabyFrom: Thomas Huth <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1c2cb594441d02815d304cccec9742ff5c707495 upstream.
The EPOW interrupt handler uses rtas_get_sensor(), which in turn uses rtas_busy_delay() to wait for RTAS becoming ready in case it is necessary. But rtas_busy_delay() is annotated with might_sleep() and thus may not be used by interrupts handlers like the EPOW handler! This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is enabled:
BUG: sleeping function called from invalid context at arch/powerpc/kernel/rtas.c:496 in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6 Call Trace: [c00000007ffe7b90] [c000000000807670] dump_stack+0xa0/0xdc (unreliable) [c00000007ffe7bc0] [c0000000000e1f14] ___might_sleep+0x134/0x180 [c00000007ffe7c20] [c00000000002aec0] rtas_busy_delay+0x30/0xd0 [c00000007ffe7c50] [c00000000002bde4] rtas_get_sensor+0x74/0xe0 [c00000007ffe7ce0] [c000000000083264] ras_epow_interrupt+0x44/0x450 [c00000007ffe7d90] [c000000000120260] handle_irq_event_percpu+0xa0/0x300 [c00000007ffe7e70] [c000000000120524] handle_irq_event+0x64/0xc0 [c00000007ffe7eb0] [c000000000124dbc] handle_fasteoi_irq+0xec/0x260 [c00000007ffe7ef0] [c00000000011f4f0] generic_handle_irq+0x50/0x80 [c00000007ffe7f20] [c000000000010f3c] __do_irq+0x8c/0x200 [c00000007ffe7f90] [c0000000000236cc] call_do_irq+0x14/0x24 [c00000007e6f39e0] [c000000000011144] do_IRQ+0x94/0x110 [c00000007e6f3a30] [c000000000002594] hardware_interrupt_common+0x114/0x180
Fix this issue by introducing a new rtas_get_sensor_fast() function that does not use rtas_busy_delay() - and thus can only be used for sensors that do not cause a BUSY condition - known as "fast" sensors.
The EPOW sensor is defined to be "fast" in sPAPR - mpe.
--- arch/powerpc/include/asm/rtas.h | 1 + arch/powerpc/kernel/rtas.c | 17 +++++++++++++++++ arch/powerpc/platforms/pseries/ras.c | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/rtas.h +1 -0
@@ -255,6 +255,7 @@ extern void rtas_power_off(void);extern void rtas_halt (void );extern void rtas_os_term (char *str);extern int rtas_get_sensor (int sensor,int index,int *state); +extern int rtas_get_sensor_fast (int sensor,int index,int *state);extern int rtas_get_power_level (int powerdomain,int *level);extern int rtas_set_power_level (int powerdomain,int level,int *setlevel);extern bool rtas_indicator_present (int token,int *maxindex);
arch/powerpc/kernel/rtas.c +17 -0
@@ -584,6 +584,23 @@ int rtas_get_sensor(int sensor, int index, int *state) }EXPORT_SYMBOL (rtas_get_sensor); +int rtas_get_sensor_fast (int sensor,int index,int *state) +{ +int token =rtas_token ("get-sensor-state" ); +int rc; + +if (token ==RTAS_UNKNOWN_SERVICE ) +return -ENOENT ; + + rc =rtas_call (token,2 ,2 , state, sensor, index); +WARN_ON (rc ==RTAS_BUSY || (rc >=RTAS_EXTENDED_DELAY_MIN && + rc <=RTAS_EXTENDED_DELAY_MAX )); + +if (rc <0 ) +return rtas_error_rc (rc); +return rc; +} +bool rtas_indicator_present (int token,int *maxindex) {int proplen, count, i;
arch/powerpc/platforms/pseries/ras.c +2 -1
@@ -187,7 +187,8 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)int state;int critical; - status =rtas_get_sensor (EPOW_SENSOR_TOKEN ,EPOW_SENSOR_INDEX , &state); + status =rtas_get_sensor_fast (EPOW_SENSOR_TOKEN ,EPOW_SENSOR_INDEX , + &state);if (state >3 ) critical =1 ;/* Time Critical */
Signature · 1 line
2.6.0
PATCH 48/84 powerpc/mm: Recompute hash value after a failed update
In reply to Jiri SlabyFrom: "Aneesh Kumar K.V" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 36b35d5d807b7e57aff7d08e63de8b17731ee211 upstream.
If we had secondary hash flag set, we ended up modifying hash value in the updatepp code path. Hence with a failed updatepp we will be using a wrong hash value for the following hash insert. Fix this by recomputing hash before insert.
Without this patch we can end up with using wrong slot number in linux pte. That can result in us missing an hash pte update or invalidate which can cause memory corruption or even machine check.
--- arch/powerpc/mm/hugepage-hash64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/mm/hugepage-hash64.c +2 -1
@@ -136,7 +136,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,BUG_ON (index >=4096 ); vpn =hpt_vpn (ea, vsid, ssize); - hash =hpt_hash (vpn, shift, ssize); hpte_slot_array =get_hpte_slot_array (pmdp);if (psize ==MMU_PAGE_4K ) {/*
@@ -151,6 +150,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid, valid =hpte_valid (hpte_slot_array, index);if (valid) {/* update the hpte bits */ + hash =hpt_hash (vpn, shift, ssize); hidx =hpte_hash_index (hpte_slot_array, index);if (hidx & _PTEIDX_SECONDARY) hash = ~hash;
@@ -176,6 +176,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,if (!valid) {unsigned long hpte_group; + hash =hpt_hash (vpn, shift, ssize);/* insert new entry */ pa =pmd_pfn (__pmd (old_pmd)) <<PAGE_SHIFT ; new_pmd |= _PAGE_HASHPTE;
Signature · 1 line
2.6.0
PATCH 49/84 Add radeon suspend/resume quirk for HP Compaq dc5750.
In reply to Jiri SlabyFrom: Jeffery Miller <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 09bfda10e6efd7b65bcc29237bee1765ed779657 upstream.
With the radeon driver loaded the HP Compaq dc5750 Small Form Factor machine fails to resume from suspend. Adding a quirk similar to other devices avoids the problem and the system resumes properly.
--- drivers/gpu/drm/radeon/radeon_combios.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/radeon/radeon_combios.c +8 -0
@@ -3403,6 +3403,14 @@ void radeon_combios_asic_init(struct drm_device *dev) rdev->pdev->subsystem_device == 0x30ae)return ; +/* quirk for rs4xx HP Compaq dc5750 Small Form Factor to make it resume +* - it hangs on resume inside the dynclk 1 table. +*/ +if (rdev->family ==CHIP_RS480 && + rdev->pdev->subsystem_vendor ==0x103c && + rdev->pdev->subsystem_device ==0x280a ) +return ; +/* DYN CLK 1 */ table =combios_get_table_offset (dev,COMBIOS_DYN_CLK_1_TABLE );if (table)
Signature · 1 line
2.6.0
PATCH 50/84 x86/mm: Initialize pmd_idx in page_table_range_init_count()
In reply to Jiri SlabyFrom: Minfei Huang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9962eea9e55f797f05f20ba6448929cab2a9f018 upstream.
The variable pmd_idx is not initialized for the first iteration of the for loop.
Assign the proper value which indexes the start address.
--- arch/x86/mm/init_32.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/mm/init_32.c +1 -0
@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end) vaddr = start; pgd_idx =pgd_index (vaddr); + pmd_idx =pmd_index (vaddr);for ( ; (pgd_idx <PTRS_PER_PGD ) && (vaddr != end); pgd_idx++) { for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);
Signature · 1 line
2.6.0
PATCH 51/84 rc-core: fix remove uevent generation
In reply to Jiri SlabyFrom: David Härdeman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a66b0c41ad277ae62a3ae6ac430a71882f899557 upstream.
The input_dev is already gone when the rc device is being unregistered so checking for its presence only means that no remove uevent will be generated.
--- drivers/media/rc/rc-main.c | 3 --- 1 file changed, 3 deletions(-)
drivers/media/rc/rc-main.c +0 -3
@@ -978,9 +978,6 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) {struct rc_dev *dev =to_rc_dev (device); -if (!dev || !dev->input_dev) -return -ENODEV ; -if (dev->rc_map.name)ADD_HOTPLUG_VAR ("NAME=%s" , dev->rc_map.name);if (dev->driver_name)
Signature · 1 line
2.6.0
PATCH 52/84 v4l: omap3isp: Fix sub-device power management code
In reply to Jiri SlabyFrom: Sakari Ailus <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 9d39f05490115bf145e5ea03c0b7ec9d3d015b01 upstream.
Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour") modified the media controller link setup notification API and updated the OMAP3 ISP driver accordingly. As a side effect it introduced a bug by turning power on after setting the link instead of before. This results in sub-devices not being powered down in some cases when they should be. Fix it.
--- drivers/media/platform/omap3isp/isp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/omap3isp/isp.c +2 -2
@@ -814,14 +814,14 @@ static int isp_pipeline_link_notify(struct media_link *link, u32 flags,int ret;if (notification ==MEDIA_DEV_NOTIFY_POST_LINK_CH && - !(link->flags &MEDIA_LNK_FL_ENABLED )) { + !(flags &MEDIA_LNK_FL_ENABLED )) {/* Powering off entities is assumed to never fail. */ isp_pipeline_pm_power (source, -sink_use);isp_pipeline_pm_power (sink, -source_use);return 0 ; } -if (notification ==MEDIA_DEV_NOTIFY_POST_LINK_CH && +if (notification ==MEDIA_DEV_NOTIFY_PRE_LINK_CH && (flags &MEDIA_LNK_FL_ENABLED )) { ret =isp_pipeline_pm_power (source, sink_use);
Signature · 1 line
2.6.0
PATCH 53/84 Btrfs: check if previous transaction aborted to avoid fs corruption
In reply to Jiri SlabyFrom: Filipe Manana <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1f9b8c8fbc9a4d029760b16f477b9d15500e3a34 upstream.
While we are committing a transaction, it's possible the previous one is still finishing its commit and therefore we wait for it to finish first. However we were not checking if that previous transaction ended up getting aborted after we waited for it to commit, so we ended up committing the current transaction which can lead to fs corruption because the new superblock can point to trees that have had one or more nodes/leafs that were never durably persisted.
The following sequence diagram exemplifies how this is possible:
CPU 0 CPU 1
transaction N starts
(...)
btrfs_commit_transaction(N)
cur_trans->state = TRANS_STATE_COMMIT_START;
(...)
cur_trans->state = TRANS_STATE_COMMIT_DOING;
(...)
cur_trans->state = TRANS_STATE_UNBLOCKED;
root->fs_info->running_transaction = NULL;
btrfs_start_transaction()
--> starts transaction N + 1
btrfs_write_and_wait_transaction(trans, root);
--> starts writing all new or COWed ebs created
at transaction N
creates some new ebs, COWs some
existing ebs but doesn't COW or
deletes eb X
btrfs_commit_transaction(N + 1)
(...)
cur_trans->state = TRANS_STATE_COMMIT_START;
(...)
wait_for_commit(root, prev_trans);
--> prev_trans == transaction N
btrfs_write_and_wait_transaction() continues
writing ebs
--> fails writing eb X, we abort transaction N
and set bit BTRFS_FS_STATE_ERROR on
fs_info->fs_state, so no new transactions
can start after setting that bit
cleanup_transaction()
btrfs_cleanup_one_transaction()
wakes up task at CPU 1
continues, doesn't abort because
cur_trans->aborted (transaction N + 1)
is zero, and no checks for bit
BTRFS_FS_STATE_ERROR in fs_info->fs_state
are made
btrfs_write_and_wait_transaction(trans, root);
--> succeeds, no errors during writeback
write_ctree_super(trans, root, 0);
--> succeeds
--> we have now a superblock that points us
to some root that uses eb X, which was
never written to diskIn this scenario future attempts to read eb X from disk results in an error message like "parent transid verify failed on X wanted Y found Z".
So fix this by aborting the current transaction if after waiting for the previous transaction we verify that it was aborted.
--- fs/btrfs/transaction.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/transaction.c +3 -0
@@ -1711,8 +1711,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,spin_unlock (&root->fs_info->trans_lock);wait_for_commit (root, prev_trans); + ret = prev_trans->aborted;btrfs_put_transaction (prev_trans); +if (ret) + goto cleanup_transaction; }else {spin_unlock (&root->fs_info->trans_lock); }
Signature · 1 line
2.6.0
PATCH 54/84 NFSv4: don't set SETATTR for O_RDONLY|O_EXCL
In reply to Jiri SlabyFrom: NeilBrown <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit efcbc04e16dfa95fef76309f89710dd1d99a5453 upstream.
It is unusual to combine the open flags O_RDONLY and O_EXCL, but it appears that libre-office does just that.
[pid 3250] stat("/home/USER/.config", {st_mode=S_IFDIR|0700, st_size=8192, ...}) = 0
[pid 3250] open("/home/USER/.config/libreoffice/4-suse/user/extensions/buildid", O_RDONLY|O_EXCL <unfinished ...>
NFSv4 takes O_EXCL as a sign that a setattr command should be sent, probably to reset the timestamps.
When it was an O_RDONLY open, the SETATTR command does not identify any actual attributes to change.
If no delegation was provided to the open, the SETATTR uses the all-zeros stateid and the request is accepted (at least by the Linux NFS server - no harm, no foul).
If a read-delegation was provided, this is used in the SETATTR request, and a Netapp filer will justifiably claim NFS4ERR_BAD_STATEID, which the Linux client takes as a sign to retry - indefinitely.
So only treat O_EXCL specially if O_CREAT was also given.
--- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4proc.c +1 -1
@@ -2267,7 +2267,7 @@ static int _nfs4_do_open(struct inode *dir, goto err_free_label; state = ctx->state; -if ((opendata->o_arg.open_flags &O_EXCL ) && +if ((opendata->o_arg.open_flags & (O_CREAT |O_EXCL )) == (O_CREAT |O_EXCL ) && (opendata->o_arg.createmode !=NFS4_CREATE_GUARDED )) {nfs4_exclusive_attrset (opendata, sattr);
Signature · 1 line
2.6.0
PATCH 55/84 NFS: nfs_set_pgio_error sometimes misses errors
In reply to Jiri SlabyFrom: Trond Myklebust <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e9ae58aeee8842a50f7e199d602a5ccb2e41a95f upstream.
We should ensure that we always set the pgio_header's error field if a READ or WRITE RPC call returns an error. The current code depends on 'hdr->good_bytes' always being initialised to a large value, which is not always done correctly by callers.
When this happens, applications may end up missing important errors.
--- fs/nfs/pagelist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/pagelist.c +2 -2
@@ -60,8 +60,8 @@ EXPORT_SYMBOL_GPL(nfs_pgheader_init);void nfs_set_pgio_error (struct nfs_pgio_header *hdr,int error,loff_t pos) {spin_lock (&hdr->lock); -if (pos < hdr->io_start + hdr->good_bytes) { -set_bit (NFS_IOHDR_ERROR , &hdr->flags); +if (!test_and_set_bit (NFS_IOHDR_ERROR , &hdr->flags) + || pos < hdr->io_start + hdr->good_bytes) {clear_bit (NFS_IOHDR_EOF , &hdr->flags); hdr->good_bytes = pos - hdr->io_start; hdr->error = error;
Signature · 1 line
2.6.0
PATCH 56/84 parisc: Filter out spurious interrupts in PA-RISC irq handler
In reply to Jiri SlabyFrom: Helge Deller <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit b1b4e435e4ef7de77f07bf2a42c8380b960c2d44 upstream.
When detecting a serial port on newer PA-RISC machines (with iosapic) we have a long way to go to find the right IRQ line, registering it, then registering the serial port and the irq handler for the serial port. During this phase spurious interrupts for the serial port may happen which then crashes the kernel because the action handler might not have been set up yet.
So, basically it's a race condition between the serial port hardware and the CPU which sets up the necessary fields in the irq sructs. The main reason for this race is, that we unmask the serial port irqs too early without having set up everything properly before (which isn't easily possible because we need the IRQ number to register the serial ports).
This patch is a work-around for this problem. It adds checks to the CPU irq handler to verify if the IRQ action field has been initialized already. If not, we just skip this interrupt (which isn't critical for a serial port at bootup). The real fix would probably involve rewriting all PA-RISC specific IRQ code (for CPU, IOSAPIC, GSC and EISA) to use IRQ domains with proper parenting of the irq chips and proper irq enabling along this line.
This bug has been in the PA-RISC port since the beginning, but the crashes happened very rarely with currently used hardware. But on the latest machine which I bought (a C8000 workstation), which uses the fastest CPUs (4 x PA8900, 1GHz) and which has the largest possible L1 cache size (64MB each), the kernel crashed at every boot because of this race. So, without this patch the machine would currently be unuseable.
For the record, here is the flow logic:
1. serial_init_chip() in 8250_gsc.c calls iosapic_serial_irq().
2. iosapic_serial_irq() calls txn_alloc_irq() to find the irq.
3. iosapic_serial_irq() calls cpu_claim_irq() to register the CPU irq
4. cpu_claim_irq() unmasks the CPU irq (which it shouldn't!)
5. serial_init_chip() then registers the 8250 port.
Problems:
- In step 4 the CPU irq shouldn't have been registered yet, but after step 5
- If serial irq happens between 4 and 5 have finished, the kernel will crash
--- arch/parisc/kernel/irq.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/parisc/kernel/irq.c +6 -2
@@ -524,8 +524,8 @@ void do_cpu_irq_mask(struct pt_regs *regs)struct pt_regs *old_regs;unsigned long eirr_val;int irq, cpu =smp_processor_id (); -#ifdef CONFIG_SMP struct irq_desc *desc; +#ifdef CONFIG_SMP cpumask_t dest;#endif
@@ -538,8 +538,12 @@ void do_cpu_irq_mask(struct pt_regs *regs) goto set_out; irq =eirr_to_irq (eirr_val); -#ifdef CONFIG_SMP +/* Filter out spurious interrupts, mostly from serial port at bootup */ desc =irq_to_desc (irq); +if (unlikely (!desc->action)) + goto set_out; + +#ifdef CONFIG_SMP cpumask_copy (&dest, desc->irq_data.affinity);if (irqd_is_per_cpu (&desc->irq_data) && !cpu_isset (smp_processor_id (), dest)) {
Signature · 1 line
2.6.0
PATCH 57/84 vmscan: fix increasing nr_isolated incurred by putback unevictable pages
In reply to Jiri SlabyFrom: Jaewon Kim <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c54839a722a02818677bcabe57e957f0ce4f841d upstream.
reclaim_clean_pages_from_list() assumes that shrink_page_list() returns number of pages removed from the candidate list. But shrink_page_list() puts back mlocked pages without passing it to caller and without counting as nr_reclaimed. This increases nr_isolated.
To fix this, this patch changes shrink_page_list() to pass unevictable pages back to caller. Caller will take care those pages.
Minchan said:
It fixes two issues.
1. With unevictable page, cma_alloc will be successful.
Exactly speaking, cma_alloc of current kernel will fail due to unevictable pages.
2. fix leaking of NR_ISOLATED counter of vmstat
With it, too_many_isolated works. Otherwise, it could make hang until the process get SIGKILL.
--- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -1087,7 +1087,7 @@ cull_mlocked:if (PageSwapCache (page))try_to_free_swap (page);unlock_page (page); -putback_lru_page (page); +list_add (&page->lru, &ret_pages);continue ; activate_locked:
Signature · 1 line
2.6.0
PATCH 58/84 fs: if a coredump already exists, unlink and recreate with O_EXCL
In reply to Jiri SlabyFrom: Jann Horn <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit fbb1816942c04429e85dbf4c1a080accc534299e upstream.
It was possible for an attacking user to trick root (or another user) into writing his coredumps into an attacker-readable, pre-existing file using rename() or link(), causing the disclosure of secret data from the victim process' virtual memory. Depending on the configuration, it was also possible to trick root into overwriting system files with coredumps. Fix that issue by never writing coredumps into existing files.
Requirements for the attack:
- The attack only applies if the victim's process has a nonzero RLIMIT_CORE and is dumpable.
- The attacker can trick the victim into coredumping into an attacker-writable directory D, either because the core_pattern is relative and the victim's cwd is attacker-writable or because an absolute core_pattern pointing to a world-writable directory is used.
- The attacker has one of these:
A: on a system with protected_hardlinks=0:
execute access to a folder containing a victim-owned, attacker-readable file on the same partition as D, and the victim-owned file will be deleted before the main part of the attack takes place. (In practice, there are lots of files that fulfill this condition, e.g. entries in Debian's /var/lib/dpkg/info/.) This does not apply to most Linux systems because most distros set protected_hardlinks=1.
B: on a system with protected_hardlinks=1:
execute access to a folder containing a victim-owned, attacker-readable and attacker-writable file on the same partition as D, and the victim-owned file will be deleted before the main part of the attack takes place.
(This seems to be uncommon.)
C: on any system, independent of protected_hardlinks:
write access to a non-sticky folder containing a victim-owned, attacker-readable file on the same partition as D
(This seems to be uncommon.)
The basic idea is that the attacker moves the victim-owned file to where he expects the victim process to dump its core. The victim process dumps its core into the existing file, and the attacker reads the coredump from it.
If the attacker can't move the file because he does not have write access to the containing directory, he can instead link the file to a directory he controls, then wait for the original link to the file to be deleted (because the kernel checks that the link count of the corefile is 1).
A less reliable variant that requires D to be non-sticky works with link() and does not require deletion of the original link: link() the file into D, but then unlink() it directly before the kernel performs the link count check.
On systems with protected_hardlinks=0, this variant allows an attacker to not only gain information from coredumps, but also clobber existing, victim-writable files with coredumps. (This could theoretically lead to a privilege escalation.)
--- fs/coredump.c | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-)
fs/coredump.c +32 -6
@@ -499,10 +499,10 @@ void do_coredump(siginfo_t *siginfo)const struct cred *old_cred;struct cred *cred;int retval =0 ; -int flag =0 ;int ispipe;struct files_struct *displaced; -bool need_nonrelative = false; +/* require nonrelative corefile path and be extra careful */ +bool need_suid_safe = false;bool core_dumped = false;static atomic_t core_dump_count =ATOMIC_INIT (0 );struct coredump_params cprm = {
@@ -536,9 +536,8 @@ void do_coredump(siginfo_t *siginfo)*/ if (__get_dumpable (cprm.mm_flags) ==SUID_DUMP_ROOT ) {/* Setuid core dump mode */ - flag =O_EXCL ;/* Stop rewrite attacks */ cred->fsuid =GLOBAL_ROOT_UID ;/* Dump root private */ - need_nonrelative = true; + need_suid_safe = true; } retval =coredump_wait (siginfo->si_signo, &core_state);
@@ -619,7 +618,7 @@ void do_coredump(siginfo_t *siginfo)if (cprm.limit < binfmt->min_coredump) goto fail_unlock; -if (need_nonrelative && cn.corename[0 ] !='/' ) { +if (need_suid_safe && cn.corename[0 ] !='/' ) {printk (KERN_WARNING "Pid %d(%s) can only dump core " \"to fully qualified path!\n" ,task_tgid_vnr (current), current->comm);
@@ -627,8 +626,35 @@ void do_coredump(siginfo_t *siginfo) goto fail_unlock; } +/* +* Unlink the file if it exists unless this is a SUID +* binary - in that case, we're running around with root +* privs and don't want to unlink another user's coredump. +*/ +if (!need_suid_safe) { +mm_segment_t old_fs; + + old_fs =get_fs (); +set_fs (KERNEL_DS ); +/* +* If it doesn't exist, that's fine. If there's some +* other problem, we'll catch it at the filp_open(). +*/ + (void )sys_unlink ((const char __user *)cn.corename); +set_fs (old_fs); + } + +/* +* There is a race between unlinking and creating the +* file, but if that causes an EEXIST here, that's +* fine - another process raced with us while creating +* the corefile, and the other process won. To userspace, +* what matters is that at least one of the two processes +* writes its coredump successfully, not which one. +*/ cprm.file =filp_open (cn.corename, -O_CREAT |2 |O_NOFOLLOW |O_LARGEFILE | flag, +O_CREAT |2 |O_NOFOLLOW | +O_LARGEFILE |O_EXCL ,0600 );if (IS_ERR (cprm.file)) goto fail_unlock;
Signature · 1 line
2.6.0
Quoted 5 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.49 release. There are 84 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.
Quoted 7 lines
Responses should be made by Tue Oct 6 15:25:04 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.49-rc1.xzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Signature · 5 lines
Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) [email protected] | (970) 217-8978
Quoted 15 lines · Shuah Khan
Quoted 5 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.49 release. There are 84 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.
Quoted 7 lines
Responses should be made by Tue Oct 6 15:25:04 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.49-rc1.xzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
Quoted 4 lines · Guenter Roeck
Build results:
total: 123 pass: 123 fail: 0 Qemu test results: total: 76 pass: 76 fail: 0
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.49 release. There are 84 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 Tue Oct 6 15:25:04 CEST 2015. Anything received after that time might be too late.
Build results:
total: 123 pass: 123 fail: 0 Qemu test results: total: 76 pass: 76 fail: 0
Details are available at http://server.roeck-us.net:8010/builders.
Guenter