linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review
@ 2016-03-31 20:13 Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 001/218] crypto: skcipher - Add crypto_skcipher_has_setkey Kamal Mostafa
                   ` (217 more replies)
  0 siblings, 218 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Kamal Mostafa

This is the start of the review cycle for the Linux 4.2.8-ckt7 stable
kernel.

This version contains 218 new patches, summarized below.  The new patches
are posted as replies to this message and also available in this git branch:

http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-4.2.y-review

git://kernel.ubuntu.com/ubuntu/linux.git  linux-4.2.y-review

The review period for version 4.2.8-ckt7 will be open for the next three
days.  To report a problem, please reply to the relevant follow-up patch
message.

For more information about the Linux 4.2.y-ckt extended stable kernel
series, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable .

 -Kamal

--
 MAINTAINERS                                        |  98 ++++----
 arch/arc/include/asm/bitops.h                      |  15 --
 arch/arc/include/asm/io.h                          |  18 +-
 arch/arm/boot/dts/armada-375.dtsi                  |   2 +-
 arch/arm/mach-davinci/Kconfig                      |  14 +-
 arch/arm/mach-davinci/board-dm644x-evm.c           |   8 +-
 arch/arm/mach-davinci/board-dm646x-evm.c           |   7 +
 arch/arm/mach-omap2/cpuidle34xx.c                  |  69 +++++-
 arch/arm/mach-prima2/Kconfig                       |   1 +
 arch/s390/include/asm/pci.h                        |   2 +-
 arch/s390/pci/pci.c                                |   5 +-
 arch/sh/mm/kmap.c                                  |   2 +
 arch/um/drivers/mconsole_kern.c                    |   2 +-
 arch/x86/include/asm/apic.h                        |   2 +-
 arch/x86/kernel/cpu/perf_event.c                   |  13 +
 arch/x86/kernel/cpu/perf_event.h                   |   1 +
 arch/x86/kernel/cpu/perf_event_intel.c             |  15 +-
 arch/x86/kernel/cpu/perf_event_intel_ds.c          |  13 +-
 arch/x86/kernel/cpu/perf_event_knc.c               |   4 +-
 arch/x86/kernel/ioport.c                           |  12 +-
 arch/x86/kvm/i8254.c                               |  12 +-
 arch/x86/kvm/vmx.c                                 |   1 +
 arch/x86/pci/fixup.c                               |   7 +
 arch/xtensa/kernel/head.S                          |   2 +-
 arch/xtensa/mm/cache.c                             |   8 +-
 arch/xtensa/platforms/iss/console.c                |  10 +-
 crypto/ablkcipher.c                                |   2 +
 crypto/algif_skcipher.c                            |  77 +++---
 crypto/blkcipher.c                                 |   1 +
 drivers/ata/ahci_xgene.c                           |   4 +-
 drivers/block/mtip32xx/mtip32xx.c                  | 102 +++++---
 drivers/block/mtip32xx/mtip32xx.h                  |   6 +
 drivers/block/nbd.c                                |   4 +-
 drivers/block/paride/pd.c                          |   4 +-
 drivers/block/paride/pt.c                          |   4 +-
 drivers/bluetooth/ath3k.c                          |   8 +
 drivers/bluetooth/btusb.c                          |   4 +
 drivers/bus/imx-weim.c                             |   2 +-
 drivers/char/tpm/tpm-chip.c                        |  14 +-
 drivers/char/tpm/tpm_crb.c                         |   4 +-
 drivers/clk/clk-divider.c                          |  11 +-
 drivers/clk/clk-xgene.c                            |   4 +-
 drivers/clk/meson/clkc.c                           |   2 +-
 drivers/clk/nxp/clk-lpc18xx-ccu.c                  |   2 +-
 drivers/clk/qcom/gcc-msm8960.c                     |   4 +-
 drivers/clk/rockchip/clk-rk3188.c                  |   3 +
 drivers/clk/rockchip/clk.c                         |  13 +-
 drivers/clk/versatile/clk-sp810.c                  |   4 +-
 drivers/crypto/ccp/ccp-crypto-aes-cmac.c           |  36 +++
 drivers/crypto/ccp/ccp-crypto-sha.c                |  40 +++
 drivers/crypto/ccp/ccp-crypto.h                    |  22 ++
 drivers/crypto/marvell/cesa.c                      |   2 +-
 drivers/edac/amd64_edac.c                          |   2 +-
 drivers/edac/sb_edac.c                             |  26 +-
 drivers/firmware/efi/efi.c                         |   1 +
 drivers/gpio/gpio-rcar.c                           |  42 ++++
 drivers/gpio/gpiolib.c                             |  15 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c             |   4 +-
 drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c            |   2 +-
 drivers/gpu/drm/i915/intel_display.c               |  17 ++
 drivers/gpu/drm/i915/intel_ringbuffer.c            |  24 +-
 drivers/gpu/drm/radeon/atombios_encoders.c         |   6 +-
 drivers/gpu/drm/radeon/radeon_fb.c                 |  19 +-
 drivers/hid/hid-core.c                             |   8 +-
 drivers/hid/i2c-hid/i2c-hid.c                      |  16 +-
 drivers/infiniband/ulp/isert/ib_isert.c            |  21 +-
 drivers/infiniband/ulp/isert/ib_isert.h            |   1 +
 drivers/infiniband/ulp/srpt/ib_srpt.c              |  59 +----
 drivers/input/misc/ati_remote2.c                   |  36 ++-
 drivers/input/misc/ims-pcu.c                       |   4 +
 drivers/input/misc/powermate.c                     |   3 +
 drivers/input/mouse/synaptics.c                    |   5 +-
 drivers/md/bcache/super.c                          |  46 +++-
 drivers/md/dm-cache-metadata.c                     |  98 +++++---
 drivers/md/dm-cache-metadata.h                     |   4 +-
 drivers/md/dm-cache-target.c                       |  12 +-
 drivers/md/dm-snap.c                               |   9 +
 drivers/md/dm-table.c                              |  36 ++-
 drivers/md/dm-thin-metadata.c                      |   5 +-
 drivers/md/dm.c                                    |   2 +-
 drivers/md/multipath.c                             |   4 +-
 drivers/md/raid5.c                                 |  51 ++--
 drivers/md/raid5.h                                 |   4 +-
 drivers/media/i2c/adv7511.c                        |  21 +-
 drivers/media/pci/bt8xx/bttv-driver.c              |  26 +-
 drivers/media/pci/saa7134/saa7134-video.c          |  18 +-
 drivers/media/platform/coda/coda-common.c          |  10 +-
 drivers/media/platform/vsp1/vsp1_sru.c             |   1 +
 drivers/media/usb/pwc/pwc-if.c                     |   6 +
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c      |  21 +-
 drivers/misc/Kconfig                               |   2 +-
 drivers/misc/ad525x_dpot.c                         |   2 +-
 drivers/misc/mei/bus.c                             | 269 +++++++++++----------
 drivers/misc/mei/mei_dev.h                         |  12 +-
 drivers/misc/mei/nfc.c                             |  80 +++---
 drivers/mmc/host/mmc_spi.c                         |   6 +
 drivers/mmc/host/sdhci.c                           |  23 +-
 drivers/mtd/nand/brcmnand/brcmnand.c               |  34 ++-
 drivers/mtd/onenand/onenand_base.c                 |   3 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c     |   4 +-
 drivers/net/ethernet/marvell/mvneta.c              |   2 +-
 .../net/ethernet/mellanox/mlx4/resource_tracker.c  |   3 +-
 drivers/net/ethernet/micrel/ks8842.c               |  10 +-
 drivers/net/irda/irtty-sir.c                       |  10 -
 drivers/net/phy/at803x.c                           |   6 +-
 drivers/net/phy/mdio-sun4i.c                       |   4 +-
 drivers/net/ppp/ppp_generic.c                      |  35 +--
 drivers/net/rionet.c                               |   4 +-
 drivers/net/wireless/ath/ath9k/eeprom.c            |   7 +-
 drivers/net/wireless/ath/ath9k/init.c              |   4 +-
 drivers/net/wireless/rt2x00/rt2800usb.c            |   1 +
 drivers/nvdimm/bus.c                               |   8 +-
 drivers/of/of_reserved_mem.c                       |   4 +-
 drivers/pci/probe.c                                |  14 ++
 drivers/pinctrl/bcm/pinctrl-bcm2835.c              |   2 +-
 drivers/platform/x86/ideapad-laptop.c              |  14 ++
 drivers/regulator/s5m8767.c                        |  13 +-
 drivers/rtc/rtc-ds1685.c                           |   8 +-
 drivers/rtc/rtc-hym8563.c                          |   2 +-
 drivers/rtc/rtc-max77686.c                         |   2 +-
 drivers/rtc/rtc-vr41xx.c                           |  13 +-
 drivers/scsi/aacraid/aacraid.h                     |   2 +
 drivers/scsi/aacraid/commsup.c                     |  37 ++-
 drivers/scsi/aacraid/src.c                         |  30 +--
 drivers/scsi/aic7xxx/aic7xxx_osm.c                 |   1 +
 drivers/scsi/be2iscsi/be_main.c                    |   1 +
 drivers/scsi/lpfc/lpfc_init.c                      |   5 +-
 drivers/scsi/megaraid/megaraid_sas_base.c          |   3 +-
 drivers/scsi/sg.c                                  |   3 +-
 drivers/spi/spi-rockchip.c                         |  19 +-
 drivers/staging/android/ion/ion_test.c             |   4 +-
 drivers/staging/comedi/drivers/ni_mio_common.c     |  12 +-
 drivers/staging/comedi/drivers/ni_tiocmd.c         |   2 +-
 drivers/target/target_core_transport.c             |   2 -
 drivers/tty/serial/8250/8250_core.c                |  18 +-
 drivers/usb/class/cdc-acm.c                        |   3 +
 drivers/usb/core/driver.c                          |   6 +-
 drivers/usb/core/hub.c                             |  16 +-
 drivers/usb/misc/iowarrior.c                       |   6 +
 drivers/usb/storage/uas.c                          |   2 +-
 drivers/video/fbdev/Kconfig                        |   1 -
 drivers/video/fbdev/da8xx-fb.c                     |   7 +-
 drivers/watchdog/rc32434_wdt.c                     |   2 +-
 fs/coredump.c                                      |  30 ++-
 fs/fhandle.c                                       |   2 +-
 fs/fs-writeback.c                                  |  52 +++-
 fs/fuse/cuse.c                                     |   4 +-
 fs/fuse/file.c                                     |  33 ++-
 fs/fuse/fuse_i.h                                   |   9 +
 fs/jbd2/journal.c                                  |  17 +-
 fs/nfsd/nfs4proc.c                                 |   1 +
 fs/nfsd/nfs4xdr.c                                  |  13 +-
 fs/ocfs2/dlm/dlmconvert.c                          |  24 +-
 fs/ocfs2/dlm/dlmrecovery.c                         |   1 -
 fs/open.c                                          |   6 +-
 fs/proc_namespace.c                                |   2 +
 fs/quota/dquot.c                                   |   3 +-
 fs/splice.c                                        |   3 +
 fs/xfs/xfs_attr_list.c                             |  19 +-
 include/asm-generic/bitops/lock.h                  |  14 +-
 include/linux/clk-provider.h                       |   1 +
 include/linux/crypto.h                             |   8 +
 include/linux/device-mapper.h                      |   2 +
 include/linux/fs.h                                 |   2 +-
 include/linux/gpio/driver.h                        |  14 +-
 include/linux/kernel.h                             |   6 +-
 include/linux/mlx5/driver.h                        |   2 +-
 include/linux/mtd/map.h                            |   7 +-
 include/linux/pci.h                                |   1 +
 include/linux/poison.h                             |   4 +-
 include/linux/tty.h                                |   2 +-
 include/net/ip_vs.h                                |  17 ++
 kernel/bpf/helpers.c                               |   2 +-
 kernel/events/core.c                               |   7 +-
 kernel/sched/core.c                                |   1 +
 kernel/sched/cputime.c                             |  14 +-
 kernel/sched/sched.h                               |  13 +
 kernel/sysctl_binary.c                             |   2 +-
 kernel/trace/trace.c                               |   5 +-
 kernel/trace/trace_irqsoff.c                       |   8 +-
 kernel/trace/trace_printk.c                        |   3 +
 kernel/watchdog.c                                  |   9 +-
 mm/memcontrol.c                                    |  44 +++-
 mm/page_alloc.c                                    |  46 +++-
 net/bluetooth/mgmt.c                               |   4 +
 net/core/dev.c                                     |   1 +
 net/ipv4/af_inet.c                                 |   9 +-
 net/ipv4/devinet.c                                 |   4 +
 net/ipv4/fib_frontend.c                            |   4 +
 net/ipv4/netfilter/nf_nat_masquerade_ipv4.c        |  12 +-
 net/ipv4/udp.c                                     |  12 +-
 net/mac80211/ibss.c                                |  22 +-
 net/mac80211/iface.c                               |   3 +
 net/mac80211/rx.c                                  |   5 +-
 net/mac80211/sta_info.c                            |  24 +-
 net/netfilter/ipvs/ip_vs_core.c                    |  37 ++-
 net/netfilter/ipvs/ip_vs_pe_sip.c                  |   2 +-
 net/sctp/associola.c                               |   2 +-
 net/sctp/transport.c                               |   2 +-
 net/socket.c                                       |  38 +--
 net/sunrpc/cache.c                                 |   6 +-
 scripts/coccinelle/iterators/use_after_iter.cocci  |   2 +-
 scripts/package/mkspec                             |   8 +-
 sound/core/pcm_lib.c                               |   2 +-
 sound/pci/hda/patch_cirrus.c                       |   8 +-
 sound/pci/hda/patch_conexant.c                     |   7 +-
 sound/pci/hda/patch_realtek.c                      |   1 +
 sound/pci/intel8x0.c                               |   1 +
 sound/soc/codecs/ssm4567.c                         |   5 +
 sound/soc/samsung/s3c-i2s-v2.c                     |   2 +-
 sound/soc/samsung/s3c-i2s-v2.h                     |   2 +-
 sound/usb/clock.c                                  |   2 +
 sound/usb/endpoint.c                               |   3 +
 sound/usb/mixer_quirks.c                           |   4 +
 sound/usb/pcm.c                                    |   2 +
 sound/usb/quirks.c                                 |   7 +
 tools/hv/Makefile                                  |   2 +
 tools/perf/Documentation/perf-stat.txt             |   8 +
 tools/perf/util/event.c                            |   2 +-
 tools/perf/util/pmu.c                              |  17 +-
 tools/perf/util/setup.py                           |   4 +
 virt/kvm/kvm_main.c                                |  21 +-
 222 files changed, 1960 insertions(+), 980 deletions(-)

Aaro Koskinen (1):
      mtd: onenand: fix deadlock in onenand_block_markbad

Addy Ke (1):
      spi: rockchip: modify DMA max burst to 1

Adrian Hunter (1):
      mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout

Alan (1):
      aic7xxx: Fix queue depth handling

Alex Deucher (1):
      drm/radeon: rework fbdev handling on chips with no connectors

Alexander Kochetkov (2):
      clk: rockchip: add hclk_cpubus to the list of rk3188 critical clocks
      rtc: hym8563: fix invalid year calculation

Alexander Shishkin (1):
      perf/core: Fix perf_sched_count derailment

Alexander Usyskin (1):
      mei: bus: check if the device is enabled before data transfer

Alexei Starovoitov (1):
      bpf: avoid copying junk bytes in bpf_get_current_comm()

Andi Kleen (1):
      perf tools: Dont stop PMU parsing on alias parse error

Andreas Färber (1):
      clk: meson: Fix meson_clk_register_clks() signature type mismatch

Andy Lutomirski (1):
      x86/iopl: Fix iopl capability check on Xen PV

Anthony Wong (1):
      rt2x00: add new rt2800usb device Buffalo WLI-UC-G450

Ard Biesheuvel (1):
      efi: Expose non-blocking set_variable() wrapper to efivars

Arnaldo Carvalho de Melo (1):
      net: Fix use after free in the recvmmsg exit path

Arnd Bergmann (12):
      mac80211: avoid excessive stack usage in sta_info
      xen kconfig: don't "select INPUT_XEN_KBDDEV_FRONTEND"
      ath9k: fix misleading indentation
      megaraid_sas: add missing curly braces in ioctl handler
      ath9k: fix buffer overrun for ar9287
      ARM: davinci: make I2C support optional
      lpfc: fix misleading indentation
      ASoC: s3c24xx: use const snd_soc_component_driver pointer
      mlx4: add missing braces in verify_qp_parameters
      paride: make 'verbose' parameter an 'int' again
      regulator: s5m8767: fix get_register() error handling
      ARM: prima2: always enable reset controller

Asai Thambi SP (7):
      mtip32xx: Fix broken service thread handling
      mtip32xx: Remove unwanted code from taskfile error handler
      mtip32xx: Print exact time when an internal command is interrupted
      mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild
      mtip32xx: Fix for rmmod crash when drive is in FTL rebuild
      mtip32xx: Handle safe removal during IO
      mtip32xx: Handle FTL rebuild failure state during device initialization

Aurelien Jacquiot (1):
      rapidio/rionet: fix deadlock on SMP

Bamvor Jian Zhang (1):
      gpiolib: do not allow to insert an empty gpiochip

Bart Van Assche (1):
      IB/srpt: Simplify srpt_handle_tsk_mgmt()

Ben Hutchings (1):
      misc/bmp085: Enable building as a module

Benjamin Tissoires (2):
      HID: fix hid_ignore_special_drivers module parameter
      Input: synaptics - handle spurious release of trackstick buttons, again

Bjorn Helgaas (2):
      PCI: Disable IO/MEM decoding for devices with non-compliant BARs
      x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs

Boris BREZILLON (1):
      crypto: marvell/cesa - forward devm_ioremap_resource() error code

Borislav Petkov (1):
      perf stat: Document --detailed option

Bryn M. Reeves (1):
      dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request()

Chris Friesen (1):
      sched/cputime: Fix steal_account_process_tick() to always return jiffies

Chris Mason (1):
      fs-writeback: unplug before cond_resched in writeback_sb_inodes

Dan Carpenter (6):
      EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr()
      mdio-sun4i: oops in error handling in probe
      ethernet: micrel: fix some error codes
      ata: ahci_xgene: dereferencing uninitialized pointer in probe
      rtc: ds1685: passing bogus values to irq_restore
      drm/amdkfd: uninitialized variable in dbgdev_wave_control_set_registers()

Dan Streetman (1):
      nbd: ratelimit error msgs after socket close

Dave Jones (1):
      x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt()

David Hildenbrand (1):
      sched/preempt, sh: kmap_coherent relies on disabled preemption

David S. Miller (1):
      ipv4: Don't do expensive useless work during inetdev destroy.

DingXiang (1):
      dm snapshot: disallow the COW and origin devices from being identical

Dmitri Epshtein (1):
      net: mvneta: enable change MAC address when interface is up

Dmitry Torokhov (1):
      HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report()

Dmitry Tunin (4):
      Bluetooth: btusb: Add new AR3012 ID 13d3:3395
      Bluetooth: Add new AR3012 ID 0489:e095
      Bluetooth: btusb: Add a new AR3012 ID 04ca:3014
      Bluetooth: btusb: Add a new AR3012 ID 13d3:3472

Dmitry V. Levin (1):
      vfs: show_vfsstat: do not ignore errors from show_devname method

Douglas Gilbert (1):
      sg: fix dxferp in from_to case

Eric Dumazet (1):
      net: bcmgenet: fix dma api length mismatch

Eric Wheeler (3):
      bcache: fix race of writeback thread starting before complete initialization
      bcache: cleaned up error handling around register_cache()
      bcache: fix cache_set_flush() NULL pointer dereference on OOM

Fabio Estevam (1):
      bus: imx-weim: Take the 'status' property value into account

Florian Fainelli (1):
      mtd: brcmnand: Fix v7.1 register offsets

Geert Uytterhoeven (2):
      gpio: rcar: Add Runtime PM handling for interrupts
      rtc: vr41xx: Wire up alarm_irq_enable

Grazvydas Ignotas (1):
      HID: logitech: fix Dual Action gamepad support

Guenter Roeck (1):
      MAINTAINERS: Update mailing list and web page for hwmon subsystem

Guillaume Nault (2):
      ppp: take reference on channels netns
      ppp: ensure file->private_data can't be overridden

H Hartley Sweeten (1):
      staging: comedi: ni_mio_common: fix the ni_write[blw]() functions

Hans Verkuil (1):
      [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect

Hans de Goede (4):
      [media] pwc: Add USB id for Philips Spc880nc webcam
      [media] saa7134: Fix bytesperline not being set correctly for planar formats
      [media] bttv: Width must be a multiple of 16 when capturing planar formats
      USB: uas: Reduce can_queue to MAX_CMNDS

Heiko Stuebner (1):
      clk-divider: make sure read-only dividers do not write to their register

Herbert Xu (4):
      crypto: skcipher - Add crypto_skcipher_has_setkey
      crypto: algif_skcipher - Add key check exception for cipher_null
      crypto: algif_skcipher - Do not assume that req is unchanged
      crypto: algif_skcipher - Do not dereference ctx without socket lock

Himanshu Madhani (1):
      target: Fix target_release_cmd_kref shutdown comp leak

Hui Wang (1):
      ALSA: hda - fix the mic mute button and led problem for a Lenovo AIO

Huibin Hong (1):
      spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs

J. Bruce Fields (2):
      nfsd4: fix bad bounds checking
      nfsd: fix deadlock secinfo+readdir compound

Jann Horn (1):
      fs/coredump: prevent fsuid=0 dumps into user-controlled directories

Jarkko Sakkinen (3):
      tpm: fix the rollback in tpm_chip_register()
      tpm: fix the cleanup of struct tpm_chip
      tpm_crb: tpm2_shutdown() must be called before tpm_chip_unregister()

Jenny Derzhavetz (3):
      iser-target: Fix identification of login rx descriptor type
      iser-target: Add new state ISER_CONN_BOUND to isert_conn
      iser-target: Separate flows for np listeners and connections cma events

Jerry Hoemann (1):
      libnvdimm: Fix security issue with DSM IOCTL.

Jes Sorensen (1):
      md/raid5: Compare apples to apples (or sectors to sectors)

Jesse Gross (1):
      ipip: Properly mark ipip GRO packets as encapsulated.

Jiri Kosina (1):
      kbuild/mkspec: fix grub2 installkernel issue

Jiri Olsa (2):
      perf tools: Fix python extension build
      perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2

Joe Thornber (2):
      dm thin metadata: don't issue prefetches if a transaction abort has failed
      dm cache: make sure every metadata function checks fail_io

Johan Hedberg (1):
      Bluetooth: Fix potential buffer overflow with Add Advertising

Johannes Weiner (2):
      mm: memcontrol: reclaim when shrinking memory.high below usage
      mm: memcontrol: reclaim and OOM kill when shrinking memory.max below usage

John Dahlstrom (1):
      ideapad-laptop: Add ideapad Y700 (15) to the no_hw_rfkill DMI list

Joseph Qi (2):
      ocfs2/dlm: fix race between convert and recovery
      ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list

Josh Boyer (2):
      Input: powermate - fix oops with malicious USB descriptors
      USB: iowarrior: fix oops with malicious USB descriptors

Joshua Hunt (1):
      watchdog: don't run proc_watchdog_update if new value is same as old

Julia Lawall (1):
      scripts/coccinelle: modernize &

Julian Anastasov (1):
      ipvs: drop first packet to redirect conntrack

Kamal Mostafa (1):
      tools/hv: Use include/uapi with __EXPORTED_HEADERS__

Kan Liang (1):
      perf/x86/intel: Fix PEBS warning by only restoring active PMU in pmi

Ken Wang (1):
      drm/amdgpu: include the right version of gmc header files for iceland

Krzysztof Kozlowski (1):
      rtc: max77686: Properly handle regmap_irq_get_virq() error code

Lada Trimasova (1):
      ARC: [BE] readl()/writel() to work in Big Endian CPU configuration

Lars-Peter Clausen (1):
      ASoC: ssm4567: Reset device before regcache_sync()

Laurent Pinchart (1):
      [media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream

Linus Walleij (3):
      gpio: add a data pointer to gpio_chip
      mtd: map: fix .set_vpp() documentation
      clk: versatile: sp810: support reentrance

Lior Amsalem (1):
      ARM: dts: armada-375: use armada-370-sata for SATA

Loc Ho (1):
      clk: xgene: Add missing parenthesis when clearing divider value

Luis de Bethencourt (1):
      net: add description for len argument of dev_get_phys_port_name

Magnus Damm (1):
      mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case

Marcin Ślusarz (1):
      perf tools: handle spaces in file names obtained from /proc/pid/maps

Marco Angaroni (1):
      ipvs: correct initial offset of Call-ID header search in SIP persistence engine

Mario Kleiner (1):
      drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards.

Markus Trippelsdorf (1):
      perf pmu: Fix misleadingly indented assignment (whitespace)

Mateusz Guzik (1):
      xfs: fix two memory leaks in xfs_attr_list.c error paths

Maurizio Lombardi (1):
      be2iscsi: set the boot_kset pointer to NULL in case of failure

Max Filippov (3):
      xtensa: ISS: don't hang if stdin EOF is reached
      xtensa: fix preemption in {clear,copy}_user_highpage
      xtensa: clear all DBREAKC registers on start

Michael Hennerich (1):
      drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors

Michael Niewoehner (1):
      clk: rockchip: add pclk_cpu to the list of rk3188 critical clocks

Michael S. Tsirkin (1):
      watchdog: rc32434_wdt: fix ioctl error handling

Michal Kazior (2):
      mac80211: fix txq queue related crashes
      mac80211: fix unnecessary frame drops in mesh fwding

Ming Lei (1):
      md: multipath: don't hardcopy bio in .make_request path

NeilBrown (2):
      md/raid5: preserve STRIPE_PREREAD_ACTIVE in break_stripe_batch_list
      sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race

Nikolay Borisov (1):
      quota: Fix possible GPF due to uninitialised pointers

OGAWA Hirofumi (1):
      jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path

Oliver Neukum (5):
      USB: cdc-acm: more sanity checking
      usb: retry reset if a device times out
      usb: hub: fix a typo in hub_port_init() leading to wrong logic
      Input: ims-pcu - sanity check against missing interfaces
      USB: usb_driver_claim_interface: add sanity checking

Or Gerlitz (1):
      net/mlx5: Make command timeout way shorter

Pali Rohár (1):
      ARM: OMAP3: Add cpuidle parameters table for omap3430

Paolo Abeni (1):
      ipv4: fix broadcast packets reception

Paolo Bonzini (2):
      KVM: VMX: avoid guest hang on invalid invept instruction
      KVM: fix spin_lock_init order on x86

Peter Hurley (2):
      tty: Fix GPF in flush_to_ldisc(), part 2
      net: irda: Fix use-after-free in irtty_open()

Peter Zijlstra (1):
      bitops: Do not default to __clear_bit() for __clear_bit_unlock()

Phil Elwell (1):
      pinctrl-bcm2835: Fix cut-and-paste error in "pull" parsing

Philipp Zabel (1):
      [media] coda: fix error path in case of missing pdata on non-DT platform

Rabin Vincent (1):
      splice: handle zero nr_pages in splice_to_pipe()

Radim Krčmář (1):
      KVM: i8254: change PIT discard tick policy

Raghava Aditya Renukunta (2):
      aacraid: Fix RRQ overload
      aacraid: Fix memory leak in aac_fib_map_free

Robert Doebbelin (1):
      fuse: do not use iocb after it may have been freed

Romain Perier (1):
      clk: rockchip: Add pclk_peri to critical clocks on RK3066/RK3188

Russell King (2):
      mmc: sdhci: fix data timeout (part 1)
      mmc: sdhci: fix data timeout (part 2)

Sara Sharon (1):
      mac80211: fix ibss scan parameters

Sebastian Frias (1):
      8250: use callbacks to access UART_DLL/UART_DLM

Sebastian Ott (1):
      s390/pci: enforce fmb page boundary rule

Sergei Shtylyov (1):
      at803x: fix reset handling

Seth Forshee (1):
      fuse: Add reference counting for fuse_io_priv

Shaohua Li (2):
      RAID5: check_reshape() shouldn't call mddev_suspend
      RAID5: revert e9e4c377e2f563 to fix a livelock

Shawn Lin (1):
      clk: rockchip: free memory in error cases when registering clock branches

Spencer E. Olson (1):
      staging: comedi: ni_tiocmd: change mistaken use of start_src for start_arg

Srinivas Kandagatla (1):
      clk: qcom: msm8960: fix ce3_core clk enable register

Stephen Boyd (1):
      clk: qcom: msm8960: Fix ce3_src register offset

Steven Rostedt (Red Hat) (3):
      tracing: Have preempt(irqs)off trace preempt disabled functions
      tracing: Fix crash from reading trace_pipe with sendfile
      tracing: Fix trace_printk() to print when not using bprintk()

Sushaanth Srirangapathi (1):
      fbdev: da8xx-fb: fix videomodes of lcd panels

Takashi Iwai (5):
      ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk()
      ALSA: usb-audio: Add sanity checks for endpoint accesses
      ALSA: hda - Apply reboot D3 fix for CX20724 codec, too
      ALSA: pcm: Avoid "BUG:" string for warnings again
      ALSA: hda - Fix unconditional GPIO toggle via automute

Tejun Heo (2):
      writeback, cgroup: fix premature wb_put() in locked_inode_to_wb_and_lock_list()
      writeback, cgroup: fix use of the wrong bdi_writeback which mismatches the inode

Thomas Gleixner (1):
      sched/cputime: Fix steal time accounting vs. CPU hotplug

Tiffany Lin (1):
      [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32

Tom Lendacky (4):
      crypto: ccp - Add hash state import and export support
      crypto: ccp - Limit the amount of information exported
      crypto: ccp - Don't assume export/import areas are aligned
      crypto: ccp - memset request context to zero during import

Tomas Winkler (1):
      mei: bus: fix drivers and devices names confusion

Tony Luck (1):
      EDAC/sb_edac: Fix computation of channel address

Vasily Kulikov (1):
      include/linux/poison.h: fix LIST_POISON{1,2} offset

Victor Clément (1):
      ALSA: usb-audio: add Microsoft HD-5001 to quirks

Ville Syrjälä (2):
      drm/i915: Workaround CHV pipe C cursor fail
      drm/i915: Cleanup phys status page too

Vinayak Menon (1):
      of: alloc anywhere from memblock if range not specified

Vineet Gupta (1):
      ARC: bitops: Remove non relevant comments

Vittorio Gambaletta (VittGam) (1):
      ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41.

Vladimir Zapolskiy (1):
      staging: android: ion_test: fix check of platform_device_register_simple() error code

Vladis Dronov (1):
      Input: ati_remote2 - fix crashes on detecting device with invalid descriptor

Vlastimil Babka (1):
      mm/page_alloc: prevent merging between isolated and other pageblocks

Xin Long (1):
      sctp: fix the transports round robin issue when init is retransmitted

^ permalink raw reply	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 001/218] crypto: skcipher - Add crypto_skcipher_has_setkey
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 002/218] crypto: algif_skcipher - Add key check exception for cipher_null Kamal Mostafa
                   ` (216 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Herbert Xu, Ben Hutchings, Luis Henriques, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Herbert Xu <herbert@gondor.apana.org.au>

commit a1383cd86a062fc798899ab20f0ec2116cce39cb upstream.

This patch adds a way for skcipher users to determine whether a key
is required by a transform.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.2: add to ablkcipher API instead]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
[kamal: plus bwh http://article.gmane.org/gmane.linux.kernel.stable/169083]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 crypto/ablkcipher.c    | 2 ++
 crypto/blkcipher.c     | 1 +
 include/linux/crypto.h | 8 ++++++++
 3 files changed, 11 insertions(+)

diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index e5b5721..13836be 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -377,6 +377,7 @@ static int crypto_init_ablkcipher_ops(struct crypto_tfm *tfm, u32 type,
 	}
 	crt->base = __crypto_ablkcipher_cast(tfm);
 	crt->ivsize = alg->ivsize;
+	crt->has_setkey = alg->max_keysize;
 
 	return 0;
 }
@@ -458,6 +459,7 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
 	crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
 	crt->base = __crypto_ablkcipher_cast(tfm);
 	crt->ivsize = alg->ivsize;
+	crt->has_setkey = alg->max_keysize;
 
 	return 0;
 }
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index 8cc1622..79978da 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -472,6 +472,7 @@ static int crypto_init_blkcipher_ops_async(struct crypto_tfm *tfm)
 	}
 	crt->base = __crypto_ablkcipher_cast(tfm);
 	crt->ivsize = alg->ivsize;
+	crt->has_setkey = alg->max_keysize;
 
 	return 0;
 }
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 81ef938..ab5f912 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -552,6 +552,7 @@ struct ablkcipher_tfm {
 
 	unsigned int ivsize;
 	unsigned int reqsize;
+	bool has_setkey;
 };
 
 struct blkcipher_tfm {
@@ -922,6 +923,13 @@ static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
 	return crt->setkey(crt->base, key, keylen);
 }
 
+static inline bool crypto_ablkcipher_has_setkey(struct crypto_ablkcipher *tfm)
+{
+	struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
+
+	return crt->has_setkey;
+}
+
 /**
  * crypto_ablkcipher_reqtfm() - obtain cipher handle from request
  * @req: ablkcipher_request out of which the cipher handle is to be obtained
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 002/218] crypto: algif_skcipher - Add key check exception for cipher_null
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 001/218] crypto: skcipher - Add crypto_skcipher_has_setkey Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 003/218] crypto: algif_skcipher - Do not assume that req is unchanged Kamal Mostafa
                   ` (215 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Herbert Xu, Ben Hutchings, Luis Henriques, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Herbert Xu <herbert@gondor.apana.org.au>

commit 6e8d8ecf438792ecf7a3207488fb4eebc4edb040 upstream.

This patch adds an exception to the key check so that cipher_null
users may continue to use algif_skcipher without setting a key.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.2: use crypto_ablkcipher_has_setkey()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 crypto/algif_skcipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 6c0410e..b5d5a35 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -961,7 +961,7 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
 {
 	struct skcipher_tfm *tfm = private;
 
-	if (!tfm->has_key)
+	if (!tfm->has_key && crypto_ablkcipher_has_setkey(tfm->skcipher))
 		return -ENOKEY;
 
 	return skcipher_accept_parent_nokey(private, sk);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 003/218] crypto: algif_skcipher - Do not assume that req is unchanged
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 001/218] crypto: skcipher - Add crypto_skcipher_has_setkey Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 002/218] crypto: algif_skcipher - Add key check exception for cipher_null Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 004/218] crypto: algif_skcipher - Do not dereference ctx without socket lock Kamal Mostafa
                   ` (214 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Herbert Xu <herbert@gondor.apana.org.au>

commit ec69bbfb9902c32a5c1492f2b1b8ad032a66d724 upstream.

The async path in algif_skcipher assumes that the crypto completion
function will be called with the original request.  This is not
necessarily the case.  In fact there is no need for this anyway
since we already embed information into the request with struct
skcipher_async_req.

This patch adds a pointer to that struct and then passes it as
the data to the callback function.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Tadeusz Struk <tadeusz.struk@intel.com>
[ kamal: backport to 4.2-stable: use ablkcipher ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 crypto/algif_skcipher.c | 60 +++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index b5d5a35..1939e60 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -65,18 +65,10 @@ struct skcipher_async_req {
 	struct skcipher_async_rsgl first_sgl;
 	struct list_head list;
 	struct scatterlist *tsg;
-	char iv[];
+	atomic_t *inflight;
+	struct ablkcipher_request req;
 };
 
-#define GET_SREQ(areq, ctx) (struct skcipher_async_req *)((char *)areq + \
-	crypto_ablkcipher_reqsize(crypto_ablkcipher_reqtfm(&ctx->req)))
-
-#define GET_REQ_SIZE(ctx) \
-	crypto_ablkcipher_reqsize(crypto_ablkcipher_reqtfm(&ctx->req))
-
-#define GET_IV_SIZE(ctx) \
-	crypto_ablkcipher_ivsize(crypto_ablkcipher_reqtfm(&ctx->req))
-
 #define MAX_SGL_ENTS ((4096 - sizeof(struct skcipher_sg_list)) / \
 		      sizeof(struct scatterlist) - 1)
 
@@ -102,15 +94,12 @@ static void skcipher_free_async_sgls(struct skcipher_async_req *sreq)
 
 static void skcipher_async_cb(struct crypto_async_request *req, int err)
 {
-	struct sock *sk = req->data;
-	struct alg_sock *ask = alg_sk(sk);
-	struct skcipher_ctx *ctx = ask->private;
-	struct skcipher_async_req *sreq = GET_SREQ(req, ctx);
+	struct skcipher_async_req *sreq = req->data;
 	struct kiocb *iocb = sreq->iocb;
 
-	atomic_dec(&ctx->inflight);
+	atomic_dec(sreq->inflight);
 	skcipher_free_async_sgls(sreq);
-	kfree(req);
+	kzfree(sreq);
 	iocb->ki_complete(iocb, err, err);
 }
 
@@ -509,37 +498,42 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
 {
 	struct sock *sk = sock->sk;
 	struct alg_sock *ask = alg_sk(sk);
+	struct sock *psk = ask->parent;
+	struct alg_sock *pask = alg_sk(psk);
 	struct skcipher_ctx *ctx = ask->private;
+	struct skcipher_tfm *skc = pask->private;
+	struct crypto_ablkcipher *tfm = skc->skcipher;
 	struct skcipher_sg_list *sgl;
 	struct scatterlist *sg;
 	struct skcipher_async_req *sreq;
 	struct ablkcipher_request *req;
 	struct skcipher_async_rsgl *last_rsgl = NULL;
 	unsigned int txbufs = 0, len = 0, tx_nents = skcipher_all_sg_nents(ctx);
-	unsigned int reqlen = sizeof(struct skcipher_async_req) +
-				GET_REQ_SIZE(ctx) + GET_IV_SIZE(ctx);
+	unsigned int reqsize = crypto_ablkcipher_reqsize(tfm);
+	unsigned int ivsize = crypto_ablkcipher_ivsize(tfm);
 	int err = -ENOMEM;
 	bool mark = false;
+	char *iv;
 
-	lock_sock(sk);
-	req = kmalloc(reqlen, GFP_KERNEL);
-	if (unlikely(!req))
-		goto unlock;
+	sreq = kzalloc(sizeof(*sreq) + reqsize + ivsize, GFP_KERNEL);
+	if (unlikely(!sreq))
+		goto out;
 
-	sreq = GET_SREQ(req, ctx);
+	req = &sreq->req;
+	iv = (char *)(req + 1) + reqsize;
 	sreq->iocb = msg->msg_iocb;
-	memset(&sreq->first_sgl, '\0', sizeof(struct skcipher_async_rsgl));
 	INIT_LIST_HEAD(&sreq->list);
+	sreq->inflight = &ctx->inflight;
+
+	lock_sock(sk);
 	sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL);
-	if (unlikely(!sreq->tsg)) {
-		kfree(req);
+	if (unlikely(!sreq->tsg))
 		goto unlock;
-	}
 	sg_init_table(sreq->tsg, tx_nents);
-	memcpy(sreq->iv, ctx->iv, GET_IV_SIZE(ctx));
-	ablkcipher_request_set_tfm(req, crypto_ablkcipher_reqtfm(&ctx->req));
+	memcpy(iv, ctx->iv, ivsize);
+	ablkcipher_request_set_tfm(req, tfm);
 	ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP,
-					skcipher_async_cb, sk);
+				        skcipher_async_cb, sreq);
 
 	while (iov_iter_count(&msg->msg_iter)) {
 		struct skcipher_async_rsgl *rsgl;
@@ -615,20 +609,22 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
 		sg_mark_end(sreq->tsg + txbufs - 1);
 
 	ablkcipher_request_set_crypt(req, sreq->tsg, sreq->first_sgl.sgl.sg,
-				     len, sreq->iv);
+				     len, iv);
 	err = ctx->enc ? crypto_ablkcipher_encrypt(req) :
 			 crypto_ablkcipher_decrypt(req);
 	if (err == -EINPROGRESS) {
 		atomic_inc(&ctx->inflight);
 		err = -EIOCBQUEUED;
+		sreq = NULL;
 		goto unlock;
 	}
 free:
 	skcipher_free_async_sgls(sreq);
-	kfree(req);
 unlock:
 	skcipher_wmem_wakeup(sk);
 	release_sock(sk);
+	kzfree(sreq);
+out:
 	return err;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 004/218] crypto: algif_skcipher - Do not dereference ctx without socket lock
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (2 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 003/218] crypto: algif_skcipher - Do not assume that req is unchanged Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 005/218] gpiolib: do not allow to insert an empty gpiochip Kamal Mostafa
                   ` (213 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Herbert Xu <herbert@gondor.apana.org.au>

commit 6454c2b83f719057069777132b13949e4c6b6350 upstream.

Any access to non-constant bits of the private context must be
done under the socket lock, in particular, this includes ctx->req.

This patch moves such accesses under the lock, and fetches the
tfm from the parent socket which is guaranteed to be constant,
rather than from ctx->req.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[ kamal: backport to 4.2-stable: use ablkcipher ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 crypto/algif_skcipher.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
index 1939e60..42e497d 100644
--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -295,8 +295,11 @@ static int skcipher_sendmsg(struct socket *sock, struct msghdr *msg,
 {
 	struct sock *sk = sock->sk;
 	struct alg_sock *ask = alg_sk(sk);
+	struct sock *psk = ask->parent;
+	struct alg_sock *pask = alg_sk(psk);
 	struct skcipher_ctx *ctx = ask->private;
-	struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(&ctx->req);
+	struct skcipher_tfm *skc = pask->private;
+	struct crypto_ablkcipher *tfm = skc->skcipher;
 	unsigned ivsize = crypto_ablkcipher_ivsize(tfm);
 	struct skcipher_sg_list *sgl;
 	struct af_alg_control con = {};
@@ -508,7 +511,7 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
 	struct skcipher_async_req *sreq;
 	struct ablkcipher_request *req;
 	struct skcipher_async_rsgl *last_rsgl = NULL;
-	unsigned int txbufs = 0, len = 0, tx_nents = skcipher_all_sg_nents(ctx);
+	unsigned int txbufs = 0, len = 0, tx_nents;
 	unsigned int reqsize = crypto_ablkcipher_reqsize(tfm);
 	unsigned int ivsize = crypto_ablkcipher_ivsize(tfm);
 	int err = -ENOMEM;
@@ -526,6 +529,7 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
 	sreq->inflight = &ctx->inflight;
 
 	lock_sock(sk);
+	tx_nents = skcipher_all_sg_nents(ctx);
 	sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL);
 	if (unlikely(!sreq->tsg))
 		goto unlock;
@@ -633,9 +637,12 @@ static int skcipher_recvmsg_sync(struct socket *sock, struct msghdr *msg,
 {
 	struct sock *sk = sock->sk;
 	struct alg_sock *ask = alg_sk(sk);
+	struct sock *psk = ask->parent;
+	struct alg_sock *pask = alg_sk(psk);
 	struct skcipher_ctx *ctx = ask->private;
-	unsigned bs = crypto_ablkcipher_blocksize(crypto_ablkcipher_reqtfm(
-		&ctx->req));
+	struct skcipher_tfm *skc = pask->private;
+	struct crypto_ablkcipher *tfm = skc->skcipher;
+	unsigned bs = crypto_ablkcipher_blocksize(tfm);
 	struct skcipher_sg_list *sgl;
 	struct scatterlist *sg;
 	int err = -EAGAIN;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 005/218] gpiolib: do not allow to insert an empty gpiochip
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (3 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 004/218] crypto: algif_skcipher - Do not dereference ctx without socket lock Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 006/218] gpio: add a data pointer to gpio_chip Kamal Mostafa
                   ` (212 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bamvor Jian Zhang, Linus Walleij, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

commit 5ed41cc4baaf4127661d2a8f8f2ee6e3085e0fa9 upstream.

We need to check if number of gpio is positive if there is no
such check in devicetree or acpi or whatever called before
gpiochip_add.

I suppose that devicetree and acpi do not allow insert gpiochip
with zero number but I do not know if it is enough to ignore
this check in gpiochip_add.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[ kamal: 4.2-stable prereq ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpio/gpiolib.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index bf4bd1d..3144d19 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -247,6 +247,11 @@ int gpiochip_add(struct gpio_chip *chip)
 	if (!descs)
 		return -ENOMEM;
 
+	if (chip->ngpio == 0) {
+		chip_err(chip, "tried to insert a GPIO chip with zero lines\n");
+		return -EINVAL;
+	}
+
 	spin_lock_irqsave(&gpio_lock, flags);
 
 	if (base < 0) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 006/218] gpio: add a data pointer to gpio_chip
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (4 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 005/218] gpiolib: do not allow to insert an empty gpiochip Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts Kamal Mostafa
                   ` (211 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Linus Walleij, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Linus Walleij <linus.walleij@linaro.org>

commit b08ea35a3296ee25c4cb53a977b752266dafa2c2 upstream.

This adds a void * pointer to gpio_chip so that driver can
assign and retrieve some states. This is done to get rid of
container_of() calls for gpio_chips embedded inside state
containers, so we can remove the need to have the gpio_chip
or later (planned) struct gpio_device be dynamically allocated
at registration time, so that its struct device can be properly
reference counted and not bound to its parent device (e.g.
a platform_device) but instead live on after unregistration
if it is opened by e.g. a char device or sysfs.

The data is added with the new function gpiochip_add_data()
and for compatibility we add static inline wrapper function
gpiochip_add() that will call gpiochip_add_data() with
NULL as argument. The latter will be removed once we have
exorcised gpiochip_add() from the kernel.

gpiochip_get_data() is added as a static inline accessor
for drivers to quickly get their data out.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[ kamal: 4.2-stable prereq ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpio/gpiolib.c      | 10 ++++++----
 include/linux/gpio/driver.h | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3144d19..27c5079d 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -219,7 +219,7 @@ static int gpiochip_add_to_list(struct gpio_chip *chip)
 }
 
 /**
- * gpiochip_add() - register a gpio_chip
+ * gpiochip_add_data() - register a gpio_chip
  * @chip: the chip to register, with chip->base initialized
  * Context: potentially before irqs will work
  *
@@ -227,7 +227,7 @@ static int gpiochip_add_to_list(struct gpio_chip *chip)
  * because the chip->base is invalid or already associated with a
  * different chip.  Otherwise it returns zero as a success code.
  *
- * When gpiochip_add() is called very early during boot, so that GPIOs
+ * When gpiochip_add_data() is called very early during boot, so that GPIOs
  * can be freely used, the chip->dev device must be registered before
  * the gpio framework's arch_initcall().  Otherwise sysfs initialization
  * for GPIOs will fail rudely.
@@ -235,7 +235,7 @@ static int gpiochip_add_to_list(struct gpio_chip *chip)
  * If chip->base is negative, this requests dynamic assignment of
  * a range of valid GPIOs.
  */
-int gpiochip_add(struct gpio_chip *chip)
+int gpiochip_add_data(struct gpio_chip *chip, void *data)
 {
 	unsigned long	flags;
 	int		status = 0;
@@ -247,6 +247,8 @@ int gpiochip_add(struct gpio_chip *chip)
 	if (!descs)
 		return -ENOMEM;
 
+	chip->data = data;
+
 	if (chip->ngpio == 0) {
 		chip_err(chip, "tried to insert a GPIO chip with zero lines\n");
 		return -EINVAL;
@@ -322,7 +324,7 @@ err_free_descs:
 		chip->label ? : "generic");
 	return status;
 }
-EXPORT_SYMBOL_GPL(gpiochip_add);
+EXPORT_SYMBOL_GPL(gpiochip_add_data);
 
 /**
  * gpiochip_remove() - unregister a gpio_chip
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index c8393cd..f819425 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -22,6 +22,7 @@ struct seq_file;
  * @dev: optional device providing the GPIOs
  * @cdev: class device used by sysfs interface (may be NULL)
  * @owner: helps prevent removal of modules exporting active GPIOs
+ * @data: per-instance data assigned by the driver
  * @list: links gpio_chips together for traversal
  * @request: optional hook for chip-specific activation, such as
  *	enabling module power and clock; may sleep
@@ -80,6 +81,7 @@ struct gpio_chip {
 	struct device		*dev;
 	struct device		*cdev;
 	struct module		*owner;
+	void			*data;
 	struct list_head        list;
 
 	int			(*request)(struct gpio_chip *chip,
@@ -153,7 +155,11 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
 			unsigned offset);
 
 /* add/remove chips */
-extern int gpiochip_add(struct gpio_chip *chip);
+extern int gpiochip_add_data(struct gpio_chip *chip, void *data);
+static inline int gpiochip_add(struct gpio_chip *chip)
+{
+	return gpiochip_add_data(chip, NULL);
+}
 extern void gpiochip_remove(struct gpio_chip *chip);
 extern struct gpio_chip *gpiochip_find(void *data,
 			      int (*match)(struct gpio_chip *chip, void *data));
@@ -162,6 +168,12 @@ extern struct gpio_chip *gpiochip_find(void *data,
 int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset);
 void gpiochip_unlock_as_irq(struct gpio_chip *chip, unsigned int offset);
 
+/* get driver data */
+static inline void *gpiochip_get_data(struct gpio_chip *chip)
+{
+	return chip->data;
+}
+
 struct gpio_chip *gpiod_to_chip(const struct gpio_desc *desc);
 
 #ifdef CONFIG_GPIOLIB_IRQCHIP
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (5 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 006/218] gpio: add a data pointer to gpio_chip Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-05-03  6:58   ` Geert Uytterhoeven
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 008/218] ipv4: Don't do expensive useless work during inetdev destroy Kamal Mostafa
                   ` (210 subsequent siblings)
  217 siblings, 1 reply; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Geert Uytterhoeven, Linus Walleij, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit b26a719bdba9aa926ceaadecc66e07623d2b8a53 upstream.

The R-Car GPIO driver handles Runtime PM for requested GPIOs only.

When using a GPIO purely as an interrupt source, no Runtime PM handling
is done, and the GPIO module's clock may not be enabled.

To fix this:
  - Add .irq_request_resources() and .irq_release_resources() callbacks
    to handle Runtime PM when an interrupt is requested,
  - Add irq_bus_lock() and sync_unlock() callbacks to handle Runtime PM
    when e.g. disabling/enabling an interrupt, or configuring the
    interrupt type.

Fixes: d5c3d84657db57bd "net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS"
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpio/gpio-rcar.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1e14a6c..3c75e81 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -200,6 +200,44 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
 	return 0;
 }
 
+static void gpio_rcar_irq_bus_lock(struct irq_data *d)
+{
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct gpio_rcar_priv *p = gpiochip_get_data(gc);
+
+	pm_runtime_get_sync(&p->pdev->dev);
+}
+
+static void gpio_rcar_irq_bus_sync_unlock(struct irq_data *d)
+{
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct gpio_rcar_priv *p = gpiochip_get_data(gc);
+
+	pm_runtime_put(&p->pdev->dev);
+}
+
+
+static int gpio_rcar_irq_request_resources(struct irq_data *d)
+{
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct gpio_rcar_priv *p = gpiochip_get_data(gc);
+	int error;
+
+	error = pm_runtime_get_sync(&p->pdev->dev);
+	if (error < 0)
+		return error;
+
+	return 0;
+}
+
+static void gpio_rcar_irq_release_resources(struct irq_data *d)
+{
+	struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+	struct gpio_rcar_priv *p = gpiochip_get_data(gc);
+
+	pm_runtime_put(&p->pdev->dev);
+}
+
 static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
 {
 	struct gpio_rcar_priv *p = dev_id;
@@ -442,6 +480,10 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 	irq_chip->irq_unmask = gpio_rcar_irq_enable;
 	irq_chip->irq_set_type = gpio_rcar_irq_set_type;
 	irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
+	irq_chip->irq_bus_lock = gpio_rcar_irq_bus_lock;
+	irq_chip->irq_bus_sync_unlock = gpio_rcar_irq_bus_sync_unlock;
+	irq_chip->irq_request_resources = gpio_rcar_irq_request_resources;
+	irq_chip->irq_release_resources = gpio_rcar_irq_release_resources;
 	irq_chip->flags	= IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
 
 	ret = gpiochip_add(gpio_chip);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 008/218] ipv4: Don't do expensive useless work during inetdev destroy.
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (6 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 009/218] Input: powermate - fix oops with malicious USB descriptors Kamal Mostafa
                   ` (209 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "David S. Miller" <davem@davemloft.net>

commit fbd40ea0180a2d328c5adc61414dc8bab9335ce2 upstream.

When an inetdev is destroyed, every address assigned to the interface
is removed.  And in this scenerio we do two pointless things which can
be very expensive if the number of assigned interfaces is large:

1) Address promotion.  We are deleting all addresses, so there is no
   point in doing this.

2) A full nf conntrack table purge for every address.  We only need to
   do this once, as is already caught by the existing
   masq_dev_notifier so masq_inet_event() can skip this.

Reported-by: Solar Designer <solar@openwall.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/devinet.c                          |  4 ++++
 net/ipv4/fib_frontend.c                     |  4 ++++
 net/ipv4/netfilter/nf_nat_masquerade_ipv4.c | 12 ++++++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 0420012..eb1ff7c 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -334,6 +334,9 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
 
 	ASSERT_RTNL();
 
+	if (in_dev->dead)
+		goto no_promotions;
+
 	/* 1. Deleting primary ifaddr forces deletion all secondaries
 	 * unless alias promotion is set
 	 **/
@@ -380,6 +383,7 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap,
 			fib_del_ifaddr(ifa, ifa1);
 	}
 
+no_promotions:
 	/* 2. Unlink it */
 
 	*ifap = ifa1->ifa_next;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d7116cf..fb963ae 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -876,6 +876,9 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim)
 		subnet = 1;
 	}
 
+	if (in_dev->dead)
+		goto no_promotions;
+
 	/* Deletion is more complicated than add.
 	 * We should take care of not to delete too much :-)
 	 *
@@ -951,6 +954,7 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim)
 		}
 	}
 
+no_promotions:
 	if (!(ok & BRD_OK))
 		fib_magic(RTM_DELROUTE, RTN_BROADCAST, ifa->ifa_broadcast, 32, prim);
 	if (subnet && ifa->ifa_prefixlen < 31) {
diff --git a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
index c6eb421..ea91058 100644
--- a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
+++ b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
@@ -108,10 +108,18 @@ static int masq_inet_event(struct notifier_block *this,
 			   unsigned long event,
 			   void *ptr)
 {
-	struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+	struct in_device *idev = ((struct in_ifaddr *)ptr)->ifa_dev;
 	struct netdev_notifier_info info;
 
-	netdev_notifier_info_init(&info, dev);
+	/* The masq_dev_notifier will catch the case of the device going
+	 * down.  So if the inetdev is dead and being destroyed we have
+	 * no work to do.  Otherwise this is an individual address removal
+	 * and we have to perform the flush.
+	 */
+	if (idev->dead)
+		return NOTIFY_DONE;
+
+	netdev_notifier_info_init(&info, idev->dev);
 	return masq_device_event(this, event, &info);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 009/218] Input: powermate - fix oops with malicious USB descriptors
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (7 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 008/218] ipv4: Don't do expensive useless work during inetdev destroy Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 010/218] USB: iowarrior: " Kamal Mostafa
                   ` (208 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Josh Boyer, Dmitry Torokhov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Josh Boyer <jwboyer@fedoraproject.org>

commit 9c6ba456711687b794dcf285856fc14e2c76074f upstream.

The powermate driver expects at least one valid USB endpoint in its
probe function.  If given malicious descriptors that specify 0 for
the number of endpoints, it will crash.  Validate the number of
endpoints on the interface before using them.

The full report for this issue can be found here:
http://seclists.org/bugtraq/2016/Mar/85

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/misc/powermate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 63b539d..84909a1 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -307,6 +307,9 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
 	int error = -ENOMEM;
 
 	interface = intf->cur_altsetting;
+	if (interface->desc.bNumEndpoints < 1)
+		return -EINVAL;
+
 	endpoint = &interface->endpoint[0].desc;
 	if (!usb_endpoint_is_int_in(endpoint))
 		return -EIO;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 010/218] USB: iowarrior: fix oops with malicious USB descriptors
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (8 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 009/218] Input: powermate - fix oops with malicious USB descriptors Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 011/218] ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk() Kamal Mostafa
                   ` (207 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Josh Boyer, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Josh Boyer <jwboyer@fedoraproject.org>

commit 4ec0ef3a82125efc36173062a50624550a900ae0 upstream.

The iowarrior driver expects at least one valid endpoint.  If given
malicious descriptors that specify 0 for the number of endpoints,
it will crash in the probe function.  Ensure there is at least
one endpoint on the interface before using it.

The full report of this issue can be found here:
http://seclists.org/bugtraq/2016/Mar/87

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/misc/iowarrior.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index c6bfd13..1950e87 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -787,6 +787,12 @@ static int iowarrior_probe(struct usb_interface *interface,
 	iface_desc = interface->cur_altsetting;
 	dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
 
+	if (iface_desc->desc.bNumEndpoints < 1) {
+		dev_err(&interface->dev, "Invalid number of endpoints\n");
+		retval = -EINVAL;
+		goto error;
+	}
+
 	/* set up the endpoint information */
 	for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
 		endpoint = &iface_desc->endpoint[i].desc;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 011/218] ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (9 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 010/218] USB: iowarrior: " Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 012/218] ALSA: usb-audio: Add sanity checks for endpoint accesses Kamal Mostafa
                   ` (206 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Takashi Iwai <tiwai@suse.de>

commit 0f886ca12765d20124bd06291c82951fd49a33be upstream.

create_fixed_stream_quirk() may cause a NULL-pointer dereference by
accessing the non-existing endpoint when a USB device with a malformed
USB descriptor is used.

This patch avoids it simply by adding a sanity check of bNumEndpoints
before the accesses.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/quirks.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index a4d03e5..47751f0 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -177,6 +177,12 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
 	}
 	alts = &iface->altsetting[fp->altset_idx];
 	altsd = get_iface_desc(alts);
+	if (altsd->bNumEndpoints < 1) {
+		kfree(fp);
+		kfree(rate_table);
+		return -EINVAL;
+	}
+
 	fp->protocol = altsd->bInterfaceProtocol;
 
 	if (fp->datainterval == 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 012/218] ALSA: usb-audio: Add sanity checks for endpoint accesses
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (10 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 011/218] ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk() Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 013/218] include/linux/poison.h: fix LIST_POISON{1,2} offset Kamal Mostafa
                   ` (205 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Takashi Iwai <tiwai@suse.de>

commit 447d6275f0c21f6cc97a88b3a0c601436a4cdf2a upstream.

Add some sanity check codes before actually accessing the endpoint via
get_endpoint() in order to avoid the invalid access through a
malformed USB descriptor.  Mostly just checking bNumEndpoints, but in
one place (snd_microii_spdif_default_get()), the validity of iface and
altsetting index is checked as well.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/clock.c        | 2 ++
 sound/usb/endpoint.c     | 3 +++
 sound/usb/mixer_quirks.c | 4 ++++
 sound/usb/pcm.c          | 2 ++
 4 files changed, 11 insertions(+)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 2ed260b..7ccbcaf 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -285,6 +285,8 @@ static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,
 	unsigned char data[3];
 	int err, crate;
 
+	if (get_iface_desc(alts)->bNumEndpoints < 1)
+		return -EINVAL;
 	ep = get_endpoint(alts, 0)->bEndpointAddress;
 
 	/* if endpoint doesn't have sampling rate control, bail out */
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 03b0744..e7f470a 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -413,6 +413,9 @@ exit_clear:
  *
  * New endpoints will be added to chip->ep_list and must be freed by
  * calling snd_usb_endpoint_free().
+ *
+ * For SND_USB_ENDPOINT_TYPE_SYNC, the caller needs to guarantee that
+ * bNumEndpoints > 1 beforehand.
  */
 struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
 					      struct usb_host_interface *alts,
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index db9547d..f8ffcda4 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1532,7 +1532,11 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol,
 
 	/* use known values for that card: interface#1 altsetting#1 */
 	iface = usb_ifnum_to_if(chip->dev, 1);
+	if (!iface || iface->num_altsetting < 2)
+		return -EINVAL;
 	alts = &iface->altsetting[1];
+	if (get_iface_desc(alts)->bNumEndpoints < 1)
+		return -EINVAL;
 	ep = get_endpoint(alts, 0)->bEndpointAddress;
 
 	err = snd_usb_ctl_msg(chip->dev,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index b4ef410..cbb9325 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -159,6 +159,8 @@ static int init_pitch_v1(struct snd_usb_audio *chip, int iface,
 	unsigned char data[1];
 	int err;
 
+	if (get_iface_desc(alts)->bNumEndpoints < 1)
+		return -EINVAL;
 	ep = get_endpoint(alts, 0)->bEndpointAddress;
 
 	data[0] = 1;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 013/218] include/linux/poison.h: fix LIST_POISON{1,2} offset
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (11 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 012/218] ALSA: usb-audio: Add sanity checks for endpoint accesses Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 014/218] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Kamal Mostafa
                   ` (204 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vasily Kulikov, Solar Designer, Thomas Gleixner,
	Kirill A. Shutemov, Andrew Morton, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Vasily Kulikov <segoon@openwall.com>

commit 8a5e5e02fc83aaf67053ab53b359af08c6c49aaf upstream.

Poison pointer values should be small enough to find a room in
non-mmap'able/hardly-mmap'able space.  E.g.  on x86 "poison pointer space"
is located starting from 0x0.  Given unprivileged users cannot mmap
anything below mmap_min_addr, it should be safe to use poison pointers
lower than mmap_min_addr.

The current poison pointer values of LIST_POISON{1,2} might be too big for
mmap_min_addr values equal or less than 1 MB (common case, e.g.  Ubuntu
uses only 0x10000).  There is little point to use such a big value given
the "poison pointer space" below 1 MB is not yet exhausted.  Changing it
to a smaller value solves the problem for small mmap_min_addr setups.

The values are suggested by Solar Designer:
http://www.openwall.com/lists/oss-security/2015/05/02/6

Signed-off-by: Vasily Kulikov <segoon@openwall.com>
Cc: Solar Designer <solar@openwall.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/poison.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/poison.h b/include/linux/poison.h
index 2110a81..253c9b4 100644
--- a/include/linux/poison.h
+++ b/include/linux/poison.h
@@ -19,8 +19,8 @@
  * under normal circumstances, used to verify that nobody uses
  * non-initialized list entries.
  */
-#define LIST_POISON1  ((void *) 0x00100100 + POISON_POINTER_DELTA)
-#define LIST_POISON2  ((void *) 0x00200200 + POISON_POINTER_DELTA)
+#define LIST_POISON1  ((void *) 0x100 + POISON_POINTER_DELTA)
+#define LIST_POISON2  ((void *) 0x200 + POISON_POINTER_DELTA)
 
 /********** include/linux/timer.h **********/
 /*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 014/218] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (12 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 013/218] include/linux/poison.h: fix LIST_POISON{1,2} offset Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 015/218] USB: cdc-acm: more sanity checking Kamal Mostafa
                   ` (203 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vladis Dronov, Dmitry Torokhov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Vladis Dronov <vdronov@redhat.com>

commit 950336ba3e4a1ffd2ca60d29f6ef386dd2c7351d upstream.

The ati_remote2 driver expects at least two interfaces with one
endpoint each. If given malicious descriptor that specify one
interface or no endpoints, it will crash in the probe function.
Ensure there is at least two interfaces and one endpoint for each
interface before using it.

The full disclosure: http://seclists.org/bugtraq/2016/Mar/90

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/misc/ati_remote2.c | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index cfd58e8..1c5914c 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -817,26 +817,49 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 
 	ar2->udev = udev;
 
+	/* Sanity check, first interface must have an endpoint */
+	if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) {
+		dev_err(&interface->dev,
+			"%s(): interface 0 must have an endpoint\n", __func__);
+		r = -ENODEV;
+		goto fail1;
+	}
 	ar2->intf[0] = interface;
 	ar2->ep[0] = &alt->endpoint[0].desc;
 
+	/* Sanity check, the device must have two interfaces */
 	ar2->intf[1] = usb_ifnum_to_if(udev, 1);
+	if ((udev->actconfig->desc.bNumInterfaces < 2) || !ar2->intf[1]) {
+		dev_err(&interface->dev, "%s(): need 2 interfaces, found %d\n",
+			__func__, udev->actconfig->desc.bNumInterfaces);
+		r = -ENODEV;
+		goto fail1;
+	}
+
 	r = usb_driver_claim_interface(&ati_remote2_driver, ar2->intf[1], ar2);
 	if (r)
 		goto fail1;
+
+	/* Sanity check, second interface must have an endpoint */
 	alt = ar2->intf[1]->cur_altsetting;
+	if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) {
+		dev_err(&interface->dev,
+			"%s(): interface 1 must have an endpoint\n", __func__);
+		r = -ENODEV;
+		goto fail2;
+	}
 	ar2->ep[1] = &alt->endpoint[0].desc;
 
 	r = ati_remote2_urb_init(ar2);
 	if (r)
-		goto fail2;
+		goto fail3;
 
 	ar2->channel_mask = channel_mask;
 	ar2->mode_mask = mode_mask;
 
 	r = ati_remote2_setup(ar2, ar2->channel_mask);
 	if (r)
-		goto fail2;
+		goto fail3;
 
 	usb_make_path(udev, ar2->phys, sizeof(ar2->phys));
 	strlcat(ar2->phys, "/input0", sizeof(ar2->phys));
@@ -845,11 +868,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 
 	r = sysfs_create_group(&udev->dev.kobj, &ati_remote2_attr_group);
 	if (r)
-		goto fail2;
+		goto fail3;
 
 	r = ati_remote2_input_init(ar2);
 	if (r)
-		goto fail3;
+		goto fail4;
 
 	usb_set_intfdata(interface, ar2);
 
@@ -857,10 +880,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d
 
 	return 0;
 
- fail3:
+ fail4:
 	sysfs_remove_group(&udev->dev.kobj, &ati_remote2_attr_group);
- fail2:
+ fail3:
 	ati_remote2_urb_cleanup(ar2);
+ fail2:
 	usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]);
  fail1:
 	kfree(ar2);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 015/218] USB: cdc-acm: more sanity checking
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (13 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 014/218] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 016/218] drm/i915: Workaround CHV pipe C cursor fail Kamal Mostafa
                   ` (202 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Oliver Neukum <oneukum@suse.com>

commit 8835ba4a39cf53f705417b3b3a94eb067673f2c9 upstream.

An attack has become available which pretends to be a quirky
device circumventing normal sanity checks and crashes the kernel
by an insufficient number of interfaces. This patch adds a check
to the code path for quirky devices.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/class/cdc-acm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index fa4e239..d37fdcc 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1114,6 +1114,9 @@ static int acm_probe(struct usb_interface *intf,
 	if (quirks == NO_UNION_NORMAL) {
 		data_interface = usb_ifnum_to_if(usb_dev, 1);
 		control_interface = usb_ifnum_to_if(usb_dev, 0);
+		/* we would crash */
+		if (!data_interface || !control_interface)
+			return -ENODEV;
 		goto skip_normal_probe;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 016/218] drm/i915: Workaround CHV pipe C cursor fail
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (14 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 015/218] USB: cdc-acm: more sanity checking Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 017/218] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Kamal Mostafa
                   ` (201 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jason Plum, Ville Syrjälä, Daniel Vetter, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>

commit b29ec92c4f5e6d45d8bae8194e664427a01c6687 upstream.

Turns out CHV pipe C was glued on somewhat poorly, and there's something
wrong with the cursor. If the cursor straddles the left screen edge,
and is then moved away from the edge or disabled, the pipe will often
underrun. If enough underruns are triggered quickly enough the pipe
will fall over and die (it just scans out a solid color and reports
a constant underrun). We need to turn the disp2d power well off and
on again to recover the pipe.

None of that is very nice for the user, so let's just refuse to place
the cursor in the compromised position. The ddx appears to fall back
to swcursor when the ioctl returns an error, so theoretically there's
no loss of functionality for the user (discounting swcursor bugs).
I suppose most cursors images actually have the hotspot not exactly
at 0,0 so under typical conditions the fallback will in fact kick in
as soon as the cursor touches the left edge of the screen.

Any atomic compositor should anyway be prepared to fall back to
GPU composition when things don't work out, so there should be no
problem with those.

Other things that I tried to solve this include flipping all
display related clock gating knobs I could find, increasing the
minimum gtt alignment all the way up to 512k. I also tried to see
if there are more specific screen coordinates that hit the bug, but
the findings were somewhat inconclusive. Sometimes the failures
happen almost across the whole left edge, sometimes more at the very
top and around the bottom half. I wasn't able to find any real pattern
to these variations, so it seems our only choice is to just refuse
to straddle the left screen edge at all.

Cc: Jason Plum <max@warheads.net>
Testcase: igt/kms_chv_cursor_fail
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92826
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1450459479-16286-1-git-send-email-ville.syrjala@linux.intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ kamal: backport to 4.2-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/intel_display.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7063016..03b1fed 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13565,6 +13565,7 @@ intel_check_cursor_plane(struct drm_plane *plane,
 	const struct drm_rect *clip = &state->clip;
 	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 	struct intel_crtc *intel_crtc;
+	enum pipe pipe = to_intel_plane(plane)->pipe;
 	unsigned stride;
 	int ret;
 
@@ -13602,6 +13603,22 @@ intel_check_cursor_plane(struct drm_plane *plane,
 		ret = -EINVAL;
 	}
 
+	/*
+	 * There's something wrong with the cursor on CHV pipe C.
+	 * If it straddles the left edge of the screen then
+	 * moving it away from the edge or disabling it often
+	 * results in a pipe underrun, and often that can lead to
+	 * dead pipe (constant underrun reported, and it scans
+	 * out just a solid color). To recover from that, the
+	 * display power well must be turned off and on again.
+	 * Refuse the put the cursor into that compromised position.
+	 */
+	if (IS_CHERRYVIEW(plane->dev) && pipe == PIPE_C &&
+	    state->visible && state->base.crtc_x < 0) {
+		DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
+		ret = -EINVAL;
+	}
+
 finish:
 	if (intel_crtc->active) {
 		if (plane->state->crtc_w != state->base.crtc_w)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 017/218] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (15 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 016/218] drm/i915: Workaround CHV pipe C cursor fail Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 018/218] crypto: ccp - Add hash state import and export support Kamal Mostafa
                   ` (200 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Aravind Gopalakrishnan, linux-edac,
	Borislav Petkov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 6f3508f61c814ee852c199988a62bd954c50dfc1 upstream.

dct_sel_base_off is declared as a u64 but we're only using the lower 32
bits because of a shift wrapping bug. This can possibly truncate the
upper 16 bits of DctSelBaseOffset[47:26], causing us to misdecode the CS
row.

Fixes: c8e518d5673d ('amd64_edac: Sanitize f10_get_base_addr_offset')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/20160120095451.GB19898@mwanda
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/edac/amd64_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 73aea40..8fbae8c 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -1437,7 +1437,7 @@ static u64 f1x_get_norm_dct_addr(struct amd64_pvt *pvt, u8 range,
 	u64 chan_off;
 	u64 dram_base		= get_dram_base(pvt, range);
 	u64 hole_off		= f10_dhar_offset(pvt);
-	u64 dct_sel_base_off	= (pvt->dct_sel_hi & 0xFFFFFC00) << 16;
+	u64 dct_sel_base_off	= (u64)(pvt->dct_sel_hi & 0xFFFFFC00) << 16;
 
 	if (hi_rng) {
 		/*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 018/218] crypto: ccp - Add hash state import and export support
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (16 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 017/218] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 019/218] clk: rockchip: add pclk_cpu to the list of rk3188 critical clocks Kamal Mostafa
                   ` (199 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tom Lendacky, Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tom Lendacky <thomas.lendacky@amd.com>

commit 952bce9792e6bf36fda09c2e5718abb5d9327369 upstream.

Commit 8996eafdcbad ("crypto: ahash - ensure statesize is non-zero")
added a check to prevent ahash algorithms from successfully registering
if the import and export functions were not implemented. This prevents
an oops in the hash_accept function of algif_hash. This commit causes
the ccp-crypto module SHA support and AES CMAC support from successfully
registering and causing the ccp-crypto module load to fail because the
ahash import and export functions are not implemented.

Update the CCP Crypto API support to provide import and export support
for ahash algorithms.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 23 +++++++++++++++++++++++
 drivers/crypto/ccp/ccp-crypto-sha.c      | 23 +++++++++++++++++++++++
 2 files changed, 46 insertions(+)

diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
index ea7e844..3b6fd1f 100644
--- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
+++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
@@ -202,6 +202,26 @@ static int ccp_aes_cmac_digest(struct ahash_request *req)
 	return ccp_aes_cmac_finup(req);
 }
 
+static int ccp_aes_cmac_export(struct ahash_request *req, void *out)
+{
+	struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
+	struct ccp_aes_cmac_req_ctx *state = out;
+
+	*state = *rctx;
+
+	return 0;
+}
+
+static int ccp_aes_cmac_import(struct ahash_request *req, const void *in)
+{
+	struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
+	const struct ccp_aes_cmac_req_ctx *state = in;
+
+	*rctx = *state;
+
+	return 0;
+}
+
 static int ccp_aes_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,
 			       unsigned int key_len)
 {
@@ -334,10 +354,13 @@ int ccp_register_aes_cmac_algs(struct list_head *head)
 	alg->final = ccp_aes_cmac_final;
 	alg->finup = ccp_aes_cmac_finup;
 	alg->digest = ccp_aes_cmac_digest;
+	alg->export = ccp_aes_cmac_export;
+	alg->import = ccp_aes_cmac_import;
 	alg->setkey = ccp_aes_cmac_setkey;
 
 	halg = &alg->halg;
 	halg->digestsize = AES_BLOCK_SIZE;
+	halg->statesize = sizeof(struct ccp_aes_cmac_req_ctx);
 
 	base = &halg->base;
 	snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "cmac(aes)");
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
index 507b34e..1747fbe 100644
--- a/drivers/crypto/ccp/ccp-crypto-sha.c
+++ b/drivers/crypto/ccp/ccp-crypto-sha.c
@@ -194,6 +194,26 @@ static int ccp_sha_digest(struct ahash_request *req)
 	return ccp_sha_finup(req);
 }
 
+static int ccp_sha_export(struct ahash_request *req, void *out)
+{
+	struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
+	struct ccp_sha_req_ctx *state = out;
+
+	*state = *rctx;
+
+	return 0;
+}
+
+static int ccp_sha_import(struct ahash_request *req, const void *in)
+{
+	struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
+	const struct ccp_sha_req_ctx *state = in;
+
+	*rctx = *state;
+
+	return 0;
+}
+
 static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key,
 			  unsigned int key_len)
 {
@@ -390,9 +410,12 @@ static int ccp_register_sha_alg(struct list_head *head,
 	alg->final = ccp_sha_final;
 	alg->finup = ccp_sha_finup;
 	alg->digest = ccp_sha_digest;
+	alg->export = ccp_sha_export;
+	alg->import = ccp_sha_import;
 
 	halg = &alg->halg;
 	halg->digestsize = def->digest_size;
+	halg->statesize = sizeof(struct ccp_sha_req_ctx);
 
 	base = &halg->base;
 	snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 019/218] clk: rockchip: add pclk_cpu to the list of rk3188 critical clocks
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (17 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 018/218] crypto: ccp - Add hash state import and export support Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 020/218] clk: rockchip: Add pclk_peri to critical clocks on RK3066/RK3188 Kamal Mostafa
                   ` (198 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Niewoehner, Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Michael Niewoehner <linux@mniewoehner.de>

commit 1166160ab531198f7abc773992c0e04d0f9b7600 upstream.

pclk_cpu needs to keep running because it is needed for devices like
the act8865 regulator but with the recent gpio clock handling this is
not always the case anymore. So add it to the list of critical clocks.

Signed-off-by: Michael Niewoehner <linux@mniewoehner.de>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/rockchip/clk-rk3188.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c
index e4f9d47..1c93229 100644
--- a/drivers/clk/rockchip/clk-rk3188.c
+++ b/drivers/clk/rockchip/clk-rk3188.c
@@ -708,6 +708,7 @@ static const char *const rk3188_critical_clocks[] __initconst = {
 	"aclk_cpu",
 	"aclk_peri",
 	"hclk_peri",
+	"pclk_cpu",
 };
 
 static void __init rk3188_common_clk_init(struct device_node *np)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 020/218] clk: rockchip: Add pclk_peri to critical clocks on RK3066/RK3188
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (18 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 019/218] clk: rockchip: add pclk_cpu to the list of rk3188 critical clocks Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 021/218] clk: rockchip: add hclk_cpubus to the list of rk3188 critical clocks Kamal Mostafa
                   ` (197 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Romain Perier, Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Romain Perier <romain.perier@gmail.com>

commit 3bba75a2ec32bd5fa7024a4de3b8cf9ee113a76a upstream.

Now that the rockchip clock subsystem does clock gating with GPIO banks,
these are no longer enabled once during probe and no longer stay enabled
for eternity. When all these clocks are disabled, the parent clock pclk_peri
might be disabled too, as no other child claims it. So, we need to add pclk_peri
to the critical clocks.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Tested-by: Michael Niewoehner <linux@mniewoehner.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/rockchip/clk-rk3188.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c
index 1c93229..de08586 100644
--- a/drivers/clk/rockchip/clk-rk3188.c
+++ b/drivers/clk/rockchip/clk-rk3188.c
@@ -709,6 +709,7 @@ static const char *const rk3188_critical_clocks[] __initconst = {
 	"aclk_peri",
 	"hclk_peri",
 	"pclk_cpu",
+	"pclk_peri",
 };
 
 static void __init rk3188_common_clk_init(struct device_node *np)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 021/218] clk: rockchip: add hclk_cpubus to the list of rk3188 critical clocks
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (19 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 020/218] clk: rockchip: Add pclk_peri to critical clocks on RK3066/RK3188 Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 022/218] tty: Fix GPF in flush_to_ldisc(), part 2 Kamal Mostafa
                   ` (196 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Kochetkov, Heiko Stuebner, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alexander Kochetkov <al.kochet@gmail.com>

commit e8b63288b37dbb8457b510c9d96f6006da4653f6 upstream.

hclk_cpubus needs to keep running because it is needed for devices like
the rom, i2s0 or spdif to be accessible via cpu. Without that all
accesses to devices (readl/writel) return wrong data. So add it
to the list of critical clocks.

Fixes: 78eaf6095cc763c ("clk: rockchip: disable unused clocks")
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/rockchip/clk-rk3188.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c
index de08586..41f7e13 100644
--- a/drivers/clk/rockchip/clk-rk3188.c
+++ b/drivers/clk/rockchip/clk-rk3188.c
@@ -710,6 +710,7 @@ static const char *const rk3188_critical_clocks[] __initconst = {
 	"hclk_peri",
 	"pclk_cpu",
 	"pclk_peri",
+	"hclk_cpubus"
 };
 
 static void __init rk3188_common_clk_init(struct device_node *np)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 022/218] tty: Fix GPF in flush_to_ldisc(), part 2
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (20 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 021/218] clk: rockchip: add hclk_cpubus to the list of rk3188 critical clocks Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 023/218] [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Kamal Mostafa
                   ` (195 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Peter Hurley <peter@hurleysoftware.com>

commit f33798deecbd59a2955f40ac0ae2bc7dff54c069 upstream.

commit 9ce119f318ba ("tty: Fix GPF in flush_to_ldisc()") fixed a
GPF caused by a line discipline which does not define a receive_buf()
method.

However, the vt driver (and speakup driver also) pushes selection
data directly to the line discipline receive_buf() method via
tty_ldisc_receive_buf(). Fix the same problem in tty_ldisc_receive_buf().

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/tty.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/tty.h b/include/linux/tty.h
index 342a760..245524a2 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -592,7 +592,7 @@ static inline int tty_ldisc_receive_buf(struct tty_ldisc *ld, unsigned char *p,
 		count = ld->ops->receive_buf2(ld->tty, p, f, count);
 	else {
 		count = min_t(int, count, ld->tty->receive_room);
-		if (count)
+		if (count && ld->ops->receive_buf)
 			ld->ops->receive_buf(ld->tty, p, f, count);
 	}
 	return count;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 023/218] [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (21 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 022/218] tty: Fix GPF in flush_to_ldisc(), part 2 Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 024/218] [media] pwc: Add USB id for Philips Spc880nc webcam Kamal Mostafa
                   ` (194 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tiffany Lin, Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tiffany Lin <tiffany.lin@mediatek.com>

commit 7df5ab8774aa383c6d2bff00688d004585d96dfd upstream.

In v4l2-compliance utility, test QUERYBUF required correct length
value to go through each planar to check planar's length in
multi-planar buffer type

Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 788b31c..73138a3 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -394,7 +394,8 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 		get_user(kp->index, &up->index) ||
 		get_user(kp->type, &up->type) ||
 		get_user(kp->flags, &up->flags) ||
-		get_user(kp->memory, &up->memory))
+		get_user(kp->memory, &up->memory) ||
+		get_user(kp->length, &up->length))
 			return -EFAULT;
 
 	if (V4L2_TYPE_IS_OUTPUT(kp->type))
@@ -406,9 +407,6 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 			return -EFAULT;
 
 	if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) {
-		if (get_user(kp->length, &up->length))
-			return -EFAULT;
-
 		num_planes = kp->length;
 		if (num_planes == 0) {
 			kp->m.planes = NULL;
@@ -441,16 +439,14 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 	} else {
 		switch (kp->memory) {
 		case V4L2_MEMORY_MMAP:
-			if (get_user(kp->length, &up->length) ||
-				get_user(kp->m.offset, &up->m.offset))
+			if (get_user(kp->m.offset, &up->m.offset))
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_USERPTR:
 			{
 			compat_long_t tmp;
 
-			if (get_user(kp->length, &up->length) ||
-			    get_user(tmp, &up->m.userptr))
+			if (get_user(tmp, &up->m.userptr))
 				return -EFAULT;
 
 			kp->m.userptr = (unsigned long)compat_ptr(tmp);
@@ -492,7 +488,8 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 		copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) ||
 		put_user(kp->sequence, &up->sequence) ||
 		put_user(kp->reserved2, &up->reserved2) ||
-		put_user(kp->reserved, &up->reserved))
+		put_user(kp->reserved, &up->reserved) ||
+		put_user(kp->length, &up->length))
 			return -EFAULT;
 
 	if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) {
@@ -515,13 +512,11 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user
 	} else {
 		switch (kp->memory) {
 		case V4L2_MEMORY_MMAP:
-			if (put_user(kp->length, &up->length) ||
-				put_user(kp->m.offset, &up->m.offset))
+			if (put_user(kp->m.offset, &up->m.offset))
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_USERPTR:
-			if (put_user(kp->length, &up->length) ||
-				put_user(kp->m.userptr, &up->m.userptr))
+			if (put_user(kp->m.userptr, &up->m.userptr))
 				return -EFAULT;
 			break;
 		case V4L2_MEMORY_OVERLAY:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 024/218] [media] pwc: Add USB id for Philips Spc880nc webcam
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (22 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 023/218] [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 025/218] crypto: ccp - Limit the amount of information exported Kamal Mostafa
                   ` (193 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 7445e45d19a09e5269dc85f17f9635be29d2f76c upstream.

SPC 880NC PC camera discussions:
	http://www.pclinuxos.com/forum/index.php/topic,135688.0.html

Reported-by: Kikim <klucznik0@op.pl>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/usb/pwc/pwc-if.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c
index 702267e..a7e1f6f 100644
--- a/drivers/media/usb/pwc/pwc-if.c
+++ b/drivers/media/usb/pwc/pwc-if.c
@@ -91,6 +91,7 @@ static const struct usb_device_id pwc_device_table [] = {
 	{ USB_DEVICE(0x0471, 0x0312) },
 	{ USB_DEVICE(0x0471, 0x0313) }, /* the 'new' 720K */
 	{ USB_DEVICE(0x0471, 0x0329) }, /* Philips SPC 900NC PC Camera */
+	{ USB_DEVICE(0x0471, 0x032C) }, /* Philips SPC 880NC PC Camera */
 	{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */
 	{ USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam Pro 3000 */
 	{ USB_DEVICE(0x046D, 0x08B1) }, /* Logitech QuickCam Notebook Pro */
@@ -802,6 +803,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id
 			name = "Philips SPC 900NC webcam";
 			type_id = 740;
 			break;
+		case 0x032C:
+			PWC_INFO("Philips SPC 880NC USB webcam detected.\n");
+			name = "Philips SPC 880NC webcam";
+			type_id = 740;
+			break;
 		default:
 			return -ENODEV;
 			break;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 025/218] crypto: ccp - Limit the amount of information exported
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (23 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 024/218] [media] pwc: Add USB id for Philips Spc880nc webcam Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 026/218] crypto: ccp - Don't assume export/import areas are aligned Kamal Mostafa
                   ` (192 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tom Lendacky, Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tom Lendacky <thomas.lendacky@amd.com>

commit d1662165ae612ec8b5f94a6b07e65ea58b6dce34 upstream.

Since the exported information can be exposed to user-space, instead of
exporting the entire request context only export the minimum information
needed.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 16 +++++++++++-----
 drivers/crypto/ccp/ccp-crypto-sha.c      | 20 +++++++++++++++-----
 drivers/crypto/ccp/ccp-crypto.h          | 22 ++++++++++++++++++++++
 3 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
index 3b6fd1f..2af9c09 100644
--- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
+++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
@@ -205,9 +205,12 @@ static int ccp_aes_cmac_digest(struct ahash_request *req)
 static int ccp_aes_cmac_export(struct ahash_request *req, void *out)
 {
 	struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
-	struct ccp_aes_cmac_req_ctx *state = out;
+	struct ccp_aes_cmac_exp_ctx *state = out;
 
-	*state = *rctx;
+	state->null_msg = rctx->null_msg;
+	memcpy(state->iv, rctx->iv, sizeof(state->iv));
+	state->buf_count = rctx->buf_count;
+	memcpy(state->buf, rctx->buf, sizeof(state->buf));
 
 	return 0;
 }
@@ -215,9 +218,12 @@ static int ccp_aes_cmac_export(struct ahash_request *req, void *out)
 static int ccp_aes_cmac_import(struct ahash_request *req, const void *in)
 {
 	struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
-	const struct ccp_aes_cmac_req_ctx *state = in;
+	const struct ccp_aes_cmac_exp_ctx *state = in;
 
-	*rctx = *state;
+	rctx->null_msg = state->null_msg;
+	memcpy(rctx->iv, state->iv, sizeof(rctx->iv));
+	rctx->buf_count = state->buf_count;
+	memcpy(rctx->buf, state->buf, sizeof(rctx->buf));
 
 	return 0;
 }
@@ -360,7 +366,7 @@ int ccp_register_aes_cmac_algs(struct list_head *head)
 
 	halg = &alg->halg;
 	halg->digestsize = AES_BLOCK_SIZE;
-	halg->statesize = sizeof(struct ccp_aes_cmac_req_ctx);
+	halg->statesize = sizeof(struct ccp_aes_cmac_exp_ctx);
 
 	base = &halg->base;
 	snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "cmac(aes)");
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
index 1747fbe..a68aa4c 100644
--- a/drivers/crypto/ccp/ccp-crypto-sha.c
+++ b/drivers/crypto/ccp/ccp-crypto-sha.c
@@ -197,9 +197,14 @@ static int ccp_sha_digest(struct ahash_request *req)
 static int ccp_sha_export(struct ahash_request *req, void *out)
 {
 	struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
-	struct ccp_sha_req_ctx *state = out;
+	struct ccp_sha_exp_ctx *state = out;
 
-	*state = *rctx;
+	state->type = rctx->type;
+	state->msg_bits = rctx->msg_bits;
+	state->first = rctx->first;
+	memcpy(state->ctx, rctx->ctx, sizeof(state->ctx));
+	state->buf_count = rctx->buf_count;
+	memcpy(state->buf, rctx->buf, sizeof(state->buf));
 
 	return 0;
 }
@@ -207,9 +212,14 @@ static int ccp_sha_export(struct ahash_request *req, void *out)
 static int ccp_sha_import(struct ahash_request *req, const void *in)
 {
 	struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
-	const struct ccp_sha_req_ctx *state = in;
+	const struct ccp_sha_exp_ctx *state = in;
 
-	*rctx = *state;
+	rctx->type = state->type;
+	rctx->msg_bits = state->msg_bits;
+	rctx->first = state->first;
+	memcpy(rctx->ctx, state->ctx, sizeof(rctx->ctx));
+	rctx->buf_count = state->buf_count;
+	memcpy(rctx->buf, state->buf, sizeof(rctx->buf));
 
 	return 0;
 }
@@ -415,7 +425,7 @@ static int ccp_register_sha_alg(struct list_head *head,
 
 	halg = &alg->halg;
 	halg->digestsize = def->digest_size;
-	halg->statesize = sizeof(struct ccp_sha_req_ctx);
+	halg->statesize = sizeof(struct ccp_sha_exp_ctx);
 
 	base = &halg->base;
 	snprintf(base->cra_name, CRYPTO_MAX_ALG_NAME, "%s", def->name);
diff --git a/drivers/crypto/ccp/ccp-crypto.h b/drivers/crypto/ccp/ccp-crypto.h
index 76a96f0..a326ec2 100644
--- a/drivers/crypto/ccp/ccp-crypto.h
+++ b/drivers/crypto/ccp/ccp-crypto.h
@@ -129,6 +129,15 @@ struct ccp_aes_cmac_req_ctx {
 	struct ccp_cmd cmd;
 };
 
+struct ccp_aes_cmac_exp_ctx {
+	unsigned int null_msg;
+
+	u8 iv[AES_BLOCK_SIZE];
+
+	unsigned int buf_count;
+	u8 buf[AES_BLOCK_SIZE];
+};
+
 /***** SHA related defines *****/
 #define MAX_SHA_CONTEXT_SIZE	SHA256_DIGEST_SIZE
 #define MAX_SHA_BLOCK_SIZE	SHA256_BLOCK_SIZE
@@ -171,6 +180,19 @@ struct ccp_sha_req_ctx {
 	struct ccp_cmd cmd;
 };
 
+struct ccp_sha_exp_ctx {
+	enum ccp_sha_type type;
+
+	u64 msg_bits;
+
+	unsigned int first;
+
+	u8 ctx[MAX_SHA_CONTEXT_SIZE];
+
+	unsigned int buf_count;
+	u8 buf[MAX_SHA_BLOCK_SIZE];
+};
+
 /***** Common Context Structure *****/
 struct ccp_ctx {
 	int (*complete)(struct crypto_async_request *req, int ret);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 026/218] crypto: ccp - Don't assume export/import areas are aligned
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (24 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 025/218] crypto: ccp - Limit the amount of information exported Kamal Mostafa
@ 2016-03-31 20:13 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 027/218] 8250: use callbacks to access UART_DLL/UART_DLM Kamal Mostafa
                   ` (191 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:13 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tom Lendacky, Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tom Lendacky <thomas.lendacky@amd.com>

commit b31dde2a5cb1bf764282abf934266b7193c2bc7c upstream.

Use a local variable for the exported and imported state so that
alignment is not an issue. On export, set a local variable from the
request context and then memcpy the contents of the local variable to
the export memory area. On import, memcpy the import memory area into
a local variable and then use the local variable to set the request
context.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 26 ++++++++++++++---------
 drivers/crypto/ccp/ccp-crypto-sha.c      | 36 +++++++++++++++++++-------------
 2 files changed, 37 insertions(+), 25 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
index 2af9c09..8680b18 100644
--- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
+++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
@@ -205,12 +205,15 @@ static int ccp_aes_cmac_digest(struct ahash_request *req)
 static int ccp_aes_cmac_export(struct ahash_request *req, void *out)
 {
 	struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
-	struct ccp_aes_cmac_exp_ctx *state = out;
+	struct ccp_aes_cmac_exp_ctx state;
 
-	state->null_msg = rctx->null_msg;
-	memcpy(state->iv, rctx->iv, sizeof(state->iv));
-	state->buf_count = rctx->buf_count;
-	memcpy(state->buf, rctx->buf, sizeof(state->buf));
+	state.null_msg = rctx->null_msg;
+	memcpy(state.iv, rctx->iv, sizeof(state.iv));
+	state.buf_count = rctx->buf_count;
+	memcpy(state.buf, rctx->buf, sizeof(state.buf));
+
+	/* 'out' may not be aligned so memcpy from local variable */
+	memcpy(out, &state, sizeof(state));
 
 	return 0;
 }
@@ -218,12 +221,15 @@ static int ccp_aes_cmac_export(struct ahash_request *req, void *out)
 static int ccp_aes_cmac_import(struct ahash_request *req, const void *in)
 {
 	struct ccp_aes_cmac_req_ctx *rctx = ahash_request_ctx(req);
-	const struct ccp_aes_cmac_exp_ctx *state = in;
+	struct ccp_aes_cmac_exp_ctx state;
+
+	/* 'in' may not be aligned so memcpy to local variable */
+	memcpy(&state, in, sizeof(state));
 
-	rctx->null_msg = state->null_msg;
-	memcpy(rctx->iv, state->iv, sizeof(rctx->iv));
-	rctx->buf_count = state->buf_count;
-	memcpy(rctx->buf, state->buf, sizeof(rctx->buf));
+	rctx->null_msg = state.null_msg;
+	memcpy(rctx->iv, state.iv, sizeof(rctx->iv));
+	rctx->buf_count = state.buf_count;
+	memcpy(rctx->buf, state.buf, sizeof(rctx->buf));
 
 	return 0;
 }
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
index a68aa4c..e9b199f 100644
--- a/drivers/crypto/ccp/ccp-crypto-sha.c
+++ b/drivers/crypto/ccp/ccp-crypto-sha.c
@@ -197,14 +197,17 @@ static int ccp_sha_digest(struct ahash_request *req)
 static int ccp_sha_export(struct ahash_request *req, void *out)
 {
 	struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
-	struct ccp_sha_exp_ctx *state = out;
+	struct ccp_sha_exp_ctx state;
 
-	state->type = rctx->type;
-	state->msg_bits = rctx->msg_bits;
-	state->first = rctx->first;
-	memcpy(state->ctx, rctx->ctx, sizeof(state->ctx));
-	state->buf_count = rctx->buf_count;
-	memcpy(state->buf, rctx->buf, sizeof(state->buf));
+	state.type = rctx->type;
+	state.msg_bits = rctx->msg_bits;
+	state.first = rctx->first;
+	memcpy(state.ctx, rctx->ctx, sizeof(state.ctx));
+	state.buf_count = rctx->buf_count;
+	memcpy(state.buf, rctx->buf, sizeof(state.buf));
+
+	/* 'out' may not be aligned so memcpy from local variable */
+	memcpy(out, &state, sizeof(state));
 
 	return 0;
 }
@@ -212,14 +215,17 @@ static int ccp_sha_export(struct ahash_request *req, void *out)
 static int ccp_sha_import(struct ahash_request *req, const void *in)
 {
 	struct ccp_sha_req_ctx *rctx = ahash_request_ctx(req);
-	const struct ccp_sha_exp_ctx *state = in;
-
-	rctx->type = state->type;
-	rctx->msg_bits = state->msg_bits;
-	rctx->first = state->first;
-	memcpy(rctx->ctx, state->ctx, sizeof(rctx->ctx));
-	rctx->buf_count = state->buf_count;
-	memcpy(rctx->buf, state->buf, sizeof(rctx->buf));
+	struct ccp_sha_exp_ctx state;
+
+	/* 'in' may not be aligned so memcpy to local variable */
+	memcpy(&state, in, sizeof(state));
+
+	rctx->type = state.type;
+	rctx->msg_bits = state.msg_bits;
+	rctx->first = state.first;
+	memcpy(rctx->ctx, state.ctx, sizeof(rctx->ctx));
+	rctx->buf_count = state.buf_count;
+	memcpy(rctx->buf, state.buf, sizeof(rctx->buf));
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 027/218] 8250: use callbacks to access UART_DLL/UART_DLM
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (25 preceding siblings ...)
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 026/218] crypto: ccp - Don't assume export/import areas are aligned Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 028/218] net: irda: Fix use-after-free in irtty_open() Kamal Mostafa
                   ` (190 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Frias, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Sebastian Frias <sf84@laposte.net>

commit 0b41ce991052022c030fd868e03877700220b090 upstream.

Some UART HW has a single register combining UART_DLL/UART_DLM
(this was probably forgotten in the change that introduced the
callbacks, commit b32b19b8ffc05cbd3bf91c65e205f6a912ca15d9)

Fixes: b32b19b8ffc0 ("[SERIAL] 8250: set divisor register correctly ...")

Signed-off-by: Sebastian Frias <sf84@laposte.net>
Reviewed-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ kamal: backport to 4.2-stable: applies to 8250_core.c ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/tty/serial/8250/8250_core.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index c35d96e..aaa9fac 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -778,22 +778,16 @@ static int size_fifo(struct uart_8250_port *up)
  */
 static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
 {
-	unsigned char old_dll, old_dlm, old_lcr;
-	unsigned int id;
+	unsigned char old_lcr;
+	unsigned int id, old_dl;
 
 	old_lcr = serial_in(p, UART_LCR);
 	serial_out(p, UART_LCR, UART_LCR_CONF_MODE_A);
+	old_dl = serial_dl_read(p);
+	serial_dl_write(p, 0);
+	id = serial_dl_read(p);
+	serial_dl_write(p, old_dl);
 
-	old_dll = serial_in(p, UART_DLL);
-	old_dlm = serial_in(p, UART_DLM);
-
-	serial_out(p, UART_DLL, 0);
-	serial_out(p, UART_DLM, 0);
-
-	id = serial_in(p, UART_DLL) | serial_in(p, UART_DLM) << 8;
-
-	serial_out(p, UART_DLL, old_dll);
-	serial_out(p, UART_DLM, old_dlm);
 	serial_out(p, UART_LCR, old_lcr);
 
 	return id;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 028/218] net: irda: Fix use-after-free in irtty_open()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (26 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 027/218] 8250: use callbacks to access UART_DLL/UART_DLM Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 029/218] mei: bus: fix drivers and devices names confusion Kamal Mostafa
                   ` (189 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Hurley, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Peter Hurley <peter@hurleysoftware.com>

commit 401879c57f01cbf2da204ad2e8db910525c6dbea upstream.

The N_IRDA line discipline may access the previous line discipline's closed
and already-fre private data on open [1].

The tty->disc_data field _never_ refers to valid data on entry to the
line discipline's open() method. Rather, the ldisc is expected to
initialize that field for its own use for the lifetime of the instance
(ie. from open() to close() only).

[1]
    ==================================================================
    BUG: KASAN: use-after-free in irtty_open+0x422/0x550 at addr ffff8800331dd068
    Read of size 4 by task a.out/13960
    =============================================================================
    BUG kmalloc-512 (Tainted: G    B          ): kasan: bad access detected
    -----------------------------------------------------------------------------
    ...
    Call Trace:
     [<ffffffff815fa2ae>] __asan_report_load4_noabort+0x3e/0x40 mm/kasan/report.c:279
     [<ffffffff836938a2>] irtty_open+0x422/0x550 drivers/net/irda/irtty-sir.c:436
     [<ffffffff829f1b80>] tty_ldisc_open.isra.2+0x60/0xa0 drivers/tty/tty_ldisc.c:447
     [<ffffffff829f21c0>] tty_set_ldisc+0x1a0/0x940 drivers/tty/tty_ldisc.c:567
     [<     inline     >] tiocsetd drivers/tty/tty_io.c:2650
     [<ffffffff829da49e>] tty_ioctl+0xace/0x1fd0 drivers/tty/tty_io.c:2883
     [<     inline     >] vfs_ioctl fs/ioctl.c:43
     [<ffffffff816708ac>] do_vfs_ioctl+0x57c/0xe60 fs/ioctl.c:607
     [<     inline     >] SYSC_ioctl fs/ioctl.c:622
     [<ffffffff81671204>] SyS_ioctl+0x74/0x80 fs/ioctl.c:613
     [<ffffffff852a7876>] entry_SYSCALL_64_fastpath+0x16/0x7a

Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/irda/irtty-sir.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index 696852e..7a3f990 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -430,16 +430,6 @@ static int irtty_open(struct tty_struct *tty)
 
 	/* Module stuff handled via irda_ldisc.owner - Jean II */
 
-	/* First make sure we're not already connected. */
-	if (tty->disc_data != NULL) {
-		priv = tty->disc_data;
-		if (priv && priv->magic == IRTTY_MAGIC) {
-			ret = -EEXIST;
-			goto out;
-		}
-		tty->disc_data = NULL;		/* ### */
-	}
-
 	/* stop the underlying  driver */
 	irtty_stop_receiver(tty, TRUE);
 	if (tty->ops->stop)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 029/218] mei: bus: fix drivers and devices names confusion
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (27 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 028/218] net: irda: Fix use-after-free in irtty_open() Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 030/218] mei: bus: check if the device is enabled before data transfer Kamal Mostafa
                   ` (188 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomas Winkler, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tomas Winkler <tomas.winkler@intel.com>

commit b37719c31f8448ba36abc218a96663b4a6c66eb6 upstream.

In the mei bus layer there is use of different variables
of driver and device types with no clear naming convention.
There are generic struct device and struct driver,
then mei_cl_{device, driver}, and finally mei_device which
in this context serves as a bus device.

The patch sets following naming convention:

the variables of type struct device remains dev
the variables of type struct driver remains drv
the variables of type struct mei_cl_device are now cldev
the variables of type struct mei_cl_driver are now cldrv
the variables of type struct mei_device are now bus, in bus
layer context

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/misc/mei/bus.c     | 260 ++++++++++++++++++++++-----------------------
 drivers/misc/mei/mei_dev.h |  12 +--
 drivers/misc/mei/nfc.c     |  80 +++++++-------
 3 files changed, 176 insertions(+), 176 deletions(-)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 458aa5a..18c37af 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -32,22 +32,22 @@
 
 static int mei_cl_device_match(struct device *dev, struct device_driver *drv)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
-	struct mei_cl_driver *driver = to_mei_cl_driver(drv);
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
+	struct mei_cl_driver *cldrv = to_mei_cl_driver(drv);
 	const struct mei_cl_device_id *id;
 	const uuid_le *uuid;
 	const char *name;
 
-	if (!device)
+	if (!cldev)
 		return 0;
 
-	uuid = mei_me_cl_uuid(device->me_cl);
-	name = device->name;
+	uuid = mei_me_cl_uuid(cldev->me_cl);
+	name = cldev->name;
 
-	if (!driver || !driver->id_table)
+	if (!cldrv || !cldrv->id_table)
 		return 0;
 
-	id = driver->id_table;
+	id = cldrv->id_table;
 
 	while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) {
 
@@ -68,54 +68,54 @@ static int mei_cl_device_match(struct device *dev, struct device_driver *drv)
 
 static int mei_cl_device_probe(struct device *dev)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
-	struct mei_cl_driver *driver;
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
+	struct mei_cl_driver *cldrv;
 	struct mei_cl_device_id id;
 
-	if (!device)
+	if (!cldev)
 		return 0;
 
-	driver = to_mei_cl_driver(dev->driver);
-	if (!driver || !driver->probe)
+	cldrv = to_mei_cl_driver(dev->driver);
+	if (!cldrv || !cldrv->probe)
 		return -ENODEV;
 
 	dev_dbg(dev, "Device probe\n");
 
-	strlcpy(id.name, device->name, sizeof(id.name));
+	strlcpy(id.name, cldev->name, sizeof(id.name));
 
-	return driver->probe(device, &id);
+	return cldrv->probe(cldev, &id);
 }
 
 static int mei_cl_device_remove(struct device *dev)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
-	struct mei_cl_driver *driver;
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
+	struct mei_cl_driver *cldrv;
 
-	if (!device || !dev->driver)
+	if (!cldev || !dev->driver)
 		return 0;
 
-	if (device->event_cb) {
-		device->event_cb = NULL;
-		cancel_work_sync(&device->event_work);
+	if (cldev->event_cb) {
+		cldev->event_cb = NULL;
+		cancel_work_sync(&cldev->event_work);
 	}
 
-	driver = to_mei_cl_driver(dev->driver);
-	if (!driver->remove) {
+	cldrv = to_mei_cl_driver(dev->driver);
+	if (!cldrv->remove) {
 		dev->driver = NULL;
 
 		return 0;
 	}
 
-	return driver->remove(device);
+	return cldrv->remove(cldev);
 }
 
 static ssize_t name_show(struct device *dev, struct device_attribute *a,
 			     char *buf)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
 	size_t len;
 
-	len = snprintf(buf, PAGE_SIZE, "%s", device->name);
+	len = snprintf(buf, PAGE_SIZE, "%s", cldev->name);
 
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
@@ -124,8 +124,8 @@ static DEVICE_ATTR_RO(name);
 static ssize_t uuid_show(struct device *dev, struct device_attribute *a,
 			     char *buf)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
-	const uuid_le *uuid = mei_me_cl_uuid(device->me_cl);
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
+	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
 	size_t len;
 
 	len = snprintf(buf, PAGE_SIZE, "%pUl", uuid);
@@ -137,12 +137,12 @@ static DEVICE_ATTR_RO(uuid);
 static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
 			     char *buf)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
-	const uuid_le *uuid = mei_me_cl_uuid(device->me_cl);
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
+	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
 	size_t len;
 
 	len = snprintf(buf, PAGE_SIZE, "mei:%s:" MEI_CL_UUID_FMT ":",
-		device->name, MEI_CL_UUID_ARGS(uuid->b));
+		cldev->name, MEI_CL_UUID_ARGS(uuid->b));
 
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
@@ -158,17 +158,17 @@ ATTRIBUTE_GROUPS(mei_cl_dev);
 
 static int mei_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
-	const uuid_le *uuid = mei_me_cl_uuid(device->me_cl);
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
+	const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl);
 
 	if (add_uevent_var(env, "MEI_CL_UUID=%pUl", uuid))
 		return -ENOMEM;
 
-	if (add_uevent_var(env, "MEI_CL_NAME=%s", device->name))
+	if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name))
 		return -ENOMEM;
 
 	if (add_uevent_var(env, "MODALIAS=mei:%s:" MEI_CL_UUID_FMT ":",
-		device->name, MEI_CL_UUID_ARGS(uuid->b)))
+		cldev->name, MEI_CL_UUID_ARGS(uuid->b)))
 		return -ENOMEM;
 
 	return 0;
@@ -185,121 +185,121 @@ static struct bus_type mei_cl_bus_type = {
 
 static void mei_cl_dev_release(struct device *dev)
 {
-	struct mei_cl_device *device = to_mei_cl_device(dev);
+	struct mei_cl_device *cldev = to_mei_cl_device(dev);
 
-	if (!device)
+	if (!cldev)
 		return;
 
-	mei_me_cl_put(device->me_cl);
-	kfree(device);
+	mei_me_cl_put(cldev->me_cl);
+	kfree(cldev);
 }
 
 static struct device_type mei_cl_device_type = {
 	.release	= mei_cl_dev_release,
 };
 
-struct mei_cl *mei_cl_bus_find_cl_by_uuid(struct mei_device *dev,
+struct mei_cl *mei_cl_bus_find_cl_by_uuid(struct mei_device *bus,
 					 uuid_le uuid)
 {
 	struct mei_cl *cl;
 
-	list_for_each_entry(cl, &dev->device_list, device_link) {
-		if (cl->device && cl->device->me_cl &&
-		    !uuid_le_cmp(uuid, *mei_me_cl_uuid(cl->device->me_cl)))
+	list_for_each_entry(cl, &bus->device_list, device_link) {
+		if (cl->cldev && cl->cldev->me_cl &&
+		    !uuid_le_cmp(uuid, *mei_me_cl_uuid(cl->cldev->me_cl)))
 			return cl;
 	}
 
 	return NULL;
 }
 
-struct mei_cl_device *mei_cl_add_device(struct mei_device *dev,
+struct mei_cl_device *mei_cl_add_device(struct mei_device *bus,
 					struct mei_me_client *me_cl,
 					struct mei_cl *cl,
 					char *name)
 {
-	struct mei_cl_device *device;
+	struct mei_cl_device *cldev;
 	int status;
 
-	device = kzalloc(sizeof(struct mei_cl_device), GFP_KERNEL);
-	if (!device)
+	cldev = kzalloc(sizeof(struct mei_cl_device), GFP_KERNEL);
+	if (!cldev)
 		return NULL;
 
-	device->me_cl = mei_me_cl_get(me_cl);
-	if (!device->me_cl) {
-		kfree(device);
+	cldev->me_cl = mei_me_cl_get(me_cl);
+	if (!cldev->me_cl) {
+		kfree(cldev);
 		return NULL;
 	}
 
-	device->cl = cl;
-	device->dev.parent = dev->dev;
-	device->dev.bus = &mei_cl_bus_type;
-	device->dev.type = &mei_cl_device_type;
+	cldev->cl = cl;
+	cldev->dev.parent = bus->dev;
+	cldev->dev.bus = &mei_cl_bus_type;
+	cldev->dev.type = &mei_cl_device_type;
 
-	strlcpy(device->name, name, sizeof(device->name));
+	strlcpy(cldev->name, name, sizeof(cldev->name));
 
-	dev_set_name(&device->dev, "mei:%s:%pUl", name, mei_me_cl_uuid(me_cl));
+	dev_set_name(&cldev->dev, "mei:%s:%pUl", name, mei_me_cl_uuid(me_cl));
 
-	status = device_register(&device->dev);
+	status = device_register(&cldev->dev);
 	if (status) {
-		dev_err(dev->dev, "Failed to register MEI device\n");
-		mei_me_cl_put(device->me_cl);
-		kfree(device);
+		dev_err(bus->dev, "Failed to register MEI device\n");
+		mei_me_cl_put(cldev->me_cl);
+		kfree(cldev);
 		return NULL;
 	}
 
-	cl->device = device;
+	cl->cldev = cldev;
 
-	dev_dbg(&device->dev, "client %s registered\n", name);
+	dev_dbg(&cldev->dev, "client %s registered\n", name);
 
-	return device;
+	return cldev;
 }
 EXPORT_SYMBOL_GPL(mei_cl_add_device);
 
-void mei_cl_remove_device(struct mei_cl_device *device)
+void mei_cl_remove_device(struct mei_cl_device *cldev)
 {
-	device_unregister(&device->dev);
+	device_unregister(&cldev->dev);
 }
 EXPORT_SYMBOL_GPL(mei_cl_remove_device);
 
-int __mei_cl_driver_register(struct mei_cl_driver *driver, struct module *owner)
+int __mei_cl_driver_register(struct mei_cl_driver *cldrv, struct module *owner)
 {
 	int err;
 
-	driver->driver.name = driver->name;
-	driver->driver.owner = owner;
-	driver->driver.bus = &mei_cl_bus_type;
+	cldrv->driver.name = cldrv->name;
+	cldrv->driver.owner = owner;
+	cldrv->driver.bus = &mei_cl_bus_type;
 
-	err = driver_register(&driver->driver);
+	err = driver_register(&cldrv->driver);
 	if (err)
 		return err;
 
-	pr_debug("mei: driver [%s] registered\n", driver->driver.name);
+	pr_debug("mei: driver [%s] registered\n", cldrv->driver.name);
 
 	return 0;
 }
 EXPORT_SYMBOL_GPL(__mei_cl_driver_register);
 
-void mei_cl_driver_unregister(struct mei_cl_driver *driver)
+void mei_cl_driver_unregister(struct mei_cl_driver *cldrv)
 {
-	driver_unregister(&driver->driver);
+	driver_unregister(&cldrv->driver);
 
-	pr_debug("mei: driver [%s] unregistered\n", driver->driver.name);
+	pr_debug("mei: driver [%s] unregistered\n", cldrv->driver.name);
 }
 EXPORT_SYMBOL_GPL(mei_cl_driver_unregister);
 
 ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
 			bool blocking)
 {
-	struct mei_device *dev;
+	struct mei_device *bus;
 	struct mei_cl_cb *cb = NULL;
 	ssize_t rets;
 
 	if (WARN_ON(!cl || !cl->dev))
 		return -ENODEV;
 
-	dev = cl->dev;
+	bus = cl->dev;
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 	if (!mei_cl_is_connected(cl)) {
 		rets = -ENODEV;
 		goto out;
@@ -327,7 +327,7 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
 	rets = mei_cl_write(cl, cb, blocking);
 
 out:
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 	if (rets < 0)
 		mei_io_cb_free(cb);
 
@@ -336,7 +336,7 @@ out:
 
 ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 {
-	struct mei_device *dev;
+	struct mei_device *bus;
 	struct mei_cl_cb *cb;
 	size_t r_length;
 	ssize_t rets;
@@ -344,9 +344,9 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 	if (WARN_ON(!cl || !cl->dev))
 		return -ENODEV;
 
-	dev = cl->dev;
+	bus = cl->dev;
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 
 	cb = mei_cl_read_cb(cl, NULL);
 	if (cb)
@@ -358,7 +358,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 
 	if (list_empty(&cl->rd_completed) && !waitqueue_active(&cl->rx_wait)) {
 
-		mutex_unlock(&dev->device_lock);
+		mutex_unlock(&bus->device_lock);
 
 		if (wait_event_interruptible(cl->rx_wait,
 				(!list_empty(&cl->rd_completed)) ||
@@ -369,7 +369,7 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 			return -ERESTARTSYS;
 		}
 
-		mutex_lock(&dev->device_lock);
+		mutex_lock(&bus->device_lock);
 
 		if (!mei_cl_is_connected(cl)) {
 			rets = -EBUSY;
@@ -396,14 +396,14 @@ copy:
 free:
 	mei_io_cb_free(cb);
 out:
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 
 	return rets;
 }
 
-ssize_t mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length)
+ssize_t mei_cl_send(struct mei_cl_device *cldev, u8 *buf, size_t length)
 {
-	struct mei_cl *cl = device->cl;
+	struct mei_cl *cl = cldev->cl;
 
 	if (cl == NULL)
 		return -ENODEV;
@@ -412,9 +412,9 @@ ssize_t mei_cl_send(struct mei_cl_device *device, u8 *buf, size_t length)
 }
 EXPORT_SYMBOL_GPL(mei_cl_send);
 
-ssize_t mei_cl_recv(struct mei_cl_device *device, u8 *buf, size_t length)
+ssize_t mei_cl_recv(struct mei_cl_device *cldev, u8 *buf, size_t length)
 {
-	struct mei_cl *cl = device->cl;
+	struct mei_cl *cl = cldev->cl;
 
 	if (cl == NULL)
 		return -ENODEV;
@@ -425,108 +425,108 @@ EXPORT_SYMBOL_GPL(mei_cl_recv);
 
 static void mei_bus_event_work(struct work_struct *work)
 {
-	struct mei_cl_device *device;
+	struct mei_cl_device *cldev;
 
-	device = container_of(work, struct mei_cl_device, event_work);
+	cldev = container_of(work, struct mei_cl_device, event_work);
 
-	if (device->event_cb)
-		device->event_cb(device, device->events, device->event_context);
+	if (cldev->event_cb)
+		cldev->event_cb(cldev, cldev->events, cldev->event_context);
 
-	device->events = 0;
+	cldev->events = 0;
 
 	/* Prepare for the next read */
-	mei_cl_read_start(device->cl, 0, NULL);
+	mei_cl_read_start(cldev->cl, 0, NULL);
 }
 
-int mei_cl_register_event_cb(struct mei_cl_device *device,
+int mei_cl_register_event_cb(struct mei_cl_device *cldev,
 			  mei_cl_event_cb_t event_cb, void *context)
 {
-	if (device->event_cb)
+	if (cldev->event_cb)
 		return -EALREADY;
 
-	device->events = 0;
-	device->event_cb = event_cb;
-	device->event_context = context;
-	INIT_WORK(&device->event_work, mei_bus_event_work);
+	cldev->events = 0;
+	cldev->event_cb = event_cb;
+	cldev->event_context = context;
+	INIT_WORK(&cldev->event_work, mei_bus_event_work);
 
-	mei_cl_read_start(device->cl, 0, NULL);
+	mei_cl_read_start(cldev->cl, 0, NULL);
 
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mei_cl_register_event_cb);
 
-void *mei_cl_get_drvdata(const struct mei_cl_device *device)
+void *mei_cl_get_drvdata(const struct mei_cl_device *cldev)
 {
-	return dev_get_drvdata(&device->dev);
+	return dev_get_drvdata(&cldev->dev);
 }
 EXPORT_SYMBOL_GPL(mei_cl_get_drvdata);
 
-void mei_cl_set_drvdata(struct mei_cl_device *device, void *data)
+void mei_cl_set_drvdata(struct mei_cl_device *cldev, void *data)
 {
-	dev_set_drvdata(&device->dev, data);
+	dev_set_drvdata(&cldev->dev, data);
 }
 EXPORT_SYMBOL_GPL(mei_cl_set_drvdata);
 
-int mei_cl_enable_device(struct mei_cl_device *device)
+int mei_cl_enable_device(struct mei_cl_device *cldev)
 {
 	int err;
-	struct mei_device *dev;
-	struct mei_cl *cl = device->cl;
+	struct mei_device *bus;
+	struct mei_cl *cl = cldev->cl;
 
 	if (cl == NULL)
 		return -ENODEV;
 
-	dev = cl->dev;
+	bus = cl->dev;
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 
 	if (mei_cl_is_connected(cl)) {
-		mutex_unlock(&dev->device_lock);
-		dev_warn(dev->dev, "Already connected");
+		mutex_unlock(&bus->device_lock);
+		dev_warn(bus->dev, "Already connected");
 		return -EBUSY;
 	}
 
-	err = mei_cl_connect(cl, device->me_cl, NULL);
+	err = mei_cl_connect(cl, cldev->me_cl, NULL);
 	if (err < 0) {
-		mutex_unlock(&dev->device_lock);
-		dev_err(dev->dev, "Could not connect to the ME client");
+		mutex_unlock(&bus->device_lock);
+		dev_err(bus->dev, "Could not connect to the ME client");
 
 		return err;
 	}
 
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 
-	if (device->event_cb)
-		mei_cl_read_start(device->cl, 0, NULL);
+	if (cldev->event_cb)
+		mei_cl_read_start(cldev->cl, 0, NULL);
 
 	return 0;
 }
 EXPORT_SYMBOL_GPL(mei_cl_enable_device);
 
-int mei_cl_disable_device(struct mei_cl_device *device)
+int mei_cl_disable_device(struct mei_cl_device *cldev)
 {
 	int err;
-	struct mei_device *dev;
-	struct mei_cl *cl = device->cl;
+	struct mei_device *bus;
+	struct mei_cl *cl = cldev->cl;
 
 	if (cl == NULL)
 		return -ENODEV;
 
-	dev = cl->dev;
+	bus = cl->dev;
 
-	device->event_cb = NULL;
+	cldev->event_cb = NULL;
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 
 	if (!mei_cl_is_connected(cl)) {
-		dev_err(dev->dev, "Already disconnected");
+		dev_err(bus->dev, "Already disconnected");
 		err = 0;
 		goto out;
 	}
 
 	err = mei_cl_disconnect(cl);
 	if (err < 0) {
-		dev_err(dev->dev, "Could not disconnect from the ME client");
+		dev_err(bus->dev, "Could not disconnect from the ME client");
 		goto out;
 	}
 
@@ -534,7 +534,7 @@ int mei_cl_disable_device(struct mei_cl_device *device)
 	mei_cl_flush_queues(cl, NULL);
 
 out:
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 	return err;
 
 }
@@ -542,14 +542,14 @@ EXPORT_SYMBOL_GPL(mei_cl_disable_device);
 
 void mei_cl_bus_rx_event(struct mei_cl *cl)
 {
-	struct mei_cl_device *device = cl->device;
+	struct mei_cl_device *cldev = cl->cldev;
 
-	if (!device || !device->event_cb)
+	if (!cldev || !cldev->event_cb)
 		return;
 
-	set_bit(MEI_CL_EVENT_RX, &device->events);
+	set_bit(MEI_CL_EVENT_RX, &cldev->events);
 
-	schedule_work(&device->event_work);
+	schedule_work(&cldev->event_work);
 }
 
 int __init mei_cl_bus_init(void)
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 453f6a3..bc65fb4 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -240,7 +240,7 @@ struct mei_cl_cb {
  * @rd_pending: pending read credits
  * @rd_completed: completed read
  *
- * @device: device on the mei client bus
+ * @cldev: device on the mei client bus
  * @device_link:  link to bus clients
  */
 struct mei_cl {
@@ -261,7 +261,7 @@ struct mei_cl {
 	struct list_head rd_completed;
 
 	/* MEI CL bus data */
-	struct mei_cl_device *device;
+	struct mei_cl_device *cldev;
 	struct list_head device_link;
 };
 
@@ -330,20 +330,20 @@ struct mei_hw_ops {
 
 /* MEI bus API*/
 
-struct mei_cl_device *mei_cl_add_device(struct mei_device *dev,
+struct mei_cl_device *mei_cl_add_device(struct mei_device *bus,
 					struct mei_me_client *me_cl,
 					struct mei_cl *cl,
 					char *name);
-void mei_cl_remove_device(struct mei_cl_device *device);
+void mei_cl_remove_device(struct mei_cl_device *cldev);
 
 ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
 			bool blocking);
 ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length);
 void mei_cl_bus_rx_event(struct mei_cl *cl);
-void mei_cl_bus_remove_devices(struct mei_device *dev);
+void mei_cl_bus_remove_devices(struct mei_device *bus);
 int mei_cl_bus_init(void);
 void mei_cl_bus_exit(void);
-struct mei_cl *mei_cl_bus_find_cl_by_uuid(struct mei_device *dev, uuid_le uuid);
+struct mei_cl *mei_cl_bus_find_cl_by_uuid(struct mei_device *bus, uuid_le uuid);
 
 /**
  * enum mei_pg_event - power gating transition events
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
index 290ef30..47aa152 100644
--- a/drivers/misc/mei/nfc.c
+++ b/drivers/misc/mei/nfc.c
@@ -152,12 +152,12 @@ static void mei_nfc_free(struct mei_nfc_dev *ndev)
 
 static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev)
 {
-	struct mei_device *dev;
+	struct mei_device *bus;
 
 	if (!ndev->cl)
 		return -ENODEV;
 
-	dev = ndev->cl->dev;
+	bus = ndev->cl->dev;
 
 	switch (ndev->vendor_id) {
 	case MEI_NFC_VENDOR_INSIDE:
@@ -167,7 +167,7 @@ static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev)
 			return 0;
 
 		default:
-			dev_err(dev->dev, "Unknown radio type 0x%x\n",
+			dev_err(bus->dev, "Unknown radio type 0x%x\n",
 				ndev->radio_type);
 
 			return -EINVAL;
@@ -179,14 +179,14 @@ static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev)
 			ndev->bus_name = "pn544";
 			return 0;
 		default:
-			dev_err(dev->dev, "Unknown radio type 0x%x\n",
+			dev_err(bus->dev, "Unknown radio type 0x%x\n",
 				ndev->radio_type);
 
 			return -EINVAL;
 		}
 
 	default:
-		dev_err(dev->dev, "Unknown vendor ID 0x%x\n",
+		dev_err(bus->dev, "Unknown vendor ID 0x%x\n",
 			ndev->vendor_id);
 
 		return -EINVAL;
@@ -197,7 +197,7 @@ static int mei_nfc_build_bus_name(struct mei_nfc_dev *ndev)
 
 static int mei_nfc_if_version(struct mei_nfc_dev *ndev)
 {
-	struct mei_device *dev;
+	struct mei_device *bus;
 	struct mei_cl *cl;
 
 	struct mei_nfc_cmd cmd;
@@ -207,7 +207,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)
 	int bytes_recv, ret;
 
 	cl = ndev->cl_info;
-	dev = cl->dev;
+	bus = cl->dev;
 
 	memset(&cmd, 0, sizeof(struct mei_nfc_cmd));
 	cmd.command = MEI_NFC_CMD_MAINTENANCE;
@@ -216,7 +216,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)
 
 	ret = __mei_cl_send(cl, (u8 *)&cmd, sizeof(struct mei_nfc_cmd), 1);
 	if (ret < 0) {
-		dev_err(dev->dev, "Could not send IF version cmd\n");
+		dev_err(bus->dev, "Could not send IF version cmd\n");
 		return ret;
 	}
 
@@ -230,7 +230,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)
 
 	bytes_recv = __mei_cl_recv(cl, (u8 *)reply, if_version_length);
 	if (bytes_recv < 0 || bytes_recv < sizeof(struct mei_nfc_reply)) {
-		dev_err(dev->dev, "Could not read IF version\n");
+		dev_err(bus->dev, "Could not read IF version\n");
 		ret = -EIO;
 		goto err;
 	}
@@ -248,7 +248,7 @@ err:
 
 static void mei_nfc_init(struct work_struct *work)
 {
-	struct mei_device *dev;
+	struct mei_device *bus;
 	struct mei_cl_device *cldev;
 	struct mei_nfc_dev *ndev;
 	struct mei_cl *cl_info;
@@ -257,57 +257,57 @@ static void mei_nfc_init(struct work_struct *work)
 	ndev = container_of(work, struct mei_nfc_dev, init_work);
 
 	cl_info = ndev->cl_info;
-	dev = cl_info->dev;
+	bus = cl_info->dev;
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 
 	/* check for valid client id */
-	me_cl_info = mei_me_cl_by_uuid(dev, &mei_nfc_info_guid);
+	me_cl_info = mei_me_cl_by_uuid(bus, &mei_nfc_info_guid);
 	if (!me_cl_info) {
-		mutex_unlock(&dev->device_lock);
-		dev_info(dev->dev, "nfc: failed to find the info client\n");
+		mutex_unlock(&bus->device_lock);
+		dev_info(bus->dev, "nfc: failed to find the info client\n");
 		goto err;
 	}
 
 	if (mei_cl_connect(cl_info, me_cl_info, NULL) < 0) {
 		mei_me_cl_put(me_cl_info);
-		mutex_unlock(&dev->device_lock);
-		dev_err(dev->dev, "Could not connect to the NFC INFO ME client");
+		mutex_unlock(&bus->device_lock);
+		dev_err(bus->dev, "Could not connect to the NFC INFO ME client");
 
 		goto err;
 	}
 	mei_me_cl_put(me_cl_info);
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 
 	if (mei_nfc_if_version(ndev) < 0) {
-		dev_err(dev->dev, "Could not get the NFC interface version");
+		dev_err(bus->dev, "Could not get the NFC interface version");
 
 		goto err;
 	}
 
-	dev_info(dev->dev, "NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n",
+	dev_info(bus->dev, "NFC MEI VERSION: IVN 0x%x Vendor ID 0x%x Type 0x%x\n",
 		ndev->fw_ivn, ndev->vendor_id, ndev->radio_type);
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 
 	if (mei_cl_disconnect(cl_info) < 0) {
-		mutex_unlock(&dev->device_lock);
-		dev_err(dev->dev, "Could not disconnect the NFC INFO ME client");
+		mutex_unlock(&bus->device_lock);
+		dev_err(bus->dev, "Could not disconnect the NFC INFO ME client");
 
 		goto err;
 	}
 
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 
 	if (mei_nfc_build_bus_name(ndev) < 0) {
-		dev_err(dev->dev, "Could not build the bus ID name\n");
+		dev_err(bus->dev, "Could not build the bus ID name\n");
 		return;
 	}
 
-	cldev = mei_cl_add_device(dev, ndev->me_cl, ndev->cl,
+	cldev = mei_cl_add_device(bus, ndev->me_cl, ndev->cl,
 				  ndev->bus_name);
 	if (!cldev) {
-		dev_err(dev->dev, "Could not add the NFC device to the MEI bus\n");
+		dev_err(bus->dev, "Could not add the NFC device to the MEI bus\n");
 
 		goto err;
 	}
@@ -318,14 +318,14 @@ static void mei_nfc_init(struct work_struct *work)
 	return;
 
 err:
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 	mei_nfc_free(ndev);
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 
 }
 
 
-int mei_nfc_host_init(struct mei_device *dev, struct mei_me_client *me_cl)
+int mei_nfc_host_init(struct mei_device *bus, struct mei_me_client *me_cl)
 {
 	struct mei_nfc_dev *ndev;
 	struct mei_cl *cl_info, *cl;
@@ -335,7 +335,7 @@ int mei_nfc_host_init(struct mei_device *dev, struct mei_me_client *me_cl)
 	/* in case of internal reset bail out
 	 * as the device is already setup
 	 */
-	cl = mei_cl_bus_find_cl_by_uuid(dev, mei_nfc_guid);
+	cl = mei_cl_bus_find_cl_by_uuid(bus, mei_nfc_guid);
 	if (cl)
 		return 0;
 
@@ -351,23 +351,23 @@ int mei_nfc_host_init(struct mei_device *dev, struct mei_me_client *me_cl)
 		goto err;
 	}
 
-	cl_info = mei_cl_alloc_linked(dev, MEI_HOST_CLIENT_ID_ANY);
+	cl_info = mei_cl_alloc_linked(bus, MEI_HOST_CLIENT_ID_ANY);
 	if (IS_ERR(cl_info)) {
 		ret = PTR_ERR(cl_info);
 		goto err;
 	}
 
-	list_add_tail(&cl_info->device_link, &dev->device_list);
+	list_add_tail(&cl_info->device_link, &bus->device_list);
 
 	ndev->cl_info = cl_info;
 
-	cl = mei_cl_alloc_linked(dev, MEI_HOST_CLIENT_ID_ANY);
+	cl = mei_cl_alloc_linked(bus, MEI_HOST_CLIENT_ID_ANY);
 	if (IS_ERR(cl)) {
 		ret = PTR_ERR(cl);
 		goto err;
 	}
 
-	list_add_tail(&cl->device_link, &dev->device_list);
+	list_add_tail(&cl->device_link, &bus->device_list);
 
 	ndev->cl = cl;
 
@@ -382,17 +382,17 @@ err:
 	return ret;
 }
 
-void mei_nfc_host_exit(struct mei_device *dev)
+void mei_nfc_host_exit(struct mei_device *bus)
 {
 	struct mei_nfc_dev *ndev;
 	struct mei_cl *cl;
 	struct mei_cl_device *cldev;
 
-	cl = mei_cl_bus_find_cl_by_uuid(dev, mei_nfc_guid);
+	cl = mei_cl_bus_find_cl_by_uuid(bus, mei_nfc_guid);
 	if (!cl)
 		return;
 
-	cldev = cl->device;
+	cldev = cl->cldev;
 	if (!cldev)
 		return;
 
@@ -407,9 +407,9 @@ void mei_nfc_host_exit(struct mei_device *dev)
 	 */
 	mei_cl_remove_device(cldev);
 
-	mutex_lock(&dev->device_lock);
+	mutex_lock(&bus->device_lock);
 	mei_nfc_free(ndev);
-	mutex_unlock(&dev->device_lock);
+	mutex_unlock(&bus->device_lock);
 }
 
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 030/218] mei: bus: check if the device is enabled before data transfer
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (28 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 029/218] mei: bus: fix drivers and devices names confusion Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 031/218] staging: comedi: ni_tiocmd: change mistaken use of start_src for start_arg Kamal Mostafa
                   ` (187 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Usyskin, Tomas Winkler, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alexander Usyskin <alexander.usyskin@intel.com>

commit 15c13dfcad883a1e76b714480fb27be96247fd82 upstream.

The bus data transfer interface was missing the check if the device is
in enabled state, this may lead to stack corruption during link reset.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/misc/mei/bus.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 18c37af..cc867e8 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -300,6 +300,11 @@ ssize_t __mei_cl_send(struct mei_cl *cl, u8 *buf, size_t length,
 	bus = cl->dev;
 
 	mutex_lock(&bus->device_lock);
+	if (bus->dev_state != MEI_DEV_ENABLED) {
+		rets = -ENODEV;
+		goto out;
+	}
+
 	if (!mei_cl_is_connected(cl)) {
 		rets = -ENODEV;
 		goto out;
@@ -347,6 +352,10 @@ ssize_t __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
 	bus = cl->dev;
 
 	mutex_lock(&bus->device_lock);
+	if (bus->dev_state != MEI_DEV_ENABLED) {
+		rets = -ENODEV;
+		goto out;
+	}
 
 	cb = mei_cl_read_cb(cl, NULL);
 	if (cb)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 031/218] staging: comedi: ni_tiocmd: change mistaken use of start_src for start_arg
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (29 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 030/218] mei: bus: check if the device is enabled before data transfer Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 032/218] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Kamal Mostafa
                   ` (186 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Spencer E . Olson, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Spencer E. Olson" <olsonse@umich.edu>

commit 1fd24a4702d2af0ea4d5845126cf57d4d1796216 upstream.

This fixes a bug in function ni_tio_input_inttrig().  The trigger number
should be compared to cmd->start_arg, not cmd->start_src.

Fixes: 6a760394d7eb ("staging: comedi: ni_tiocmd: clarify the cmd->start_arg validation and use")
Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/comedi/drivers/ni_tiocmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 9b124b0..bfd4c3b 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -92,7 +92,7 @@ static int ni_tio_input_inttrig(struct comedi_device *dev,
 	unsigned long flags;
 	int ret = 0;
 
-	if (trig_num != cmd->start_src)
+	if (trig_num != cmd->start_arg)
 		return -EINVAL;
 
 	spin_lock_irqsave(&counter->lock, flags);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 032/218] tools/hv: Use include/uapi with __EXPORTED_HEADERS__
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (30 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 031/218] staging: comedi: ni_tiocmd: change mistaken use of start_src for start_arg Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 033/218] tpm: fix the rollback in tpm_chip_register() Kamal Mostafa
                   ` (185 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: K . Y . Srinivasan, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Kamal Mostafa <kamal@canonical.com>

commit 50fe6dd10069e7c062e27f29606f6e91ea979399 upstream.

Use the local uapi headers to keep in sync with "recently" added #define's
(e.g. VSS_OP_REGISTER1).

Fixes: 3eb2094c59e8 ("Adding makefile for tools/hv")
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/hv/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/hv/Makefile b/tools/hv/Makefile
index a8ab795..a8c4644 100644
--- a/tools/hv/Makefile
+++ b/tools/hv/Makefile
@@ -5,6 +5,8 @@ PTHREAD_LIBS = -lpthread
 WARNINGS = -Wall -Wextra
 CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) $(shell getconf LFS_CFLAGS)
 
+CFLAGS += -D__EXPORTED_HEADERS__ -I../../include/uapi -I../../include
+
 all: hv_kvp_daemon hv_vss_daemon hv_fcopy_daemon
 %: %.c
 	$(CC) $(CFLAGS) -o $@ $^
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 033/218] tpm: fix the rollback in tpm_chip_register()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (31 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 032/218] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 034/218] tpm: fix the cleanup of struct tpm_chip Kamal Mostafa
                   ` (184 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jarkko Sakkinen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

commit 72c91ce8523ae5828fe5e4417ae0aaab53707a08 upstream.

Fixed the rollback and gave more self-documenting names for the
functions.

Fixes: d972b0523f ("tpm: fix call order in tpm-chip.c")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm-chip.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 0f8623d..86194a6 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -137,7 +137,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(tpmm_chip_alloc);
 
-static int tpm_dev_add_device(struct tpm_chip *chip)
+static int tpm_add_char_device(struct tpm_chip *chip)
 {
 	int rc;
 
@@ -148,7 +148,6 @@ static int tpm_dev_add_device(struct tpm_chip *chip)
 			chip->devname, MAJOR(chip->dev.devt),
 			MINOR(chip->dev.devt), rc);
 
-		device_unregister(&chip->dev);
 		return rc;
 	}
 
@@ -159,13 +158,14 @@ static int tpm_dev_add_device(struct tpm_chip *chip)
 			chip->devname, MAJOR(chip->dev.devt),
 			MINOR(chip->dev.devt), rc);
 
+		cdev_del(&chip->cdev);
 		return rc;
 	}
 
 	return rc;
 }
 
-static void tpm_dev_del_device(struct tpm_chip *chip)
+static void tpm_del_char_device(struct tpm_chip *chip)
 {
 	cdev_del(&chip->cdev);
 	device_unregister(&chip->dev);
@@ -225,7 +225,7 @@ int tpm_chip_register(struct tpm_chip *chip)
 	if (rc)
 		return rc;
 
-	rc = tpm_dev_add_device(chip);
+	rc = tpm_add_char_device(chip);
 	if (rc)
 		goto out_err;
 
@@ -264,6 +264,6 @@ void tpm_chip_unregister(struct tpm_chip *chip)
 	synchronize_rcu();
 
 	tpm1_chip_unregister(chip);
-	tpm_dev_del_device(chip);
+	tpm_del_char_device(chip);
 }
 EXPORT_SYMBOL_GPL(tpm_chip_unregister);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 034/218] tpm: fix the cleanup of struct tpm_chip
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (32 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 033/218] tpm: fix the rollback in tpm_chip_register() Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 035/218] ARM: dts: armada-375: use armada-370-sata for SATA Kamal Mostafa
                   ` (183 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jarkko Sakkinen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

commit 8e0ee3c9faed7ca68807ea45141775856c438ac0 upstream.

If the initialization fails before tpm_chip_register(), put_device()
will be not called, which causes release callback not to be called.
This patch fixes the issue by adding put_device() to devres list of
the parent device.

Fixes: 313d21eeab ("tpm: device class for tpm")
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm-chip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 86194a6..4a3e534 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -133,6 +133,8 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
 	chip->cdev.owner = chip->pdev->driver->owner;
 	chip->cdev.kobj.parent = &chip->dev.kobj;
 
+	devm_add_action(dev, (void (*)(void *)) put_device, &chip->dev);
+
 	return chip;
 }
 EXPORT_SYMBOL_GPL(tpmm_chip_alloc);
@@ -168,7 +170,7 @@ static int tpm_add_char_device(struct tpm_chip *chip)
 static void tpm_del_char_device(struct tpm_chip *chip)
 {
 	cdev_del(&chip->cdev);
-	device_unregister(&chip->dev);
+	device_del(&chip->dev);
 }
 
 static int tpm1_chip_register(struct tpm_chip *chip)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 035/218] ARM: dts: armada-375: use armada-370-sata for SATA
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (33 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 034/218] tpm: fix the cleanup of struct tpm_chip Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 036/218] usb: retry reset if a device times out Kamal Mostafa
                   ` (182 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lior Amsalem, Thomas Petazzoni, Gregory CLEMENT, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Lior Amsalem <alior@marvell.com>

commit b3a7f31eb7375633cd6a742f19488fc5a4208b36 upstream.

The Armada 375 has the same SATA IP as Armada 370 and Armada XP, which
requires the PHY speed to be set in the LP_PHY_CTL register for SATA
hotplug to work.

Therefore, this commit updates the compatible string used to describe
the SATA IP in Armada 375 from marvell,orion-sata to
marvell,armada-370-sata.

Fixes: 4de59085091f753d08c8429d756b46756ab94665 ("ARM: mvebu: add Device Tree description of the Armada 375 SoC")
Signed-off-by: Lior Amsalem <alior@marvell.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/boot/dts/armada-375.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index 67a0ab0..811b233 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -510,7 +510,7 @@
 			};
 
 			sata@a0000 {
-				compatible = "marvell,orion-sata";
+				compatible = "marvell,armada-370-sata";
 				reg = <0xa0000 0x5000>;
 				interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&gateclk 14>, <&gateclk 20>;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 036/218] usb: retry reset if a device times out
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (34 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 035/218] ARM: dts: armada-375: use armada-370-sata for SATA Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 037/218] HID: fix hid_ignore_special_drivers module parameter Kamal Mostafa
                   ` (181 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Oliver Neukum <oneukum@suse.com>

commit 264904ccc33c604d4b3141bbd33808152dfac45b upstream.

Some devices I got show an inability to operate right after
power on if they are already connected. They are beyond recovery
if the descriptors are requested multiple times. So in case of
a timeout we rather bail early and reset again. But it must be
done only on the first loop lest we get into a reset/time out
spiral that can be overcome with a retry.

This patch is a rework of a patch that fell through the cracks.
http://www.spinics.net/lists/linux-usb/msg103263.html

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/core/hub.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 252807d..62ea2cd 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4392,7 +4392,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 						r = -EPROTO;
 					break;
 				}
-				if (r == 0)
+				/*
+				 * Some devices time out if they are powered on
+				 * when already connected. They need a second
+				 * reset. But only on the first attempt,
+				 * lest we get into a time out/reset loop
+				 */
+				if (r == 0  || (r == -ETIMEDOUT && j == 0))
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 037/218] HID: fix hid_ignore_special_drivers module parameter
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (35 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 036/218] usb: retry reset if a device times out Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 038/218] scripts/coccinelle: modernize & Kamal Mostafa
                   ` (180 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Jiri Kosina, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

commit 4392bf333388cabdad5afe5b1500002d7b9c318e upstream.

hid_ignore_special_drivers works fine until hid_scan_report autodetects and
reassign devices (for hid-multitouch, hid-microsoft and hid-rmi).

Simplify the handling of the parameter: if it is there, use hid-generic, no
matter what, and if not, scan the device or rely on the hid_have_special_driver
table.

This was detected while trying to disable hid-multitouch on a Surface Pro cover
which prevented to use the keyboard.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hid/hid-core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index e3edddd..349af67 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2582,9 +2582,10 @@ int hid_add_device(struct hid_device *hdev)
 	/*
 	 * Scan generic devices for group information
 	 */
-	if (hid_ignore_special_drivers ||
-	    (!hdev->group &&
-	     !hid_match_id(hdev, hid_have_special_driver))) {
+	if (hid_ignore_special_drivers) {
+		hdev->group = HID_GROUP_GENERIC;
+	} else if (!hdev->group &&
+		   !hid_match_id(hdev, hid_have_special_driver)) {
 		ret = hid_scan_report(hdev);
 		if (ret)
 			hid_warn(hdev, "bad device descriptor (%d)\n", ret);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 038/218] scripts/coccinelle: modernize &
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (36 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 037/218] HID: fix hid_ignore_special_drivers module parameter Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 039/218] [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect Kamal Mostafa
                   ` (179 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Julia Lawall, Michal Marek, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Julia Lawall <Julia.Lawall@lip6.fr>

commit 1b669e713f277a4d4b3cec84e13d16544ac8286d upstream.

& is no longer allowed in column 0, since Coccinelle 1.0.4.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Michal Marek <mmarek@suse.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 scripts/coccinelle/iterators/use_after_iter.cocci | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci
index f085f59..ce8cc9c 100644
--- a/scripts/coccinelle/iterators/use_after_iter.cocci
+++ b/scripts/coccinelle/iterators/use_after_iter.cocci
@@ -123,7 +123,7 @@ list_remove_head(x,c,...)
 |
 sizeof(<+...c...+>)
 |
-&c->member
+ &c->member
 |
 c = E
 |
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 039/218] [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (37 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 038/218] scripts/coccinelle: modernize & Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 040/218] [media] saa7134: Fix bytesperline not being set correctly for planar formats Kamal Mostafa
                   ` (178 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Hans Verkuil <hverkuil@xs4all.nl>

commit b339a72e04a62f0b1882c43492fc712f1176b3e6 upstream.

The V4L2_CID_TX_EDID_PRESENT control reports if an EDID is present.
The adv7511 however still reported the EDID present after disconnecting
the HDMI cable. Fix the logic regarding this control. And when the EDID
is disconnected also call ADV7511_EDID_DETECT to notify the bridge driver.
This was also missing.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/i2c/adv7511.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index 95bcd40..e837099 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -1161,12 +1161,23 @@ static void adv7511_dbg_dump_edid(int lvl, int debug, struct v4l2_subdev *sd, in
 	}
 }
 
+static void adv7511_notify_no_edid(struct v4l2_subdev *sd)
+{
+	struct adv7511_state *state = get_adv7511_state(sd);
+	struct adv7511_edid_detect ed;
+
+	/* We failed to read the EDID, so send an event for this. */
+	ed.present = false;
+	ed.segment = adv7511_rd(sd, 0xc4);
+	v4l2_subdev_notify(sd, ADV7511_EDID_DETECT, (void *)&ed);
+	v4l2_ctrl_s_ctrl(state->have_edid0_ctrl, 0x0);
+}
+
 static void adv7511_edid_handler(struct work_struct *work)
 {
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct adv7511_state *state = container_of(dwork, struct adv7511_state, edid_handler);
 	struct v4l2_subdev *sd = &state->sd;
-	struct adv7511_edid_detect ed;
 
 	v4l2_dbg(1, debug, sd, "%s:\n", __func__);
 
@@ -1191,9 +1202,7 @@ static void adv7511_edid_handler(struct work_struct *work)
 	}
 
 	/* We failed to read the EDID, so send an event for this. */
-	ed.present = false;
-	ed.segment = adv7511_rd(sd, 0xc4);
-	v4l2_subdev_notify(sd, ADV7511_EDID_DETECT, (void *)&ed);
+	adv7511_notify_no_edid(sd);
 	v4l2_dbg(1, debug, sd, "%s: no edid found\n", __func__);
 }
 
@@ -1264,7 +1273,6 @@ static void adv7511_check_monitor_present_status(struct v4l2_subdev *sd)
 	/* update read only ctrls */
 	v4l2_ctrl_s_ctrl(state->hotplug_ctrl, adv7511_have_hotplug(sd) ? 0x1 : 0x0);
 	v4l2_ctrl_s_ctrl(state->rx_sense_ctrl, adv7511_have_rx_sense(sd) ? 0x1 : 0x0);
-	v4l2_ctrl_s_ctrl(state->have_edid0_ctrl, state->edid.segments ? 0x1 : 0x0);
 
 	if ((status & MASK_ADV7511_HPD_DETECT) && ((status & MASK_ADV7511_MSEN_DETECT) || state->edid.segments)) {
 		v4l2_dbg(1, debug, sd, "%s: hotplug and (rx-sense or edid)\n", __func__);
@@ -1294,6 +1302,7 @@ static void adv7511_check_monitor_present_status(struct v4l2_subdev *sd)
 		}
 		adv7511_s_power(sd, false);
 		memset(&state->edid, 0, sizeof(struct adv7511_state_edid));
+		adv7511_notify_no_edid(sd);
 	}
 }
 
@@ -1370,6 +1379,7 @@ static bool adv7511_check_edid_status(struct v4l2_subdev *sd)
 		}
 		/* one more segment read ok */
 		state->edid.segments = segment + 1;
+		v4l2_ctrl_s_ctrl(state->have_edid0_ctrl, 0x1);
 		if (((state->edid.data[0x7e] >> 1) + 1) > state->edid.segments) {
 			/* Request next EDID segment */
 			v4l2_dbg(1, debug, sd, "%s: request segment %d\n", __func__, state->edid.segments);
@@ -1389,7 +1399,6 @@ static bool adv7511_check_edid_status(struct v4l2_subdev *sd)
 		ed.present = true;
 		ed.segment = 0;
 		state->edid_detect_counter++;
-		v4l2_ctrl_s_ctrl(state->have_edid0_ctrl, state->edid.segments ? 0x1 : 0x0);
 		v4l2_subdev_notify(sd, ADV7511_EDID_DETECT, (void *)&ed);
 		return ed.present;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 040/218] [media] saa7134: Fix bytesperline not being set correctly for planar formats
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (38 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 039/218] [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 041/218] tpm_crb: tpm2_shutdown() must be called before tpm_chip_unregister() Kamal Mostafa
                   ` (177 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Hans Verkuil, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 3e71da19f9dc22e39a755d6ae9678661abb66adc upstream.

bytesperline should be the bytesperline for the first plane for planar
formats, not that of all planes combined.

This fixes a crash in xawtv caused by the wrong bpl.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1305389
Reported-and-tested-by: Stas Sergeev <stsp@list.ru>

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/pci/saa7134/saa7134-video.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c
index 035039c..a8185d4 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -1214,10 +1214,13 @@ static int saa7134_g_fmt_vid_cap(struct file *file, void *priv,
 	f->fmt.pix.height       = dev->height;
 	f->fmt.pix.field        = dev->field;
 	f->fmt.pix.pixelformat  = dev->fmt->fourcc;
-	f->fmt.pix.bytesperline =
-		(f->fmt.pix.width * dev->fmt->depth) >> 3;
+	if (dev->fmt->planar)
+		f->fmt.pix.bytesperline = f->fmt.pix.width;
+	else
+		f->fmt.pix.bytesperline =
+			(f->fmt.pix.width * dev->fmt->depth) / 8;
 	f->fmt.pix.sizeimage =
-		f->fmt.pix.height * f->fmt.pix.bytesperline;
+		(f->fmt.pix.height * f->fmt.pix.width * dev->fmt->depth) / 8;
 	f->fmt.pix.colorspace   = V4L2_COLORSPACE_SMPTE170M;
 	return 0;
 }
@@ -1293,10 +1296,13 @@ static int saa7134_try_fmt_vid_cap(struct file *file, void *priv,
 	if (f->fmt.pix.height > maxh)
 		f->fmt.pix.height = maxh;
 	f->fmt.pix.width &= ~0x03;
-	f->fmt.pix.bytesperline =
-		(f->fmt.pix.width * fmt->depth) >> 3;
+	if (fmt->planar)
+		f->fmt.pix.bytesperline = f->fmt.pix.width;
+	else
+		f->fmt.pix.bytesperline =
+			(f->fmt.pix.width * fmt->depth) / 8;
 	f->fmt.pix.sizeimage =
-		f->fmt.pix.height * f->fmt.pix.bytesperline;
+		(f->fmt.pix.height * f->fmt.pix.width * fmt->depth) / 8;
 	f->fmt.pix.colorspace   = V4L2_COLORSPACE_SMPTE170M;
 
 	return 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 041/218] tpm_crb: tpm2_shutdown() must be called before tpm_chip_unregister()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (39 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 040/218] [media] saa7134: Fix bytesperline not being set correctly for planar formats Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 042/218] perf tools: Dont stop PMU parsing on alias parse error Kamal Mostafa
                   ` (176 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jarkko Sakkinen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

commit 99cda8cb4639de81cde785b5bab9bc52e916e594 upstream.

Wrong call order.

Reported-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Fixes: 74d6b3ceaa17
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/char/tpm/tpm_crb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index 4bb9727..61e6429 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -310,11 +310,11 @@ static int crb_acpi_remove(struct acpi_device *device)
 	struct device *dev = &device->dev;
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 
-	tpm_chip_unregister(chip);
-
 	if (chip->flags & TPM_CHIP_FLAG_TPM2)
 		tpm2_shutdown(chip, TPM2_SU_CLEAR);
 
+	tpm_chip_unregister(chip);
+
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 042/218] perf tools: Dont stop PMU parsing on alias parse error
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (40 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 041/218] tpm_crb: tpm2_shutdown() must be called before tpm_chip_unregister() Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 043/218] Bluetooth: btusb: Add new AR3012 ID 13d3:3395 Kamal Mostafa
                   ` (175 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andi Kleen, Jiri Olsa, Arnaldo Carvalho de Melo, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Andi Kleen <ak@linux.intel.com>

commit 940db6dcd3f4659303fdf6befe7416adc4d24118 upstream.

When an error happens during alias parsing currently the complete
parsing of all attributes of the PMU is stopped. This is breaks old perf
on a newer kernel that may have not-yet-know alias attributes (such as
.scale or .per-pkg).

Continue when some attribute is unparseable.

This is IMHO a stable candidate and should be backported to older
versions to avoid problems with newer kernels.

v2: Print warnings when something goes wrong.
v3: Change warning to debug output

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1455749095-18358-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/perf/util/pmu.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7bcb8c3..ca54a61 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -283,13 +283,12 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 {
 	struct dirent *evt_ent;
 	DIR *event_dir;
-	int ret = 0;
 
 	event_dir = opendir(dir);
 	if (!event_dir)
 		return -EINVAL;
 
-	while (!ret && (evt_ent = readdir(event_dir))) {
+	while ((evt_ent = readdir(event_dir))) {
 		char path[PATH_MAX];
 		char *name = evt_ent->d_name;
 		FILE *file;
@@ -305,17 +304,19 @@ static int pmu_aliases_parse(char *dir, struct list_head *head)
 
 		snprintf(path, PATH_MAX, "%s/%s", dir, name);
 
-		ret = -EINVAL;
 		file = fopen(path, "r");
-		if (!file)
-			break;
+		if (!file) {
+			pr_debug("Cannot open %s\n", path);
+			continue;
+		}
 
-		ret = perf_pmu__new_alias(head, dir, name, file);
+		if (perf_pmu__new_alias(head, dir, name, file) < 0)
+			pr_debug("Cannot set up %s\n", name);
 		fclose(file);
 	}
 
 	closedir(event_dir);
-	return ret;
+	return 0;
 }
 
 /*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 043/218] Bluetooth: btusb: Add new AR3012 ID 13d3:3395
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (41 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 042/218] perf tools: Dont stop PMU parsing on alias parse error Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 044/218] Bluetooth: Add new AR3012 ID 0489:e095 Kamal Mostafa
                   ` (174 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit 609574eb46335cfac1421a07c0505627cbbab1f0 upstream.

T: Bus=03 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=13d3 ProdID=3395 Rev=00.01
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

BugLink: https://bugs.launchpad.net/bugs/1542564

Reported-and-tested-by: Christopher Simerly <kilikopela29@gmail.com>
Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index fa893c3..cb1cb9a 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -113,6 +113,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x13d3, 0x3362) },
 	{ USB_DEVICE(0x13d3, 0x3375) },
 	{ USB_DEVICE(0x13d3, 0x3393) },
+	{ USB_DEVICE(0x13d3, 0x3395) },
 	{ USB_DEVICE(0x13d3, 0x3402) },
 	{ USB_DEVICE(0x13d3, 0x3408) },
 	{ USB_DEVICE(0x13d3, 0x3423) },
@@ -175,6 +176,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x13d3, 0x3395), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index f869fb1..e581234 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -216,6 +216,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x13d3, 0x3395), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 044/218] Bluetooth: Add new AR3012 ID 0489:e095
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (42 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 043/218] Bluetooth: btusb: Add new AR3012 ID 13d3:3395 Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 045/218] aacraid: Fix RRQ overload Kamal Mostafa
                   ` (173 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit 28c971d82fb58ef7cba22e5308be6d2d2590473d upstream.

T: Bus=01 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0489 ProdID=e095 Rev=00.01
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

This device requires ar3k/AthrBT_0x31010100.dfu and
ar3k/ramps_0x31010100_40.dfu firmware files that are not in
linux-firmware yet.

BugLink: https://bugs.launchpad.net/bugs/1542944

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index cb1cb9a..3d71c1a 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -82,6 +82,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x0489, 0xe05f) },
 	{ USB_DEVICE(0x0489, 0xe076) },
 	{ USB_DEVICE(0x0489, 0xe078) },
+	{ USB_DEVICE(0x0489, 0xe095) },
 	{ USB_DEVICE(0x04c5, 0x1330) },
 	{ USB_DEVICE(0x04CA, 0x3004) },
 	{ USB_DEVICE(0x04CA, 0x3005) },
@@ -145,6 +146,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe076), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0489, 0xe095), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e581234..2768dcb 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -185,6 +185,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x0489, 0xe05f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe076), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0489, 0xe078), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x0489, 0xe095), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 045/218] aacraid: Fix RRQ overload
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (43 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 044/218] Bluetooth: Add new AR3012 ID 0489:e095 Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 046/218] aacraid: Fix memory leak in aac_fib_map_free Kamal Mostafa
                   ` (172 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Raghava Aditya Renukunta, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>

commit 3f4ce057d51a9c0ed9b01ba693df685d230ffcae upstream.

The driver utilizes an array of atomic variables to keep track of IO
submissions to each vector. To submit an IO multiple threads iterate
through the array to find a vector which has empty slots to send an
IO. The reading and updating of the variable is not atomic, causing race
conditions when a thread uses a full vector to submit an IO.

Fixed by mapping each FIB to a vector, the submission path then uses
said vector to submit IO thereby removing the possibly of a race
condition.The vector assignment is started from 1 since vector 0 is
reserved for the use of AIF management FIBS.If the number of MSIx
vectors is 1 (MSI or INTx mode) then all the fibs are allocated to
vector 0.

Fixes: 495c0217 "aacraid: MSI-x support"

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/aacraid/aacraid.h |  2 ++
 drivers/scsi/aacraid/commsup.c | 28 ++++++++++++++++++++++++++++
 drivers/scsi/aacraid/src.c     | 30 +++++++-----------------------
 3 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 40fe65c..18c9c06 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -939,6 +939,7 @@ struct fib {
 	 */
 	struct list_head	fiblink;
 	void			*data;
+	u32			vector_no;
 	struct hw_fib		*hw_fib_va;		/* Actual shared object */
 	dma_addr_t		hw_fib_pa;		/* physical address of hw_fib*/
 };
@@ -2098,6 +2099,7 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
 #define AAC_OWNER_FIRMWARE	0x106
 
 const char *aac_driverinfo(struct Scsi_Host *);
+void aac_fib_vector_assign(struct aac_dev *dev);
 struct fib *aac_fib_alloc(struct aac_dev *dev);
 int aac_fib_setup(struct aac_dev *dev);
 void aac_fib_map_free(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 4da5749..d8e1a54 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -90,6 +90,28 @@ void aac_fib_map_free(struct aac_dev *dev)
 	dev->hw_fib_pa = 0;
 }
 
+void aac_fib_vector_assign(struct aac_dev *dev)
+{
+	u32 i = 0;
+	u32 vector = 1;
+	struct fib *fibptr = NULL;
+
+	for (i = 0, fibptr = &dev->fibs[i];
+		i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB);
+		i++, fibptr++) {
+		if ((dev->max_msix == 1) ||
+		  (i > ((dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB - 1)
+			- dev->vector_cap))) {
+			fibptr->vector_no = 0;
+		} else {
+			fibptr->vector_no = vector;
+			vector++;
+			if (vector == dev->max_msix)
+				vector = 1;
+		}
+	}
+}
+
 /**
  *	aac_fib_setup	-	setup the fibs
  *	@dev: Adapter to set up
@@ -151,6 +173,12 @@ int aac_fib_setup(struct aac_dev * dev)
 		hw_fib_pa = hw_fib_pa +
 			dev->max_fib_size + sizeof(struct aac_fib_xporthdr);
 	}
+
+	/*
+	 *Assign vector numbers to fibs
+	 */
+	aac_fib_vector_assign(dev);
+
 	/*
 	 *	Add the fib chain to the free list
 	 */
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index e63cf9f..cf437bd 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -156,8 +156,8 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id)
 				break;
 			if (dev->msi_enabled && dev->max_msix > 1)
 				atomic_dec(&dev->rrq_outstanding[vector_no]);
-			aac_intr_normal(dev, handle-1, 0, isFastResponse, NULL);
 			dev->host_rrq[index++] = 0;
+			aac_intr_normal(dev, handle-1, 0, isFastResponse, NULL);
 			if (index == (vector_no + 1) * dev->vector_cap)
 				index = vector_no * dev->vector_cap;
 			dev->host_rrq_idx[vector_no] = index;
@@ -448,36 +448,20 @@ static int aac_src_deliver_message(struct fib *fib)
 	dma_addr_t address;
 	struct aac_fib_xporthdr *pFibX;
 	u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
+	u16 vector_no;
 
 	atomic_inc(&q->numpending);
 
 	if (dev->msi_enabled && fib->hw_fib_va->header.Command != AifRequest &&
 	    dev->max_msix > 1) {
-		u_int16_t vector_no, first_choice = 0xffff;
-
-		vector_no = dev->fibs_pushed_no % dev->max_msix;
-		do {
-			vector_no += 1;
-			if (vector_no == dev->max_msix)
-				vector_no = 1;
-			if (atomic_read(&dev->rrq_outstanding[vector_no]) <
-			    dev->vector_cap)
-				break;
-			if (0xffff == first_choice)
-				first_choice = vector_no;
-			else if (vector_no == first_choice)
-				break;
-		} while (1);
-		if (vector_no == first_choice)
-			vector_no = 0;
-		atomic_inc(&dev->rrq_outstanding[vector_no]);
-		if (dev->fibs_pushed_no == 0xffffffff)
-			dev->fibs_pushed_no = 0;
-		else
-			dev->fibs_pushed_no++;
+		vector_no = fib->vector_no;
 		fib->hw_fib_va->header.Handle += (vector_no << 16);
+	} else {
+		vector_no = 0;
 	}
 
+	atomic_inc(&dev->rrq_outstanding[vector_no]);
+
 	if (dev->comm_interface == AAC_COMM_MESSAGE_TYPE2) {
 		/* Calculate the amount to the fibsize bits */
 		fibsize = (hdr_size + 127) / 128 - 1;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 046/218] aacraid: Fix memory leak in aac_fib_map_free
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (44 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 045/218] aacraid: Fix RRQ overload Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 047/218] aic7xxx: Fix queue depth handling Kamal Mostafa
                   ` (171 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Raghava Aditya Renukunta, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>

commit f88fa79a61726ce9434df9b4aede36961f709f17 upstream.

aac_fib_map_free() calls pci_free_consistent() without checking that
dev->hw_fib_va is not NULL and dev->max_fib_size is not zero.If they are
indeed NULL/0, this will result in a hang as pci_free_consistent() will
attempt to invalidate cache for the entire 64-bit address space
(which would take a very long time).

Fixed by adding a check to make sure that dev->hw_fib_va and
dev->max_fib_size are not NULL and 0 respectively.

Fixes: 9ad5204d6 - "[SCSI]aacraid: incorrect dma mapping mask during blinked recover or user initiated reset"

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/aacraid/commsup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index d8e1a54..4b79d95 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_dev *dev)
 
 void aac_fib_map_free(struct aac_dev *dev)
 {
-	pci_free_consistent(dev->pdev,
-	  dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB),
-	  dev->hw_fib_va, dev->hw_fib_pa);
+	if (dev->hw_fib_va && dev->max_fib_size) {
+		pci_free_consistent(dev->pdev,
+		(dev->max_fib_size *
+		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)),
+		dev->hw_fib_va, dev->hw_fib_pa);
+	}
 	dev->hw_fib_va = NULL;
 	dev->hw_fib_pa = 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 047/218] aic7xxx: Fix queue depth handling
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (45 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 046/218] aacraid: Fix memory leak in aac_fib_map_free Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 048/218] mtd: onenand: fix deadlock in onenand_block_markbad Kamal Mostafa
                   ` (170 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alan Cox, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alan <gnomes@lxorguk.ukuu.org.uk>

commit 5a51a7abca133860a6f4429655a9eda3c4afde32 upstream.

We were setting the queue depth correctly, then setting it back to
two. If you hit this as a bisection point then please send me an email
as it would imply we've been hiding other bugs with this one.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/aic7xxx/aic7xxx_osm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index a2f2c77..82529f9 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1337,6 +1337,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
 	case AHC_DEV_Q_TAGGED:
 		scsi_change_queue_depth(sdev,
 				dev->openings + dev->active);
+		break;
 	default:
 		/*
 		 * We allow the OS to queue 2 untagged transactions to
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 048/218] mtd: onenand: fix deadlock in onenand_block_markbad
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (46 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 047/218] aic7xxx: Fix queue depth handling Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 049/218] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Kamal Mostafa
                   ` (169 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Aaro Koskinen, Brian Norris, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Aaro Koskinen <aaro.koskinen@iki.fi>

commit 5e64c29e98bfbba1b527b0a164f9493f3db9e8cb upstream.

Commit 5942ddbc500d ("mtd: introduce mtd_block_markbad interface")
incorrectly changed onenand_block_markbad() to call mtd_block_markbad
instead of onenand_chip's block_markbad function. As a result the function
will now recurse and deadlock. Fix by reverting the change.

Fixes: 5942ddbc500d ("mtd: introduce mtd_block_markbad interface")
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mtd/onenand/onenand_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 43b3392..652d018 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -2599,6 +2599,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
  */
 static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 {
+	struct onenand_chip *this = mtd->priv;
 	int ret;
 
 	ret = onenand_block_isbad(mtd, ofs);
@@ -2610,7 +2611,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
 	}
 
 	onenand_get_device(mtd, FL_WRITING);
-	ret = mtd_block_markbad(mtd, ofs);
+	ret = this->block_markbad(mtd, ofs);
 	onenand_release_device(mtd);
 	return ret;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 049/218] PCI: Disable IO/MEM decoding for devices with non-compliant BARs
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (47 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 048/218] mtd: onenand: fix deadlock in onenand_block_markbad Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 050/218] md/raid5: Compare apples to apples (or sectors to sectors) Kamal Mostafa
                   ` (168 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Bjorn Helgaas, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Bjorn Helgaas <bhelgaas@google.com>

commit b84106b4e2290c081cdab521fa832596cdfea246 upstream.

The PCI config header (first 64 bytes of each device's config space) is
defined by the PCI spec so generic software can identify the device and
manage its usage of I/O, memory, and IRQ resources.

Some non-spec-compliant devices put registers other than BARs where the
BARs should be.  When the PCI core sizes these "BARs", the reads and writes
it does may have unwanted side effects, and the "BAR" may appear to
describe non-sensical address space.

Add a flag bit to mark non-compliant devices so we don't touch their BARs.
Turn off IO/MEM decoding to prevent the devices from consuming address
space, since we can't read the BARs to find out what that address space
would be.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Andi Kleen <ak@linux.intel.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pci/probe.c | 14 ++++++++++++++
 include/linux/pci.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8e4ad97..8cb5197 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -176,6 +176,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 	u16 orig_cmd;
 	struct pci_bus_region region, inverted_region;
 
+	if (dev->non_compliant_bars)
+		return 0;
+
 	mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
 
 	/* No printks while decoding is disabled! */
@@ -1137,6 +1140,7 @@ static void pci_msi_setup_pci_dev(struct pci_dev *dev)
 int pci_setup_device(struct pci_dev *dev)
 {
 	u32 class;
+	u16 cmd;
 	u8 hdr_type;
 	struct pci_slot *slot;
 	int pos = 0;
@@ -1184,6 +1188,16 @@ int pci_setup_device(struct pci_dev *dev)
 	/* device class may be changed after fixup */
 	class = dev->class >> 8;
 
+	if (dev->non_compliant_bars) {
+		pci_read_config_word(dev, PCI_COMMAND, &cmd);
+		if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+			dev_info(&dev->dev, "device has non-compliant BARs; disabling IO/MEM decoding\n");
+			cmd &= ~PCI_COMMAND_IO;
+			cmd &= ~PCI_COMMAND_MEMORY;
+			pci_write_config_word(dev, PCI_COMMAND, cmd);
+		}
+	}
+
 	switch (dev->hdr_type) {		    /* header type */
 	case PCI_HEADER_TYPE_NORMAL:		    /* standard header */
 		if (class == PCI_CLASS_BRIDGE_PCI)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5b098ed..d93b2cb 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -358,6 +358,7 @@ struct pci_dev {
 	unsigned int	io_window_1k:1;	/* Intel P2P bridge 1K I/O windows */
 	unsigned int	irq_managed:1;
 	unsigned int	has_secondary_link:1;
+	unsigned int	non_compliant_bars:1;	/* broken BARs; ignore them */
 	pci_dev_flags_t dev_flags;
 	atomic_t	enable_cnt;	/* pci_enable_device has been called */
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 050/218] md/raid5: Compare apples to apples (or sectors to sectors)
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (48 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 049/218] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 051/218] RAID5: check_reshape() shouldn't call mddev_suspend Kamal Mostafa
                   ` (167 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Jes Sorensen, Shaohua Li, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jes Sorensen <Jes.Sorensen@redhat.com>

commit e7597e69dec59b65c5525db1626b9d34afdfa678 upstream.

'max_discard_sectors' is in sectors, while 'stripe' is in bytes.

This fixes the problem where DISCARD would get disabled on some larger
RAID5 configurations (6 or more drives in my testing), while it worked
as expected with smaller configurations.

Fixes: 620125f2bf8 ("MD: raid5 trim support")
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid5.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 0d4f7b1..a6917f0 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6958,8 +6958,8 @@ static int run(struct mddev *mddev)
 		}
 
 		if (discard_supported &&
-		   mddev->queue->limits.max_discard_sectors >= stripe &&
-		   mddev->queue->limits.discard_granularity >= stripe)
+		    mddev->queue->limits.max_discard_sectors >= (stripe >> 9) &&
+		    mddev->queue->limits.discard_granularity >= stripe)
 			queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
 						mddev->queue);
 		else
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 051/218] RAID5: check_reshape() shouldn't call mddev_suspend
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (49 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 050/218] md/raid5: Compare apples to apples (or sectors to sectors) Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 052/218] RAID5: revert e9e4c377e2f563 to fix a livelock Kamal Mostafa
                   ` (166 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Shaohua Li, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Shaohua Li <shli@fb.com>

commit 27a353c026a879a1001e5eac4bda75b16262c44a upstream.

check_reshape() is called from raid5d thread. raid5d thread shouldn't
call mddev_suspend(), because mddev_suspend() waits for all IO finish
but IO is handled in raid5d thread, we could easily deadlock here.

This issue is introduced by
738a273 ("md/raid5: fix allocation of 'scribble' array.")

Reported-and-tested-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid5.c | 18 ++++++++++++++++++
 drivers/md/raid5.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index a6917f0..a55b6859 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2091,6 +2091,14 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)
 	unsigned long cpu;
 	int err = 0;
 
+	/*
+	 * Never shrink. And mddev_suspend() could deadlock if this is called
+	 * from raid5d. In that case, scribble_disks and scribble_sectors
+	 * should equal to new_disks and new_sectors
+	 */
+	if (conf->scribble_disks >= new_disks &&
+	    conf->scribble_sectors >= new_sectors)
+		return 0;
 	mddev_suspend(conf->mddev);
 	get_online_cpus();
 	for_each_present_cpu(cpu) {
@@ -2112,6 +2120,10 @@ static int resize_chunks(struct r5conf *conf, int new_disks, int new_sectors)
 	}
 	put_online_cpus();
 	mddev_resume(conf->mddev);
+	if (!err) {
+		conf->scribble_disks = new_disks;
+		conf->scribble_sectors = new_sectors;
+	}
 	return err;
 }
 
@@ -6379,6 +6391,12 @@ static int raid5_alloc_percpu(struct r5conf *conf)
 	}
 	put_online_cpus();
 
+	if (!err) {
+		conf->scribble_disks = max(conf->raid_disks,
+			conf->previous_raid_disks);
+		conf->scribble_sectors = max(conf->chunk_sectors,
+			conf->prev_chunk_sectors);
+	}
 	return err;
 }
 
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index d051442..65ecd49 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -501,6 +501,8 @@ struct r5conf {
 					      * conversions
 					      */
 	} __percpu *percpu;
+	int scribble_disks;
+	int scribble_sectors;
 #ifdef CONFIG_HOTPLUG_CPU
 	struct notifier_block	cpu_notify;
 #endif
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 052/218] RAID5: revert e9e4c377e2f563 to fix a livelock
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (50 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 051/218] RAID5: check_reshape() shouldn't call mddev_suspend Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 053/218] crypto: ccp - memset request context to zero during import Kamal Mostafa
                   ` (165 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Yuanhan Liu, NeilBrown, Shaohua Li, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Shaohua Li <shli@fb.com>

commit 6ab2a4b806ae21b6c3e47c5ff1285ec06d505325 upstream.

Revert commit
e9e4c377e2f563(md/raid5: per hash value and exclusive wait_for_stripe)

The problem is raid5_get_active_stripe waits on
conf->wait_for_stripe[hash]. Assume hash is 0. My test release stripes
in this order:
- release all stripes with hash 0
- raid5_get_active_stripe still sleeps since active_stripes >
  max_nr_stripes * 3 / 4
- release all stripes with hash other than 0. active_stripes becomes 0
- raid5_get_active_stripe still sleeps, since nobody wakes up
  wait_for_stripe[0]
The system live locks. The problem is active_stripes isn't a per-hash
count. Revert the patch makes the live lock go away.

Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: NeilBrown <neilb@suse.de>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid5.c | 27 ++++++++-------------------
 drivers/md/raid5.h |  2 +-
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index a55b6859..71d7cf7 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -344,8 +344,7 @@ static void release_inactive_stripe_list(struct r5conf *conf,
 					 int hash)
 {
 	int size;
-	unsigned long do_wakeup = 0;
-	int i = 0;
+	bool do_wakeup = false;
 	unsigned long flags;
 
 	if (hash == NR_STRIPE_HASH_LOCKS) {
@@ -366,19 +365,15 @@ static void release_inactive_stripe_list(struct r5conf *conf,
 			    !list_empty(list))
 				atomic_dec(&conf->empty_inactive_list_nr);
 			list_splice_tail_init(list, conf->inactive_list + hash);
-			do_wakeup |= 1 << hash;
+			do_wakeup = true;
 			spin_unlock_irqrestore(conf->hash_locks + hash, flags);
 		}
 		size--;
 		hash--;
 	}
 
-	for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++) {
-		if (do_wakeup & (1 << i))
-			wake_up(&conf->wait_for_stripe[i]);
-	}
-
 	if (do_wakeup) {
+		wake_up(&conf->wait_for_stripe);
 		if (atomic_read(&conf->active_stripes) == 0)
 			wake_up(&conf->wait_for_quiescent);
 		if (conf->retry_read_aligned)
@@ -691,15 +686,14 @@ get_active_stripe(struct r5conf *conf, sector_t sector,
 			if (!sh) {
 				set_bit(R5_INACTIVE_BLOCKED,
 					&conf->cache_state);
-				wait_event_exclusive_cmd(
-					conf->wait_for_stripe[hash],
+				wait_event_lock_irq(
+					conf->wait_for_stripe,
 					!list_empty(conf->inactive_list + hash) &&
 					(atomic_read(&conf->active_stripes)
 					 < (conf->max_nr_stripes * 3 / 4)
 					 || !test_bit(R5_INACTIVE_BLOCKED,
 						      &conf->cache_state)),
-					spin_unlock_irq(conf->hash_locks + hash),
-					spin_lock_irq(conf->hash_locks + hash));
+					*(conf->hash_locks + hash));
 				clear_bit(R5_INACTIVE_BLOCKED,
 					  &conf->cache_state);
 			} else {
@@ -724,9 +718,6 @@ get_active_stripe(struct r5conf *conf, sector_t sector,
 		}
 	} while (sh == NULL);
 
-	if (!list_empty(conf->inactive_list + hash))
-		wake_up(&conf->wait_for_stripe[hash]);
-
 	spin_unlock_irq(conf->hash_locks + hash);
 	return sh;
 }
@@ -2204,7 +2195,7 @@ static int resize_stripes(struct r5conf *conf, int newsize)
 	cnt = 0;
 	list_for_each_entry(nsh, &newstripes, lru) {
 		lock_device_hash_lock(conf, hash);
-		wait_event_exclusive_cmd(conf->wait_for_stripe[hash],
+		wait_event_cmd(conf->wait_for_stripe,
 				    !list_empty(conf->inactive_list + hash),
 				    unlock_device_hash_lock(conf, hash),
 				    lock_device_hash_lock(conf, hash));
@@ -6487,9 +6478,7 @@ static struct r5conf *setup_conf(struct mddev *mddev)
 	seqcount_init(&conf->gen_lock);
 	mutex_init(&conf->cache_size_mutex);
 	init_waitqueue_head(&conf->wait_for_quiescent);
-	for (i = 0; i < NR_STRIPE_HASH_LOCKS; i++) {
-		init_waitqueue_head(&conf->wait_for_stripe[i]);
-	}
+	init_waitqueue_head(&conf->wait_for_stripe);
 	init_waitqueue_head(&conf->wait_for_overlap);
 	INIT_LIST_HEAD(&conf->handle_list);
 	INIT_LIST_HEAD(&conf->hold_list);
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
index 65ecd49..a42a25d 100644
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -515,7 +515,7 @@ struct r5conf {
 	atomic_t		empty_inactive_list_nr;
 	struct llist_head	released_stripes;
 	wait_queue_head_t	wait_for_quiescent;
-	wait_queue_head_t	wait_for_stripe[NR_STRIPE_HASH_LOCKS];
+	wait_queue_head_t	wait_for_stripe;
 	wait_queue_head_t	wait_for_overlap;
 	unsigned long		cache_state;
 #define R5_INACTIVE_BLOCKED	1	/* release of inactive stripes blocked,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 053/218] crypto: ccp - memset request context to zero during import
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (51 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 052/218] RAID5: revert e9e4c377e2f563 to fix a livelock Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 054/218] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014 Kamal Mostafa
                   ` (164 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tom Lendacky, Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tom Lendacky <thomas.lendacky@amd.com>

commit ce0ae266feaf35930394bd770c69778e4ef03ba9 upstream.

Since a crypto_ahash_import() can be called against a request context
that has not had a crypto_ahash_init() performed, the request context
needs to be cleared to insure there is no random data present. If not,
the random data can result in a kernel oops during crypto_ahash_update().

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 1 +
 drivers/crypto/ccp/ccp-crypto-sha.c      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
index 8680b18..0a4973b 100644
--- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
+++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
@@ -226,6 +226,7 @@ static int ccp_aes_cmac_import(struct ahash_request *req, const void *in)
 	/* 'in' may not be aligned so memcpy to local variable */
 	memcpy(&state, in, sizeof(state));
 
+	memset(rctx, 0, sizeof(*rctx));
 	rctx->null_msg = state.null_msg;
 	memcpy(rctx->iv, state.iv, sizeof(rctx->iv));
 	rctx->buf_count = state.buf_count;
diff --git a/drivers/crypto/ccp/ccp-crypto-sha.c b/drivers/crypto/ccp/ccp-crypto-sha.c
index e9b199f..9711b6d 100644
--- a/drivers/crypto/ccp/ccp-crypto-sha.c
+++ b/drivers/crypto/ccp/ccp-crypto-sha.c
@@ -220,6 +220,7 @@ static int ccp_sha_import(struct ahash_request *req, const void *in)
 	/* 'in' may not be aligned so memcpy to local variable */
 	memcpy(&state, in, sizeof(state));
 
+	memset(rctx, 0, sizeof(*rctx));
 	rctx->type = state.type;
 	rctx->msg_bits = state.msg_bits;
 	rctx->first = state.first;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 054/218] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (52 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 053/218] crypto: ccp - memset request context to zero during import Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 055/218] mmc: sdhci: fix data timeout (part 1) Kamal Mostafa
                   ` (163 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit 81d90442eac779938217c3444b240aa51fd3db47 upstream.

T: Bus=01 Lev=01 Prnt=01 Port=04 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=04ca ProdID=3014 Rev=00.02
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

BugLink: https://bugs.launchpad.net/bugs/1546694

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 3d71c1a..b313b20 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -93,6 +93,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x04CA, 0x300d) },
 	{ USB_DEVICE(0x04CA, 0x300f) },
 	{ USB_DEVICE(0x04CA, 0x3010) },
+	{ USB_DEVICE(0x04CA, 0x3014) },
 	{ USB_DEVICE(0x0930, 0x0219) },
 	{ USB_DEVICE(0x0930, 0x021c) },
 	{ USB_DEVICE(0x0930, 0x0220) },
@@ -157,6 +158,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x04ca, 0x300d), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x04ca, 0x3014), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 2768dcb..52ad06b 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -196,6 +196,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x04ca, 0x300d), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x04ca, 0x3014), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x021c), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 055/218] mmc: sdhci: fix data timeout (part 1)
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (53 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 054/218] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014 Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 056/218] mmc: sdhci: fix data timeout (part 2) Kamal Mostafa
                   ` (162 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Russell King, Adrian Hunter, Ulf Hansson, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit fafcfda9e78cae8796d1799f14e6457790797555 upstream.

The data timeout gives the minimum amount of time that should be
waited before timing out if no data is received from the card.
Simply dividing the nanosecond part by 1000 does not give this
required guarantee, since such a division rounds down.  Use
DIV_ROUND_UP() to give the desired timeout.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 939438f..3c13169 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -667,7 +667,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
 	if (!data)
 		target_timeout = cmd->busy_timeout * 1000;
 	else {
-		target_timeout = data->timeout_ns / 1000;
+		target_timeout = DIV_ROUND_UP(data->timeout_ns, 1000);
 		if (host->clock)
 			target_timeout += data->timeout_clks / host->clock;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 056/218] mmc: sdhci: fix data timeout (part 2)
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (54 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 055/218] mmc: sdhci: fix data timeout (part 1) Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 057/218] perf tools: Fix python extension build Kamal Mostafa
                   ` (161 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Russell King, Adrian Hunter, Ulf Hansson, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Russell King <rmk+kernel@arm.linux.org.uk>

commit 7f05538af71c7d30b5fc821cbe9f318edc645961 upstream.

The calculation for the timeout based on the number of card clocks is
incorrect.  The calculation assumed:

	timeout in microseconds = clock cycles / clock in Hz

which is clearly a several orders of magnitude wrong.  Fix this by
multiplying the clock cycles by 1000000 prior to dividing by the Hz
based clock.  Also, as per part 1, ensure that the division rounds
up.

As this needs 64-bit math via do_div(), avoid it if the clock cycles
is zero.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3c13169..57dd499 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -668,8 +668,19 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
 		target_timeout = cmd->busy_timeout * 1000;
 	else {
 		target_timeout = DIV_ROUND_UP(data->timeout_ns, 1000);
-		if (host->clock)
-			target_timeout += data->timeout_clks / host->clock;
+		if (host->clock && data->timeout_clks) {
+			unsigned long long val;
+
+			/*
+			 * data->timeout_clks is in units of clock cycles.
+			 * host->clock is in Hz.  target_timeout is in us.
+			 * Hence, us = 1000000 * cycles / Hz.  Round up.
+			 */
+			val = 1000000 * data->timeout_clks;
+			if (do_div(val, host->clock))
+				target_timeout++;
+			target_timeout += val;
+		}
 	}
 
 	/*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 057/218] perf tools: Fix python extension build
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (55 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 056/218] mmc: sdhci: fix data timeout (part 2) Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 058/218] IB/srpt: Simplify srpt_handle_tsk_mgmt() Kamal Mostafa
                   ` (160 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Olsa, David Ahern, Namhyung Kim, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jiri Olsa <jolsa@redhat.com>

commit 67d5268908283c187e0a460048a423256c2fb288 upstream.

The util/python-ext-sources file contains source files required to build
the python extension relative to $(srctree)/tools/perf,

Such a file path $(FILE).c is handed over to the python extension build
system, which builds the final object in the
$(PYTHON_EXTBUILD)/tmp/$(FILE).o path.

After the build is done all files from $(PYTHON_EXTBUILD)lib/ are
carried as the result binaries.

Above system fails when we add source file relative to ../lib, which we
do for:

  ../lib/bitmap.c
  ../lib/find_bit.c
  ../lib/hweight.c
  ../lib/rbtree.c

All above objects will be built like:

  $(PYTHON_EXTBUILD)/tmp/../lib/bitmap.c
  $(PYTHON_EXTBUILD)/tmp/../lib/find_bit.c
  $(PYTHON_EXTBUILD)/tmp/../lib/hweight.c
  $(PYTHON_EXTBUILD)/tmp/../lib/rbtree.c

which accidentally happens to be final library path:

  $(PYTHON_EXTBUILD)/lib/

Changing setup.py to pass full paths of source files to Extension build
class and thus keep all built objects under $(PYTHON_EXTBUILD)tmp
directory.

Reported-by: Jeff Bastian <jbastian@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Josh Boyer <jwboyer@fedoraproject.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20160227201350.GB28494@krava.redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/perf/util/setup.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index 1833103..c868098 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -22,6 +22,7 @@ cflags = getenv('CFLAGS', '').split()
 # switch off several checks (need to be at the end of cflags list)
 cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
 
+src_perf  = getenv('srctree') + '/tools/perf'
 build_lib = getenv('PYTHON_EXTBUILD_LIB')
 build_tmp = getenv('PYTHON_EXTBUILD_TMP')
 libtraceevent = getenv('LIBTRACEEVENT')
@@ -30,6 +31,9 @@ libapikfs = getenv('LIBAPI')
 ext_sources = [f.strip() for f in file('util/python-ext-sources')
 				if len(f.strip()) > 0 and f[0] != '#']
 
+# use full paths with source files
+ext_sources = map(lambda x: '%s/%s' % (src_perf, x) , ext_sources)
+
 perf = Extension('perf',
 		  sources = ext_sources,
 		  include_dirs = ['util/include'],
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 058/218] IB/srpt: Simplify srpt_handle_tsk_mgmt()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (56 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 057/218] perf tools: Fix python extension build Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 059/218] [media] bttv: Width must be a multiple of 16 when capturing planar formats Kamal Mostafa
                   ` (159 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bart Van Assche, Nicholas Bellinger, Sagi Grimberg, Doug Ledford,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Bart Van Assche <bart.vanassche@sandisk.com>

commit 51093254bf879bc9ce96590400a87897c7498463 upstream.

Let the target core check task existence instead of the SRP target
driver. Additionally, let the target core check the validity of the
task management request instead of the ib_srpt driver.

This patch fixes the following kernel crash:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
IP: [<ffffffffa0565f37>] srpt_handle_new_iu+0x6d7/0x790 [ib_srpt]
Oops: 0002 [#1] SMP
Call Trace:
 [<ffffffffa05660ce>] srpt_process_completion+0xde/0x570 [ib_srpt]
 [<ffffffffa056669f>] srpt_compl_thread+0x13f/0x160 [ib_srpt]
 [<ffffffff8109726f>] kthread+0xcf/0xe0
 [<ffffffff81613cfc>] ret_from_fork+0x7c/0xb0

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Fixes: 3e4f574857ee ("ib_srpt: Convert TMR path to target_submit_tmr")
Tested-by: Alex Estrin <alex.estrin@intel.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 59 +----------------------------------
 1 file changed, 1 insertion(+), 58 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 60ff0a2..bf8d4e4 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1738,47 +1738,6 @@ send_sense:
 	return -1;
 }
 
-/**
- * srpt_rx_mgmt_fn_tag() - Process a task management function by tag.
- * @ch: RDMA channel of the task management request.
- * @fn: Task management function to perform.
- * @req_tag: Tag of the SRP task management request.
- * @mgmt_ioctx: I/O context of the task management request.
- *
- * Returns zero if the target core will process the task management
- * request asynchronously.
- *
- * Note: It is assumed that the initiator serializes tag-based task management
- * requests.
- */
-static int srpt_rx_mgmt_fn_tag(struct srpt_send_ioctx *ioctx, u64 tag)
-{
-	struct srpt_device *sdev;
-	struct srpt_rdma_ch *ch;
-	struct srpt_send_ioctx *target;
-	int ret, i;
-
-	ret = -EINVAL;
-	ch = ioctx->ch;
-	BUG_ON(!ch);
-	BUG_ON(!ch->sport);
-	sdev = ch->sport->sdev;
-	BUG_ON(!sdev);
-	spin_lock_irq(&sdev->spinlock);
-	for (i = 0; i < ch->rq_size; ++i) {
-		target = ch->ioctx_ring[i];
-		if (target->cmd.se_lun == ioctx->cmd.se_lun &&
-		    target->cmd.tag == tag &&
-		    srpt_get_cmd_state(target) != SRPT_STATE_DONE) {
-			ret = 0;
-			/* now let the target core abort &target->cmd; */
-			break;
-		}
-	}
-	spin_unlock_irq(&sdev->spinlock);
-	return ret;
-}
-
 static int srp_tmr_to_tcm(int fn)
 {
 	switch (fn) {
@@ -1813,7 +1772,6 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
 	struct se_cmd *cmd;
 	struct se_session *sess = ch->sess;
 	uint64_t unpacked_lun;
-	uint32_t tag = 0;
 	int tcm_tmr;
 	int rc;
 
@@ -1829,25 +1787,10 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch,
 	srpt_set_cmd_state(send_ioctx, SRPT_STATE_MGMT);
 	send_ioctx->cmd.tag = srp_tsk->tag;
 	tcm_tmr = srp_tmr_to_tcm(srp_tsk->tsk_mgmt_func);
-	if (tcm_tmr < 0) {
-		send_ioctx->cmd.se_tmr_req->response =
-			TMR_TASK_MGMT_FUNCTION_NOT_SUPPORTED;
-		goto fail;
-	}
 	unpacked_lun = srpt_unpack_lun((uint8_t *)&srp_tsk->lun,
 				       sizeof(srp_tsk->lun));
-
-	if (srp_tsk->tsk_mgmt_func == SRP_TSK_ABORT_TASK) {
-		rc = srpt_rx_mgmt_fn_tag(send_ioctx, srp_tsk->task_tag);
-		if (rc < 0) {
-			send_ioctx->cmd.se_tmr_req->response =
-					TMR_TASK_DOES_NOT_EXIST;
-			goto fail;
-		}
-		tag = srp_tsk->task_tag;
-	}
 	rc = target_submit_tmr(&send_ioctx->cmd, sess, NULL, unpacked_lun,
-				srp_tsk, tcm_tmr, GFP_KERNEL, tag,
+				srp_tsk, tcm_tmr, GFP_KERNEL, srp_tsk->task_tag,
 				TARGET_SCF_ACK_KREF);
 	if (rc != 0) {
 		send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 059/218] [media] bttv: Width must be a multiple of 16 when capturing planar formats
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (57 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 058/218] IB/srpt: Simplify srpt_handle_tsk_mgmt() Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 060/218] watchdog: rc32434_wdt: fix ioctl error handling Kamal Mostafa
                   ` (158 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 5c915c68763889f0183a1cc61c84bb228b60124a upstream.

On my bttv card "Hauppauge WinTV [card=10]" capturing in YV12 fmt at max
size results in a solid green rectangle being captured (all colors 0 in
YUV).

This turns out to be caused by max-width (924) not being a multiple of 16.

We've likely never hit this problem before since normally xawtv / tvtime,
etc. will prefer packed pixel formats. But when using a video card which
is using xf86-video-modesetting + glamor, only planar XVideo fmts are
available, and xawtv will chose a matching capture format to avoid needing
to do conversion, triggering the solid green window problem.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/pci/bt8xx/bttv-driver.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index 3632958..06d586b 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -2334,6 +2334,19 @@ static int bttv_g_fmt_vid_overlay(struct file *file, void *priv,
 	return 0;
 }
 
+static void bttv_get_width_mask_vid_cap(const struct bttv_format *fmt,
+					unsigned int *width_mask,
+					unsigned int *width_bias)
+{
+	if (fmt->flags & FORMAT_FLAGS_PLANAR) {
+		*width_mask = ~15; /* width must be a multiple of 16 pixels */
+		*width_bias = 8;   /* nearest */
+	} else {
+		*width_mask = ~3; /* width must be a multiple of 4 pixels */
+		*width_bias = 2;  /* nearest */
+	}
+}
+
 static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 						struct v4l2_format *f)
 {
@@ -2343,6 +2356,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 	enum v4l2_field field;
 	__s32 width, height;
 	__s32 height2;
+	unsigned int width_mask, width_bias;
 	int rc;
 
 	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
@@ -2375,9 +2389,9 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
 	width = f->fmt.pix.width;
 	height = f->fmt.pix.height;
 
+	bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias);
 	rc = limit_scaled_size_lock(fh, &width, &height, field,
-			       /* width_mask: 4 pixels */ ~3,
-			       /* width_bias: nearest */ 2,
+			       width_mask, width_bias,
 			       /* adjust_size */ 1,
 			       /* adjust_crop */ 0);
 	if (0 != rc)
@@ -2410,6 +2424,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
 	struct bttv_fh *fh = priv;
 	struct bttv *btv = fh->btv;
 	__s32 width, height;
+	unsigned int width_mask, width_bias;
 	enum v4l2_field field;
 
 	retval = bttv_switch_type(fh, f->type);
@@ -2424,9 +2439,10 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
 	height = f->fmt.pix.height;
 	field = f->fmt.pix.field;
 
+	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
+	bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias);
 	retval = limit_scaled_size_lock(fh, &width, &height, f->fmt.pix.field,
-			       /* width_mask: 4 pixels */ ~3,
-			       /* width_bias: nearest */ 2,
+			       width_mask, width_bias,
 			       /* adjust_size */ 1,
 			       /* adjust_crop */ 1);
 	if (0 != retval)
@@ -2434,8 +2450,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
 
 	f->fmt.pix.field = field;
 
-	fmt = format_by_fourcc(f->fmt.pix.pixelformat);
-
 	/* update our state informations */
 	fh->fmt              = fmt;
 	fh->cap.field        = f->fmt.pix.field;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 060/218] watchdog: rc32434_wdt: fix ioctl error handling
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (58 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 059/218] [media] bttv: Width must be a multiple of 16 when capturing planar formats Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 061/218] nfsd4: fix bad bounds checking Kamal Mostafa
                   ` (157 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael S . Tsirkin, Guenter Roeck, Wim Van Sebroeck, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Michael S. Tsirkin" <mst@redhat.com>

commit 10e7ac22cdd4d211cef99afcb9371b70cb175be6 upstream.

Calling return copy_to_user(...) in an ioctl will not do the right thing
if there's a pagefault: copy_to_user returns the number of bytes not
copied in this case.

Fix up watchdog/rc32434_wdt to do
	return copy_to_user(...)) ?  -EFAULT : 0;

instead.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/watchdog/rc32434_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index 71e78ef..3a75f3b 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -237,7 +237,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
 			return -EINVAL;
 		/* Fall through */
 	case WDIOC_GETTIMEOUT:
-		return copy_to_user(argp, &timeout, sizeof(int));
+		return copy_to_user(argp, &timeout, sizeof(int)) ? -EFAULT : 0;
 	default:
 		return -ENOTTY;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 061/218] nfsd4: fix bad bounds checking
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (59 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 060/218] watchdog: rc32434_wdt: fix ioctl error handling Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 062/218] xfs: fix two memory leaks in xfs_attr_list.c error paths Kamal Mostafa
                   ` (156 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: J . Bruce Fields, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "J. Bruce Fields" <bfields@redhat.com>

commit 4aed9c46afb80164401143aa0fdcfe3798baa9d5 upstream.

A number of spots in the xdr decoding follow a pattern like

	n = be32_to_cpup(p++);
	READ_BUF(n + 4);

where n is a u32.  The only bounds checking is done in READ_BUF itself,
but since it's checking (n + 4), it won't catch cases where n is very
large, (u32)(-4) or higher.  I'm not sure exactly what the consequences
are, but we've seen crashes soon after.

Instead, just break these up into two READ_BUF()s.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/nfsd/nfs4xdr.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b81f725..02c0161 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1072,8 +1072,9 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename
 
 	READ_BUF(4);
 	rename->rn_snamelen = be32_to_cpup(p++);
-	READ_BUF(rename->rn_snamelen + 4);
+	READ_BUF(rename->rn_snamelen);
 	SAVEMEM(rename->rn_sname, rename->rn_snamelen);
+	READ_BUF(4);
 	rename->rn_tnamelen = be32_to_cpup(p++);
 	READ_BUF(rename->rn_tnamelen);
 	SAVEMEM(rename->rn_tname, rename->rn_tnamelen);
@@ -1155,13 +1156,14 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
 	READ_BUF(8);
 	setclientid->se_callback_prog = be32_to_cpup(p++);
 	setclientid->se_callback_netid_len = be32_to_cpup(p++);
-
-	READ_BUF(setclientid->se_callback_netid_len + 4);
+	READ_BUF(setclientid->se_callback_netid_len);
 	SAVEMEM(setclientid->se_callback_netid_val, setclientid->se_callback_netid_len);
+	READ_BUF(4);
 	setclientid->se_callback_addr_len = be32_to_cpup(p++);
 
-	READ_BUF(setclientid->se_callback_addr_len + 4);
+	READ_BUF(setclientid->se_callback_addr_len);
 	SAVEMEM(setclientid->se_callback_addr_val, setclientid->se_callback_addr_len);
+	READ_BUF(4);
 	setclientid->se_callback_ident = be32_to_cpup(p++);
 
 	DECODE_TAIL;
@@ -1815,8 +1817,9 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
 
 	READ_BUF(4);
 	argp->taglen = be32_to_cpup(p++);
-	READ_BUF(argp->taglen + 8);
+	READ_BUF(argp->taglen);
 	SAVEMEM(argp->tag, argp->taglen);
+	READ_BUF(8);
 	argp->minorversion = be32_to_cpup(p++);
 	argp->opcnt = be32_to_cpup(p++);
 	max_reply += 4 + (XDR_QUADLEN(argp->taglen) << 2);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 062/218] xfs: fix two memory leaks in xfs_attr_list.c error paths
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (60 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 061/218] nfsd4: fix bad bounds checking Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 063/218] quota: Fix possible GPF due to uninitialised pointers Kamal Mostafa
                   ` (155 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mateusz Guzik, Dave Chinner, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Mateusz Guzik <mguzik@redhat.com>

commit 2e83b79b2d6c78bf1b4aa227938a214dcbddc83f upstream.

This plugs 2 trivial leaks in xfs_attr_shortform_list and
xfs_attr3_leaf_list_int.

Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/xfs/xfs_attr_list.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_attr_list.c b/fs/xfs/xfs_attr_list.c
index 65fb37a..8f7e09d 100644
--- a/fs/xfs/xfs_attr_list.c
+++ b/fs/xfs/xfs_attr_list.c
@@ -202,8 +202,10 @@ xfs_attr_shortform_list(xfs_attr_list_context_t *context)
 					sbp->namelen,
 					sbp->valuelen,
 					&sbp->name[sbp->namelen]);
-		if (error)
+		if (error) {
+			kmem_free(sbuf);
 			return error;
+		}
 		if (context->seen_enough)
 			break;
 		cursor->offset++;
@@ -454,14 +456,13 @@ xfs_attr3_leaf_list_int(
 				args.rmtblkcnt = xfs_attr3_rmt_blocks(
 							args.dp->i_mount, valuelen);
 				retval = xfs_attr_rmtval_get(&args);
-				if (retval)
-					return retval;
-				retval = context->put_listent(context,
-						entry->flags,
-						name_rmt->name,
-						(int)name_rmt->namelen,
-						valuelen,
-						args.value);
+				if (!retval)
+					retval = context->put_listent(context,
+							entry->flags,
+							name_rmt->name,
+							(int)name_rmt->namelen,
+							valuelen,
+							args.value);
 				kmem_free(args.value);
 			} else {
 				retval = context->put_listent(context,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 063/218] quota: Fix possible GPF due to uninitialised pointers
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (61 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 062/218] xfs: fix two memory leaks in xfs_attr_list.c error paths Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 064/218] mtip32xx: Fix broken service thread handling Kamal Mostafa
                   ` (154 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nikolay Borisov, Jan Kara, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Nikolay Borisov <kernel@kyup.com>

commit ab73ef46398e2c0159f3a71de834586422d2a44a upstream.

When dqget() in __dquot_initialize() fails e.g. due to IO error,
__dquot_initialize() will pass an array of uninitialized pointers to
dqput_all() and thus can lead to deference of random data. Fix the
problem by properly initializing the array.

Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/quota/dquot.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 20d1f74..19c777a 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1393,7 +1393,7 @@ static int dquot_active(const struct inode *inode)
 static void __dquot_initialize(struct inode *inode, int type)
 {
 	int cnt, init_needed = 0;
-	struct dquot **dquots, *got[MAXQUOTAS];
+	struct dquot **dquots, *got[MAXQUOTAS] = {};
 	struct super_block *sb = inode->i_sb;
 	qsize_t rsv;
 
@@ -1408,7 +1408,6 @@ static void __dquot_initialize(struct inode *inode, int type)
 		kprojid_t projid;
 		int rc;
 
-		got[cnt] = NULL;
 		if (type != -1 && cnt != type)
 			continue;
 		/*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 064/218] mtip32xx: Fix broken service thread handling
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (62 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 063/218] quota: Fix possible GPF due to uninitialised pointers Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 065/218] mtip32xx: Remove unwanted code from taskfile error handler Kamal Mostafa
                   ` (153 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Asai Thambi S P, Jens Axboe, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit cfc05bd31384c4898bf2437a4de5557f3cf9803a upstream.

Service thread does not detect the need for taskfile error hanlding. Fixed the
flag condition to process taskfile error.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 6 +++---
 drivers/block/mtip32xx/mtip32xx.h | 5 +++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index f504232..4e772dc 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2924,9 +2924,7 @@ static int mtip_service_thread(void *data)
 		 * is in progress nor error handling is active
 		 */
 		wait_event_interruptible(port->svc_wait, (port->flags) &&
-			!(port->flags & MTIP_PF_PAUSE_IO));
-
-		set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags);
+			(port->flags & MTIP_PF_SVC_THD_WORK));
 
 		if (kthread_should_stop() ||
 			test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags))
@@ -2936,6 +2934,8 @@ static int mtip_service_thread(void *data)
 				&dd->dd_flag)))
 			goto st_out;
 
+		set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags);
+
 restart_eh:
 		/* Demux bits: start with error handling */
 		if (test_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags)) {
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 3274784..8635239 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -144,6 +144,11 @@ enum {
 	MTIP_PF_REBUILD_BIT         = 6,
 	MTIP_PF_SVC_THD_STOP_BIT    = 8,
 
+	MTIP_PF_SVC_THD_WORK	= ((1 << MTIP_PF_EH_ACTIVE_BIT) |
+				  (1 << MTIP_PF_ISSUE_CMDS_BIT) |
+				  (1 << MTIP_PF_REBUILD_BIT) |
+				  (1 << MTIP_PF_SVC_THD_STOP_BIT)),
+
 	/* below are bit numbers in 'dd_flag' defined in driver_data */
 	MTIP_DDF_SEC_LOCK_BIT	    = 0,
 	MTIP_DDF_REMOVE_PENDING_BIT = 1,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 065/218] mtip32xx: Remove unwanted code from taskfile error handler
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (63 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 064/218] mtip32xx: Fix broken service thread handling Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 066/218] mtip32xx: Print exact time when an internal command is interrupted Kamal Mostafa
                   ` (152 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Rajesh Kumar Sambandam, Asai Thambi S P, Jens Axboe,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit e35b94738a2f7caa12017f69ef385cb6b8028965 upstream.

Remove setting and clearing MTIP_PF_EH_ACTIVE_BIT flag in
mtip_handle_tfe() as they are redundant. Also avoid waking
up service thread from mtip_handle_tfe() because it is
already woken up in case of taskfile error.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Rajesh Kumar Sambandam <rsambandam@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 4e772dc..2b432f1 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -618,8 +618,6 @@ static void mtip_handle_tfe(struct driver_data *dd)
 
 	port = dd->port;
 
-	set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);
-
 	if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) {
 		cmd = mtip_cmd_from_tag(dd, MTIP_TAG_INTERNAL);
 		dbg_printk(MTIP_DRV_NAME " TFE for the internal command\n");
@@ -628,7 +626,7 @@ static void mtip_handle_tfe(struct driver_data *dd)
 			cmd->comp_func(port, MTIP_TAG_INTERNAL,
 					cmd, PORT_IRQ_TF_ERR);
 		}
-		goto handle_tfe_exit;
+		return;
 	}
 
 	/* clear the tag accumulator */
@@ -771,11 +769,6 @@ static void mtip_handle_tfe(struct driver_data *dd)
 		}
 	}
 	print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt);
-
-handle_tfe_exit:
-	/* clear eh_active */
-	clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags);
-	wake_up_interruptible(&port->svc_wait);
 }
 
 /*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 066/218] mtip32xx: Print exact time when an internal command is interrupted
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (64 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 065/218] mtip32xx: Remove unwanted code from taskfile error handler Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 067/218] mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild Kamal Mostafa
                   ` (151 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Rajesh Kumar Sambandam, Asai Thambi S P, Jens Axboe,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit 5b7e0a8ac85e2dfd83830dc9e0b3554d153a37e3 upstream.

Print exact time when an internal command is interrupted.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Rajesh Kumar Sambandam <rsambandam@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 2b432f1..d97ffa6 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -1092,6 +1092,7 @@ static int mtip_exec_internal_command(struct mtip_port *port,
 	struct mtip_cmd *int_cmd;
 	struct driver_data *dd = port->dd;
 	int rv = 0;
+	unsigned long start;
 
 	/* Make sure the buffer is 8 byte aligned. This is asic specific. */
 	if (buffer & 0x00000007) {
@@ -1155,6 +1156,8 @@ static int mtip_exec_internal_command(struct mtip_port *port,
 	/* Populate the command header */
 	int_cmd->command_header->byte_count = 0;
 
+	start = jiffies;
+
 	/* Issue the command to the hardware */
 	mtip_issue_non_ncq_command(port, MTIP_TAG_INTERNAL);
 
@@ -1165,8 +1168,9 @@ static int mtip_exec_internal_command(struct mtip_port *port,
 				msecs_to_jiffies(timeout))) <= 0) {
 			if (rv == -ERESTARTSYS) { /* interrupted */
 				dev_err(&dd->pdev->dev,
-					"Internal command [%02X] was interrupted after %lu ms\n",
-					fis->command, timeout);
+					"Internal command [%02X] was interrupted after %u ms\n",
+					fis->command,
+					jiffies_to_msecs(jiffies - start));
 				rv = -EINTR;
 				goto exec_ic_exit;
 			} else if (rv == 0) /* timeout */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 067/218] mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (65 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 066/218] mtip32xx: Print exact time when an internal command is interrupted Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 068/218] mtip32xx: Fix for rmmod crash when drive is in " Kamal Mostafa
                   ` (150 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Vignesh Gunasekaran, Asai Thambi S P, Jens Axboe,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit d8a18d2d8f5de55666c6011ed175939d22c8e3d8 upstream.

Prevent standby immediate command from being issued in remove,
suspend and shutdown paths, while drive is in FTL rebuild process.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Vignesh Gunasekaran <vgunasekaran@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index d97ffa6..c41fc0f 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3267,20 +3267,25 @@ out1:
 	return rv;
 }
 
-static void mtip_standby_drive(struct driver_data *dd)
+static int mtip_standby_drive(struct driver_data *dd)
 {
-	if (dd->sr)
-		return;
+	int rv = 0;
 
+	if (dd->sr || !dd->port)
+		return -ENODEV;
 	/*
 	 * Send standby immediate (E0h) to the drive so that it
 	 * saves its state.
 	 */
 	if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags) &&
-	    !test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag))
-		if (mtip_standby_immediate(dd->port))
+	    !test_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag) &&
+	    !test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag)) {
+		rv = mtip_standby_immediate(dd->port);
+		if (rv)
 			dev_warn(&dd->pdev->dev,
 				"STANDBY IMMEDIATE failed\n");
+	}
+	return rv;
 }
 
 /*
@@ -3338,8 +3343,7 @@ static int mtip_hw_shutdown(struct driver_data *dd)
 	 * Send standby immediate (E0h) to the drive so that it
 	 * saves its state.
 	 */
-	if (!dd->sr && dd->port)
-		mtip_standby_immediate(dd->port);
+	mtip_standby_drive(dd);
 
 	return 0;
 }
@@ -3362,7 +3366,7 @@ static int mtip_hw_suspend(struct driver_data *dd)
 	 * Send standby immediate (E0h) to the drive
 	 * so that it saves its state.
 	 */
-	if (mtip_standby_immediate(dd->port) != 0) {
+	if (mtip_standby_drive(dd) != 0) {
 		dev_err(&dd->pdev->dev,
 			"Failed standby-immediate command\n");
 		return -EFAULT;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 068/218] mtip32xx: Fix for rmmod crash when drive is in FTL rebuild
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (66 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 067/218] mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 069/218] mtip32xx: Handle safe removal during IO Kamal Mostafa
                   ` (149 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Asai Thambi S P, Jens Axboe, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit 59cf70e236c96594d9f1e065755d8fce9df5356b upstream.

When FTL rebuild is in progress, alloc_disk() initializes the disk
but device node will be created by add_disk() only after successful
completion of FTL rebuild. So, skip deletion of device node in
removal path when FTL rebuild is in progress.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index c41fc0f..35012a6 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2975,10 +2975,8 @@ restart_eh:
 		}
 
 		if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) {
-			if (mtip_ftl_rebuild_poll(dd) < 0)
-				set_bit(MTIP_DDF_REBUILD_FAILED_BIT,
-							&dd->dd_flag);
-			clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);
+			if (mtip_ftl_rebuild_poll(dd) == 0)
+				clear_bit(MTIP_PF_REBUILD_BIT, &port->flags);
 		}
 	}
 
@@ -3859,7 +3857,6 @@ static int mtip_block_initialize(struct driver_data *dd)
 
 	mtip_hw_debugfs_init(dd);
 
-skip_create_disk:
 	memset(&dd->tags, 0, sizeof(dd->tags));
 	dd->tags.ops = &mtip_mq_ops;
 	dd->tags.nr_hw_queues = 1;
@@ -3889,6 +3886,7 @@ skip_create_disk:
 	dd->disk->queue		= dd->queue;
 	dd->queue->queuedata	= dd;
 
+skip_create_disk:
 	/* Initialize the protocol layer. */
 	wait_for_rebuild = mtip_hw_get_identify(dd);
 	if (wait_for_rebuild < 0) {
@@ -4050,7 +4048,8 @@ static int mtip_block_remove(struct driver_data *dd)
 		dd->bdev = NULL;
 	}
 	if (dd->disk) {
-		del_gendisk(dd->disk);
+		if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag))
+			del_gendisk(dd->disk);
 		if (dd->disk->queue) {
 			blk_cleanup_queue(dd->queue);
 			blk_mq_free_tag_set(&dd->tags);
@@ -4091,7 +4090,8 @@ static int mtip_block_shutdown(struct driver_data *dd)
 		dev_info(&dd->pdev->dev,
 			"Shutting down %s ...\n", dd->disk->disk_name);
 
-		del_gendisk(dd->disk);
+		if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag))
+			del_gendisk(dd->disk);
 		if (dd->disk->queue) {
 			blk_cleanup_queue(dd->queue);
 			blk_mq_free_tag_set(&dd->tags);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 069/218] mtip32xx: Handle safe removal during IO
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (67 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 068/218] mtip32xx: Fix for rmmod crash when drive is in " Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 070/218] mtip32xx: Handle FTL rebuild failure state during device initialization Kamal Mostafa
                   ` (148 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Rajesh Kumar Sambandam, Asai Thambi S P, Jens Axboe,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit 51c6570eb922146470c2fe660c34585414679bd6 upstream.

Flush inflight IOs using fsync_bdev() when the device is safely
removed. Also, block further IOs in device open function.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Rajesh Kumar Sambandam <rsambandam@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 34 ++++++++++++++++++++++++++++++++--
 drivers/block/mtip32xx/mtip32xx.h |  1 +
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 35012a6..dfd1906 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3602,6 +3602,28 @@ static int mtip_block_getgeo(struct block_device *dev,
 	return 0;
 }
 
+static int mtip_block_open(struct block_device *dev, fmode_t mode)
+{
+	struct driver_data *dd;
+
+	if (dev && dev->bd_disk) {
+		dd = (struct driver_data *) dev->bd_disk->private_data;
+
+		if (dd) {
+			if (test_bit(MTIP_DDF_REMOVAL_BIT,
+							&dd->dd_flag)) {
+				return -ENODEV;
+			}
+			return 0;
+		}
+	}
+	return -ENODEV;
+}
+
+void mtip_block_release(struct gendisk *disk, fmode_t mode)
+{
+}
+
 /*
  * Block device operation function.
  *
@@ -3609,6 +3631,8 @@ static int mtip_block_getgeo(struct block_device *dev,
  * layer.
  */
 static const struct block_device_operations mtip_block_ops = {
+	.open		= mtip_block_open,
+	.release	= mtip_block_release,
 	.ioctl		= mtip_block_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= mtip_block_compat_ioctl,
@@ -4436,7 +4460,7 @@ static void mtip_pci_remove(struct pci_dev *pdev)
 	struct driver_data *dd = pci_get_drvdata(pdev);
 	unsigned long flags, to;
 
-	set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag);
+	set_bit(MTIP_DDF_REMOVAL_BIT, &dd->dd_flag);
 
 	spin_lock_irqsave(&dev_lock, flags);
 	list_del_init(&dd->online_list);
@@ -4453,12 +4477,18 @@ static void mtip_pci_remove(struct pci_dev *pdev)
 	} while (atomic_read(&dd->irq_workers_active) != 0 &&
 		time_before(jiffies, to));
 
+	fsync_bdev(dd->bdev);
+
 	if (atomic_read(&dd->irq_workers_active) != 0) {
 		dev_warn(&dd->pdev->dev,
 			"Completion workers still active!\n");
 	}
 
-	blk_mq_stop_hw_queues(dd->queue);
+	if (dd->sr)
+		blk_mq_stop_hw_queues(dd->queue);
+
+	set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag);
+
 	/* Clean up the block layer. */
 	mtip_block_remove(dd);
 
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h
index 8635239..50af742 100644
--- a/drivers/block/mtip32xx/mtip32xx.h
+++ b/drivers/block/mtip32xx/mtip32xx.h
@@ -158,6 +158,7 @@ enum {
 	MTIP_DDF_RESUME_BIT         = 6,
 	MTIP_DDF_INIT_DONE_BIT      = 7,
 	MTIP_DDF_REBUILD_FAILED_BIT = 8,
+	MTIP_DDF_REMOVAL_BIT	    = 9,
 
 	MTIP_DDF_STOP_IO      = ((1 << MTIP_DDF_REMOVE_PENDING_BIT) |
 				(1 << MTIP_DDF_SEC_LOCK_BIT) |
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 070/218] mtip32xx: Handle FTL rebuild failure state during device initialization
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (68 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 069/218] mtip32xx: Handle safe removal during IO Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 071/218] of: alloc anywhere from memblock if range not specified Kamal Mostafa
                   ` (147 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Selvan Mani, Vignesh Gunasekaran, Asai Thambi S P, Jens Axboe,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Asai Thambi SP <asamymuthupa@micron.com>

commit aae4a033868c496adae86fc6f9c3e0c405bbf360 upstream.

Allow device initialization to finish gracefully when it is in
FTL rebuild failure state. Also, recover device out of this state
after successfully secure erasing it.

Signed-off-by: Selvan Mani <smani@micron.com>
Signed-off-by: Vignesh Gunasekaran <vgunasekaran@micron.com>
Signed-off-by: Asai Thambi S P <asamymuthupa@micron.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/mtip32xx/mtip32xx.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index dfd1906..f0a937d 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -699,7 +699,7 @@ static void mtip_handle_tfe(struct driver_data *dd)
 			fail_reason = "thermal shutdown";
 		}
 		if (buf[288] == 0xBF) {
-			set_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag);
+			set_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag);
 			dev_info(&dd->pdev->dev,
 				"Drive indicates rebuild has failed. Secure erase required.\n");
 			fail_all_ncq_cmds = 1;
@@ -1000,6 +1000,7 @@ static bool mtip_pause_ncq(struct mtip_port *port,
 			(fis->features == 0x27 || fis->features == 0x72 ||
 			 fis->features == 0x62 || fis->features == 0x26))) {
 		clear_bit(MTIP_DDF_SEC_LOCK_BIT, &port->dd->dd_flag);
+		clear_bit(MTIP_DDF_REBUILD_FAILED_BIT, &port->dd->dd_flag);
 		/* Com reset after secure erase or lowlevel format */
 		mtip_restart_port(port);
 		clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags);
@@ -1166,6 +1167,7 @@ static int mtip_exec_internal_command(struct mtip_port *port,
 		if ((rv = wait_for_completion_interruptible_timeout(
 				&wait,
 				msecs_to_jiffies(timeout))) <= 0) {
+
 			if (rv == -ERESTARTSYS) { /* interrupted */
 				dev_err(&dd->pdev->dev,
 					"Internal command [%02X] was interrupted after %u ms\n",
@@ -3091,7 +3093,7 @@ static int mtip_hw_get_identify(struct driver_data *dd)
 		if (buf[288] == 0xBF) {
 			dev_info(&dd->pdev->dev,
 				"Drive indicates rebuild has failed.\n");
-			/* TODO */
+			set_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag);
 		}
 	}
 
@@ -3694,10 +3696,9 @@ static int mtip_submit_request(struct blk_mq_hw_ctx *hctx, struct request *rq)
 				rq_data_dir(rq))) {
 			return -ENODATA;
 		}
-		if (unlikely(test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag)))
+		if (unlikely(test_bit(MTIP_DDF_SEC_LOCK_BIT, &dd->dd_flag) ||
+			test_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag)))
 			return -ENODATA;
-		if (test_bit(MTIP_DDF_REBUILD_FAILED_BIT, &dd->dd_flag))
-			return -ENXIO;
 	}
 
 	if (rq->cmd_flags & REQ_DISCARD) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 071/218] of: alloc anywhere from memblock if range not specified
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (69 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 070/218] mtip32xx: Handle FTL rebuild failure state during device initialization Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 072/218] usb: hub: fix a typo in hub_port_init() leading to wrong logic Kamal Mostafa
                   ` (146 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vinayak Menon, Rob Herring, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Vinayak Menon <vinmenon@codeaurora.org>

commit e53b50c0cbe392c946807abf7d07615a3c588642 upstream.

early_init_dt_alloc_reserved_memory_arch passes end as 0 to
__memblock_alloc_base, when limits are not specified. But
__memblock_alloc_base takes end value of 0 as MEMBLOCK_ALLOC_ACCESSIBLE
and limits the end to memblock.current_limit. This results in regions
never being placed in HIGHMEM area, for e.g. CMA.
Let __memblock_alloc_base allocate from anywhere in memory if limits are
not specified.

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/of/of_reserved_mem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 56c23ee..be4f65c 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -31,11 +31,13 @@ int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
 	phys_addr_t align, phys_addr_t start, phys_addr_t end, bool nomap,
 	phys_addr_t *res_base)
 {
+	phys_addr_t base;
 	/*
 	 * We use __memblock_alloc_base() because memblock_alloc_base()
 	 * panic()s on allocation failure.
 	 */
-	phys_addr_t base = __memblock_alloc_base(size, align, end);
+	end = !end ? MEMBLOCK_ALLOC_ANYWHERE : end;
+	base = __memblock_alloc_base(size, align, end);
 	if (!base)
 		return -ENOMEM;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 072/218] usb: hub: fix a typo in hub_port_init() leading to wrong logic
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (70 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 071/218] of: alloc anywhere from memblock if range not specified Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 073/218] KVM: i8254: change PIT discard tick policy Kamal Mostafa
                   ` (145 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Oliver Neukum <oneukum@suse.com>

commit 0d5ce778c43bf888328231bcdce05d5c860655aa upstream.

A typo of j for i led to a logic bug. To rule out future
confusion, the variable names are made meaningful.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/core/hub.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 62ea2cd..67f7e31 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4243,7 +4243,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 {
 	struct usb_device	*hdev = hub->hdev;
 	struct usb_hcd		*hcd = bus_to_hcd(hdev->bus);
-	int			i, j, retval;
+	int			retries, operations, retval, i;
 	unsigned		delay = HUB_SHORT_RESET_TIME;
 	enum usb_device_speed	oldspeed = udev->speed;
 	const char		*speed;
@@ -4345,7 +4345,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 	 * first 8 bytes of the device descriptor to get the ep0 maxpacket
 	 * value.
 	 */
-	for (i = 0; i < GET_DESCRIPTOR_TRIES; (++i, msleep(100))) {
+	for (retries = 0; retries < GET_DESCRIPTOR_TRIES; (++retries, msleep(100))) {
 		bool did_new_scheme = false;
 
 		if (use_new_scheme(udev, retry_counter)) {
@@ -4372,7 +4372,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 			 * 255 is for WUSB devices, we actually need to use
 			 * 512 (WUSB1.0[4.8.1]).
 			 */
-			for (j = 0; j < 3; ++j) {
+			for (operations = 0; operations < 3; ++operations) {
 				buf->bMaxPacketSize0 = 0;
 				r = usb_control_msg(udev, usb_rcvaddr0pipe(),
 					USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
@@ -4398,7 +4398,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 				 * reset. But only on the first attempt,
 				 * lest we get into a time out/reset loop
 				 */
-				if (r == 0  || (r == -ETIMEDOUT && j == 0))
+				if (r == 0  || (r == -ETIMEDOUT && retries == 0))
 					break;
 			}
 			udev->descriptor.bMaxPacketSize0 =
@@ -4430,7 +4430,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
 		 * authorization will assign the final address.
 		 */
 		if (udev->wusb == 0) {
-			for (j = 0; j < SET_ADDRESS_TRIES; ++j) {
+			for (operations = 0; operations < SET_ADDRESS_TRIES; ++operations) {
 				retval = hub_set_address(udev, devnum);
 				if (retval >= 0)
 					break;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 073/218] KVM: i8254: change PIT discard tick policy
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (71 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 072/218] usb: hub: fix a typo in hub_port_init() leading to wrong logic Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 074/218] sched/cputime: Fix steal time accounting vs. CPU hotplug Kamal Mostafa
                   ` (144 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Radim Krčmář, Paolo Bonzini, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@redhat.com>

commit 7dd0fdff145c5be7146d0ac06732ae3613412ac1 upstream.

Discard policy uses ack_notifiers to prevent injection of PIT interrupts
before EOI from the last one.

This patch changes the policy to always try to deliver the interrupt,
which makes a difference when its vector is in ISR.
Old implementation would drop the interrupt, but proposed one injects to
IRR, like real hardware would.

The old policy breaks legacy NMI watchdogs, where PIT is used through
virtual wire (LVT0): PIT never sends an interrupt before receiving EOI,
thus a guest deadlock with disabled interrupts will stop NMIs.

Note that NMI doesn't do EOI, so PIT also had to send a normal interrupt
through IOAPIC.  (KVM's PIT is deeply rotten and luckily not used much
in modern systems.)

Even though there is a chance of regressions, I think we can fix the
LVT0 NMI bug without introducing a new tick policy.

Reported-by: Yuki Shibuya <shibuya.yk@ncos.nec.co.jp>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kvm/i8254.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index a5b5997..3ec922b 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -244,7 +244,7 @@ static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian)
 		 * PIC is being reset.  Handle it gracefully here
 		 */
 		atomic_inc(&ps->pending);
-	else if (value > 0)
+	else if (value > 0 && ps->reinject)
 		/* in this case, we had multiple outstanding pit interrupts
 		 * that we needed to inject.  Reinject
 		 */
@@ -287,7 +287,9 @@ static void pit_do_work(struct kthread_work *work)
 	 * last one has been acked.
 	 */
 	spin_lock(&ps->inject_lock);
-	if (ps->irq_ack) {
+	if (!ps->reinject)
+		inject = 1;
+	else if (ps->irq_ack) {
 		ps->irq_ack = 0;
 		inject = 1;
 	}
@@ -316,10 +318,10 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data)
 	struct kvm_kpit_state *ps = container_of(data, struct kvm_kpit_state, timer);
 	struct kvm_pit *pt = ps->kvm->arch.vpit;
 
-	if (ps->reinject || !atomic_read(&ps->pending)) {
+	if (ps->reinject)
 		atomic_inc(&ps->pending);
-		queue_kthread_work(&pt->worker, &pt->expired);
-	}
+
+	queue_kthread_work(&pt->worker, &pt->expired);
 
 	if (ps->is_periodic) {
 		hrtimer_add_expires_ns(&ps->timer, ps->period);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 074/218] sched/cputime: Fix steal time accounting vs. CPU hotplug
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (72 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 073/218] KVM: i8254: change PIT discard tick policy Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 075/218] libnvdimm: Fix security issue with DSM IOCTL Kamal Mostafa
                   ` (143 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Gleixner, Frederic Weisbecker, Glauber Costa,
	Linus Torvalds, Peter Zijlstra, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit e9532e69b8d1d1284e8ecf8d2586de34aec61244 upstream.

On CPU hotplug the steal time accounting can keep a stale rq->prev_steal_time
value over CPU down and up. So after the CPU comes up again the delta
calculation in steal_account_process_tick() wreckages itself due to the
unsigned math:

	 u64 steal = paravirt_steal_clock(smp_processor_id());

	 steal -= this_rq()->prev_steal_time;

So if steal is smaller than rq->prev_steal_time we end up with an insane large
value which then gets added to rq->prev_steal_time, resulting in a permanent
wreckage of the accounting. As a consequence the per CPU stats in /proc/stat
become stale.

Nice trick to tell the world how idle the system is (100%) while the CPU is
100% busy running tasks. Though we prefer realistic numbers.

None of the accounting values which use a previous value to account for
fractions is reset at CPU hotplug time. update_rq_clock_task() has a sanity
check for prev_irq_time and prev_steal_time_rq, but that sanity check solely
deals with clock warps and limits the /proc/stat visible wreckage. The
prev_time values are still wrong.

Solution is simple: Reset rq->prev_*_time when the CPU is plugged in again.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: commit 095c0aa83e52 "sched: adjust scheduler cpu power for stolen time"
Fixes: commit aa483808516c "sched: Remove irq time from available CPU power"
Fixes: commit e6e6685accfa "KVM guest: Steal time accounting"
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1603041539490.3686@nanos
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/sched/core.c  |  1 +
 kernel/sched/sched.h | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 99cc1f4..5a7f856 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5377,6 +5377,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
 
 	case CPU_UP_PREPARE:
 		rq->calc_load_update = calc_load_update;
+		account_reset_rq(rq);
 		break;
 
 	case CPU_ONLINE:
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 08ab96b..a3c331f 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1771,3 +1771,16 @@ static inline u64 irq_time_read(int cpu)
 }
 #endif /* CONFIG_64BIT */
 #endif /* CONFIG_IRQ_TIME_ACCOUNTING */
+
+static inline void account_reset_rq(struct rq *rq)
+{
+#ifdef CONFIG_IRQ_TIME_ACCOUNTING
+	rq->prev_irq_time = 0;
+#endif
+#ifdef CONFIG_PARAVIRT
+	rq->prev_steal_time = 0;
+#endif
+#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
+	rq->prev_steal_time_rq = 0;
+#endif
+}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 075/218] libnvdimm: Fix security issue with DSM IOCTL.
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (73 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 074/218] sched/cputime: Fix steal time accounting vs. CPU hotplug Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 076/218] rt2x00: add new rt2800usb device Buffalo WLI-UC-G450 Kamal Mostafa
                   ` (142 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jerry Hoemann, Dan Williams, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jerry Hoemann <jerry.hoemann@hpe.com>

commit 07accfa9d1a8bac8262f6d24a94a54d2d1f35149 upstream.

Code attempts to prevent certain IOCTL DSM from being called
when device is opened read only.  This security feature can
be trivially overcome by changing the size portion of the
ioctl_command which isn't used.

Check only the _IOC_NR (i.e. the command).

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/nvdimm/bus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 7e2c43f..496b9b6 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -513,10 +513,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 
 	/* fail write commands (when read-only) */
 	if (read_only)
-		switch (ioctl_cmd) {
-		case ND_IOCTL_VENDOR:
-		case ND_IOCTL_SET_CONFIG_DATA:
-		case ND_IOCTL_ARS_START:
+		switch (cmd) {
+		case ND_CMD_VENDOR:
+		case ND_CMD_SET_CONFIG_DATA:
+		case ND_CMD_ARS_START:
 			dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n",
 					nvdimm ? nvdimm_cmd_name(cmd)
 					: nvdimm_bus_cmd_name(cmd));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 076/218] rt2x00: add new rt2800usb device Buffalo WLI-UC-G450
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (74 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 075/218] libnvdimm: Fix security issue with DSM IOCTL Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 077/218] pinctrl-bcm2835: Fix cut-and-paste error in "pull" parsing Kamal Mostafa
                   ` (141 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Anthony Wong, Kalle Valo, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Anthony Wong <anthony.wong@ubuntu.com>

commit f36f299068794ffc5026f25b6a1b3ed615ea832d upstream.

Add USB ID 0411:01fd for Buffalo WLI-UC-G450 wireless adapter,
RT chipset 3593

Signed-off-by: Anthony Wong <anthony.wong@ubuntu.com>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/rt2x00/rt2800usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 5932306..9fceb4f 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1026,6 +1026,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
 	{ USB_DEVICE(0x0411, 0x01a2) },
 	{ USB_DEVICE(0x0411, 0x01ee) },
 	{ USB_DEVICE(0x0411, 0x01a8) },
+	{ USB_DEVICE(0x0411, 0x01fd) },
 	/* Corega */
 	{ USB_DEVICE(0x07aa, 0x002f) },
 	{ USB_DEVICE(0x07aa, 0x003c) },
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 077/218] pinctrl-bcm2835: Fix cut-and-paste error in "pull" parsing
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (75 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 076/218] rt2x00: add new rt2800usb device Buffalo WLI-UC-G450 Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 078/218] perf/core: Fix perf_sched_count derailment Kamal Mostafa
                   ` (140 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Anholt, Phil Elwell, Linus Walleij, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Phil Elwell <phil@raspberrypi.org>

commit 2c7e3306d23864d49f686f22e56e180ff0fffb7f upstream.

The DT bindings for pinctrl-bcm2835 allow both the function and pull
to contain either one entry or one per pin. However, an error in the
DT parsing can cause failures if the number of pulls differs from the
number of functions.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 8f93ec3..7c09f90 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -789,7 +789,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
 		}
 		if (num_pulls) {
 			err = of_property_read_u32_index(np, "brcm,pull",
-					(num_funcs > 1) ? i : 0, &pull);
+					(num_pulls > 1) ? i : 0, &pull);
 			if (err)
 				goto out;
 			err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 078/218] perf/core: Fix perf_sched_count derailment
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (76 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 077/218] pinctrl-bcm2835: Fix cut-and-paste error in "pull" parsing Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 079/218] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2 Kamal Mostafa
                   ` (139 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Shishkin, Peter Zijlstra, Arnaldo Carvalho de Melo,
	Arnaldo Carvalho de Melo, Jiri Olsa, Linus Torvalds,
	Stephane Eranian, Thomas Gleixner, Vince Weaver, vince,
	Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alexander Shishkin <alexander.shishkin@linux.intel.com>

commit 927a5570855836e5d5859a80ce7e91e963545e8f upstream.

The error path in perf_event_open() is such that asking for a sampling
event on a PMU that doesn't generate interrupts will end up in dropping
the perf_sched_count even though it hasn't been incremented for this
event yet.

Given a sufficient amount of these calls, we'll end up disabling
scheduler's jump label even though we'd still have active events in the
system, thereby facilitating the arrival of the infernal regions upon us.

I'm fixing this by moving account_event() inside perf_event_alloc().

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: vince@deater.net
Link: http://lkml.kernel.org/r/1456917854-29427-1-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/events/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d86859f..ca03e01 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7672,6 +7672,9 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
 		}
 	}
 
+	/* symmetric to unaccount_event() in _free_event() */
+	account_event(event);
+
 	return event;
 
 err_per_task:
@@ -8035,8 +8038,6 @@ SYSCALL_DEFINE5(perf_event_open,
 		}
 	}
 
-	account_event(event);
-
 	/*
 	 * Special case software events and allow them to be part of
 	 * any hardware group.
@@ -8296,8 +8297,6 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
 	/* Mark owner so we could distinguish it from user events. */
 	event->owner = EVENT_OWNER_KERNEL;
 
-	account_event(event);
-
 	ctx = find_get_context(event->pmu, task, event);
 	if (IS_ERR(ctx)) {
 		err = PTR_ERR(ctx);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 079/218] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (77 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 078/218] perf/core: Fix perf_sched_count derailment Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 080/218] perf/x86/intel: Fix PEBS warning by only restoring active PMU in pmi Kamal Mostafa
                   ` (138 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Olsa, Peter Zijlstra, Alexander Shishkin, Jiri Olsa,
	Kan Liang, Linus Torvalds, Stephane Eranian, Thomas Gleixner,
	Vince Weaver, Wang Nan, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jiri Olsa <jolsa@redhat.com>

commit e72daf3f4d764c47fb71c9bdc7f9c54a503825b1 upstream.

Using PAGE_SIZE buffers makes the WRMSR to PERF_GLOBAL_CTRL in
intel_pmu_enable_all() mysteriously hang on Core2. As a workaround, we
don't do this.

The hard lockup is easily triggered by running 'perf test attr'
repeatedly. Most of the time it gets stuck on sample session with
small periods.

  # perf test attr -vv
  14: struct perf_event_attr setup                             :
  --- start ---
  ...
    'PERF_TEST_ATTR=/tmp/tmpuEKz3B /usr/bin/perf record -o /tmp/tmpuEKz3B/perf.data -c 123 kill >/dev/null 2>&1' ret 1

Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20160301190352.GA8355@krava.redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ kamal: backport to 4.2-stable: files renamed ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/cpu/perf_event.h          |  1 +
 arch/x86/kernel/cpu/perf_event_intel_ds.c | 13 +++++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 3e7fd27..04cd687 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -590,6 +590,7 @@ struct x86_pmu {
 			pebs_active	:1,
 			pebs_broken	:1;
 	int		pebs_record_size;
+	int		pebs_buffer_size;
 	void		(*drain_pebs)(struct pt_regs *regs);
 	struct event_constraint *pebs_constraints;
 	void		(*pebs_aliases)(struct perf_event *event);
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index dbe8d89..56a9cfd 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -256,7 +256,7 @@ static int alloc_pebs_buffer(int cpu)
 	if (!x86_pmu.pebs)
 		return 0;
 
-	buffer = kzalloc_node(PEBS_BUFFER_SIZE, GFP_KERNEL, node);
+	buffer = kzalloc_node(x86_pmu.pebs_buffer_size, GFP_KERNEL, node);
 	if (unlikely(!buffer))
 		return -ENOMEM;
 
@@ -273,7 +273,7 @@ static int alloc_pebs_buffer(int cpu)
 		per_cpu(insn_buffer, cpu) = ibuffer;
 	}
 
-	max = PEBS_BUFFER_SIZE / x86_pmu.pebs_record_size;
+	max = x86_pmu.pebs_buffer_size / x86_pmu.pebs_record_size;
 
 	ds->pebs_buffer_base = (u64)(unsigned long)buffer;
 	ds->pebs_index = ds->pebs_buffer_base;
@@ -1229,6 +1229,7 @@ void __init intel_ds_init(void)
 
 	x86_pmu.bts  = boot_cpu_has(X86_FEATURE_BTS);
 	x86_pmu.pebs = boot_cpu_has(X86_FEATURE_PEBS);
+	x86_pmu.pebs_buffer_size = PEBS_BUFFER_SIZE;
 	if (x86_pmu.pebs) {
 		char pebs_type = x86_pmu.intel_cap.pebs_trap ?  '+' : '-';
 		int format = x86_pmu.intel_cap.pebs_format;
@@ -1237,6 +1238,14 @@ void __init intel_ds_init(void)
 		case 0:
 			printk(KERN_CONT "PEBS fmt0%c, ", pebs_type);
 			x86_pmu.pebs_record_size = sizeof(struct pebs_record_core);
+			/*
+			 * Using >PAGE_SIZE buffers makes the WRMSR to
+			 * PERF_GLOBAL_CTRL in intel_pmu_enable_all()
+			 * mysteriously hang on Core2.
+			 *
+			 * As a workaround, we don't do this.
+			 */
+			x86_pmu.pebs_buffer_size = PAGE_SIZE;
 			x86_pmu.drain_pebs = intel_pmu_drain_pebs_core;
 			break;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 080/218] perf/x86/intel: Fix PEBS warning by only restoring active PMU in pmi
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (78 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 079/218] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2 Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 081/218] sched/cputime: Fix steal_account_process_tick() to always return jiffies Kamal Mostafa
                   ` (137 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kan Liang, Peter Zijlstra, Alexander Shishkin,
	Arnaldo Carvalho de Melo, Jiri Olsa, Linus Torvalds,
	Stephane Eranian, Thomas Gleixner, Vince Weaver, Ingo Molnar,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Kan Liang <kan.liang@intel.com>

commit c3d266c8a9838cc141b69548bc3b1b18808ae8c4 upstream.

This patch tries to fix a PEBS warning found in my stress test. The
following perf command can easily trigger the pebs warning or spurious
NMI error on Skylake/Broadwell/Haswell platforms:

  sudo perf record -e 'cpu/umask=0x04,event=0xc4/pp,cycles,branches,ref-cycles,cache-misses,cache-references' --call-graph fp -b -c1000 -a

Also the NMI watchdog must be enabled.

For this case, the events number is larger than counter number. So
perf has to do multiplexing.

In perf_mux_hrtimer_handler, it does perf_pmu_disable(), schedule out
old events, rotate_ctx, schedule in new events and finally
perf_pmu_enable().

If the old events include precise event, the MSR_IA32_PEBS_ENABLE
should be cleared when perf_pmu_disable().  The MSR_IA32_PEBS_ENABLE
should keep 0 until the perf_pmu_enable() is called and the new event is
precise event.

However, there is a corner case which could restore PEBS_ENABLE to
stale value during the above period. In perf_pmu_disable(), GLOBAL_CTRL
will be set to 0 to stop overflow and followed PMI. But there may be
pending PMI from an earlier overflow, which cannot be stopped. So even
GLOBAL_CTRL is cleared, the kernel still be possible to get PMI. At
the end of the PMI handler, __intel_pmu_enable_all() will be called,
which will restore the stale values if old events haven't scheduled
out.

Once the stale pebs value is set, it's impossible to be corrected if
the new events are non-precise. Because the pebs_enabled will be set
to 0. x86_pmu.enable_all() will ignore the MSR_IA32_PEBS_ENABLE
setting. As a result, the following NMI with stale PEBS_ENABLE
trigger pebs warning.

The pending PMI after enabled=0 will become harmless if the NMI handler
does not change the state. This patch checks cpuc->enabled in pmi and
only restore the state when PMU is active.

Here is the dump:

  Call Trace:
   <NMI>  [<ffffffff813c3a2e>] dump_stack+0x63/0x85
   [<ffffffff810a46f2>] warn_slowpath_common+0x82/0xc0
   [<ffffffff810a483a>] warn_slowpath_null+0x1a/0x20
   [<ffffffff8100fe2e>] intel_pmu_drain_pebs_nhm+0x2be/0x320
   [<ffffffff8100caa9>] intel_pmu_handle_irq+0x279/0x460
   [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
   [<ffffffff811f290d>] ? vunmap_page_range+0x20d/0x330
   [<ffffffff811f2f11>] ?  unmap_kernel_range_noflush+0x11/0x20
   [<ffffffff8148379f>] ? ghes_copy_tofrom_phys+0x10f/0x2a0
   [<ffffffff814839c8>] ? ghes_read_estatus+0x98/0x170
   [<ffffffff81005a7d>] perf_event_nmi_handler+0x2d/0x50
   [<ffffffff810310b9>] nmi_handle+0x69/0x120
   [<ffffffff810316f6>] default_do_nmi+0xe6/0x100
   [<ffffffff810317f2>] do_nmi+0xe2/0x130
   [<ffffffff817aea71>] end_repeat_nmi+0x1a/0x1e
   [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
   [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
   [<ffffffff810639b6>] ? native_write_msr_safe+0x6/0x40
   <<EOE>>  <IRQ>  [<ffffffff81006df8>] ?  x86_perf_event_set_period+0xd8/0x180
   [<ffffffff81006eec>] x86_pmu_start+0x4c/0x100
   [<ffffffff8100722d>] x86_pmu_enable+0x28d/0x300
   [<ffffffff811994d7>] perf_pmu_enable.part.81+0x7/0x10
   [<ffffffff8119cb70>] perf_mux_hrtimer_handler+0x200/0x280
   [<ffffffff8119c970>] ?  __perf_install_in_context+0xc0/0xc0
   [<ffffffff8110f92d>] __hrtimer_run_queues+0xfd/0x280
   [<ffffffff811100d8>] hrtimer_interrupt+0xa8/0x190
   [<ffffffff81199080>] ?  __perf_read_group_add.part.61+0x1a0/0x1a0
   [<ffffffff81051bd8>] local_apic_timer_interrupt+0x38/0x60
   [<ffffffff817af01d>] smp_apic_timer_interrupt+0x3d/0x50
   [<ffffffff817ad15c>] apic_timer_interrupt+0x8c/0xa0
   <EOI>  [<ffffffff81199080>] ?  __perf_read_group_add.part.61+0x1a0/0x1a0
   [<ffffffff81123de5>] ?  smp_call_function_single+0xd5/0x130
   [<ffffffff81123ddb>] ?  smp_call_function_single+0xcb/0x130
   [<ffffffff81199080>] ?  __perf_read_group_add.part.61+0x1a0/0x1a0
   [<ffffffff8119765a>] event_function_call+0x10a/0x120
   [<ffffffff8119c660>] ? ctx_resched+0x90/0x90
   [<ffffffff811971e0>] ? cpu_clock_event_read+0x30/0x30
   [<ffffffff811976d0>] ? _perf_event_disable+0x60/0x60
   [<ffffffff8119772b>] _perf_event_enable+0x5b/0x70
   [<ffffffff81197388>] perf_event_for_each_child+0x38/0xa0
   [<ffffffff811976d0>] ? _perf_event_disable+0x60/0x60
   [<ffffffff811a0ffd>] perf_ioctl+0x12d/0x3c0
   [<ffffffff8134d855>] ? selinux_file_ioctl+0x95/0x1e0
   [<ffffffff8124a3a1>] do_vfs_ioctl+0xa1/0x5a0
   [<ffffffff81036d29>] ? sched_clock+0x9/0x10
   [<ffffffff8124a919>] SyS_ioctl+0x79/0x90
   [<ffffffff817ac4b2>] entry_SYSCALL_64_fastpath+0x1a/0xa4
  ---[ end trace aef202839fe9a71d ]---
  Uhhuh. NMI received for unknown reason 2d on CPU 2.
  Do you have a strange power saving mode enabled?

Signed-off-by: Kan Liang <kan.liang@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/1457046448-6184-1-git-send-email-kan.liang@intel.com
[ Fixed various typos and other small details. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
[ kamal: backport to 4.2-stable: files renamed ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/cpu/perf_event.c       | 13 +++++++++++++
 arch/x86/kernel/cpu/perf_event_intel.c | 15 +++++++++++++--
 arch/x86/kernel/cpu/perf_event_knc.c   |  4 +++-
 3 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index a27d738..d93690c 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -593,6 +593,19 @@ void x86_pmu_disable_all(void)
 	}
 }
 
+/*
+ * There may be PMI landing after enabled=0. The PMI hitting could be before or
+ * after disable_all.
+ *
+ * If PMI hits before disable_all, the PMU will be disabled in the NMI handler.
+ * It will not be re-enabled in the NMI handler again, because enabled=0. After
+ * handling the NMI, disable_all will be called, which will not change the
+ * state either. If PMI hits after disable_all, the PMU is already disabled
+ * before entering NMI handler. The NMI handler will not change the state
+ * either.
+ *
+ * So either situation is harmless.
+ */
 static void x86_pmu_disable(struct pmu *pmu)
 {
 	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 1b09c42..9af4ba8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1244,7 +1244,15 @@ static __initconst const u64 slm_hw_cache_event_ids
 };
 
 /*
- * Use from PMIs where the LBRs are already disabled.
+ * Used from PMIs where the LBRs are already disabled.
+ *
+ * This function could be called consecutively. It is required to remain in
+ * disabled state if called consecutively.
+ *
+ * During consecutive calls, the same disable value will be written to related
+ * registers, so the PMU state remains unchanged. hw.state in
+ * intel_bts_disable_local will remain PERF_HES_STOPPED too in consecutive
+ * calls.
  */
 static void __intel_pmu_disable_all(void)
 {
@@ -1670,7 +1678,10 @@ again:
 		goto again;
 
 done:
-	__intel_pmu_enable_all(0, true);
+	/* Only restore PMU state when it's active. See x86_pmu_disable(). */
+	if (cpuc->enabled)
+		__intel_pmu_enable_all(0, true);
+
 	/*
 	 * Only unmask the NMI after the overflow counters
 	 * have been reset. This avoids spurious NMIs on
diff --git a/arch/x86/kernel/cpu/perf_event_knc.c b/arch/x86/kernel/cpu/perf_event_knc.c
index 5b0c232..b931095 100644
--- a/arch/x86/kernel/cpu/perf_event_knc.c
+++ b/arch/x86/kernel/cpu/perf_event_knc.c
@@ -263,7 +263,9 @@ again:
 		goto again;
 
 done:
-	knc_pmu_enable_all(0);
+	/* Only restore PMU state when it's active. See x86_pmu_disable(). */
+	if (cpuc->enabled)
+		knc_pmu_enable_all(0);
 
 	return handled;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 081/218] sched/cputime: Fix steal_account_process_tick() to always return jiffies
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (79 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 080/218] perf/x86/intel: Fix PEBS warning by only restoring active PMU in pmi Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 082/218] bcache: fix race of writeback thread starting before complete initialization Kamal Mostafa
                   ` (136 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Friesen, Peter Zijlstra, Frederic Weisbecker,
	Linus Torvalds, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Chris Friesen <cbf123@mail.usask.ca>

commit f9c904b7613b8b4c85b10cd6b33ad41b2843fa9d upstream.

The callers of steal_account_process_tick() expect it to return
whether a jiffy should be considered stolen or not.

Currently the return value of steal_account_process_tick() is in
units of cputime, which vary between either jiffies or nsecs
depending on CONFIG_VIRT_CPU_ACCOUNTING_GEN.

If cputime has nsecs granularity and there is a tiny amount of
stolen time (a few nsecs, say) then we will consider the entire
tick stolen and will not account the tick on user/system/idle,
causing /proc/stats to show invalid data.

The fix is to change steal_account_process_tick() to accumulate
the stolen time and only account it once it's worth a jiffy.

(Thanks to Frederic Weisbecker for suggestions to fix a bug in my
first version of the patch.)

Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/56DBBDB8.40305@mail.usask.ca
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/sched/cputime.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index f5a64ff..ce34c6e 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -259,21 +259,21 @@ static __always_inline bool steal_account_process_tick(void)
 #ifdef CONFIG_PARAVIRT
 	if (static_key_false(&paravirt_steal_enabled)) {
 		u64 steal;
-		cputime_t steal_ct;
+		unsigned long steal_jiffies;
 
 		steal = paravirt_steal_clock(smp_processor_id());
 		steal -= this_rq()->prev_steal_time;
 
 		/*
-		 * cputime_t may be less precise than nsecs (eg: if it's
-		 * based on jiffies). Lets cast the result to cputime
+		 * steal is in nsecs but our caller is expecting steal
+		 * time in jiffies. Lets cast the result to jiffies
 		 * granularity and account the rest on the next rounds.
 		 */
-		steal_ct = nsecs_to_cputime(steal);
-		this_rq()->prev_steal_time += cputime_to_nsecs(steal_ct);
+		steal_jiffies = nsecs_to_jiffies(steal);
+		this_rq()->prev_steal_time += jiffies_to_nsecs(steal_jiffies);
 
-		account_steal_time(steal_ct);
-		return steal_ct;
+		account_steal_time(jiffies_to_cputime(steal_jiffies));
+		return steal_jiffies;
 	}
 #endif
 	return false;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 082/218] bcache: fix race of writeback thread starting before complete initialization
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (80 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 081/218] sched/cputime: Fix steal_account_process_tick() to always return jiffies Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 083/218] bcache: cleaned up error handling around register_cache() Kamal Mostafa
                   ` (135 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric Wheeler, Jens Axboe, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Eric Wheeler <git@linux.ewheeler.net>

commit 07cc6ef8edc47f8b4fc1e276d31127a0a5863d4d upstream.

The bch_writeback_thread might BUG_ON in read_dirty() if
dc->sb==BDEV_STATE_DIRTY and bch_sectors_dirty_init has not yet completed
its related initialization.  This patch downs the dc->writeback_lock until
after initialization is complete, thus preventing bch_writeback_thread
from proceeding prematurely.

See this thread:
  http://thread.gmane.org/gmane.linux.kernel.bcache.devel/3453

Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Tested-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/bcache/super.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 90bd95b..45cedc7 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1040,8 +1040,12 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
 	 */
 	atomic_set(&dc->count, 1);
 
-	if (bch_cached_dev_writeback_start(dc))
+	/* Block writeback thread, but spawn it */
+	down_write(&dc->writeback_lock);
+	if (bch_cached_dev_writeback_start(dc)) {
+		up_write(&dc->writeback_lock);
 		return -ENOMEM;
+	}
 
 	if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) {
 		bch_sectors_dirty_init(dc);
@@ -1053,6 +1057,9 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
 	bch_cached_dev_run(dc);
 	bcache_device_link(&dc->disk, c, "bdev");
 
+	/* Allow the writeback thread to proceed */
+	up_write(&dc->writeback_lock);
+
 	pr_info("Caching %s as %s on set %pU",
 		bdevname(dc->bdev, buf), dc->disk.disk->disk_name,
 		dc->disk.c->sb.set_uuid);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 083/218] bcache: cleaned up error handling around register_cache()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (81 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 082/218] bcache: fix race of writeback thread starting before complete initialization Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 084/218] bcache: fix cache_set_flush() NULL pointer dereference on OOM Kamal Mostafa
                   ` (134 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric Wheeler, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Eric Wheeler <git@linux.ewheeler.net>

commit 9b299728ed777428b3908ac72ace5f8f84b97789 upstream.

Fix null pointer dereference by changing register_cache() to return an int
instead of being void.  This allows it to return -ENOMEM or -ENODEV and
enables upper layers to handle the OOM case without NULL pointer issues.

See this thread:
  http://thread.gmane.org/gmane.linux.kernel.bcache.devel/3521

Fixes this error:
  gargamel:/sys/block/md5/bcache# echo /dev/sdh2 > /sys/fs/bcache/register

  bcache: register_cache() error opening sdh2: cannot allocate memory
  BUG: unable to handle kernel NULL pointer dereference at 00000000000009b8
  IP: [<ffffffffc05a7e8d>] cache_set_flush+0x102/0x15c [bcache]
  PGD 120dff067 PUD 1119a3067 PMD 0
  Oops: 0000 [#1] SMP
  Modules linked in: veth ip6table_filter ip6_tables
  (...)
  CPU: 4 PID: 3371 Comm: kworker/4:3 Not tainted 4.4.2-amd64-i915-volpreempt-20160213bc1 #3
  Hardware name: System manufacturer System Product Name/P8H67-M PRO, BIOS 3904 04/27/2013
  Workqueue: events cache_set_flush [bcache]
  task: ffff88020d5dc280 ti: ffff88020b6f8000 task.ti: ffff88020b6f8000
  RIP: 0010:[<ffffffffc05a7e8d>]  [<ffffffffc05a7e8d>] cache_set_flush+0x102/0x15c [bcache]

Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Tested-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/bcache/super.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 45cedc7..d7ce93e 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1863,11 +1863,12 @@ static int cache_alloc(struct cache_sb *sb, struct cache *ca)
 	return 0;
 }
 
-static void register_cache(struct cache_sb *sb, struct page *sb_page,
+static int register_cache(struct cache_sb *sb, struct page *sb_page,
 				struct block_device *bdev, struct cache *ca)
 {
 	char name[BDEVNAME_SIZE];
-	const char *err = "cannot allocate memory";
+	const char *err = NULL;
+	int ret = 0;
 
 	memcpy(&ca->sb, sb, sizeof(struct cache_sb));
 	ca->bdev = bdev;
@@ -1882,27 +1883,35 @@ static void register_cache(struct cache_sb *sb, struct page *sb_page,
 	if (blk_queue_discard(bdev_get_queue(ca->bdev)))
 		ca->discard = CACHE_DISCARD(&ca->sb);
 
-	if (cache_alloc(sb, ca) != 0)
+	ret = cache_alloc(sb, ca);
+	if (ret != 0)
 		goto err;
 
-	err = "error creating kobject";
-	if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache"))
-		goto err;
+	if (kobject_add(&ca->kobj, &part_to_dev(bdev->bd_part)->kobj, "bcache")) {
+		err = "error calling kobject_add";
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	mutex_lock(&bch_register_lock);
 	err = register_cache_set(ca);
 	mutex_unlock(&bch_register_lock);
 
-	if (err)
-		goto err;
+	if (err) {
+		ret = -ENODEV;
+		goto out;
+	}
 
 	pr_info("registered cache device %s", bdevname(bdev, name));
+
 out:
 	kobject_put(&ca->kobj);
-	return;
+
 err:
-	pr_notice("error opening %s: %s", bdevname(bdev, name), err);
-	goto out;
+	if (err)
+		pr_notice("error opening %s: %s", bdevname(bdev, name), err);
+
+	return ret;
 }
 
 /* Global interfaces/init */
@@ -2000,7 +2009,8 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
 		if (!ca)
 			goto err_close;
 
-		register_cache(sb, sb_page, bdev, ca);
+		if (register_cache(sb, sb_page, bdev, ca) != 0)
+			goto err_close;
 	}
 out:
 	if (sb_page)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 084/218] bcache: fix cache_set_flush() NULL pointer dereference on OOM
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (82 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 083/218] bcache: cleaned up error handling around register_cache() Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 085/218] x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs Kamal Mostafa
                   ` (133 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Eric Wheeler, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Eric Wheeler <git@linux.ewheeler.net>

commit f8b11260a445169989d01df75d35af0f56178f95 upstream.

When bch_cache_set_alloc() fails to kzalloc the cache_set, the
asyncronous closure handling tries to dereference a cache_set that
hadn't yet been allocated inside of cache_set_flush() which is called
by __cache_set_unregister() during cleanup.  This appears to happen only
during an OOM condition on bcache_register.

Signed-off-by: Eric Wheeler <bcache@linux.ewheeler.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/bcache/super.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index d7ce93e..eff6144 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1398,6 +1398,9 @@ static void cache_set_flush(struct closure *cl)
 	struct btree *b;
 	unsigned i;
 
+	if (!c)
+		closure_return(cl);
+
 	bch_cache_accounting_destroy(&c->accounting);
 
 	kobject_put(&c->internal);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 085/218] x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (83 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 084/218] bcache: fix cache_set_flush() NULL pointer dereference on OOM Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 086/218] be2iscsi: set the boot_kset pointer to NULL in case of failure Kamal Mostafa
                   ` (132 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Bjorn Helgaas, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Bjorn Helgaas <bhelgaas@google.com>

commit b894157145e4ac7598d7062bc93320898a5e059e upstream.

The Home Agent and PCU PCI devices in Broadwell-EP have a non-BAR register
where a BAR should be.  We don't know what the side effects of sizing the
"BAR" would be, and we don't know what address space the "BAR" might appear
to describe.

Mark these devices as having non-compliant BARs so the PCI core doesn't
touch them.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/pci/fixup.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 9a2b710..f16af96 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -553,3 +553,10 @@ static void twinhead_reserve_killing_zone(struct pci_dev *dev)
         }
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x27B9, twinhead_reserve_killing_zone);
+
+static void pci_bdwep_bar(struct pci_dev *dev)
+{
+	dev->non_compliant_bars = 1;
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fa0, pci_bdwep_bar);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x6fc0, pci_bdwep_bar);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 086/218] be2iscsi: set the boot_kset pointer to NULL in case of failure
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (84 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 085/218] x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs Kamal Mostafa
@ 2016-03-31 20:14 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 087/218] md/raid5: preserve STRIPE_PREREAD_ACTIVE in break_stripe_batch_list Kamal Mostafa
                   ` (131 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:14 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maurizio Lombardi, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Maurizio Lombardi <mlombard@redhat.com>

commit 84bd64993f916bcf86270c67686ecf4cea7b8933 upstream.

In beiscsi_setup_boot_info(), the boot_kset pointer should be set to
NULL in case of failure otherwise an invalid pointer dereference may
occur later.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Jitendra Bhivare <jitendra.bhivare@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/be2iscsi/be_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 7a6dbfb..32f827e 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4468,6 +4468,7 @@ put_shost:
 	scsi_host_put(phba->shost);
 free_kset:
 	iscsi_boot_destroy_kset(phba->boot_kset);
+	phba->boot_kset = NULL;
 	return -ENOMEM;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 087/218] md/raid5: preserve STRIPE_PREREAD_ACTIVE in break_stripe_batch_list
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (85 preceding siblings ...)
  2016-03-31 20:14 ` [PATCH 4.2.y-ckt 086/218] be2iscsi: set the boot_kset pointer to NULL in case of failure Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 088/218] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards Kamal Mostafa
                   ` (130 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: NeilBrown, Shaohua Li, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: NeilBrown <neilb@suse.com>

commit 550da24f8d62fe81f3c13e3ec27602d6e44d43dc upstream.

break_stripe_batch_list breaks up a batch and copies some flags from
the batch head to the members, preserving others.

It doesn't preserve or copy STRIPE_PREREAD_ACTIVE.  This is not
normally a problem as STRIPE_PREREAD_ACTIVE is cleared when a
stripe_head is added to a batch, and is not set on stripe_heads
already in a batch.

However there is no locking to ensure one thread doesn't set the flag
after it has just been cleared in another.  This does occasionally happen.

md/raid5 maintains a count of the number of stripe_heads with
STRIPE_PREREAD_ACTIVE set: conf->preread_active_stripes.  When
break_stripe_batch_list clears STRIPE_PREREAD_ACTIVE inadvertently
this could becomes incorrect and will never again return to zero.

md/raid5 delays the handling of some stripe_heads until
preread_active_stripes becomes zero.  So when the above mention race
happens, those stripe_heads become blocked and never progress,
resulting is write to the array handing.

So: change break_stripe_batch_list to preserve STRIPE_PREREAD_ACTIVE
in the members of a batch.

URL: https://bugzilla.kernel.org/show_bug.cgi?id=108741
URL: https://bugzilla.redhat.com/show_bug.cgi?id=1258153
URL: http://thread.gmane.org/5649C0E9.2030204@zoner.cz
Reported-by: Martin Svec <martin.svec@zoner.cz> (and others)
Tested-by: Tom Weber <linux@junkyard.4t2.com>
Fixes: 1b956f7a8f9a ("md/raid5: be more selective about distributing flags across batch.")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/raid5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 71d7cf7..f6be7c4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4236,7 +4236,6 @@ static void break_stripe_batch_list(struct stripe_head *head_sh,
 		WARN_ON_ONCE(sh->state & ((1 << STRIPE_ACTIVE) |
 					  (1 << STRIPE_SYNCING) |
 					  (1 << STRIPE_REPLACED) |
-					  (1 << STRIPE_PREREAD_ACTIVE) |
 					  (1 << STRIPE_DELAYED) |
 					  (1 << STRIPE_BIT_DELAY) |
 					  (1 << STRIPE_FULL_WRITE) |
@@ -4251,6 +4250,7 @@ static void break_stripe_batch_list(struct stripe_head *head_sh,
 					      (1 << STRIPE_REPLACED)));
 
 		set_mask_bits(&sh->state, ~(STRIPE_EXPAND_SYNC_FLAGS |
+					    (1 << STRIPE_PREREAD_ACTIVE) |
 					    (1 << STRIPE_DEGRADED)),
 			      head_sh->state & (1 << STRIPE_INSYNC));
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 088/218] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards.
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (86 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 087/218] md/raid5: preserve STRIPE_PREREAD_ACTIVE in break_stripe_batch_list Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 089/218] sg: fix dxferp in from_to case Kamal Mostafa
                   ` (129 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mario Kleiner, Alex Deucher, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Mario Kleiner <mario.kleiner.de@gmail.com>

commit 459ee1c3fd097ab56ababd8ff4bb7ef6a792de33 upstream.

As observed on Apple iMac10,1, DCE-3.2, RV-730,
link rate of 2.7 Ghz is not selected, because
the args.v1.ucConfig flag setting for 2.7 Ghz
gets overwritten by a following assignment of
the transmitter to use.

Move link rate setup a few lines down to fix this.
In practice this didn't have any positive or
negative effect on display setup on the tested
iMac10,1 so i don't know if backporting to stable
makes sense or not.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/atombios_encoders.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
index bb29214..adf74f4 100644
--- a/drivers/gpu/drm/radeon/atombios_encoders.c
+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
@@ -892,8 +892,6 @@ atombios_dig_encoder_setup2(struct drm_encoder *encoder, int action, int panel_m
 			else
 				args.v1.ucLaneNum = 4;
 
-			if (ENCODER_MODE_IS_DP(args.v1.ucEncoderMode) && (dp_clock == 270000))
-				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ;
 			switch (radeon_encoder->encoder_id) {
 			case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
 				args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER1;
@@ -910,6 +908,10 @@ atombios_dig_encoder_setup2(struct drm_encoder *encoder, int action, int panel_m
 				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKB;
 			else
 				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKA;
+
+			if (ENCODER_MODE_IS_DP(args.v1.ucEncoderMode) && (dp_clock == 270000))
+				args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ;
+
 			break;
 		case 2:
 		case 3:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 089/218] sg: fix dxferp in from_to case
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (87 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 088/218] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 090/218] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Kamal Mostafa
                   ` (128 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Douglas Gilbert, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Douglas Gilbert <dgilbert@interlog.com>

commit 5ecee0a3ee8d74b6950cb41e8989b0c2174568d4 upstream.

One of the strange things that the original sg driver did was let the
user provide both a data-out buffer (it followed the sg_header+cdb)
_and_ specify a reply length greater than zero. What happened was that
the user data-out buffer was copied into some kernel buffers and then
the mid level was told a read type operation would take place with the
data from the device overwriting the same kernel buffers. The user would
then read those kernel buffers back into the user space.

>From what I can tell, the above action was broken by commit fad7f01e61bf
("sg: set dxferp to NULL for READ with the older SG interface") in 2008
and syzkaller found that out recently.

Make sure that a user space pointer is passed through when data follows
the sg_header structure and command.  Fix the abnormal case when a
non-zero reply_len is also given.

Fixes: fad7f01e61bf737fe8a3740d803f000db57ecac6
Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/sg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 3bbf485..ec19293 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -652,7 +652,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
 	else
 		hp->dxfer_direction = (mxsize > 0) ? SG_DXFER_FROM_DEV : SG_DXFER_NONE;
 	hp->dxfer_len = mxsize;
-	if (hp->dxfer_direction == SG_DXFER_TO_DEV)
+	if ((hp->dxfer_direction == SG_DXFER_TO_DEV) ||
+	    (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV))
 		hp->dxferp = (char __user *)buf + cmd_size;
 	else
 		hp->dxferp = NULL;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 090/218] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (88 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 089/218] sg: fix dxferp in from_to case Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 091/218] ALSA: hda - Apply reboot D3 fix for CX20724 codec, too Kamal Mostafa
                   ` (127 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: OGAWA Hirofumi, Theodore Ts'o, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

commit c0a2ad9b50dd80eeccd73d9ff962234590d5ec93 upstream.

On umount path, jbd2_journal_destroy() writes latest transaction ID
(->j_tail_sequence) to be used at next mount.

The bug is that ->j_tail_sequence is not holding latest transaction ID
in some cases. So, at next mount, there is chance to conflict with
remaining (not overwritten yet) transactions.

	mount (id=10)
	write transaction (id=11)
	write transaction (id=12)
	umount (id=10) <= the bug doesn't write latest ID

	mount (id=10)
	write transaction (id=11)
	crash

	mount
	[recovery process]
		transaction (id=11)
		transaction (id=12) <= valid transaction ID, but old commit
                                       must not replay

Like above, this bug become the cause of recovery failure, or FS
corruption.

So why ->j_tail_sequence doesn't point latest ID?

Because if checkpoint transactions was reclaimed by memory pressure
(i.e. bdev_try_to_free_page()), then ->j_tail_sequence is not updated.
(And another case is, __jbd2_journal_clean_checkpoint_list() is called
with empty transaction.)

So in above cases, ->j_tail_sequence is not pointing latest
transaction ID at umount path. Plus, REQ_FLUSH for checkpoint is not
done too.

So, to fix this problem with minimum changes, this patch updates
->j_tail_sequence, and issue REQ_FLUSH.  (With more complex changes,
some optimizations would be possible to avoid unnecessary REQ_FLUSH
for example though.)

BTW,

	journal->j_tail_sequence =
		++journal->j_transaction_sequence;

Increment of ->j_transaction_sequence seems to be unnecessary, but
ext3 does this.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/jbd2/journal.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index fd2787a..76c3947 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1408,11 +1408,12 @@ out:
 /**
  * jbd2_mark_journal_empty() - Mark on disk journal as empty.
  * @journal: The journal to update.
+ * @write_op: With which operation should we write the journal sb
  *
  * Update a journal's dynamic superblock fields to show that journal is empty.
  * Write updated superblock to disk waiting for IO to complete.
  */
-static void jbd2_mark_journal_empty(journal_t *journal)
+static void jbd2_mark_journal_empty(journal_t *journal, int write_op)
 {
 	journal_superblock_t *sb = journal->j_superblock;
 
@@ -1430,7 +1431,7 @@ static void jbd2_mark_journal_empty(journal_t *journal)
 	sb->s_start    = cpu_to_be32(0);
 	read_unlock(&journal->j_state_lock);
 
-	jbd2_write_superblock(journal, WRITE_FUA);
+	jbd2_write_superblock(journal, write_op);
 
 	/* Log is no longer empty */
 	write_lock(&journal->j_state_lock);
@@ -1715,7 +1716,13 @@ int jbd2_journal_destroy(journal_t *journal)
 	if (journal->j_sb_buffer) {
 		if (!is_journal_aborted(journal)) {
 			mutex_lock(&journal->j_checkpoint_mutex);
-			jbd2_mark_journal_empty(journal);
+
+			write_lock(&journal->j_state_lock);
+			journal->j_tail_sequence =
+				++journal->j_transaction_sequence;
+			write_unlock(&journal->j_state_lock);
+
+			jbd2_mark_journal_empty(journal, WRITE_FLUSH_FUA);
 			mutex_unlock(&journal->j_checkpoint_mutex);
 		} else
 			err = -EIO;
@@ -1974,7 +1981,7 @@ int jbd2_journal_flush(journal_t *journal)
 	 * the magic code for a fully-recovered superblock.  Any future
 	 * commits of data to the journal will restore the current
 	 * s_start value. */
-	jbd2_mark_journal_empty(journal);
+	jbd2_mark_journal_empty(journal, WRITE_FUA);
 	mutex_unlock(&journal->j_checkpoint_mutex);
 	write_lock(&journal->j_state_lock);
 	J_ASSERT(!journal->j_running_transaction);
@@ -2020,7 +2027,7 @@ int jbd2_journal_wipe(journal_t *journal, int write)
 	if (write) {
 		/* Lock to make assertions happy... */
 		mutex_lock(&journal->j_checkpoint_mutex);
-		jbd2_mark_journal_empty(journal);
+		jbd2_mark_journal_empty(journal, WRITE_FUA);
 		mutex_unlock(&journal->j_checkpoint_mutex);
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 091/218] ALSA: hda - Apply reboot D3 fix for CX20724 codec, too
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (89 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 090/218] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 092/218] EDAC/sb_edac: Fix computation of channel address Kamal Mostafa
                   ` (126 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Takashi Iwai <tiwai@suse.de>

commit 56dc66ff1c6d71f9a38c4a7c000b72b921fe4c89 upstream.

Just like CX20722, CX7024 codec also requires the power down at reboot
in order to reduce the noise at reboot/shutdown.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=113511
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_conexant.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 2f0ec7c..ae2a8da 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -204,8 +204,13 @@ static void cx_auto_reboot_notify(struct hda_codec *codec)
 {
 	struct conexant_spec *spec = codec->spec;
 
-	if (codec->core.vendor_id != 0x14f150f2)
+	switch (codec->core.vendor_id) {
+	case 0x14f150f2: /* CX20722 */
+	case 0x14f150f4: /* CX20724 */
+		break;
+	default:
 		return;
+	}
 
 	/* Turn the CX20722 codec into D3 to avoid spurious noises
 	   from the internal speaker during (and after) reboot */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 092/218] EDAC/sb_edac: Fix computation of channel address
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (90 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 091/218] ALSA: hda - Apply reboot D3 fix for CX20724 codec, too Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:24   ` Luck, Tony
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 093/218] Bluetooth: btusb: Add a new AR3012 ID 13d3:3472 Kamal Mostafa
                   ` (125 subsequent siblings)
  217 siblings, 1 reply; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tony Luck, Borislav Petkov, Linus Torvalds,
	Mauro Carvalho Chehab, Peter Zijlstra, Thomas Gleixner,
	linux-edac, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Luck, Tony" <tony.luck@intel.com>

commit eb1af3b71f9d83e45f2fd2fd649356e98e1c582c upstream.

Large memory Haswell-EX systems with multiple DIMMs per channel were
sometimes reporting the wrong DIMM.

Found three problems:

 1) Debug printouts for socket and channel interleave were not interpreting
    the register fields correctly. The socket interleave field is a 2^X
    value (0=1, 1=2, 2=4, 3=8). The channel interleave is X+1 (0=1, 1=2,
    2=3. 3=4).

 2) Actual use of the socket interleave value didn't interpret as 2^X

 3) Conversion of address to channel address was complicated, and wrong.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Acked-by: Aristeu Rozanski <arozansk@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-edac@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/edac/sb_edac.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 91cf710..9c61607 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -1077,8 +1077,8 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 		edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n",
 			 n_tads, gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
-			 (u32)TAD_SOCK(reg),
-			 (u32)TAD_CH(reg),
+			 (u32)(1 << TAD_SOCK(reg)),
+			 (u32)TAD_CH(reg) + 1,
 			 (u32)TAD_TGT0(reg),
 			 (u32)TAD_TGT1(reg),
 			 (u32)TAD_TGT2(reg),
@@ -1356,7 +1356,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 	}
 
 	ch_way = TAD_CH(reg) + 1;
-	sck_way = TAD_SOCK(reg) + 1;
+	sck_way = 1 << TAD_SOCK(reg);
 
 	if (ch_way == 3)
 		idx = addr >> 6;
@@ -1413,7 +1413,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 		 n_tads,
 		 addr,
 		 limit,
-		 (u32)TAD_SOCK(reg),
+		 sck_way,
 		 ch_way,
 		 offset,
 		 idx,
@@ -1428,18 +1428,12 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 			offset, addr);
 		return -EINVAL;
 	}
-	addr -= offset;
-	/* Store the low bits [0:6] of the addr */
-	ch_addr = addr & 0x7f;
-	/* Remove socket wayness and remove 6 bits */
-	addr >>= 6;
-	addr = div_u64(addr, sck_xch);
-#if 0
-	/* Divide by channel way */
-	addr = addr / ch_way;
-#endif
-	/* Recover the last 6 bits */
-	ch_addr |= addr << 6;
+
+	ch_addr = addr - offset;
+	ch_addr >>= (6 + shiftup);
+	ch_addr /= ch_way * sck_way;
+	ch_addr <<= (6 + shiftup);
+	ch_addr |= addr & ((1 << (6 + shiftup)) - 1);
 
 	/*
 	 * Step 3) Decode rank
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 093/218] Bluetooth: btusb: Add a new AR3012 ID 13d3:3472
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (91 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 092/218] EDAC/sb_edac: Fix computation of channel address Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 094/218] ALSA: pcm: Avoid "BUG:" string for warnings again Kamal Mostafa
                   ` (124 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Tunin, Marcel Holtmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dmitry Tunin <hanipouspilot@gmail.com>

commit 75c6aca4765dbe3d0c1507ab5052f2e373dc2331 upstream.

T: Bus=01 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=13d3 ProdID=3472 Rev=00.01
C: #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I: If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

BugLink: https://bugs.launchpad.net/bugs/1552925

Signed-off-by: Dmitry Tunin <hanipouspilot@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/bluetooth/ath3k.c | 2 ++
 drivers/bluetooth/btusb.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index b313b20..0beaa52 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -120,6 +120,7 @@ static const struct usb_device_id ath3k_table[] = {
 	{ USB_DEVICE(0x13d3, 0x3408) },
 	{ USB_DEVICE(0x13d3, 0x3423) },
 	{ USB_DEVICE(0x13d3, 0x3432) },
+	{ USB_DEVICE(0x13d3, 0x3472) },
 	{ USB_DEVICE(0x13d3, 0x3474) },
 
 	/* Atheros AR5BBU12 with sflash firmware */
@@ -185,6 +186,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = {
 	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 },
 
 	/* Atheros AR5BBU22 with sflash firmware */
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 52ad06b..447947f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -223,6 +223,7 @@ static const struct usb_device_id blacklist_table[] = {
 	{ USB_DEVICE(0x13d3, 0x3408), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3423), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3432), .driver_info = BTUSB_ATH3012 },
+	{ USB_DEVICE(0x13d3, 0x3472), .driver_info = BTUSB_ATH3012 },
 	{ USB_DEVICE(0x13d3, 0x3474), .driver_info = BTUSB_ATH3012 },
 
 	/* Atheros AR5BBU12 with sflash firmware */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 094/218] ALSA: pcm: Avoid "BUG:" string for warnings again
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (92 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 093/218] Bluetooth: btusb: Add a new AR3012 ID 13d3:3472 Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 095/218] dm snapshot: disallow the COW and origin devices from being identical Kamal Mostafa
                   ` (123 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Takashi Iwai <tiwai@suse.de>

commit 0ab1ace856205d10cbc1924b2d931c01ffd216a6 upstream.

The commit [d507941beb1e: ALSA: pcm: Correct PCM BUG error message]
made the warning prefix back to "BUG:" due to its previous wrong
prefix.  But a kernel message containing "BUG:" seems taken as an Oops
message wrongly by some brain-dead daemons, and it annoys users in the
end.  Instead of teaching daemons, change the string again to a more
reasonable one.

Fixes: 507941beb1e ('ALSA: pcm: Correct PCM BUG error message')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/core/pcm_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 7d45645..253a2da 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -322,7 +322,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
 			char name[16];
 			snd_pcm_debug_name(substream, name, sizeof(name));
 			pcm_err(substream->pcm,
-				"BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n",
+				"invalid position: %s, pos = %ld, buffer size = %ld, period size = %ld\n",
 				name, pos, runtime->buffer_size,
 				runtime->period_size);
 		}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 095/218] dm snapshot: disallow the COW and origin devices from being identical
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (93 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 094/218] ALSA: pcm: Avoid "BUG:" string for warnings again Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 096/218] dm thin metadata: don't issue prefetches if a transaction abort has failed Kamal Mostafa
                   ` (122 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ding Xiang, Mike Snitzer, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: DingXiang <dingxiang@huawei.com>

commit 4df2bf466a9c9c92f40d27c4aa9120f4e8227bfc upstream.

Otherwise loading a "snapshot" table using the same device for the
origin and COW devices, e.g.:

echo "0 20971520 snapshot 253:3 253:3 P 8" | dmsetup create snap

will trigger:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
[ 1958.979934] IP: [<ffffffffa040efba>] dm_exception_store_set_chunk_size+0x7a/0x110 [dm_snapshot]
[ 1958.989655] PGD 0
[ 1958.991903] Oops: 0000 [#1] SMP
...
[ 1959.059647] CPU: 9 PID: 3556 Comm: dmsetup Tainted: G          IO    4.5.0-rc5.snitm+ #150
...
[ 1959.083517] task: ffff8800b9660c80 ti: ffff88032a954000 task.ti: ffff88032a954000
[ 1959.091865] RIP: 0010:[<ffffffffa040efba>]  [<ffffffffa040efba>] dm_exception_store_set_chunk_size+0x7a/0x110 [dm_snapshot]
[ 1959.104295] RSP: 0018:ffff88032a957b30  EFLAGS: 00010246
[ 1959.110219] RAX: 0000000000000000 RBX: 0000000000000008 RCX: 0000000000000001
[ 1959.118180] RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff880329334a00
[ 1959.126141] RBP: ffff88032a957b50 R08: 0000000000000000 R09: 0000000000000001
[ 1959.134102] R10: 000000000000000a R11: f000000000000000 R12: ffff880330884d80
[ 1959.142061] R13: 0000000000000008 R14: ffffc90001c13088 R15: ffff880330884d80
[ 1959.150021] FS:  00007f8926ba3840(0000) GS:ffff880333440000(0000) knlGS:0000000000000000
[ 1959.159047] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1959.165456] CR2: 0000000000000098 CR3: 000000032f48b000 CR4: 00000000000006e0
[ 1959.173415] Stack:
[ 1959.175656]  ffffc90001c13040 ffff880329334a00 ffff880330884ed0 ffff88032a957bdc
[ 1959.183946]  ffff88032a957bb8 ffffffffa040f225 ffff880329334a30 ffff880300000000
[ 1959.192233]  ffffffffa04133e0 ffff880329334b30 0000000830884d58 00000000569c58cf
[ 1959.200521] Call Trace:
[ 1959.203248]  [<ffffffffa040f225>] dm_exception_store_create+0x1d5/0x240 [dm_snapshot]
[ 1959.211986]  [<ffffffffa040d310>] snapshot_ctr+0x140/0x630 [dm_snapshot]
[ 1959.219469]  [<ffffffffa0005c44>] ? dm_split_args+0x64/0x150 [dm_mod]
[ 1959.226656]  [<ffffffffa0005ea7>] dm_table_add_target+0x177/0x440 [dm_mod]
[ 1959.234328]  [<ffffffffa0009203>] table_load+0x143/0x370 [dm_mod]
[ 1959.241129]  [<ffffffffa00090c0>] ? retrieve_status+0x1b0/0x1b0 [dm_mod]
[ 1959.248607]  [<ffffffffa0009e35>] ctl_ioctl+0x255/0x4d0 [dm_mod]
[ 1959.255307]  [<ffffffff813304e2>] ? memzero_explicit+0x12/0x20
[ 1959.261816]  [<ffffffffa000a0c3>] dm_ctl_ioctl+0x13/0x20 [dm_mod]
[ 1959.268615]  [<ffffffff81215eb6>] do_vfs_ioctl+0xa6/0x5c0
[ 1959.274637]  [<ffffffff81120d2f>] ? __audit_syscall_entry+0xaf/0x100
[ 1959.281726]  [<ffffffff81003176>] ? do_audit_syscall_entry+0x66/0x70
[ 1959.288814]  [<ffffffff81216449>] SyS_ioctl+0x79/0x90
[ 1959.294450]  [<ffffffff8167e4ae>] entry_SYSCALL_64_fastpath+0x12/0x71
...
[ 1959.323277] RIP  [<ffffffffa040efba>] dm_exception_store_set_chunk_size+0x7a/0x110 [dm_snapshot]
[ 1959.333090]  RSP <ffff88032a957b30>
[ 1959.336978] CR2: 0000000000000098
[ 1959.344121] ---[ end trace b049991ccad1169e ]---

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1195899
Signed-off-by: Ding Xiang <dingxiang@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-snap.c          |  9 +++++++++
 drivers/md/dm-table.c         | 36 ++++++++++++++++++++++++------------
 include/linux/device-mapper.h |  2 ++
 3 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 75e1297..305b296 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -1099,6 +1099,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	int i;
 	int r = -EINVAL;
 	char *origin_path, *cow_path;
+	dev_t origin_dev, cow_dev;
 	unsigned args_used, num_flush_bios = 1;
 	fmode_t origin_mode = FMODE_READ;
 
@@ -1129,11 +1130,19 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		ti->error = "Cannot get origin device";
 		goto bad_origin;
 	}
+	origin_dev = s->origin->bdev->bd_dev;
 
 	cow_path = argv[0];
 	argv++;
 	argc--;
 
+	cow_dev = dm_get_dev_t(cow_path);
+	if (cow_dev && cow_dev == origin_dev) {
+		ti->error = "COW device cannot be the same as origin device";
+		r = -EINVAL;
+		goto bad_cow;
+	}
+
 	r = dm_get_device(ti, cow_path, dm_table_get_mode(ti->table), &s->cow);
 	if (r) {
 		ti->error = "Cannot get COW device";
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 16ba55a..e411ccb 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -365,6 +365,26 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode,
 }
 
 /*
+ * Convert the path to a device
+ */
+dev_t dm_get_dev_t(const char *path)
+{
+	dev_t uninitialized_var(dev);
+	struct block_device *bdev;
+
+	bdev = lookup_bdev(path);
+	if (IS_ERR(bdev))
+		dev = name_to_dev_t(path);
+	else {
+		dev = bdev->bd_dev;
+		bdput(bdev);
+	}
+
+	return dev;
+}
+EXPORT_SYMBOL_GPL(dm_get_dev_t);
+
+/*
  * Add a device to the list, or just increment the usage count if
  * it's already present.
  */
@@ -372,23 +392,15 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode,
 		  struct dm_dev **result)
 {
 	int r;
-	dev_t uninitialized_var(dev);
+	dev_t dev;
 	struct dm_dev_internal *dd;
 	struct dm_table *t = ti->table;
-	struct block_device *bdev;
 
 	BUG_ON(!t);
 
-	/* convert the path to a device */
-	bdev = lookup_bdev(path);
-	if (IS_ERR(bdev)) {
-		dev = name_to_dev_t(path);
-		if (!dev)
-			return -ENODEV;
-	} else {
-		dev = bdev->bd_dev;
-		bdput(bdev);
-	}
+	dev = dm_get_dev_t(path);
+	if (!dev)
+		return -ENODEV;
 
 	dd = find_device(&t->devices, dev);
 	if (!dd) {
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 51cc1de..30c8971b 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -127,6 +127,8 @@ struct dm_dev {
 	char name[16];
 };
 
+dev_t dm_get_dev_t(const char *path);
+
 /*
  * Constructors should call these functions to ensure destination devices
  * are opened/closed correctly.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 096/218] dm thin metadata: don't issue prefetches if a transaction abort has failed
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (94 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 095/218] dm snapshot: disallow the COW and origin devices from being identical Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 097/218] dm cache: make sure every metadata function checks fail_io Kamal Mostafa
                   ` (121 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joe Thornber, Mike Snitzer, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Joe Thornber <ejt@redhat.com>

commit 2eae9e4489b4cf83213fa3bd508b5afca3f01780 upstream.

If a transaction abort has failed then we can no longer use the metadata
device.  Typically this happens if the superblock is unreadable.

This fix addresses a crash seen during metadata device failure testing.

Fixes: 8a01a6af75 ("dm thin: prefetch missing metadata pages")
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-thin-metadata.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 4479e90..dbce0df 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -1935,5 +1935,8 @@ bool dm_pool_metadata_needs_check(struct dm_pool_metadata *pmd)
 
 void dm_pool_issue_prefetches(struct dm_pool_metadata *pmd)
 {
-	dm_tm_issue_prefetches(pmd->tm);
+	down_read(&pmd->root_lock);
+	if (!pmd->fail_io)
+		dm_tm_issue_prefetches(pmd->tm);
+	up_read(&pmd->root_lock);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 097/218] dm cache: make sure every metadata function checks fail_io
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (95 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 096/218] dm thin metadata: don't issue prefetches if a transaction abort has failed Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 098/218] iser-target: Fix identification of login rx descriptor type Kamal Mostafa
                   ` (120 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joe Thornber, Mike Snitzer, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Joe Thornber <ejt@redhat.com>

commit d14fcf3dd79c0b8a8d0ba469c44a6b04f3a1403b upstream.

Otherwise operations may be attempted that will only ever go on to crash
(since the metadata device is either missing or unreliable if 'fail_io'
is set).

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm-cache-metadata.c | 98 +++++++++++++++++++++++++-----------------
 drivers/md/dm-cache-metadata.h |  4 +-
 drivers/md/dm-cache-target.c   | 12 +++++-
 3 files changed, 71 insertions(+), 43 deletions(-)

diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index 0a17d1b..1ed4ab1 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -863,19 +863,40 @@ static int blocks_are_unmapped_or_clean(struct dm_cache_metadata *cmd,
 	return 0;
 }
 
-#define WRITE_LOCK(cmd) \
-	if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) \
+#define WRITE_LOCK(cmd)	\
+	down_write(&cmd->root_lock); \
+	if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) { \
+		up_write(&cmd->root_lock); \
 		return -EINVAL; \
-	down_write(&cmd->root_lock)
+	}
 
 #define WRITE_LOCK_VOID(cmd) \
-	if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) \
+	down_write(&cmd->root_lock); \
+	if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) { \
+		up_write(&cmd->root_lock); \
 		return; \
-	down_write(&cmd->root_lock)
+	}
 
 #define WRITE_UNLOCK(cmd) \
 	up_write(&cmd->root_lock)
 
+#define READ_LOCK(cmd) \
+	down_read(&cmd->root_lock); \
+	if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) { \
+		up_read(&cmd->root_lock); \
+		return -EINVAL; \
+	}
+
+#define READ_LOCK_VOID(cmd)	\
+	down_read(&cmd->root_lock); \
+	if (cmd->fail_io || dm_bm_is_read_only(cmd->bm)) { \
+		up_read(&cmd->root_lock); \
+		return; \
+	}
+
+#define READ_UNLOCK(cmd) \
+	up_read(&cmd->root_lock)
+
 int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size)
 {
 	int r;
@@ -1011,22 +1032,20 @@ int dm_cache_load_discards(struct dm_cache_metadata *cmd,
 {
 	int r;
 
-	down_read(&cmd->root_lock);
+	READ_LOCK(cmd);
 	r = __load_discards(cmd, fn, context);
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 
 	return r;
 }
 
-dm_cblock_t dm_cache_size(struct dm_cache_metadata *cmd)
+int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result)
 {
-	dm_cblock_t r;
+	READ_LOCK(cmd);
+	*result = cmd->cache_blocks;
+	READ_UNLOCK(cmd);
 
-	down_read(&cmd->root_lock);
-	r = cmd->cache_blocks;
-	up_read(&cmd->root_lock);
-
-	return r;
+	return 0;
 }
 
 static int __remove(struct dm_cache_metadata *cmd, dm_cblock_t cblock)
@@ -1184,9 +1203,9 @@ int dm_cache_load_mappings(struct dm_cache_metadata *cmd,
 {
 	int r;
 
-	down_read(&cmd->root_lock);
+	READ_LOCK(cmd);
 	r = __load_mappings(cmd, policy, fn, context);
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 
 	return r;
 }
@@ -1211,18 +1230,18 @@ static int __dump_mappings(struct dm_cache_metadata *cmd)
 
 void dm_cache_dump(struct dm_cache_metadata *cmd)
 {
-	down_read(&cmd->root_lock);
+	READ_LOCK_VOID(cmd);
 	__dump_mappings(cmd);
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 }
 
 int dm_cache_changed_this_transaction(struct dm_cache_metadata *cmd)
 {
 	int r;
 
-	down_read(&cmd->root_lock);
+	READ_LOCK(cmd);
 	r = cmd->changed;
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 
 	return r;
 }
@@ -1272,9 +1291,9 @@ int dm_cache_set_dirty(struct dm_cache_metadata *cmd,
 void dm_cache_metadata_get_stats(struct dm_cache_metadata *cmd,
 				 struct dm_cache_statistics *stats)
 {
-	down_read(&cmd->root_lock);
+	READ_LOCK_VOID(cmd);
 	*stats = cmd->stats;
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 }
 
 void dm_cache_metadata_set_stats(struct dm_cache_metadata *cmd,
@@ -1308,9 +1327,9 @@ int dm_cache_get_free_metadata_block_count(struct dm_cache_metadata *cmd,
 {
 	int r = -EINVAL;
 
-	down_read(&cmd->root_lock);
+	READ_LOCK(cmd);
 	r = dm_sm_get_nr_free(cmd->metadata_sm, result);
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 
 	return r;
 }
@@ -1320,9 +1339,9 @@ int dm_cache_get_metadata_dev_size(struct dm_cache_metadata *cmd,
 {
 	int r = -EINVAL;
 
-	down_read(&cmd->root_lock);
+	READ_LOCK(cmd);
 	r = dm_sm_get_nr_blocks(cmd->metadata_sm, result);
-	up_read(&cmd->root_lock);
+	READ_UNLOCK(cmd);
 
 	return r;
 }
@@ -1413,7 +1432,13 @@ int dm_cache_write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *
 
 int dm_cache_metadata_all_clean(struct dm_cache_metadata *cmd, bool *result)
 {
-	return blocks_are_unmapped_or_clean(cmd, 0, cmd->cache_blocks, result);
+	int r;
+
+	READ_LOCK(cmd);
+	r = blocks_are_unmapped_or_clean(cmd, 0, cmd->cache_blocks, result);
+	READ_UNLOCK(cmd);
+
+	return r;
 }
 
 void dm_cache_metadata_set_read_only(struct dm_cache_metadata *cmd)
@@ -1436,10 +1461,7 @@ int dm_cache_metadata_set_needs_check(struct dm_cache_metadata *cmd)
 	struct dm_block *sblock;
 	struct cache_disk_superblock *disk_super;
 
-	/*
-	 * We ignore fail_io for this function.
-	 */
-	down_write(&cmd->root_lock);
+	WRITE_LOCK(cmd);
 	set_bit(NEEDS_CHECK, &cmd->flags);
 
 	r = superblock_lock(cmd, &sblock);
@@ -1454,19 +1476,17 @@ int dm_cache_metadata_set_needs_check(struct dm_cache_metadata *cmd)
 	dm_bm_unlock(sblock);
 
 out:
-	up_write(&cmd->root_lock);
+	WRITE_UNLOCK(cmd);
 	return r;
 }
 
-bool dm_cache_metadata_needs_check(struct dm_cache_metadata *cmd)
+int dm_cache_metadata_needs_check(struct dm_cache_metadata *cmd, bool *result)
 {
-	bool needs_check;
+	READ_LOCK(cmd);
+	*result = !!test_bit(NEEDS_CHECK, &cmd->flags);
+	READ_UNLOCK(cmd);
 
-	down_read(&cmd->root_lock);
-	needs_check = !!test_bit(NEEDS_CHECK, &cmd->flags);
-	up_read(&cmd->root_lock);
-
-	return needs_check;
+	return 0;
 }
 
 int dm_cache_metadata_abort(struct dm_cache_metadata *cmd)
diff --git a/drivers/md/dm-cache-metadata.h b/drivers/md/dm-cache-metadata.h
index 2ffee21..8528744 100644
--- a/drivers/md/dm-cache-metadata.h
+++ b/drivers/md/dm-cache-metadata.h
@@ -66,7 +66,7 @@ void dm_cache_metadata_close(struct dm_cache_metadata *cmd);
  * origin blocks to map to.
  */
 int dm_cache_resize(struct dm_cache_metadata *cmd, dm_cblock_t new_cache_size);
-dm_cblock_t dm_cache_size(struct dm_cache_metadata *cmd);
+int dm_cache_size(struct dm_cache_metadata *cmd, dm_cblock_t *result);
 
 int dm_cache_discard_bitset_resize(struct dm_cache_metadata *cmd,
 				   sector_t discard_block_size,
@@ -137,7 +137,7 @@ int dm_cache_write_hints(struct dm_cache_metadata *cmd, struct dm_cache_policy *
  */
 int dm_cache_metadata_all_clean(struct dm_cache_metadata *cmd, bool *result);
 
-bool dm_cache_metadata_needs_check(struct dm_cache_metadata *cmd);
+int dm_cache_metadata_needs_check(struct dm_cache_metadata *cmd, bool *result);
 int dm_cache_metadata_set_needs_check(struct dm_cache_metadata *cmd);
 void dm_cache_metadata_set_read_only(struct dm_cache_metadata *cmd);
 void dm_cache_metadata_set_read_write(struct dm_cache_metadata *cmd);
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 9d0672b..6ad5ddf 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -988,9 +988,14 @@ static void notify_mode_switch(struct cache *cache, enum cache_metadata_mode mod
 
 static void set_cache_mode(struct cache *cache, enum cache_metadata_mode new_mode)
 {
-	bool needs_check = dm_cache_metadata_needs_check(cache->cmd);
+	bool needs_check;
 	enum cache_metadata_mode old_mode = get_cache_mode(cache);
 
+	if (dm_cache_metadata_needs_check(cache->cmd, &needs_check)) {
+		DMERR("unable to read needs_check flag, setting failure mode");
+		new_mode = CM_FAIL;
+	}
+
 	if (new_mode == CM_WRITE && needs_check) {
 		DMERR("%s: unable to switch cache to write mode until repaired.",
 		      cache_device_name(cache));
@@ -3517,6 +3522,7 @@ static void cache_status(struct dm_target *ti, status_type_t type,
 	char buf[BDEVNAME_SIZE];
 	struct cache *cache = ti->private;
 	dm_cblock_t residency;
+	bool needs_check;
 
 	switch (type) {
 	case STATUSTYPE_INFO:
@@ -3590,7 +3596,9 @@ static void cache_status(struct dm_target *ti, status_type_t type,
 		else
 			DMEMIT("rw ");
 
-		if (dm_cache_metadata_needs_check(cache->cmd))
+		r = dm_cache_metadata_needs_check(cache->cmd, &needs_check);
+
+		if (r || needs_check)
 			DMEMIT("needs_check ");
 		else
 			DMEMIT("- ");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 098/218] iser-target: Fix identification of login rx descriptor type
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (96 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 097/218] dm cache: make sure every metadata function checks fail_io Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 099/218] iser-target: Add new state ISER_CONN_BOUND to isert_conn Kamal Mostafa
                   ` (119 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jenny Derzhavetz, Sagi Grimberg, Nicholas Bellinger, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jenny Derzhavetz <jennyf@mellanox.com>

commit b89a7c25462b164db280abc3b05d4d9d888d40e9 upstream.

Once connection request is accepted, one rx descriptor
is posted to receive login request. This descriptor has rx type,
but is outside the main pool of rx descriptors, and thus
was mistreated as tx type.

Signed-off-by: Jenny Derzhavetz <jennyf@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 85761b7..50933954 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -2072,7 +2072,8 @@ is_isert_tx_desc(struct isert_conn *isert_conn, void *wr_id)
 	void *start = isert_conn->rx_descs;
 	int len = ISERT_QP_MAX_RECV_DTOS * sizeof(*isert_conn->rx_descs);
 
-	if (wr_id >= start && wr_id < start + len)
+	if ((wr_id >= start && wr_id < start + len) ||
+	    (wr_id == isert_conn->login_req_buf))
 		return false;
 
 	return true;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 099/218] iser-target: Add new state ISER_CONN_BOUND to isert_conn
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (97 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 098/218] iser-target: Fix identification of login rx descriptor type Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 100/218] iser-target: Separate flows for np listeners and connections cma events Kamal Mostafa
                   ` (118 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jenny Derzhavetz, Sagi Grimberg, Nicholas Bellinger, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jenny Derzhavetz <jennyf@mellanox.com>

commit aea92980601f7ddfcb3c54caa53a43726314fe46 upstream.

We need an indication that isert_conn->iscsi_conn binding has
happened so we'll know not to invoke a connection reinstatement
on an unbound connection which will lead to a bogus isert_conn->conn
dereferece.

Signed-off-by: Jenny Derzhavetz <jennyf@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 7 +++++--
 drivers/infiniband/ulp/isert/ib_isert.h | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 50933954..c57777f 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -876,7 +876,7 @@ isert_put_conn(struct isert_conn *isert_conn)
  * @isert_conn: isert connection struct
  *
  * Notes:
- * In case the connection state is FULL_FEATURE, move state
+ * In case the connection state is BOUND, move state
  * to TEMINATING and start teardown sequence (rdma_disconnect).
  * In case the connection state is UP, complete flush as well.
  *
@@ -892,6 +892,7 @@ isert_conn_terminate(struct isert_conn *isert_conn)
 	case ISER_CONN_TERMINATING:
 		break;
 	case ISER_CONN_UP:
+	case ISER_CONN_BOUND:
 	case ISER_CONN_FULL_FEATURE: /* FALLTHRU */
 		isert_info("Terminating conn %p state %d\n",
 			   isert_conn, isert_conn->state);
@@ -2099,7 +2100,8 @@ isert_cq_comp_err(struct isert_conn *isert_conn, struct ib_wc *wc)
 			isert_completion_put(desc, isert_cmd, ib_dev, true);
 	} else {
 		isert_conn->post_recv_buf_count--;
-		if (!isert_conn->post_recv_buf_count)
+		if (!isert_conn->post_recv_buf_count &&
+		    isert_conn->state >= ISER_CONN_BOUND)
 			iscsit_cause_connection_reinstatement(isert_conn->conn, 0);
 	}
 }
@@ -3285,6 +3287,7 @@ accept_wait:
 
 	conn->context = isert_conn;
 	isert_conn->conn = conn;
+	isert_conn->state = ISER_CONN_BOUND;
 
 	isert_set_conn_info(np, conn, isert_conn);
 
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
index 9ec23a78..621c222 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -50,6 +50,7 @@ enum iser_ib_op_code {
 enum iser_conn_state {
 	ISER_CONN_INIT,
 	ISER_CONN_UP,
+	ISER_CONN_BOUND,
 	ISER_CONN_FULL_FEATURE,
 	ISER_CONN_TERMINATING,
 	ISER_CONN_DOWN,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 100/218] iser-target: Separate flows for np listeners and connections cma events
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (98 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 099/218] iser-target: Add new state ISER_CONN_BOUND to isert_conn Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 101/218] ALSA: hda - fix the mic mute button and led problem for a Lenovo AIO Kamal Mostafa
                   ` (117 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jenny Derzhavetz, Sagi Grimberg, Nicholas Bellinger, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jenny Derzhavetz <jennyf@mellanox.com>

commit f81bf458208ef6d12b2fc08091204e3859dcdba4 upstream.

No need to restrict this check to specific events.

Signed-off-by: Jenny Derzhavetz <jennyf@mellanox.com>
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[ kamal: backport to 4.2-stable: s/cm_id/np_cm_id/ ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/infiniband/ulp/isert/ib_isert.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index c57777f..6c10899 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -940,14 +940,9 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
 			   enum rdma_cm_event_type event)
 {
 	struct isert_np *isert_np = cma_id->context;
-	struct isert_conn *isert_conn;
+	struct isert_conn *isert_conn = cma_id->qp->qp_context;
 	bool terminating = false;
 
-	if (isert_np->np_cm_id == cma_id)
-		return isert_np_cma_handler(cma_id->context, event);
-
-	isert_conn = cma_id->qp->qp_context;
-
 	mutex_lock(&isert_conn->mutex);
 	terminating = (isert_conn->state == ISER_CONN_TERMINATING);
 	isert_conn_terminate(isert_conn);
@@ -985,12 +980,16 @@ isert_connect_error(struct rdma_cm_id *cma_id)
 static int
 isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
 {
+	struct isert_np *isert_np = cma_id->context;
 	int ret = 0;
 
 	isert_info("%s (%d): status %d id %p np %p\n",
 		   rdma_event_msg(event->event), event->event,
 		   event->status, cma_id, cma_id->context);
 
+	if (isert_np->np_cm_id == cma_id)
+		return isert_np_cma_handler(cma_id->context, event->event);
+
 	switch (event->event) {
 	case RDMA_CM_EVENT_CONNECT_REQUEST:
 		ret = isert_connect_request(cma_id, event);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 101/218] ALSA: hda - fix the mic mute button and led problem for a Lenovo AIO
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (99 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 100/218] iser-target: Separate flows for np listeners and connections cma events Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 102/218] xtensa: ISS: don't hang if stdin EOF is reached Kamal Mostafa
                   ` (116 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Hui Wang, Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Hui Wang <hui.wang@canonical.com>

commit 6ef2f68fa38bf415830f67903d87180d933e0f47 upstream.

This Lenovo ThinkCentre AIO also uses Line2 as mic mute button and
uses GPIO2 to control the mic mute led, so applying this quirk can
make both the button and led work.

BugLink: https://bugs.launchpad.net/bugs/1555912
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 73d135c..6c143e3 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5505,6 +5505,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
 	SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
+	SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
 	SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
 	SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
 	SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 102/218] xtensa: ISS: don't hang if stdin EOF is reached
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (100 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 101/218] ALSA: hda - fix the mic mute button and led problem for a Lenovo AIO Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 103/218] xtensa: fix preemption in {clear,copy}_user_highpage Kamal Mostafa
                   ` (115 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Max Filippov <jcmvbkbc@gmail.com>

commit 362014c8d9d51d504c167c44ac280169457732be upstream.

Simulator stdin may be connected to a file, when its end is reached
kernel hangs in infinite loop inside rs_poll, because simc_poll always
signals that descriptor 0 is readable and simc_read always returns 0.
Check simc_read return value and exit loop if it's not positive. Also
don't rewind polling timer if it's zero.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/xtensa/platforms/iss/console.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 70cb408..92d785f 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -100,21 +100,23 @@ static void rs_poll(unsigned long priv)
 {
 	struct tty_port *port = (struct tty_port *)priv;
 	int i = 0;
+	int rd = 1;
 	unsigned char c;
 
 	spin_lock(&timer_lock);
 
 	while (simc_poll(0)) {
-		simc_read(0, &c, 1);
+		rd = simc_read(0, &c, 1);
+		if (rd <= 0)
+			break;
 		tty_insert_flip_char(port, c, TTY_NORMAL);
 		i++;
 	}
 
 	if (i)
 		tty_flip_buffer_push(port);
-
-
-	mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
+	if (rd)
+		mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE);
 	spin_unlock(&timer_lock);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 103/218] xtensa: fix preemption in {clear,copy}_user_highpage
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (101 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 102/218] xtensa: ISS: don't hang if stdin EOF is reached Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 104/218] xtensa: clear all DBREAKC registers on start Kamal Mostafa
                   ` (114 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Max Filippov <jcmvbkbc@gmail.com>

commit a67cc9aa2dfc6e66addf240bbd79e16e01565e81 upstream.

Disabling pagefault makes little sense there, preemption disabling is
what was meant.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/xtensa/mm/cache.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/xtensa/mm/cache.c b/arch/xtensa/mm/cache.c
index d75aa14..1a804a2 100644
--- a/arch/xtensa/mm/cache.c
+++ b/arch/xtensa/mm/cache.c
@@ -97,11 +97,11 @@ void clear_user_highpage(struct page *page, unsigned long vaddr)
 	unsigned long paddr;
 	void *kvaddr = coherent_kvaddr(page, TLBTEMP_BASE_1, vaddr, &paddr);
 
-	pagefault_disable();
+	preempt_disable();
 	kmap_invalidate_coherent(page, vaddr);
 	set_bit(PG_arch_1, &page->flags);
 	clear_page_alias(kvaddr, paddr);
-	pagefault_enable();
+	preempt_enable();
 }
 
 void copy_user_highpage(struct page *dst, struct page *src,
@@ -113,11 +113,11 @@ void copy_user_highpage(struct page *dst, struct page *src,
 	void *src_vaddr = coherent_kvaddr(src, TLBTEMP_BASE_2, vaddr,
 					  &src_paddr);
 
-	pagefault_disable();
+	preempt_disable();
 	kmap_invalidate_coherent(dst, vaddr);
 	set_bit(PG_arch_1, &dst->flags);
 	copy_page_alias(dst_vaddr, src_vaddr, dst_paddr, src_paddr);
-	pagefault_enable();
+	preempt_enable();
 }
 
 #endif /* DCACHE_WAY_SIZE > PAGE_SIZE */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 104/218] xtensa: clear all DBREAKC registers on start
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (102 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 103/218] xtensa: fix preemption in {clear,copy}_user_highpage Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 105/218] Bluetooth: Fix potential buffer overflow with Add Advertising Kamal Mostafa
                   ` (113 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Max Filippov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Max Filippov <jcmvbkbc@gmail.com>

commit 7de7ac785ae18a2cdc78d7560f48e3213d9ea0ab upstream.

There are XCHAL_NUM_DBREAK registers, clear them all.
This also fixes cryptic assembler error message with binutils 2.25 when
XCHAL_NUM_DBREAK is 0:

  as: out of memory allocating 18446744073709551575 bytes after a total
  of 495616 bytes

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/xtensa/kernel/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index 9ed5564..05e1df9 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -128,7 +128,7 @@ ENTRY(_startup)
 	wsr	a0, icountlevel
 
 	.set	_index, 0
-	.rept	XCHAL_NUM_DBREAK - 1
+	.rept	XCHAL_NUM_DBREAK
 	wsr	a0, SREG_DBREAKC + _index
 	.set	_index, _index + 1
 	.endr
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 105/218] Bluetooth: Fix potential buffer overflow with Add Advertising
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (103 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 104/218] xtensa: clear all DBREAKC registers on start Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 106/218] ARC: [BE] readl()/writel() to work in Big Endian CPU configuration Kamal Mostafa
                   ` (112 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johan Hedberg, Marcel Holtmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Johan Hedberg <johan.hedberg@intel.com>

commit 6a0e78072c2ae7b20b14e0249d8108441ea928d2 upstream.

The Add Advertising command handler does the appropriate checks for
the AD and Scan Response data, however fails to take into account the
general length of the mgmt command itself, which could lead to
potential buffer overflows. This patch adds the necessary check that
the mgmt command length is consistent with the given ad and scan_rsp
lengths.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/bluetooth/mgmt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index e32a9e4..3750b37 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -7135,6 +7135,10 @@ static int add_advertising(struct sock *sk, struct hci_dev *hdev,
 		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING,
 				       status);
 
+	if (data_len != sizeof(*cp) + cp->adv_data_len + cp->scan_rsp_len)
+		return mgmt_cmd_status(sk, hdev->id, MGMT_OP_ADD_ADVERTISING,
+				       MGMT_STATUS_INVALID_PARAMS);
+
 	flags = __le32_to_cpu(cp->flags);
 	timeout = __le16_to_cpu(cp->timeout);
 	duration = __le16_to_cpu(cp->duration);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 106/218] ARC: [BE] readl()/writel() to work in Big Endian CPU configuration
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (104 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 105/218] Bluetooth: Fix potential buffer overflow with Add Advertising Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 107/218] bus: imx-weim: Take the 'status' property value into account Kamal Mostafa
                   ` (111 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexey Brodkin, Arnd Bergmann, Lada Trimasova, Vineet Gupta,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Lada Trimasova <ltrimas@synopsys.com>

commit f778cc65717687a3d3f26dd21bef62cd059f1b8b upstream.

read{l,w}() write{l,w}() primitives should use le{16,32}_to_cpu() and
cpu_to_le{16,32}() respectively to ensure device registers are read
correctly in Big Endian CPU configuration.

Per Arnd Bergmann
| Most drivers using readl() or readl_relaxed() expect those to perform byte
| swaps on big-endian architectures, as the registers tend to be fixed endian

This was needed for getting UART to work correctly on a Big Endian ARC.

The ARC accessors originally were fine, and the bug got introduced
inadventently by commit b8a033023994 ("ARCv2: barriers")

Fixes: b8a033023994 ("ARCv2: barriers")
Link: http://lkml.kernel.org/r/201603100845.30602.arnd@arndb.de
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lada Trimasova <ltrimas@synopsys.com>
[vgupta: beefed up changelog, added Fixes/stable tags]
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arc/include/asm/io.h | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 694ece8..27b17ad 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -129,15 +129,23 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr)
 #define writel(v,c)		({ __iowmb(); writel_relaxed(v,c); })
 
 /*
- * Relaxed API for drivers which can handle any ordering themselves
+ * Relaxed API for drivers which can handle barrier ordering themselves
+ *
+ * Also these are defined to perform little endian accesses.
+ * To provide the typical device register semantics of fixed endian,
+ * swap the byte order for Big Endian
+ *
+ * http://lkml.kernel.org/r/201603100845.30602.arnd@arndb.de
  */
 #define readb_relaxed(c)	__raw_readb(c)
-#define readw_relaxed(c)	__raw_readw(c)
-#define readl_relaxed(c)	__raw_readl(c)
+#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
+					__raw_readw(c)); __r; })
+#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
+					__raw_readl(c)); __r; })
 
 #define writeb_relaxed(v,c)	__raw_writeb(v,c)
-#define writew_relaxed(v,c)	__raw_writew(v,c)
-#define writel_relaxed(v,c)	__raw_writel(v,c)
+#define writew_relaxed(v,c)	__raw_writew((__force u16) cpu_to_le16(v),c)
+#define writel_relaxed(v,c)	__raw_writel((__force u32) cpu_to_le32(v),c)
 
 #include <asm-generic/io.h>
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 107/218] bus: imx-weim: Take the 'status' property value into account
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (105 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 106/218] ARC: [BE] readl()/writel() to work in Big Endian CPU configuration Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 108/218] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Kamal Mostafa
                   ` (110 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Fabio Estevam, Olof Johansson, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Fabio Estevam <fabio.estevam@nxp.com>

commit 33b96d2c9579213cf3f36d7b29841b1e464750c4 upstream.

Currently we have an incorrect behaviour when multiple devices
are present under the weim node. For example:

&weim {
	...
	status = "okay";

	sram@0,0 {
		...
        	status = "okay";
	};

	mram@0,0 {
		...
        	status = "disabled";
    	};
};

In this case only the 'sram' device should be probed and not 'mram'.

However what happens currently is that the status variable is ignored,
causing the 'sram' device to be disabled and 'mram' to be enabled.

Change the weim_parse_dt() function to use
for_each_available_child_of_node()so that the devices marked with
'status = disabled' are not probed.

Suggested-by: Wolfgang Netbal <wolfgang.netbal@sigmatek.at>
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/bus/imx-weim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c
index e98d15e..1827fc4 100644
--- a/drivers/bus/imx-weim.c
+++ b/drivers/bus/imx-weim.c
@@ -150,7 +150,7 @@ static int __init weim_parse_dt(struct platform_device *pdev,
 			return ret;
 	}
 
-	for_each_child_of_node(pdev->dev.of_node, child) {
+	for_each_available_child_of_node(pdev->dev.of_node, child) {
 		if (!child->name)
 			continue;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 108/218] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41.
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (106 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 107/218] bus: imx-weim: Take the 'status' property value into account Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 109/218] fuse: do not use iocb after it may have been freed Kamal Mostafa
                   ` (109 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vittorio Gambaletta, Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Vittorio Gambaletta (VittGam)" <linuxbugs@vittgam.net>

commit 4061db03dd71d195b9973ee466f6ed32f6a3fc16 upstream.

The clock measurement on the AC'97 audio card found in the IBM ThinkPad X41
will often fail, so add a quirk entry to fix it.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=441087
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/intel8x0.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 42bcbac..ccdab29 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2879,6 +2879,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
 
 static struct snd_pci_quirk intel8x0_clock_list[] = {
 	SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000),
+	SND_PCI_QUIRK(0x1014, 0x0581, "AD1981B", 48000),
 	SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100),
 	SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000),
 	SND_PCI_QUIRK(0x1028, 0x01ad, "AD1981B", 48000),
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 109/218] fuse: do not use iocb after it may have been freed
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (107 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 108/218] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 110/218] fuse: Add reference counting for fuse_io_priv Kamal Mostafa
                   ` (108 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Robert Doebbelin, Miklos Szeredi, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Robert Doebbelin <robert@quobyte.com>

commit 7cabc61e01a0a8b663bd2b4c982aa53048218734 upstream.

There's a race in fuse_direct_IO(), whereby is_sync_kiocb() is called on an
iocb that could have been freed if async io has already completed.  The fix
in this case is simple and obvious: cache the result before starting io.

It was discovered by KASan:

kernel: ==================================================================
kernel: BUG: KASan: use after free in fuse_direct_IO+0xb1a/0xcc0 at addr ffff88036c414390

Signed-off-by: Robert Doebbelin <robert@quobyte.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: bcba24ccdc82 ("fuse: enable asynchronous processing direct IO")
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/fuse/file.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 195476a..9e80d01 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2786,6 +2786,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 	loff_t i_size;
 	size_t count = iov_iter_count(iter);
 	struct fuse_io_priv *io;
+	bool is_sync = is_sync_kiocb(iocb);
 
 	pos = offset;
 	inode = file->f_mapping->host;
@@ -2825,11 +2826,11 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 	 * to wait on real async I/O requests, so we must submit this request
 	 * synchronously.
 	 */
-	if (!is_sync_kiocb(iocb) && (offset + count > i_size) &&
+	if (!is_sync && (offset + count > i_size) &&
 	    iov_iter_rw(iter) == WRITE)
 		io->async = false;
 
-	if (io->async && is_sync_kiocb(iocb))
+	if (io->async && is_sync)
 		io->done = &wait;
 
 	if (iov_iter_rw(iter) == WRITE) {
@@ -2843,7 +2844,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 		fuse_aio_complete(io, ret < 0 ? ret : 0, -1);
 
 		/* we have a non-extending, async request, so return */
-		if (!is_sync_kiocb(iocb))
+		if (!is_sync)
 			return -EIOCBQUEUED;
 
 		wait_for_completion(&wait);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 110/218] fuse: Add reference counting for fuse_io_priv
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (108 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 109/218] fuse: do not use iocb after it may have been freed Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 111/218] s390/pci: enforce fmb page boundary rule Kamal Mostafa
                   ` (107 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Seth Forshee, Miklos Szeredi, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Seth Forshee <seth.forshee@canonical.com>

commit 744742d692e37ad5c20630e57d526c8f2e2fe3c9 upstream.

The 'reqs' member of fuse_io_priv serves two purposes. First is to track
the number of oustanding async requests to the server and to signal that
the io request is completed. The second is to be a reference count on the
structure to know when it can be freed.

For sync io requests these purposes can be at odds.  fuse_direct_IO() wants
to block until the request is done, and since the signal is sent when
'reqs' reaches 0 it cannot keep a reference to the object. Yet it needs to
use the object after the userspace server has completed processing
requests. This leads to some handshaking and special casing that it
needlessly complicated and responsible for at least one race condition.

It's much cleaner and safer to maintain a separate reference count for the
object lifecycle and to let 'reqs' just be a count of outstanding requests
to the userspace server. Then we can know for sure when it is safe to free
the object without any handshaking or special cases.

The catch here is that most of the time these objects are stack allocated
and should not be freed. Initializing these objects with a single reference
that is never released prevents accidental attempts to free the objects.

Fixes: 9d5722b7777e ("fuse: handle synchronous iocbs internally")
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/fuse/cuse.c   |  4 ++--
 fs/fuse/file.c   | 28 +++++++++++++++++++++-------
 fs/fuse/fuse_i.h |  9 +++++++++
 3 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 8e3ee19..c5b6b71 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -90,7 +90,7 @@ static struct list_head *cuse_conntbl_head(dev_t devt)
 
 static ssize_t cuse_read_iter(struct kiocb *kiocb, struct iov_iter *to)
 {
-	struct fuse_io_priv io = { .async = 0, .file = kiocb->ki_filp };
+	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(kiocb->ki_filp);
 	loff_t pos = 0;
 
 	return fuse_direct_io(&io, to, &pos, FUSE_DIO_CUSE);
@@ -98,7 +98,7 @@ static ssize_t cuse_read_iter(struct kiocb *kiocb, struct iov_iter *to)
 
 static ssize_t cuse_write_iter(struct kiocb *kiocb, struct iov_iter *from)
 {
-	struct fuse_io_priv io = { .async = 0, .file = kiocb->ki_filp };
+	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(kiocb->ki_filp);
 	loff_t pos = 0;
 	/*
 	 * No locking or generic_write_checks(), the server is
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 9e80d01..b4aae5a 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -528,6 +528,11 @@ static void fuse_release_user_pages(struct fuse_req *req, int write)
 	}
 }
 
+static void fuse_io_release(struct kref *kref)
+{
+	kfree(container_of(kref, struct fuse_io_priv, refcnt));
+}
+
 static ssize_t fuse_get_res_by_io(struct fuse_io_priv *io)
 {
 	if (io->err)
@@ -585,8 +590,9 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
 		}
 
 		io->iocb->ki_complete(io->iocb, res, 0);
-		kfree(io);
 	}
+
+	kref_put(&io->refcnt, fuse_io_release);
 }
 
 static void fuse_aio_complete_req(struct fuse_conn *fc, struct fuse_req *req)
@@ -613,6 +619,7 @@ static size_t fuse_async_req_send(struct fuse_conn *fc, struct fuse_req *req,
 		size_t num_bytes, struct fuse_io_priv *io)
 {
 	spin_lock(&io->lock);
+	kref_get(&io->refcnt);
 	io->size += num_bytes;
 	io->reqs++;
 	spin_unlock(&io->lock);
@@ -691,7 +698,7 @@ static void fuse_short_read(struct fuse_req *req, struct inode *inode,
 
 static int fuse_do_readpage(struct file *file, struct page *page)
 {
-	struct fuse_io_priv io = { .async = 0, .file = file };
+	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(file);
 	struct inode *inode = page->mapping->host;
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_req *req;
@@ -984,7 +991,7 @@ static size_t fuse_send_write_pages(struct fuse_req *req, struct file *file,
 	size_t res;
 	unsigned offset;
 	unsigned i;
-	struct fuse_io_priv io = { .async = 0, .file = file };
+	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(file);
 
 	for (i = 0; i < req->num_pages; i++)
 		fuse_wait_on_page_writeback(inode, req->pages[i]->index);
@@ -1398,7 +1405,7 @@ static ssize_t __fuse_direct_read(struct fuse_io_priv *io,
 
 static ssize_t fuse_direct_read_iter(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct fuse_io_priv io = { .async = 0, .file = iocb->ki_filp };
+	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(iocb->ki_filp);
 	return __fuse_direct_read(&io, to, &iocb->ki_pos);
 }
 
@@ -1406,7 +1413,7 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
 {
 	struct file *file = iocb->ki_filp;
 	struct inode *inode = file_inode(file);
-	struct fuse_io_priv io = { .async = 0, .file = file };
+	struct fuse_io_priv io = FUSE_IO_PRIV_SYNC(file);
 	ssize_t res;
 
 	if (is_bad_inode(inode))
@@ -2807,6 +2814,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 	if (!io)
 		return -ENOMEM;
 	spin_lock_init(&io->lock);
+	kref_init(&io->refcnt);
 	io->reqs = 1;
 	io->bytes = -1;
 	io->size = 0;
@@ -2830,8 +2838,14 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 	    iov_iter_rw(iter) == WRITE)
 		io->async = false;
 
-	if (io->async && is_sync)
+	if (io->async && is_sync) {
+		/*
+		 * Additional reference to keep io around after
+		 * calling fuse_aio_complete()
+		 */
+		kref_get(&io->refcnt);
 		io->done = &wait;
+	}
 
 	if (iov_iter_rw(iter) == WRITE) {
 		ret = fuse_direct_io(io, iter, &pos, FUSE_DIO_WRITE);
@@ -2851,7 +2865,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset)
 		ret = fuse_get_res_by_io(io);
 	}
 
-	kfree(io);
+	kref_put(&io->refcnt, fuse_io_release);
 
 	if (iov_iter_rw(iter) == WRITE) {
 		if (ret > 0)
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 4051131..604cd42 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -22,6 +22,7 @@
 #include <linux/rbtree.h>
 #include <linux/poll.h>
 #include <linux/workqueue.h>
+#include <linux/kref.h>
 
 /** Max number of pages that can be used in a single read request */
 #define FUSE_MAX_PAGES_PER_REQ 32
@@ -243,6 +244,7 @@ struct fuse_args {
 
 /** The request IO state (for asynchronous processing) */
 struct fuse_io_priv {
+	struct kref refcnt;
 	int async;
 	spinlock_t lock;
 	unsigned reqs;
@@ -256,6 +258,13 @@ struct fuse_io_priv {
 	struct completion *done;
 };
 
+#define FUSE_IO_PRIV_SYNC(f) \
+{					\
+	.refcnt = { ATOMIC_INIT(1) },	\
+	.async = 0,			\
+	.file = f,			\
+}
+
 /**
  * Request flags
  *
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 111/218] s390/pci: enforce fmb page boundary rule
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (109 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 110/218] fuse: Add reference counting for fuse_io_priv Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 112/218] drm/radeon: rework fbdev handling on chips with no connectors Kamal Mostafa
                   ` (106 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Ott, Martin Schwidefsky, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Sebastian Ott <sebott@linux.vnet.ibm.com>

commit 80c544ded25ac14d7cc3e555abb8ed2c2da99b84 upstream.

The function measurement block must not cross a page boundary. Ensure
that by raising the alignment requirement to the smallest power of 2
larger than the size of the fmb.

Fixes: d0b088531 ("s390/pci: performance statistics and debug infrastructure")
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/s390/include/asm/pci.h | 2 +-
 arch/s390/pci/pci.c         | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index a648338..4e33fe3 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -45,7 +45,7 @@ struct zpci_fmb {
 	u64 rpcit_ops;
 	u64 dma_rbytes;
 	u64 dma_wbytes;
-} __packed __aligned(16);
+} __packed __aligned(64);
 
 enum zpci_state {
 	ZPCI_FN_STATE_RESERVED,
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 598f023..50a79a5 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -871,8 +871,11 @@ static inline int barsize(u8 size)
 
 static int zpci_mem_init(void)
 {
+	BUILD_BUG_ON(!is_power_of_2(__alignof__(struct zpci_fmb)) ||
+		     __alignof__(struct zpci_fmb) < sizeof(struct zpci_fmb));
+
 	zdev_fmb_cache = kmem_cache_create("PCI_FMB_cache", sizeof(struct zpci_fmb),
-				16, 0, NULL);
+					   __alignof__(struct zpci_fmb), 0, NULL);
 	if (!zdev_fmb_cache)
 		goto error_zdev;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 112/218] drm/radeon: rework fbdev handling on chips with no connectors
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (110 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 111/218] s390/pci: enforce fmb page boundary rule Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 113/218] md: multipath: don't hardcopy bio in .make_request path Kamal Mostafa
                   ` (105 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Alex Deucher, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alex Deucher <alexander.deucher@amd.com>

commit e5f243bd2edd95c6cc1d90c1878f821068e83fba upstream.

Move all the logic to radeon_fb.c and add checks to functions
called frome elsewhere.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=112781

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_fb.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index aeb6767..0aff289 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -334,7 +334,8 @@ out_unref:
 
 void radeon_fb_output_poll_changed(struct radeon_device *rdev)
 {
-	drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper);
+	if (rdev->mode_info.rfbdev)
+		drm_fb_helper_hotplug_event(&rdev->mode_info.rfbdev->helper);
 }
 
 static int radeon_fbdev_destroy(struct drm_device *dev, struct radeon_fbdev *rfbdev)
@@ -374,6 +375,10 @@ int radeon_fbdev_init(struct radeon_device *rdev)
 	int bpp_sel = 32;
 	int ret;
 
+	/* don't enable fbdev if no connectors */
+	if (list_empty(&rdev->ddev->mode_config.connector_list))
+		return 0;
+
 	/* select 8 bpp console on RN50 or 16MB cards */
 	if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
 		bpp_sel = 8;
@@ -426,11 +431,15 @@ void radeon_fbdev_fini(struct radeon_device *rdev)
 
 void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state)
 {
-	fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state);
+	if (rdev->mode_info.rfbdev)
+		fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state);
 }
 
 bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
 {
+	if (!rdev->mode_info.rfbdev)
+		return false;
+
 	if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj))
 		return true;
 	return false;
@@ -438,10 +447,12 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)
 
 void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector)
 {
-	drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector);
+	if (rdev->mode_info.rfbdev)
+		drm_fb_helper_add_one_connector(&rdev->mode_info.rfbdev->helper, connector);
 }
 
 void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector)
 {
-	drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
+	if (rdev->mode_info.rfbdev)
+		drm_fb_helper_remove_one_connector(&rdev->mode_info.rfbdev->helper, connector);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 113/218] md: multipath: don't hardcopy bio in .make_request path
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (111 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 112/218] drm/radeon: rework fbdev handling on chips with no connectors Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 114/218] net: mvneta: enable change MAC address when interface is up Kamal Mostafa
                   ` (104 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ming Lei, Shaohua Li, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Ming Lei <ming.lei@canonical.com>

commit fafcde3ac1a418688a734365203a12483b83907a upstream.

Inside multipath_make_request(), multipath maps the incoming
bio into low level device's bio, but it is totally wrong to
copy the bio into mapped bio via '*mapped_bio = *bio'. For
example, .__bi_remaining is kept in the copy, especially if
the incoming bio is chained to via bio splitting, so .bi_end_io
can't be called for the mapped bio at all in the completing path
in this kind of situation.

This patch fixes the issue by using clone style.

Reported-and-tested-by: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/multipath.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index ac3ede2..ac37ef1 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -129,7 +129,9 @@ static void multipath_make_request(struct mddev *mddev, struct bio * bio)
 	}
 	multipath = conf->multipaths + mp_bh->path;
 
-	mp_bh->bio = *bio;
+	bio_init(&mp_bh->bio);
+	__bio_clone_fast(&mp_bh->bio, bio);
+
 	mp_bh->bio.bi_iter.bi_sector += multipath->rdev->data_offset;
 	mp_bh->bio.bi_bdev = multipath->rdev->bdev;
 	mp_bh->bio.bi_rw |= REQ_FAILFAST_TRANSPORT;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 114/218] net: mvneta: enable change MAC address when interface is up
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (112 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 113/218] md: multipath: don't hardcopy bio in .make_request path Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 115/218] dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request() Kamal Mostafa
                   ` (103 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitri Epshtein, Gregory CLEMENT, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dmitri Epshtein <dima@marvell.com>

commit 928b6519afeb2a5e2dc61154380b545ed66c476a upstream.

Function eth_prepare_mac_addr_change() is called as part of MAC
address change. This function check if interface is running.
To enable change MAC address when interface is running:
IFF_LIVE_ADDR_CHANGE flag must be set to dev->priv_flags field

Fixes: c5aff18204da ("net: mvneta: driver for Marvell Armada 370/XP
network unit")
Signed-off-by: Dmitri Epshtein <dima@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 060af9b..37abcde 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3163,7 +3163,7 @@ static int mvneta_probe(struct platform_device *pdev)
 	dev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
 	dev->hw_features |= dev->features;
 	dev->vlan_features |= dev->features;
-	dev->priv_flags |= IFF_UNICAST_FLT;
+	dev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
 	dev->gso_max_segs = MVNETA_MAX_TSO_SEGS;
 
 	err = register_netdev(dev);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 115/218] dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (113 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 114/218] net: mvneta: enable change MAC address when interface is up Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 116/218] HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report() Kamal Mostafa
                   ` (102 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bryn M . Reeves, Mike Snitzer, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Bryn M. Reeves" <bmr@redhat.com>

commit 98dbc9c6c61698792e3a66f32f3bf066201d42d7 upstream.

An "old" (.request_fn) DM 'struct request' stores a pointer to the
associated 'struct dm_rq_target_io' in rq->special.

dm_requeue_original_request(), previously named
dm_requeue_unmapped_original_request(), called dm_unprep_request() to
reset rq->special to NULL.  But rq_end_stats() would go on to hit a NULL
pointer deference because its call to tio_from_request() returned NULL.

Fix this by calling rq_end_stats() _before_ dm_unprep_request()

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Fixes: e262f34741 ("dm stats: add support for request-based DM devices")
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/md/dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 3f82998..e066983 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -1184,9 +1184,9 @@ static void dm_requeue_original_request(struct mapped_device *md,
 {
 	int rw = rq_data_dir(rq);
 
+	rq_end_stats(md, rq);
 	dm_unprep_request(rq);
 
-	rq_end_stats(md, rq);
 	if (!rq->q->mq_ops)
 		old_requeue_request(rq);
 	else {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 116/218] HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (114 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 115/218] dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 117/218] ALSA: hda - Fix unconditional GPIO toggle via automute Kamal Mostafa
                   ` (101 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry Torokhov, Jiri Kosina, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dmitry Torokhov <dtor@chromium.org>

commit 3b654288b196ceaa156029d9457ccbded0489b98 upstream.

Even though hid_hw_* checks that passed in data_len is less than
HID_MAX_BUFFER_SIZE it is not enough, as i2c-hid does not necessarily
allocate buffers of HID_MAX_BUFFER_SIZE but rather checks all device
reports and select largest size. In-kernel users normally just send as much
data as report needs, so there is no problem, but hidraw users can do
whatever they please:

BUG: KASAN: slab-out-of-bounds in memcpy+0x34/0x54 at addr ffffffc07135ea80
Write of size 4101 by task syz-executor/8747
CPU: 2 PID: 8747 Comm: syz-executor Tainted: G    BU         3.18.0 #37
Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT)
Call trace:
[<ffffffc00020ebcc>] dump_backtrace+0x0/0x258 arch/arm64/kernel/traps.c:83
[<ffffffc00020ee40>] show_stack+0x1c/0x2c arch/arm64/kernel/traps.c:172
[<     inline     >] __dump_stack lib/dump_stack.c:15
[<ffffffc001958114>] dump_stack+0x90/0x140 lib/dump_stack.c:50
[<     inline     >] print_error_description mm/kasan/report.c:97
[<     inline     >] kasan_report_error mm/kasan/report.c:278
[<ffffffc0004597dc>] kasan_report+0x268/0x530 mm/kasan/report.c:305
[<ffffffc0004592e8>] __asan_storeN+0x20/0x150 mm/kasan/kasan.c:718
[<ffffffc0004594e0>] memcpy+0x30/0x54 mm/kasan/kasan.c:299
[<ffffffc001306354>] __i2c_hid_command+0x2b0/0x7b4 drivers/hid/i2c-hid/i2c-hid.c:178
[<     inline     >] i2c_hid_set_or_send_report drivers/hid/i2c-hid/i2c-hid.c:321
[<ffffffc0013079a0>] i2c_hid_output_raw_report.isra.2+0x3d4/0x4b8 drivers/hid/i2c-hid/i2c-hid.c:589
[<ffffffc001307ad8>] i2c_hid_output_report+0x54/0x68 drivers/hid/i2c-hid/i2c-hid.c:602
[<     inline     >] hid_hw_output_report include/linux/hid.h:1039
[<ffffffc0012cc7a0>] hidraw_send_report+0x400/0x414 drivers/hid/hidraw.c:154
[<ffffffc0012cc7f4>] hidraw_write+0x40/0x64 drivers/hid/hidraw.c:177
[<ffffffc0004681dc>] vfs_write+0x1d4/0x3cc fs/read_write.c:534
[<     inline     >] SYSC_pwrite64 fs/read_write.c:627
[<ffffffc000468984>] SyS_pwrite64+0xec/0x144 fs/read_write.c:614
Object at ffffffc07135ea80, in cache kmalloc-512
Object allocated with size 268 bytes.

Let's check data length against the buffer size before attempting to copy
data over.

Reported-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hid/i2c-hid/i2c-hid.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index f77469d..9a71d71 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -280,17 +280,21 @@ static int i2c_hid_set_or_send_report(struct i2c_client *client, u8 reportType,
 	u16 dataRegister = le16_to_cpu(ihid->hdesc.wDataRegister);
 	u16 outputRegister = le16_to_cpu(ihid->hdesc.wOutputRegister);
 	u16 maxOutputLength = le16_to_cpu(ihid->hdesc.wMaxOutputLength);
+	u16 size;
+	int args_len;
+	int index = 0;
+
+	i2c_hid_dbg(ihid, "%s\n", __func__);
+
+	if (data_len > ihid->bufsize)
+		return -EINVAL;
 
-	/* hid_hw_* already checked that data_len < HID_MAX_BUFFER_SIZE */
-	u16 size =	2			/* size */ +
+	size =		2			/* size */ +
 			(reportID ? 1 : 0)	/* reportID */ +
 			data_len		/* buf */;
-	int args_len =	(reportID >= 0x0F ? 1 : 0) /* optional third byte */ +
+	args_len =	(reportID >= 0x0F ? 1 : 0) /* optional third byte */ +
 			2			/* dataRegister */ +
 			size			/* args */;
-	int index = 0;
-
-	i2c_hid_dbg(ihid, "%s\n", __func__);
 
 	if (!use_data && maxOutputLength == 0)
 		return -ENOSYS;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 117/218] ALSA: hda - Fix unconditional GPIO toggle via automute
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (115 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 116/218] HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 118/218] mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case Kamal Mostafa
                   ` (100 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Takashi Iwai <tiwai@suse.de>

commit 1f7c6658962fa1260c1658d681bd6bb0c746b99a upstream.

Cirrus HD-audio driver may adjust GPIO pins for EAPD dynamically
depending on the jack plug state.  This works fine for the auto-mute
mode where the speaker gets muted upon the HP jack plug.   OTOH, when
the auto-mute mode is off, this turns off the EAPD unexpectedly
depending on the jack state, which results in the silent speaker
output.

This patch fixes the silent speaker output issue by setting GPIO bits
constantly when the auto-mute mode is off.

Reported-and-tested-by: moosotc@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/pci/hda/patch_cirrus.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index ac38222..43fc6e8 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -174,8 +174,12 @@ static void cs_automute(struct hda_codec *codec)
 	snd_hda_gen_update_outputs(codec);
 
 	if (spec->gpio_eapd_hp || spec->gpio_eapd_speaker) {
-		spec->gpio_data = spec->gen.hp_jack_present ?
-			spec->gpio_eapd_hp : spec->gpio_eapd_speaker;
+		if (spec->gen.automute_speaker)
+			spec->gpio_data = spec->gen.hp_jack_present ?
+				spec->gpio_eapd_hp : spec->gpio_eapd_speaker;
+		else
+			spec->gpio_data =
+				spec->gpio_eapd_hp | spec->gpio_eapd_speaker;
 		snd_hda_codec_write(codec, 0x01, 0,
 				    AC_VERB_SET_GPIO_DATA, spec->gpio_data);
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 118/218] mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (116 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 117/218] ALSA: hda - Fix unconditional GPIO toggle via automute Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 119/218] nfsd: fix deadlock secinfo+readdir compound Kamal Mostafa
                   ` (99 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Magnus Damm, Ulf Hansson, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Magnus Damm <damm+renesas@opensource.se>

commit bcdc9f260bdce09913db1464be9817170d51044a upstream.

This patch fixes the MMC SPI driver from doing polling card detect when a
CD GPIO that supports interrupts is specified using the gpios DT property.

Without this patch the DT node below results in the following output:

 spi_gpio: spi-gpio { /* SD2 @ CN12 */
         compatible = "spi-gpio";
         #address-cells = <1>;
         #size-cells = <0>;
         gpio-sck = <&gpio6 16 GPIO_ACTIVE_HIGH>;
         gpio-mosi = <&gpio6 17 GPIO_ACTIVE_HIGH>;
         gpio-miso = <&gpio6 18 GPIO_ACTIVE_HIGH>;
         num-chipselects = <1>;
         cs-gpios = <&gpio6 21 GPIO_ACTIVE_LOW>;
         status = "okay";

         spi@0 {
                 compatible = "mmc-spi-slot";
                 reg = <0>;
                 voltage-ranges = <3200 3400>;
                 spi-max-frequency = <25000000>;
                 gpios = <&gpio6 22 GPIO_ACTIVE_LOW>;   /* CD */
         };
 };

 # dmesg | grep mmc
 mmc_spi spi32766.0: SD/MMC host mmc0, no WP, no poweroff, cd polling
 mmc0: host does not support reading read-only switch, assuming write-enable
 mmc0: new SDHC card on SPI
 mmcblk0: mmc0:0000 SU04G 3.69 GiB
 mmcblk0: p1

With this patch applied the "cd polling" portion above disappears.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/mmc_spi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index ae19d83..055cad1 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1436,6 +1436,12 @@ static int mmc_spi_probe(struct spi_device *spi)
 					     host->pdata->cd_debounce);
 		if (status != 0)
 			goto fail_add_host;
+
+		/* The platform has a CD GPIO signal that may support
+		 * interrupts, so let mmc_gpiod_request_cd_irq() decide
+		 * if polling is needed or not.
+		 */
+		mmc->caps &= ~MMC_CAP_NEEDS_POLL;
 		mmc_gpiod_request_cd_irq(mmc);
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 119/218] nfsd: fix deadlock secinfo+readdir compound
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (117 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 118/218] mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 120/218] vfs: show_vfsstat: do not ignore errors from show_devname method Kamal Mostafa
                   ` (98 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: J . Bruce Fields, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "J. Bruce Fields" <bfields@redhat.com>

commit 2f6fc056e899bd0144a08da5cacaecbe8997cd74 upstream.

nfsd_lookup_dentry exits with the parent filehandle locked.  fh_put also
unlocks if necessary (nfsd filehandle locking is probably too lenient),
so it gets unlocked eventually, but if the following op in the compound
needs to lock it again, we can deadlock.

A fuzzer ran into this; normal clients don't send a secinfo followed by
a readdir in the same compound.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/nfsd/nfs4proc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 90cfda7..aaa5b8f 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -879,6 +879,7 @@ nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
 				    &exp, &dentry);
 	if (err)
 		return err;
+	fh_unlock(&cstate->current_fh);
 	if (d_really_is_negative(dentry)) {
 		exp_put(exp);
 		err = nfserr_noent;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 120/218] vfs: show_vfsstat: do not ignore errors from show_devname method
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (118 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 119/218] nfsd: fix deadlock secinfo+readdir compound Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 121/218] x86/iopl: Fix iopl capability check on Xen PV Kamal Mostafa
                   ` (97 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dmitry V . Levin, Al Viro, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Dmitry V. Levin" <ldv@altlinux.org>

commit 5f8d498d4364f544fee17125787a47553db02afa upstream.

Explicitly check show_devname method return code and bail out in case
of an error.  This fixes regression introduced by commit 9d4d65748a5c.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/proc_namespace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 8ebd9a3..876459559 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -197,6 +197,8 @@ static int show_vfsstat(struct seq_file *m, struct vfsmount *mnt)
 	if (sb->s_op->show_devname) {
 		seq_puts(m, "device ");
 		err = sb->s_op->show_devname(m, mnt_path.dentry);
+		if (err)
+			goto out;
 	} else {
 		if (r->mnt_devname) {
 			seq_puts(m, "device ");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 121/218] x86/iopl: Fix iopl capability check on Xen PV
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (119 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 120/218] vfs: show_vfsstat: do not ignore errors from show_devname method Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 122/218] crypto: marvell/cesa - forward devm_ioremap_resource() error code Kamal Mostafa
                   ` (96 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andy Lutomirski, Andrew Cooper, Andy Lutomirski, Boris Ostrovsky,
	Borislav Petkov, Brian Gerst, David Vrabel, Denys Vlasenko,
	H . Peter Anvin, Jan Beulich, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Andy Lutomirski <luto@kernel.org>

commit c29016cf41fe9fa994a5ecca607cf5f1cd98801e upstream.

iopl(3) is supposed to work if iopl is already 3, even if
unprivileged.  This didn't work right on Xen PV.  Fix it.

Reviewewd-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/8ce12013e6e4c0a44a97e316be4a6faff31bd5ea.1458162709.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kernel/ioport.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 37dae79..589b319 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -96,9 +96,14 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
 SYSCALL_DEFINE1(iopl, unsigned int, level)
 {
 	struct pt_regs *regs = current_pt_regs();
-	unsigned int old = (regs->flags >> 12) & 3;
 	struct thread_struct *t = &current->thread;
 
+	/*
+	 * Careful: the IOPL bits in regs->flags are undefined under Xen PV
+	 * and changing them has no effect.
+	 */
+	unsigned int old = t->iopl >> X86_EFLAGS_IOPL_BIT;
+
 	if (level > 3)
 		return -EINVAL;
 	/* Trying to gain more privileges? */
@@ -106,8 +111,9 @@ SYSCALL_DEFINE1(iopl, unsigned int, level)
 		if (!capable(CAP_SYS_RAWIO))
 			return -EPERM;
 	}
-	regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
-	t->iopl = level << 12;
+	regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) |
+		(level << X86_EFLAGS_IOPL_BIT);
+	t->iopl = level << X86_EFLAGS_IOPL_BIT;
 	set_iopl_mask(t->iopl);
 
 	return 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 122/218] crypto: marvell/cesa - forward devm_ioremap_resource() error code
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (120 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 121/218] x86/iopl: Fix iopl capability check on Xen PV Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 123/218] mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout Kamal Mostafa
                   ` (95 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Boris Brezillon, Herbert Xu, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Boris BREZILLON <boris.brezillon@free-electrons.com>

commit dfe97ad30e8c038261663a18b9e04b8b5bc07bea upstream.

Forward devm_ioremap_resource() error code instead of returning
-ENOMEM.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Russell King - ARM Linux <linux@arm.linux.org.uk>
Fixes: f63601fd616a ("crypto: marvell/cesa - add a new driver for Marvell's CESA")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/crypto/marvell/cesa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/marvell/cesa.c b/drivers/crypto/marvell/cesa.c
index c6d71ad..c426400 100644
--- a/drivers/crypto/marvell/cesa.c
+++ b/drivers/crypto/marvell/cesa.c
@@ -420,7 +420,7 @@ static int mv_cesa_probe(struct platform_device *pdev)
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
 	cesa->regs = devm_ioremap_resource(dev, res);
 	if (IS_ERR(cesa->regs))
-		return -ENOMEM;
+		return PTR_ERR(cesa->regs);
 
 	ret = mv_cesa_dev_dma_init(cesa);
 	if (ret)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 123/218] mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (121 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 122/218] crypto: marvell/cesa - forward devm_ioremap_resource() error code Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 124/218] drm/amdgpu: include the right version of gmc header files for iceland Kamal Mostafa
                   ` (94 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Adrian Hunter, Ulf Hansson, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Adrian Hunter <adrian.hunter@intel.com>

commit 995136247915c5cee633d55ba23f6eebf67aa567 upstream.

Normally the timeout clock frequency is read from the capabilities
register.  It is also possible to set the value prior to calling
sdhci_add_host() in which case that value will override the
capabilities register value.  However that was being done after
calculating max_busy_timeout so that max_busy_timeout was being
calculated using the wrong value of timeout_clk.

Fix that by moving the override before max_busy_timeout is
calculated.

The result is that the max_busy_timeout and max_discard
increase for BSW devices so that, for example, the time for
mkfs.ext4 on a 64GB eMMC drops from about 1 minute 40 seconds
to about 20 seconds.

Note, in the future, the capabilities setting will be tidied up
and this override won't be used anymore.  However this fix is
needed for stable.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mmc/host/sdhci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 57dd499..c27800d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3076,14 +3076,14 @@ int sdhci_add_host(struct sdhci_host *host)
 		if (caps[0] & SDHCI_TIMEOUT_CLK_UNIT)
 			host->timeout_clk *= 1000;
 
+		if (override_timeout_clk)
+			host->timeout_clk = override_timeout_clk;
+
 		mmc->max_busy_timeout = host->ops->get_max_timeout_count ?
 			host->ops->get_max_timeout_count(host) : 1 << 27;
 		mmc->max_busy_timeout /= host->timeout_clk;
 	}
 
-	if (override_timeout_clk)
-		host->timeout_clk = override_timeout_clk;
-
 	mmc->caps |= MMC_CAP_SDIO_IRQ | MMC_CAP_ERASE | MMC_CAP_CMD23;
 	mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 124/218] drm/amdgpu: include the right version of gmc header files for iceland
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (122 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 123/218] mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 125/218] Input: ims-pcu - sanity check against missing interfaces Kamal Mostafa
                   ` (93 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Ken Wang, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Ken Wang <Qingqing.Wang@amd.com>

commit 16a8a49be1b878ef6dd5d1663d456e254e54ae3d upstream.

Signed-off-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index a988dfb..5f66eb1 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
@@ -32,8 +32,8 @@
 #include "oss/oss_2_4_d.h"
 #include "oss/oss_2_4_sh_mask.h"
 
-#include "gmc/gmc_8_1_d.h"
-#include "gmc/gmc_8_1_sh_mask.h"
+#include "gmc/gmc_7_1_d.h"
+#include "gmc/gmc_7_1_sh_mask.h"
 
 #include "gca/gfx_8_0_d.h"
 #include "gca/gfx_8_0_enum.h"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 125/218] Input: ims-pcu - sanity check against missing interfaces
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (123 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 124/218] drm/amdgpu: include the right version of gmc header files for iceland Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 126/218] watchdog: don't run proc_watchdog_update if new value is same as old Kamal Mostafa
                   ` (92 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Dmitry Torokhov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Oliver Neukum <oneukum@suse.com>

commit a0ad220c96692eda76b2e3fd7279f3dcd1d8a8ff upstream.

A malicious device missing interface can make the driver oops.
Add sanity checking.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/misc/ims-pcu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index ac1fa5f..9c0ea36 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1663,6 +1663,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 
 	pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev,
 					 union_desc->bMasterInterface0);
+	if (!pcu->ctrl_intf)
+		return -EINVAL;
 
 	alt = pcu->ctrl_intf->cur_altsetting;
 	pcu->ep_ctrl = &alt->endpoint[0].desc;
@@ -1670,6 +1672,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 
 	pcu->data_intf = usb_ifnum_to_if(pcu->udev,
 					 union_desc->bSlaveInterface0);
+	if (!pcu->data_intf)
+		return -EINVAL;
 
 	alt = pcu->data_intf->cur_altsetting;
 	if (alt->desc.bNumEndpoints != 2) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 126/218] watchdog: don't run proc_watchdog_update if new value is same as old
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (124 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 125/218] Input: ims-pcu - sanity check against missing interfaces Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 127/218] mm: memcontrol: reclaim when shrinking memory.high below usage Kamal Mostafa
                   ` (91 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Josh Hunt, Ulrich Obergfell, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Joshua Hunt <johunt@akamai.com>

commit a1ee1932aa6bea0bb074f5e3ced112664e4637ed upstream.

While working on a script to restore all sysctl params before a series of
tests I found that writing any value into the
/proc/sys/kernel/{nmi_watchdog,soft_watchdog,watchdog,watchdog_thresh}
causes them to call proc_watchdog_update().

  NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
  NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
  NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
  NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.

There doesn't appear to be a reason for doing this work every time a write
occurs, so only do it when the values change.

Signed-off-by: Josh Hunt <johunt@akamai.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/watchdog.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index a6ffa43..8389aaf 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -823,6 +823,9 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
 		 * Update the run state of the lockup detectors.
 		 * Restore 'watchdog_enabled' on failure.
 		 */
+		if (old == new)
+			goto out;
+
 		err = proc_watchdog_update();
 		if (err)
 			watchdog_enabled = old;
@@ -868,7 +871,7 @@ int proc_soft_watchdog(struct ctl_table *table, int write,
 int proc_watchdog_thresh(struct ctl_table *table, int write,
 			 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-	int err, old;
+	int err, old, new;
 
 	mutex_lock(&watchdog_proc_mutex);
 
@@ -882,6 +885,10 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
 	 * Update the sample period.
 	 * Restore 'watchdog_thresh' on failure.
 	 */
+	new = ACCESS_ONCE(watchdog_thresh);
+	if (old == new)
+		goto out;
+
 	set_sample_period();
 	err = proc_watchdog_update();
 	if (err)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 127/218] mm: memcontrol: reclaim when shrinking memory.high below usage
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (125 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 126/218] watchdog: don't run proc_watchdog_update if new value is same as old Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 128/218] mm: memcontrol: reclaim and OOM kill when shrinking memory.max " Kamal Mostafa
                   ` (90 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johannes Weiner, Vladimir Davydov, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Johannes Weiner <hannes@cmpxchg.org>

commit 588083bb37a3cea8533c392370a554417c8f29cb upstream.

When setting memory.high below usage, nothing happens until the next
charge comes along, and then it will only reclaim its own charge and not
the now potentially huge excess of the new memory.high.  This can cause
groups to stay in excess of their memory.high indefinitely.

To fix that, when shrinking memory.high, kick off a reclaim cycle that
goes after the delta.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/memcontrol.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 48540e5..1021069 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5422,6 +5422,7 @@ static ssize_t memory_high_write(struct kernfs_open_file *of,
 				 char *buf, size_t nbytes, loff_t off)
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of));
+	unsigned long nr_pages;
 	unsigned long high;
 	int err;
 
@@ -5432,6 +5433,11 @@ static ssize_t memory_high_write(struct kernfs_open_file *of,
 
 	memcg->high = high;
 
+	nr_pages = page_counter_read(&memcg->memory);
+	if (nr_pages > high)
+		try_to_free_mem_cgroup_pages(memcg, nr_pages - high,
+					     GFP_KERNEL, true);
+
 	memcg_wb_domain_size_changed(memcg);
 	return nbytes;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 128/218] mm: memcontrol: reclaim and OOM kill when shrinking memory.max below usage
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (126 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 127/218] mm: memcontrol: reclaim when shrinking memory.high below usage Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 129/218] Input: synaptics - handle spurious release of trackstick buttons, again Kamal Mostafa
                   ` (89 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johannes Weiner, Vladimir Davydov, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Johannes Weiner <hannes@cmpxchg.org>

commit b6e6edcfa40561e9c8abe5eecf1c96f8e5fd9c6f upstream.

Setting the original memory.limit_in_bytes hardlimit is subject to a
race condition when the desired value is below the current usage.  The
code tries a few times to first reclaim and then see if the usage has
dropped to where we would like it to be, but there is no locking, and
the workload is free to continue making new charges up to the old limit.
Thus, attempting to shrink a workload relies on pure luck and hope that
the workload happens to cooperate.

To fix this in the cgroup2 memory.max knob, do it the other way round:
set the limit first, then try enforcement.  And if reclaim is not able
to succeed, trigger OOM kills in the group.  Keep going until the new
limit is met, we run out of OOM victims and there's only unreclaimable
memory left, or the task writing to memory.max is killed.  This allows
users to shrink groups reliably, and the behavior is consistent with
what happens when new charges are attempted in excess of memory.max.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ kamal: backport to 4.2-stable: no Documentation/cgroup-v2.txt ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/memcontrol.c | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1021069..d5ff354 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1551,7 +1551,7 @@ static unsigned long mem_cgroup_get_limit(struct mem_cgroup *memcg)
 	return limit;
 }
 
-static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
+static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
 				     int order)
 {
 	struct mem_cgroup *iter;
@@ -1624,6 +1624,7 @@ static void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	}
 unlock:
 	mutex_unlock(&oom_lock);
+	return chosen;
 }
 
 #if MAX_NUMNODES > 1
@@ -5459,6 +5460,8 @@ static ssize_t memory_max_write(struct kernfs_open_file *of,
 				char *buf, size_t nbytes, loff_t off)
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_css(of_css(of));
+	unsigned int nr_reclaims = MEM_CGROUP_RECLAIM_RETRIES;
+	bool drained = false;
 	unsigned long max;
 	int err;
 
@@ -5467,9 +5470,36 @@ static ssize_t memory_max_write(struct kernfs_open_file *of,
 	if (err)
 		return err;
 
-	err = mem_cgroup_resize_limit(memcg, max);
-	if (err)
-		return err;
+	xchg(&memcg->memory.limit, max);
+
+	for (;;) {
+		unsigned long nr_pages = page_counter_read(&memcg->memory);
+
+		if (nr_pages <= max)
+			break;
+
+		if (signal_pending(current)) {
+			err = -EINTR;
+			break;
+		}
+
+		if (!drained) {
+			drain_all_stock(memcg);
+			drained = true;
+			continue;
+		}
+
+		if (nr_reclaims) {
+			if (!try_to_free_mem_cgroup_pages(memcg, nr_pages - max,
+							  GFP_KERNEL, true))
+				nr_reclaims--;
+			continue;
+		}
+
+		mem_cgroup_events(memcg, MEMCG_OOM, 1);
+		if (!mem_cgroup_out_of_memory(memcg, GFP_KERNEL, 0))
+			break;
+	}
 
 	memcg_wb_domain_size_changed(memcg);
 	return nbytes;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 129/218] Input: synaptics - handle spurious release of trackstick buttons, again
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (127 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 128/218] mm: memcontrol: reclaim and OOM kill when shrinking memory.max " Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 130/218] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt() Kamal Mostafa
                   ` (88 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Benjamin Tissoires, Dmitry Torokhov, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Benjamin Tissoires <benjamin.tissoires@redhat.com>

commit 82be788c96ed5978d3cb4a00079e26b981a3df3f upstream.

Looks like the fimware 8.2 still has the extra buttons spurious release
bug.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=114321
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/input/mouse/synaptics.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 6025eb4..a41d832 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -862,8 +862,9 @@ static void synaptics_report_ext_buttons(struct psmouse *psmouse,
 	if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
 		return;
 
-	/* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */
-	if (SYN_ID_FULL(priv->identity) == 0x801 &&
+	/* Bug in FW 8.1 & 8.2, buttons are reported only when ExtBit is 1 */
+	if ((SYN_ID_FULL(priv->identity) == 0x801 ||
+	     SYN_ID_FULL(priv->identity) == 0x802) &&
 	    !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
 		return;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 130/218] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (128 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 129/218] Input: synaptics - handle spurious release of trackstick buttons, again Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 131/218] USB: usb_driver_claim_interface: add sanity checking Kamal Mostafa
                   ` (87 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andi Kleen, Thomas Gleixner, Dave Jones, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dave Jones <davej@codemonkey.org.uk>

commit 7834c10313fb823e538f2772be78edcdeed2e6e3 upstream.

Since 4.4, I've been able to trigger this occasionally:

===============================
[ INFO: suspicious RCU usage. ]
4.5.0-rc7-think+ #3 Not tainted
Cc: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/20160315012054.GA17765@codemonkey.org.uk
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

-------------------------------
./arch/x86/include/asm/msr-trace.h:47 suspicious rcu_dereference_check() usage!

other info that might help us debug this:

RCU used illegally from idle CPU!
rcu_scheduler_active = 1, debug_locks = 1
RCU used illegally from extended quiescent state!
no locks held by swapper/3/0.

stack backtrace:
CPU: 3 PID: 0 Comm: swapper/3 Not tainted 4.5.0-rc7-think+ #3
 ffffffff92f821e0 1f3e5c340597d7fc ffff880468e07f10 ffffffff92560c2a
 ffff880462145280 0000000000000001 ffff880468e07f40 ffffffff921376a6
 ffffffff93665ea0 0000cc7c876d28da 0000000000000005 ffffffff9383dd60
Call Trace:
 <IRQ>  [<ffffffff92560c2a>] dump_stack+0x67/0x9d
 [<ffffffff921376a6>] lockdep_rcu_suspicious+0xe6/0x100
 [<ffffffff925ae7a7>] do_trace_write_msr+0x127/0x1a0
 [<ffffffff92061c83>] native_apic_msr_eoi_write+0x23/0x30
 [<ffffffff92054408>] smp_trace_call_function_interrupt+0x38/0x360
 [<ffffffff92d1ca60>] trace_call_function_interrupt+0x90/0xa0
 <EOI>  [<ffffffff92ac5124>] ? cpuidle_enter_state+0x1b4/0x520

Move the entering_irq() call before ack_APIC_irq(), because entering_irq()
tells the RCU susbstems to end the extended quiescent state, so that the
following trace call in ack_APIC_irq() works correctly.

Suggested-by: Andi Kleen <ak@linux.intel.com>
Fixes: 4787c368a9bc "x86/tracing: Add irq_enter/exit() in smp_trace_reschedule_interrupt()"
Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/include/asm/apic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index c839363..fa2f39f 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -640,8 +640,8 @@ static inline void entering_irq(void)
 
 static inline void entering_ack_irq(void)
 {
-	ack_APIC_irq();
 	entering_irq();
+	ack_APIC_irq();
 }
 
 static inline void ipi_entering_ack_irq(void)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 131/218] USB: usb_driver_claim_interface: add sanity checking
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (129 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 130/218] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 132/218] USB: uas: Reduce can_queue to MAX_CMNDS Kamal Mostafa
                   ` (86 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Oliver Neukum <oneukum@suse.com>

commit 0b818e3956fc1ad976bee791eadcbb3b5fec5bfd upstream.

Attacks that trick drivers into passing a NULL pointer
to usb_driver_claim_interface() using forged descriptors are
known. This thwarts them by sanity checking.

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/core/driver.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 818369a..7792c0e 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -499,11 +499,15 @@ static int usb_unbind_interface(struct device *dev)
 int usb_driver_claim_interface(struct usb_driver *driver,
 				struct usb_interface *iface, void *priv)
 {
-	struct device *dev = &iface->dev;
+	struct device *dev;
 	struct usb_device *udev;
 	int retval = 0;
 	int lpm_disable_error;
 
+	if (!iface)
+		return -ENODEV;
+
+	dev = &iface->dev;
 	if (dev->driver)
 		return -EBUSY;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 132/218] USB: uas: Reduce can_queue to MAX_CMNDS
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (130 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 131/218] USB: usb_driver_claim_interface: add sanity checking Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 133/218] tracing: Have preempt(irqs)off trace preempt disabled functions Kamal Mostafa
                   ` (85 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 55ff8cfbc4e12a7d2187df523938cc671fbebdd1 upstream.

The uas driver can never queue more then MAX_CMNDS (- 1) tags and tags
are shared between luns, so there is no need to claim that we can_queue
some random large number.

Not claiming that we can_queue 65536 commands, fixes the uas driver
failing to initialize while allocating the tag map with a "Page allocation
failure (order 7)" error on systems which have been running for a while
and thus have fragmented memory.

Reported-and-tested-by: Yves-Alexis Perez <corsac@corsac.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/usb/storage/uas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 43b1caf..bf1ed71 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -812,7 +812,7 @@ static struct scsi_host_template uas_host_template = {
 	.slave_configure = uas_slave_configure,
 	.eh_abort_handler = uas_eh_abort_handler,
 	.eh_bus_reset_handler = uas_eh_bus_reset_handler,
-	.can_queue = 65536,	/* Is there a limit on the _host_ ? */
+	.can_queue = MAX_CMNDS,
 	.this_id = -1,
 	.sg_tablesize = SG_NONE,
 	.skip_settle_delay = 1,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 133/218] tracing: Have preempt(irqs)off trace preempt disabled functions
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (131 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 132/218] USB: uas: Reduce can_queue to MAX_CMNDS Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 134/218] tracing: Fix crash from reading trace_pipe with sendfile Kamal Mostafa
                   ` (84 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit cb86e05390debcc084cfdb0a71ed4c5dbbec517d upstream.

Joel Fernandes reported that the function tracing of preempt disabled
sections was not being reported when running either the preemptirqsoff or
preemptoff tracers. This was due to the fact that the function tracer
callback for those tracers checked if irqs were disabled before tracing. But
this fails when we want to trace preempt off locations as well.

Joel explained that he wanted to see funcitons where interrupts are enabled
but preemption was disabled. The expected output he wanted:

   <...>-2265    1d.h1 3419us : preempt_count_sub <-irq_exit
   <...>-2265    1d..1 3419us : __do_softirq <-irq_exit
   <...>-2265    1d..1 3419us : msecs_to_jiffies <-__do_softirq
   <...>-2265    1d..1 3420us : irqtime_account_irq <-__do_softirq
   <...>-2265    1d..1 3420us : __local_bh_disable_ip <-__do_softirq
   <...>-2265    1..s1 3421us : run_timer_softirq <-__do_softirq
   <...>-2265    1..s1 3421us : hrtimer_run_pending <-run_timer_softirq
   <...>-2265    1..s1 3421us : _raw_spin_lock_irq <-run_timer_softirq
   <...>-2265    1d.s1 3422us : preempt_count_add <-_raw_spin_lock_irq
   <...>-2265    1d.s2 3422us : _raw_spin_unlock_irq <-run_timer_softirq
   <...>-2265    1..s2 3422us : preempt_count_sub <-_raw_spin_unlock_irq
   <...>-2265    1..s1 3423us : rcu_bh_qs <-__do_softirq
   <...>-2265    1d.s1 3423us : irqtime_account_irq <-__do_softirq
   <...>-2265    1d.s1 3423us : __local_bh_enable <-__do_softirq

There's a comment saying that the irq disabled check is because there's a
possible race that tracing_cpu may be set when the function is executed. But
I don't remember that race. For now, I added a check for preemption being
enabled too to not record the function, as there would be no race if that
was the case. I need to re-investigate this, as I'm now thinking that the
tracing_cpu will always be correct. But no harm in keeping the check for
now, except for the slight performance hit.

Link: http://lkml.kernel.org/r/1457770386-88717-1-git-send-email-agnel.joel@gmail.com

Fixes: 5e6d2b9cfa3a "tracing: Use one prologue for the preempt irqs off tracer function tracers"
Reported-by: Joel Fernandes <agnel.joel@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/trace/trace_irqsoff.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 8523ea3..22d9230 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -116,8 +116,12 @@ static int func_prolog_dec(struct trace_array *tr,
 		return 0;
 
 	local_save_flags(*flags);
-	/* slight chance to get a false positive on tracing_cpu */
-	if (!irqs_disabled_flags(*flags))
+	/*
+	 * Slight chance to get a false positive on tracing_cpu,
+	 * although I'm starting to think there isn't a chance.
+	 * Leave this for now just to be paranoid.
+	 */
+	if (!irqs_disabled_flags(*flags) && !preempt_count())
 		return 0;
 
 	*data = per_cpu_ptr(tr->trace_buffer.data, cpu);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 134/218] tracing: Fix crash from reading trace_pipe with sendfile
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (132 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 133/218] tracing: Have preempt(irqs)off trace preempt disabled functions Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 135/218] splice: handle zero nr_pages in splice_to_pipe() Kamal Mostafa
                   ` (83 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit a29054d9478d0435ab01b7544da4f674ab13f533 upstream.

If tracing contains data and the trace_pipe file is read with sendfile(),
then it can trigger a NULL pointer dereference and various BUG_ON within the
VM code.

There's a patch to fix this in the splice_to_pipe() code, but it's also a
good idea to not let that happen from trace_pipe either.

Link: http://lkml.kernel.org/r/1457641146-9068-1-git-send-email-rabin@rab.in

Reported-by: Rabin Vincent <rabin.vincent@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/trace/trace.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 126f8f6..8693c83 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4917,7 +4917,10 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
 
 	spd.nr_pages = i;
 
-	ret = splice_to_pipe(pipe, &spd);
+	if (i)
+		ret = splice_to_pipe(pipe, &spd);
+	else
+		ret = 0;
 out:
 	splice_shrink_spd(&spd);
 	return ret;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 135/218] splice: handle zero nr_pages in splice_to_pipe()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (133 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 134/218] tracing: Fix crash from reading trace_pipe with sendfile Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 136/218] ALSA: usb-audio: add Microsoft HD-5001 to quirks Kamal Mostafa
                   ` (82 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Rabin Vincent, Al Viro, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Rabin Vincent <rabin@rab.in>

commit d6785d9152147596f60234157da2b02540c3e60f upstream.

Running the following command:

 busybox cat /sys/kernel/debug/tracing/trace_pipe > /dev/null

with any tracing enabled pretty very quickly leads to various NULL
pointer dereferences and VM BUG_ON()s, such as these:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
 IP: [<ffffffff8119df6c>] generic_pipe_buf_release+0xc/0x40
 Call Trace:
  [<ffffffff811c48a3>] splice_direct_to_actor+0x143/0x1e0
  [<ffffffff811c42e0>] ? generic_pipe_buf_nosteal+0x10/0x10
  [<ffffffff811c49cf>] do_splice_direct+0x8f/0xb0
  [<ffffffff81196869>] do_sendfile+0x199/0x380
  [<ffffffff81197600>] SyS_sendfile64+0x90/0xa0
  [<ffffffff8192cbee>] entry_SYSCALL_64_fastpath+0x12/0x6d

 page dumped because: VM_BUG_ON_PAGE(atomic_read(&page->_count) == 0)
 kernel BUG at include/linux/mm.h:367!
 invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
 RIP: [<ffffffff8119df9c>] generic_pipe_buf_release+0x3c/0x40
 Call Trace:
  [<ffffffff811c48a3>] splice_direct_to_actor+0x143/0x1e0
  [<ffffffff811c42e0>] ? generic_pipe_buf_nosteal+0x10/0x10
  [<ffffffff811c49cf>] do_splice_direct+0x8f/0xb0
  [<ffffffff81196869>] do_sendfile+0x199/0x380
  [<ffffffff81197600>] SyS_sendfile64+0x90/0xa0
  [<ffffffff8192cd1e>] tracesys_phase2+0x84/0x89

(busybox's cat uses sendfile(2), unlike the coreutils version)

This is because tracing_splice_read_pipe() can call splice_to_pipe()
with spd->nr_pages == 0.  spd_pages underflows in splice_to_pipe() and
we fill the page pointers and the other fields of the pipe_buffers with
garbage.

All other callers of splice_to_pipe() avoid calling it when nr_pages ==
0, and we could make tracing_splice_read_pipe() do that too, but it
seems reasonable to have splice_to_page() handle this condition
gracefully.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/splice.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/splice.c b/fs/splice.c
index 014657c..27c0f34 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -185,6 +185,9 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
 	unsigned int spd_pages = spd->nr_pages;
 	int ret, do_wakeup, page_nr;
 
+	if (!spd_pages)
+		return 0;
+
 	ret = 0;
 	do_wakeup = 0;
 	page_nr = 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 136/218] ALSA: usb-audio: add Microsoft HD-5001 to quirks
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (134 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 135/218] splice: handle zero nr_pages in splice_to_pipe() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 137/218] writeback, cgroup: fix premature wb_put() in locked_inode_to_wb_and_lock_list() Kamal Mostafa
                   ` (81 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Victor Clément, Takashi Iwai, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Victor=20Cl=C3=A9ment?= <victor.clement@openmailbox.org>

commit 0ef21100ae912f76ed89f76ecd894f4ffb3689c1 upstream.

The Microsoft HD-5001 webcam microphone does not support sample rate
reading as the HD-5000 one.
This results in dmesg errors and sound hanging with pulseaudio.

Signed-off-by: Victor Clément <victor.clement@openmailbox.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/usb/quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 47751f0..5fb308d 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1124,6 +1124,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
 	switch (chip->usb_id) {
 	case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema  */
 	case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */
+	case USB_ID(0x045E, 0x076E): /* MS Lifecam HD-5001 */
 	case USB_ID(0x045E, 0x076F): /* MS Lifecam HD-6000 */
 	case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */
 	case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 137/218] writeback, cgroup: fix premature wb_put() in locked_inode_to_wb_and_lock_list()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (135 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 136/218] ALSA: usb-audio: add Microsoft HD-5001 to quirks Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 138/218] fs-writeback: unplug before cond_resched in writeback_sb_inodes Kamal Mostafa
                   ` (80 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tejun Heo, Jens Axboe, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tejun Heo <tj@kernel.org>

commit 614a4e3773148a31f58dc174bbf578ceb63510c2 upstream.

locked_inode_to_wb_and_lock_list() wb_get()'s the wb associated with
the target inode, unlocks inode, locks the wb's list_lock and verifies
that the inode is still associated with the wb.  To prevent the wb
going away between dropping inode lock and acquiring list_lock, the wb
is pinned while inode lock is held.  The wb reference is put right
after acquiring list_lock citing that the wb won't be dereferenced
anymore.

This isn't true.  If the inode is still associated with the wb, the
inode has reference and it's safe to return the wb; however, if inode
has been switched, the wb still needs to be unlocked which is a
dereference and can lead to use-after-free if it it races with wb
destruction.

Fix it by putting the reference after releasing list_lock.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 87e1d789bf55 ("writeback: implement [locked_]inode_to_wb_and_lock_list()")
Tested-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/fs-writeback.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 5fa588e..5760ea9 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -283,13 +283,15 @@ locked_inode_to_wb_and_lock_list(struct inode *inode)
 		wb_get(wb);
 		spin_unlock(&inode->i_lock);
 		spin_lock(&wb->list_lock);
-		wb_put(wb);		/* not gonna deref it anymore */
 
 		/* i_wb may have changed inbetween, can't use inode_to_wb() */
-		if (likely(wb == inode->i_wb))
-			return wb;	/* @inode already has ref */
+		if (likely(wb == inode->i_wb)) {
+			wb_put(wb);	/* @inode already has ref */
+			return wb;
+		}
 
 		spin_unlock(&wb->list_lock);
+		wb_put(wb);
 		cpu_relax();
 		spin_lock(&inode->i_lock);
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 138/218] fs-writeback: unplug before cond_resched in writeback_sb_inodes
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (136 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 137/218] writeback, cgroup: fix premature wb_put() in locked_inode_to_wb_and_lock_list() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 139/218] writeback, cgroup: fix use of the wrong bdi_writeback which mismatches the inode Kamal Mostafa
                   ` (79 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Mason, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Chris Mason <clm@fb.com>

commit 590dca3a71875461e8fea3013af74386945191b2 upstream.

Commit 505a666ee3fc ("writeback: plug writeback in wb_writeback() and
writeback_inodes_wb()") has us holding a plug during writeback_sb_inodes,
which increases the merge rate when relatively contiguous small files
are written by the filesystem.  It helps both on flash and spindles.

For an fs_mark workload creating 4K files in parallel across 8 drives,
this commit improves performance ~9% more by unplugging before calling
cond_resched().  cond_resched() doesn't trigger an implicit unplug, so
explicitly getting the IO down to the device before scheduling reduces
latencies for anyone waiting on clean pages.

It also cuts down on how often we use kblockd to unplug, which means
less work bouncing from one workqueue to another.

Many more details about how we got here:

  https://lkml.org/lkml/2015/9/11/570

Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/fs-writeback.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 5760ea9..f907b9d 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1520,6 +1520,21 @@ static long writeback_sb_inodes(struct super_block *sb,
 		wbc_detach_inode(&wbc);
 		work->nr_pages -= write_chunk - wbc.nr_to_write;
 		wrote += write_chunk - wbc.nr_to_write;
+
+		if (need_resched()) {
+			/*
+			 * We're trying to balance between building up a nice
+			 * long list of IOs to improve our merge rate, and
+			 * getting those IOs out quickly for anyone throttling
+			 * in balance_dirty_pages().  cond_resched() doesn't
+			 * unplug, so get our IOs out the door before we
+			 * give up the CPU.
+			 */
+			blk_flush_plug(current);
+			cond_resched();
+		}
+
+
 		spin_lock(&wb->list_lock);
 		spin_lock(&inode->i_lock);
 		if (!(inode->i_state & I_DIRTY_ALL))
@@ -1527,7 +1542,7 @@ static long writeback_sb_inodes(struct super_block *sb,
 		requeue_inode(inode, wb, &wbc);
 		inode_sync_complete(inode);
 		spin_unlock(&inode->i_lock);
-		cond_resched_lock(&wb->list_lock);
+
 		/*
 		 * bail out to wb_writeback() often enough to check
 		 * background threshold and other termination conditions.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 139/218] writeback, cgroup: fix use of the wrong bdi_writeback which mismatches the inode
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (137 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 138/218] fs-writeback: unplug before cond_resched in writeback_sb_inodes Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 140/218] bitops: Do not default to __clear_bit() for __clear_bit_unlock() Kamal Mostafa
                   ` (78 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Tejun Heo, Jens Axboe, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Tejun Heo <tj@kernel.org>

commit aaf2559332ba272671bb870464a99b909b29a3a1 upstream.

When cgroup writeback is in use, there can be multiple wb's
(bdi_writeback's) per bdi and an inode may switch among them
dynamically.  In a couple places, the wrong wb was used leading to
performing operations on the wrong list under the wrong lock
corrupting the io lists.

* writeback_single_inode() was taking @wb parameter and used it to
  remove the inode from io lists if it becomes clean after writeback.
  The callers of this function were always passing in the root wb
  regardless of the actual wb that the inode was associated with,
  which could also change while writeback is in progress.

  Fix it by dropping the @wb parameter and using
  inode_to_wb_and_lock_list() to determine and lock the associated wb.

* After writeback_sb_inodes() writes out an inode, it re-locks @wb and
  inode to remove it from or move it to the right io list.  It assumes
  that the inode is still associated with @wb; however, the inode may
  have switched to another wb while writeback was in progress.

  Fix it by using inode_to_wb_and_lock_list() to determine and lock
  the associated wb after writeback is complete.  As the function
  requires the original @wb->list_lock locked for the next iteration,
  in the unlikely case where the inode has changed association, switch
  the locks.

Kudos to Tahsin for pinpointing these subtle breakages.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: d10c80955265 ("writeback: implement foreign cgroup inode bdi_writeback switching")
Link: http://lkml.kernel.org/g/CAAeU0aMYeM_39Y2+PaRvyB1nqAPYZSNngJ1eBRmrxn7gKAt2Mg@mail.gmail.com
Reported-and-diagnosed-by: Tahsin Erdogan <tahsin@google.com>
Tested-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/fs-writeback.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index f907b9d..d4facb3 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -1332,10 +1332,10 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
  * we go e.g. from filesystem. Flusher thread uses __writeback_single_inode()
  * and does more profound writeback list handling in writeback_sb_inodes().
  */
-static int
-writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
-		       struct writeback_control *wbc)
+static int writeback_single_inode(struct inode *inode,
+				  struct writeback_control *wbc)
 {
+	struct bdi_writeback *wb;
 	int ret = 0;
 
 	spin_lock(&inode->i_lock);
@@ -1373,7 +1373,8 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
 	ret = __writeback_single_inode(inode, wbc);
 
 	wbc_detach_inode(wbc);
-	spin_lock(&wb->list_lock);
+
+	wb = inode_to_wb_and_lock_list(inode);
 	spin_lock(&inode->i_lock);
 	/*
 	 * If inode is clean, remove it from writeback lists. Otherwise don't
@@ -1444,6 +1445,7 @@ static long writeback_sb_inodes(struct super_block *sb,
 
 	while (!list_empty(&wb->b_io)) {
 		struct inode *inode = wb_inode(wb->b_io.prev);
+		struct bdi_writeback *tmp_wb;
 
 		if (inode->i_sb != sb) {
 			if (work->sb) {
@@ -1534,15 +1536,23 @@ static long writeback_sb_inodes(struct super_block *sb,
 			cond_resched();
 		}
 
-
-		spin_lock(&wb->list_lock);
+		/*
+		 * Requeue @inode if still dirty.  Be careful as @inode may
+		 * have been switched to another wb in the meantime.
+		 */
+		tmp_wb = inode_to_wb_and_lock_list(inode);
 		spin_lock(&inode->i_lock);
 		if (!(inode->i_state & I_DIRTY_ALL))
 			wrote++;
-		requeue_inode(inode, wb, &wbc);
+		requeue_inode(inode, tmp_wb, &wbc);
 		inode_sync_complete(inode);
 		spin_unlock(&inode->i_lock);
 
+		if (unlikely(tmp_wb != wb)) {
+			spin_unlock(&tmp_wb->list_lock);
+			spin_lock(&wb->list_lock);
+		}
+
 		/*
 		 * bail out to wb_writeback() often enough to check
 		 * background threshold and other termination conditions.
@@ -2320,7 +2330,6 @@ EXPORT_SYMBOL(sync_inodes_sb);
  */
 int write_inode_now(struct inode *inode, int sync)
 {
-	struct bdi_writeback *wb = &inode_to_bdi(inode)->wb;
 	struct writeback_control wbc = {
 		.nr_to_write = LONG_MAX,
 		.sync_mode = sync ? WB_SYNC_ALL : WB_SYNC_NONE,
@@ -2332,7 +2341,7 @@ int write_inode_now(struct inode *inode, int sync)
 		wbc.nr_to_write = 0;
 
 	might_sleep();
-	return writeback_single_inode(inode, wb, &wbc);
+	return writeback_single_inode(inode, &wbc);
 }
 EXPORT_SYMBOL(write_inode_now);
 
@@ -2349,7 +2358,7 @@ EXPORT_SYMBOL(write_inode_now);
  */
 int sync_inode(struct inode *inode, struct writeback_control *wbc)
 {
-	return writeback_single_inode(inode, &inode_to_bdi(inode)->wb, wbc);
+	return writeback_single_inode(inode, wbc);
 }
 EXPORT_SYMBOL(sync_inode);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 140/218] bitops: Do not default to __clear_bit() for __clear_bit_unlock()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (138 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 139/218] writeback, cgroup: fix use of the wrong bdi_writeback which mismatches the inode Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 141/218] target: Fix target_release_cmd_kref shutdown comp leak Kamal Mostafa
                   ` (77 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Peter Zijlstra, Andrew Morton, Christoph Lameter, David Rientjes,
	Helge Deller, James E . J . Bottomley, Joonsoo Kim,
	Linus Torvalds, Noam Camus, Paul E . McKenney, Pekka Enberg,
	Thomas Gleixner, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Peter Zijlstra <peterz@infradead.org>

commit f75d48644c56a31731d17fa693c8175328957e1d upstream.

__clear_bit_unlock() is a special little snowflake. While it carries the
non-atomic '__' prefix, it is specifically documented to pair with
test_and_set_bit() and therefore should be 'somewhat' atomic.

Therefore the generic implementation of __clear_bit_unlock() cannot use
the fully non-atomic __clear_bit() as a default.

If an arch is able to do better; is must provide an implementation of
__clear_bit_unlock() itself.

Specifically, this came up as a result of hackbench livelock'ing in
slab_lock() on ARC with SMP + SLUB + !LLSC.

The issue was incorrect pairing of atomic ops.

 slab_lock() -> bit_spin_lock() -> test_and_set_bit()
 slab_unlock() -> __bit_spin_unlock() -> __clear_bit()

The non serializing __clear_bit() was getting "lost"

 80543b8e:	ld_s       r2,[r13,0] <--- (A) Finds PG_locked is set
 80543b90:	or         r3,r2,1    <--- (B) other core unlocks right here
 80543b94:	st_s       r3,[r13,0] <--- (C) sets PG_locked (overwrites unlock)

Fixes ARC STAR 9000817404 (and probably more).

Reported-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Tested-by: Vineet Gupta <Vineet.Gupta1@synopsys.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Helge Deller <deller@gmx.de>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Noam Camus <noamc@ezchip.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160309114054.GJ6356@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/asm-generic/bitops/lock.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h
index c30266e..8ef0ccb 100644
--- a/include/asm-generic/bitops/lock.h
+++ b/include/asm-generic/bitops/lock.h
@@ -29,16 +29,16 @@ do {					\
  * @nr: the bit to set
  * @addr: the address to start counting from
  *
- * This operation is like clear_bit_unlock, however it is not atomic.
- * It does provide release barrier semantics so it can be used to unlock
- * a bit lock, however it would only be used if no other CPU can modify
- * any bits in the memory until the lock is released (a good example is
- * if the bit lock itself protects access to the other bits in the word).
+ * A weaker form of clear_bit_unlock() as used by __bit_lock_unlock(). If all
+ * the bits in the word are protected by this lock some archs can use weaker
+ * ops to safely unlock.
+ *
+ * See for example x86's implementation.
  */
 #define __clear_bit_unlock(nr, addr)	\
 do {					\
-	smp_mb();			\
-	__clear_bit(nr, addr);		\
+	smp_mb__before_atomic();	\
+	clear_bit(nr, addr);		\
 } while (0)
 
 #endif /* _ASM_GENERIC_BITOPS_LOCK_H_ */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 141/218] target: Fix target_release_cmd_kref shutdown comp leak
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (139 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 140/218] bitops: Do not default to __clear_bit() for __clear_bit_unlock() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 142/218] KVM: VMX: avoid guest hang on invalid invept instruction Kamal Mostafa
                   ` (76 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Himanshu Madhani, Nicholas Bellinger, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Himanshu Madhani <himanshu.madhani@qlogic.com>

commit 5e47f1985d7107331c3f64fb3ec83d66fd73577e upstream.

This patch fixes an active I/O shutdown bug for fabric
drivers using target_wait_for_sess_cmds(), where se_cmd
descriptor shutdown would result in hung tasks waiting
indefinitely for se_cmd->cmd_wait_comp to complete().

To address this bug, drop the incorrect list_del_init()
usage in target_wait_for_sess_cmds() and always complete()
during se_cmd target_release_cmd_kref() put, in order to
let caller invoke the final fabric release callback
into se_cmd->se_tfo->release_cmd() code.

Reported-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Tested-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/target/target_core_transport.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 9456f02..e591fbd 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2577,8 +2577,6 @@ void target_wait_for_sess_cmds(struct se_session *se_sess)
 
 	list_for_each_entry_safe(se_cmd, tmp_cmd,
 				&se_sess->sess_wait_list, se_cmd_list) {
-		list_del_init(&se_cmd->se_cmd_list);
-
 		pr_debug("Waiting for se_cmd: %p t_state: %d, fabric state:"
 			" %d\n", se_cmd, se_cmd->t_state,
 			se_cmd->se_tfo->get_cmd_state(se_cmd));
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 142/218] KVM: VMX: avoid guest hang on invalid invept instruction
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (140 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 141/218] target: Fix target_release_cmd_kref shutdown comp leak Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 143/218] KVM: fix spin_lock_init order on x86 Kamal Mostafa
                   ` (75 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Paolo Bonzini <pbonzini@redhat.com>

commit 2849eb4f99d54925c543db12917127f88b3c38ff upstream.

A guest executing an invalid invept instruction would hang
because the instruction pointer was not updated.

Fixes: bfd0a56b90005f8c8a004baf407ad90045c2b11e
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/kvm/vmx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index abf8cc7..c832c7d 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7199,6 +7199,7 @@ static int handle_invept(struct kvm_vcpu *vcpu)
 	if (!(types & (1UL << type))) {
 		nested_vmx_failValid(vcpu,
 				VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID);
+		skip_emulated_instruction(vcpu);
 		return 1;
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 143/218] KVM: fix spin_lock_init order on x86
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (141 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 142/218] KVM: VMX: avoid guest hang on invalid invept instruction Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 144/218] tracing: Fix trace_printk() to print when not using bprintk() Kamal Mostafa
                   ` (74 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Paolo Bonzini, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Paolo Bonzini <pbonzini@redhat.com>

commit e9ad4ec8379ad1ba6f68b8ca1c26b50b5ae0a327 upstream.

Moving the initialization earlier is needed in 4.6 because
kvm_arch_init_vm is now using mmu_lock, causing lockdep to
complain:

[  284.440294] INFO: trying to register non-static key.
[  284.445259] the code is fine but needs lockdep annotation.
[  284.450736] turning off the locking correctness validator.
...
[  284.528318]  [<ffffffff810aecc3>] lock_acquire+0xd3/0x240
[  284.533733]  [<ffffffffa0305aa0>] ? kvm_page_track_register_notifier+0x20/0x60 [kvm]
[  284.541467]  [<ffffffff81715581>] _raw_spin_lock+0x41/0x80
[  284.546960]  [<ffffffffa0305aa0>] ? kvm_page_track_register_notifier+0x20/0x60 [kvm]
[  284.554707]  [<ffffffffa0305aa0>] kvm_page_track_register_notifier+0x20/0x60 [kvm]
[  284.562281]  [<ffffffffa02ece70>] kvm_mmu_init_vm+0x20/0x30 [kvm]
[  284.568381]  [<ffffffffa02dbf7a>] kvm_arch_init_vm+0x1ea/0x200 [kvm]
[  284.574740]  [<ffffffffa02bff3f>] kvm_dev_ioctl+0xbf/0x4d0 [kvm]

However, it also helps fixing a preexisting problem, which is why this
patch is also good for stable kernels: kvm_create_vm was incrementing
current->mm->mm_count but not decrementing it at the out_err label (in
case kvm_init_mmu_notifier failed).  The new initialization order makes
it possible to add the required mmdrop without adding a new error label.

Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 virt/kvm/kvm_main.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 5a2a78a..77b6eb6 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -503,6 +503,16 @@ static struct kvm *kvm_create_vm(unsigned long type)
 	if (!kvm)
 		return ERR_PTR(-ENOMEM);
 
+	spin_lock_init(&kvm->mmu_lock);
+	atomic_inc(&current->mm->mm_count);
+	kvm->mm = current->mm;
+	kvm_eventfd_init(kvm);
+	mutex_init(&kvm->lock);
+	mutex_init(&kvm->irq_lock);
+	mutex_init(&kvm->slots_lock);
+	atomic_set(&kvm->users_count, 1);
+	INIT_LIST_HEAD(&kvm->devices);
+
 	r = kvm_arch_init_vm(kvm, type);
 	if (r)
 		goto out_err_no_disable;
@@ -535,16 +545,6 @@ static struct kvm *kvm_create_vm(unsigned long type)
 			goto out_err;
 	}
 
-	spin_lock_init(&kvm->mmu_lock);
-	kvm->mm = current->mm;
-	atomic_inc(&kvm->mm->mm_count);
-	kvm_eventfd_init(kvm);
-	mutex_init(&kvm->lock);
-	mutex_init(&kvm->irq_lock);
-	mutex_init(&kvm->slots_lock);
-	atomic_set(&kvm->users_count, 1);
-	INIT_LIST_HEAD(&kvm->devices);
-
 	r = kvm_init_mmu_notifier(kvm);
 	if (r)
 		goto out_err;
@@ -569,6 +569,7 @@ out_err_no_disable:
 	for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++)
 		kvm_free_memslots(kvm, kvm->memslots[i]);
 	kvm_arch_free_vm(kvm);
+	mmdrop(current->mm);
 	return ERR_PTR(r);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 144/218] tracing: Fix trace_printk() to print when not using bprintk()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (142 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 143/218] KVM: fix spin_lock_init order on x86 Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 145/218] fs/coredump: prevent fsuid=0 dumps into user-controlled directories Kamal Mostafa
                   ` (73 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Steven Rostedt, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

commit 3debb0a9ddb16526de8b456491b7db60114f7b5e upstream.

The trace_printk() code will allocate extra buffers if the compile detects
that a trace_printk() is used. To do this, the format of the trace_printk()
is saved to the __trace_printk_fmt section, and if that section is bigger
than zero, the buffers are allocated (along with a message that this has
happened).

If trace_printk() uses a format that is not a constant, and thus something
not guaranteed to be around when the print happens, the compiler optimizes
the fmt out, as it is not used, and the __trace_printk_fmt section is not
filled. This means the kernel will not allocate the special buffers needed
for the trace_printk() and the trace_printk() will not write anything to the
tracing buffer.

Adding a "__used" to the variable in the __trace_printk_fmt section will
keep it around, even though it is set to NULL. This will keep the string
from being printed in the debugfs/tracing/printk_formats section as it is
not needed.

Reported-by: Vlastimil Babka <vbabka@suse.cz>
Fixes: 07d777fe8c398 "tracing: Add percpu buffers for trace_printk()"
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/kernel.h      | 6 +++---
 kernel/trace/trace_printk.c | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 5582410..73e6f3b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -605,7 +605,7 @@ do {							\
 
 #define do_trace_printk(fmt, args...)					\
 do {									\
-	static const char *trace_printk_fmt				\
+	static const char *trace_printk_fmt __used			\
 		__attribute__((section("__trace_printk_fmt"))) =	\
 		__builtin_constant_p(fmt) ? fmt : NULL;			\
 									\
@@ -649,7 +649,7 @@ int __trace_printk(unsigned long ip, const char *fmt, ...);
  */
 
 #define trace_puts(str) ({						\
-	static const char *trace_printk_fmt				\
+	static const char *trace_printk_fmt __used			\
 		__attribute__((section("__trace_printk_fmt"))) =	\
 		__builtin_constant_p(str) ? str : NULL;			\
 									\
@@ -671,7 +671,7 @@ extern void trace_dump_stack(int skip);
 #define ftrace_vprintk(fmt, vargs)					\
 do {									\
 	if (__builtin_constant_p(fmt)) {				\
-		static const char *trace_printk_fmt			\
+		static const char *trace_printk_fmt __used		\
 		  __attribute__((section("__trace_printk_fmt"))) =	\
 			__builtin_constant_p(fmt) ? fmt : NULL;		\
 									\
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 2dbffe2..866902c 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -290,6 +290,9 @@ static int t_show(struct seq_file *m, void *v)
 	const char *str = *fmt;
 	int i;
 
+	if (!*fmt)
+		return 0;
+
 	seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt);
 
 	/*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 145/218] fs/coredump: prevent fsuid=0 dumps into user-controlled directories
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (143 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 144/218] tracing: Fix trace_printk() to print when not using bprintk() Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 146/218] rapidio/rionet: fix deadlock on SMP Kamal Mostafa
                   ` (72 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jann Horn, Al Viro, Eric W. Biederman, Andy Lutomirski,
	Oleg Nesterov, Andrew Morton, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jann Horn <jann@thejh.net>

commit 378c6520e7d29280f400ef2ceaf155c86f05a71a upstream.

This commit fixes the following security hole affecting systems where
all of the following conditions are fulfilled:

 - The fs.suid_dumpable sysctl is set to 2.
 - The kernel.core_pattern sysctl's value starts with "/". (Systems
   where kernel.core_pattern starts with "|/" are not affected.)
 - Unprivileged user namespace creation is permitted. (This is
   true on Linux >=3.8, but some distributions disallow it by
   default using a distro patch.)

Under these conditions, if a program executes under secure exec rules,
causing it to run with the SUID_DUMP_ROOT flag, then unshares its user
namespace, changes its root directory and crashes, the coredump will be
written using fsuid=0 and a path derived from kernel.core_pattern - but
this path is interpreted relative to the root directory of the process,
allowing the attacker to control where a coredump will be written with
root privileges.

To fix the security issue, always interpret core_pattern for dumps that
are written under SUID_DUMP_ROOT relative to the root directory of init.

Signed-off-by: Jann Horn <jann@thejh.net>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/um/drivers/mconsole_kern.c |  2 +-
 fs/coredump.c                   | 30 ++++++++++++++++++++++++++----
 fs/fhandle.c                    |  2 +-
 fs/open.c                       |  6 ++----
 include/linux/fs.h              |  2 +-
 kernel/sysctl_binary.c          |  2 +-
 6 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 29880c9..e22e572 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -133,7 +133,7 @@ void mconsole_proc(struct mc_request *req)
 	ptr += strlen("proc");
 	ptr = skip_spaces(ptr);
 
-	file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY);
+	file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY, 0);
 	if (IS_ERR(file)) {
 		mconsole_reply(req, "Failed to open file", 1, 0);
 		printk(KERN_ERR "open /proc/%s: %ld\n", ptr, PTR_ERR(file));
diff --git a/fs/coredump.c b/fs/coredump.c
index a8f7564..df6a1af 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -32,6 +32,9 @@
 #include <linux/pipe_fs_i.h>
 #include <linux/oom.h>
 #include <linux/compat.h>
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/path.h>
 
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -628,6 +631,8 @@ void do_coredump(const siginfo_t *siginfo)
 		}
 	} else {
 		struct inode *inode;
+		int open_flags = O_CREAT | O_RDWR | O_NOFOLLOW |
+				 O_LARGEFILE | O_EXCL;
 
 		if (cprm.limit < binfmt->min_coredump)
 			goto fail_unlock;
@@ -666,10 +671,27 @@ void do_coredump(const siginfo_t *siginfo)
 		 * 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 | O_EXCL,
-				 0600);
+		if (need_suid_safe) {
+			/*
+			 * Using user namespaces, normal user tasks can change
+			 * their current->fs->root to point to arbitrary
+			 * directories. Since the intention of the "only dump
+			 * with a fully qualified path" rule is to control where
+			 * coredumps may be placed using root privileges,
+			 * current->fs->root must not be used. Instead, use the
+			 * root directory of init_task.
+			 */
+			struct path root;
+
+			task_lock(&init_task);
+			get_fs_root(init_task.fs, &root);
+			task_unlock(&init_task);
+			cprm.file = file_open_root(root.dentry, root.mnt,
+				cn.corename, open_flags, 0600);
+			path_put(&root);
+		} else {
+			cprm.file = filp_open(cn.corename, open_flags, 0600);
+		}
 		if (IS_ERR(cprm.file))
 			goto fail_unlock;
 
diff --git a/fs/fhandle.c b/fs/fhandle.c
index d59712d..ca3c3dd 100644
--- a/fs/fhandle.c
+++ b/fs/fhandle.c
@@ -228,7 +228,7 @@ long do_handle_open(int mountdirfd,
 		path_put(&path);
 		return fd;
 	}
-	file = file_open_root(path.dentry, path.mnt, "", open_flag);
+	file = file_open_root(path.dentry, path.mnt, "", open_flag, 0);
 	if (IS_ERR(file)) {
 		put_unused_fd(fd);
 		retval =  PTR_ERR(file);
diff --git a/fs/open.c b/fs/open.c
index e33dab2..50958c2 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -995,14 +995,12 @@ struct file *filp_open(const char *filename, int flags, umode_t mode)
 EXPORT_SYMBOL(filp_open);
 
 struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt,
-			    const char *filename, int flags)
+			    const char *filename, int flags, umode_t mode)
 {
 	struct open_flags op;
-	int err = build_open_flags(flags, 0, &op);
+	int err = build_open_flags(flags, mode, &op);
 	if (err)
 		return ERR_PTR(err);
-	if (flags & O_CREAT)
-		return ERR_PTR(-EINVAL);
 	return do_file_open_root(dentry, mnt, filename, &op);
 }
 EXPORT_SYMBOL(file_open_root);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 84b783f..5f59f86 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2222,7 +2222,7 @@ extern long do_sys_open(int dfd, const char __user *filename, int flags,
 extern struct file *file_open_name(struct filename *, int, umode_t);
 extern struct file *filp_open(const char *, int, umode_t);
 extern struct file *file_open_root(struct dentry *, struct vfsmount *,
-				   const char *, int);
+				   const char *, int, umode_t);
 extern struct file * dentry_open(const struct path *, int, const struct cred *);
 extern int filp_close(struct file *, fl_owner_t id);
 
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index 7e7746a..10a1d7d 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -1321,7 +1321,7 @@ static ssize_t binary_sysctl(const int *name, int nlen,
 	}
 
 	mnt = task_active_pid_ns(current)->proc_mnt;
-	file = file_open_root(mnt->mnt_root, mnt, pathname, flags);
+	file = file_open_root(mnt->mnt_root, mnt, pathname, flags, 0);
 	result = PTR_ERR(file);
 	if (IS_ERR(file))
 		goto out_putname;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 146/218] rapidio/rionet: fix deadlock on SMP
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (144 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 145/218] fs/coredump: prevent fsuid=0 dumps into user-controlled directories Kamal Mostafa
@ 2016-03-31 20:15 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 147/218] staging: comedi: ni_mio_common: fix the ni_write[blw]() functions Kamal Mostafa
                   ` (71 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:15 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Aurelien Jacquiot, Alexandre Bounine, Matt Porter,
	Andre van Herk, Andrew Morton, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Aurelien Jacquiot <a-jacquiot@ti.com>

commit 36915976eca58f2eefa040ba8f9939672564df61 upstream.

Fix deadlocking during concurrent receive and transmit operations on SMP
platforms caused by the use of incorrect lock: on transmit 'tx_lock'
spinlock should be used instead of 'lock' which is used for receive
operation.

This fix is applicable to kernel versions starting from v2.15.

Signed-off-by: Aurelien Jacquiot <a-jacquiot@ti.com>
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/rionet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index dac7a0d..18cc2c8 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -280,7 +280,7 @@ static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbo
 	struct net_device *ndev = dev_id;
 	struct rionet_private *rnet = netdev_priv(ndev);
 
-	spin_lock(&rnet->lock);
+	spin_lock(&rnet->tx_lock);
 
 	if (netif_msg_intr(rnet))
 		printk(KERN_INFO
@@ -299,7 +299,7 @@ static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbo
 	if (rnet->tx_cnt < RIONET_TX_RING_SIZE)
 		netif_wake_queue(ndev);
 
-	spin_unlock(&rnet->lock);
+	spin_unlock(&rnet->tx_lock);
 }
 
 static int rionet_open(struct net_device *ndev)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 147/218] staging: comedi: ni_mio_common: fix the ni_write[blw]() functions
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (145 preceding siblings ...)
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 146/218] rapidio/rionet: fix deadlock on SMP Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 148/218] staging: android: ion_test: fix check of platform_device_register_simple() error code Kamal Mostafa
                   ` (70 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: H Hartley Sweeten, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: H Hartley Sweeten <hsweeten@visionengravers.com>

commit bd3a3cd6c27b117fb9a43a38c8072c95332beecc upstream.

Memory mapped io (dev->mmio) should not also be writing to the ioport
(dev->iobase) registers. Add the missing 'else' to these functions.

Fixes: 0953ee4acca0 ("staging: comedi: ni_mio_common: checkpatch.pl cleanup (else not useful)")
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index 6cc304a..27fbf1a 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -246,24 +246,24 @@ static void ni_writel(struct comedi_device *dev, uint32_t data, int reg)
 {
 	if (dev->mmio)
 		writel(data, dev->mmio + reg);
-
-	outl(data, dev->iobase + reg);
+	else
+		outl(data, dev->iobase + reg);
 }
 
 static void ni_writew(struct comedi_device *dev, uint16_t data, int reg)
 {
 	if (dev->mmio)
 		writew(data, dev->mmio + reg);
-
-	outw(data, dev->iobase + reg);
+	else
+		outw(data, dev->iobase + reg);
 }
 
 static void ni_writeb(struct comedi_device *dev, uint8_t data, int reg)
 {
 	if (dev->mmio)
 		writeb(data, dev->mmio + reg);
-
-	outb(data, dev->iobase + reg);
+	else
+		outb(data, dev->iobase + reg);
 }
 
 static uint32_t ni_readl(struct comedi_device *dev, int reg)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 148/218] staging: android: ion_test: fix check of platform_device_register_simple() error code
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (146 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 147/218] staging: comedi: ni_mio_common: fix the ni_write[blw]() functions Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 149/218] ideapad-laptop: Add ideapad Y700 (15) to the no_hw_rfkill DMI list Kamal Mostafa
                   ` (69 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vladimir Zapolskiy, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Vladimir Zapolskiy <vz@mleia.com>

commit ccbc2a9e7878ff09bcaed4893c2a2d3adbb797e2 upstream.

On error platform_device_register_simple() returns ERR_PTR() value,
check for NULL always fails. The change corrects the check itself and
propagates the returned error upwards.

Fixes: 81fb0b901397 ("staging: android: ion_test: unregister the platform device")
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/staging/android/ion/ion_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index 7d6e6b6..1b86a33 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -284,8 +284,8 @@ static int __init ion_test_init(void)
 {
 	ion_test_pdev = platform_device_register_simple("ion-test",
 							-1, NULL, 0);
-	if (!ion_test_pdev)
-		return -ENODEV;
+	if (IS_ERR(ion_test_pdev))
+		return PTR_ERR(ion_test_pdev);
 
 	return platform_driver_probe(&ion_test_platform_driver, ion_test_probe);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 149/218] ideapad-laptop: Add ideapad Y700 (15) to the no_hw_rfkill DMI list
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (147 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 148/218] staging: android: ion_test: fix check of platform_device_register_simple() error code Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 150/218] MAINTAINERS: Update mailing list and web page for hwmon subsystem Kamal Mostafa
                   ` (68 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: John Dahlstrom, Darren Hart, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: John Dahlstrom <jodarom@SDF.ORG>

commit 4db9675d927a71faa66e5ab128d2390d6329750b upstream.

Some Lenovo ideapad models lack a physical rfkill switch.
On Lenovo models ideapad Y700 Touch-15ISK and ideapad Y700-15ISK,
ideapad-laptop would wrongly report all radios as blocked by
hardware which caused wireless network connections to fail.

Add these models without an rfkill switch to the no_hw_rfkill list.

Signed-off-by: John Dahlstrom <jodarom@sdf.org>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/platform/x86/ideapad-laptop.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index e2b3743..aff3c70 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -846,6 +846,20 @@ static const struct dmi_system_id no_hw_rfkill_list[] = {
 		},
 	},
 	{
+		.ident = "Lenovo ideapad Y700-15ISK",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad Y700-15ISK"),
+		},
+	},
+	{
+		.ident = "Lenovo ideapad Y700 Touch-15ISK",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad Y700 Touch-15ISK"),
+		},
+	},
+	{
 		.ident = "Lenovo ideapad Y700-17ISK",
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 150/218] MAINTAINERS: Update mailing list and web page for hwmon subsystem
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (148 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 149/218] ideapad-laptop: Add ideapad Y700 (15) to the no_hw_rfkill DMI list Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 151/218] ocfs2/dlm: fix race between convert and recovery Kamal Mostafa
                   ` (67 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Guenter Roeck, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Guenter Roeck <linux@roeck-us.net>

commit 968ce1b1f45a7d76b5471b19bd035dbecc72f32d upstream.

The old web page for the hwmon subsystem is no longer operational,
and the mailing list has become unreliable. Move both to kernel.org.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[ kamal: backport to 4.2-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 MAINTAINERS | 98 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4be1334..ab4384f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -229,13 +229,13 @@ F:	kernel/sys_ni.c
 
 ABIT UGURU 1,2 HARDWARE MONITOR DRIVER
 M:	Hans de Goede <hdegoede@redhat.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/abituguru.c
 
 ABIT UGURU 3 HARDWARE MONITOR DRIVER
 M:	Alistair John Strachan <alistair@devzero.co.uk>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/abituguru3.c
 
@@ -366,14 +366,14 @@ S:	Maintained
 
 ADM1025 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/adm1025
 F:	drivers/hwmon/adm1025.c
 
 ADM1029 HARDWARE MONITOR DRIVER
 M:	Corentin Labbe <clabbe.montjoie@gmail.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/adm1029.c
 
@@ -418,7 +418,7 @@ F:	drivers/video/backlight/adp8860_bl.c
 
 ADS1015 HARDWARE MONITOR DRIVER
 M:	Dirk Eibach <eibach@gdsys.de>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/ads1015
 F:	drivers/hwmon/ads1015.c
@@ -431,7 +431,7 @@ F:	drivers/macintosh/therm_adt746x.c
 
 ADT7475 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/adt7475
 F:	drivers/hwmon/adt7475.c
@@ -601,9 +601,9 @@ F:	drivers/crypto/ccp/
 F:	include/linux/ccp.h
 
 AMD FAM15H PROCESSOR POWER MONITORING DRIVER
-M:	Andreas Herrmann <herrmann.der.user@googlemail.com>
-L:	lm-sensors@lm-sensors.org
-S:	Maintained
+M:	Huang Rui <ray.huang@amd.com>
+L:	linux-hwmon@vger.kernel.org
+S:	Supported
 F:	Documentation/hwmon/fam15h_power
 F:	drivers/hwmon/fam15h_power.c
 
@@ -761,7 +761,7 @@ F:	drivers/input/mouse/bcm5974.c
 
 APPLE SMC DRIVER
 M:	Henrik Rydberg <rydberg@bitmath.org>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Odd fixes
 F:	drivers/hwmon/applesmc.c
 
@@ -1712,7 +1712,7 @@ F:	include/media/as3645a.h
 
 ASC7621 HARDWARE MONITOR DRIVER
 M:	George Joseph <george.joseph@fairview5.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/asc7621
 F:	drivers/hwmon/asc7621.c
@@ -1791,7 +1791,7 @@ F:	drivers/net/wireless/ath/carl9170/
 
 ATK0110 HWMON DRIVER
 M:	Luca Tettamanti <kronos.it@gmail.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/asus_atk0110.c
 
@@ -2866,7 +2866,7 @@ F:	mm/swap_cgroup.c
 
 CORETEMP HARDWARE MONITORING DRIVER
 M:	Fenghua Yu <fenghua.yu@intel.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/coretemp
 F:	drivers/hwmon/coretemp.c
@@ -3422,7 +3422,7 @@ T:	git git://git.infradead.org/users/vkoul/slave-dma.git
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/dme1737
 F:	drivers/hwmon/dme1737.c
@@ -4112,7 +4112,7 @@ F:	include/video/exynos_mipi*
 
 F71805F HARDWARE MONITORING DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/f71805f
 F:	drivers/hwmon/f71805f.c
@@ -4191,7 +4191,7 @@ F:	fs/*
 
 FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER
 M:	Riku Voipio <riku.voipio@iki.fi>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/f75375s.c
 F:	include/linux/f75375s.h
@@ -4716,8 +4716,8 @@ F:	drivers/media/usb/hackrf/
 HARDWARE MONITORING
 M:	Jean Delvare <jdelvare@suse.com>
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
-W:	http://www.lm-sensors.org/
+L:	linux-hwmon@vger.kernel.org
+W:	http://hwmon.wiki.kernel.org/
 T:	quilt http://jdelvare.nerim.net/devel/linux/jdelvare-hwmon/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
 S:	Maintained
@@ -5212,7 +5212,7 @@ F:	drivers/usb/atm/ueagle-atm.c
 
 INA209 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/ina209
 F:	Documentation/devicetree/bindings/i2c/ina209.txt
@@ -5220,7 +5220,7 @@ F:	drivers/hwmon/ina209.c
 
 INA2XX HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/ina2xx
 F:	drivers/hwmon/ina2xx.c
@@ -5692,7 +5692,7 @@ F:	drivers/isdn/hardware/eicon/
 
 IT87 HARDWARE MONITORING DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/it87
 F:	drivers/hwmon/it87.c
@@ -5728,7 +5728,7 @@ F:	drivers/media/dvb-frontends/ix2505v*
 
 JC42.4 TEMPERATURE SENSOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/jc42.c
 F:	Documentation/hwmon/jc42
@@ -5779,14 +5779,14 @@ F:	drivers/tty/serial/jsm/
 
 K10TEMP HARDWARE MONITORING DRIVER
 M:	Clemens Ladisch <clemens@ladisch.de>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/k10temp
 F:	drivers/hwmon/k10temp.c
 
 K8TEMP HARDWARE MONITORING DRIVER
 M:	Rudolf Marek <r.marek@assembler.cz>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/k8temp
 F:	drivers/hwmon/k8temp.c
@@ -6279,27 +6279,27 @@ F:	net/llc/
 
 LM73 HARDWARE MONITOR DRIVER
 M:	Guillaume Ligneul <guillaume.ligneul@gmail.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/lm73.c
 
 LM78 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/lm78
 F:	drivers/hwmon/lm78.c
 
 LM83 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/lm83
 F:	drivers/hwmon/lm83.c
 
 LM90 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/lm90
 F:	Documentation/devicetree/bindings/hwmon/lm90.txt
@@ -6307,7 +6307,7 @@ F:	drivers/hwmon/lm90.c
 
 LM95234 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/lm95234
 F:	drivers/hwmon/lm95234.c
@@ -6374,7 +6374,7 @@ F:	drivers/scsi/sym53c8xx_2/
 
 LTC4261 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/ltc4261
 F:	drivers/hwmon/ltc4261.c
@@ -6536,21 +6536,21 @@ F:	include/uapi/linux/matroxfb.h
 
 MAX16065 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/max16065
 F:	drivers/hwmon/max16065.c
 
 MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER
 M:	"Hans J. Koch" <hjk@hansjkoch.de>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/max6650
 F:	drivers/hwmon/max6650.c
 
 MAX6697 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/max6697
 F:	Documentation/devicetree/bindings/i2c/max6697.txt
@@ -6985,7 +6985,7 @@ F:	drivers/scsi/NCR_D700.*
 
 NCT6775 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/nct6775
 F:	drivers/hwmon/nct6775.c
@@ -7720,7 +7720,7 @@ F:	drivers/video/logo/logo_parisc*
 
 PC87360 HARDWARE MONITORING DRIVER
 M:	Jim Cromie <jim.cromie@gmail.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/pc87360
 F:	drivers/hwmon/pc87360.c
@@ -7732,7 +7732,7 @@ F:	drivers/char/pc8736x_gpio.c
 
 PC87427 HARDWARE MONITORING DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/pc87427
 F:	drivers/hwmon/pc87427.c
@@ -8034,8 +8034,8 @@ F:	drivers/rtc/rtc-puv3.c
 
 PMBUS HARDWARE MONITORING DRIVERS
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
-W:	http://www.lm-sensors.org/
+L:	linux-hwmon@vger.kernel.org
+W:	http://hwmon.wiki.kernel.org/
 W:	http://www.roeck-us.net/linux/drivers/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
 S:	Maintained
@@ -8226,7 +8226,7 @@ F:	drivers/media/usb/pwc/*
 
 PWM FAN DRIVER
 M:	Kamil Debski <k.debski@samsung.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Supported
 F:	Documentation/devicetree/bindings/hwmon/pwm-fan.txt
 F:	Documentation/hwmon/pwm-fan
@@ -9416,28 +9416,28 @@ F:	Documentation/devicetree/bindings/media/i2c/nokia,smia.txt
 
 SMM665 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/smm665
 F:	drivers/hwmon/smm665.c
 
 SMSC EMC2103 HARDWARE MONITOR DRIVER
 M:	Steve Glendinning <steve.glendinning@shawell.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/emc2103
 F:	drivers/hwmon/emc2103.c
 
 SMSC SCH5627 HARDWARE MONITOR DRIVER
 M:	Hans de Goede <hdegoede@redhat.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Supported
 F:	Documentation/hwmon/sch5627
 F:	drivers/hwmon/sch5627.c
 
 SMSC47B397 HARDWARE MONITOR DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/smsc47b397
 F:	drivers/hwmon/smsc47b397.c
@@ -10346,7 +10346,7 @@ F:	include/linux/mmc/sh_mobile_sdhi.h
 
 TMP401 HARDWARE MONITOR DRIVER
 M:	Guenter Roeck <linux@roeck-us.net>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/tmp401
 F:	drivers/hwmon/tmp401.c
@@ -11053,14 +11053,14 @@ F:	include/linux/regulator/
 
 VT1211 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/vt1211
 F:	drivers/hwmon/vt1211.c
 
 VT8231 HARDWARE MONITOR DRIVER
 M:	Roger Lucas <vt8231@hiddenengine.co.uk>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/vt8231.c
 
@@ -11079,21 +11079,21 @@ F:	drivers/w1/
 
 W83791D HARDWARE MONITORING DRIVER
 M:	Marc Hulsman <m.hulsman@tudelft.nl>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/w83791d
 F:	drivers/hwmon/w83791d.c
 
 W83793 HARDWARE MONITORING DRIVER
 M:	Rudolf Marek <r.marek@assembler.cz>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	Documentation/hwmon/w83793
 F:	drivers/hwmon/w83793.c
 
 W83795 HARDWARE MONITORING DRIVER
 M:	Jean Delvare <jdelvare@suse.com>
-L:	lm-sensors@lm-sensors.org
+L:	linux-hwmon@vger.kernel.org
 S:	Maintained
 F:	drivers/hwmon/w83795.c
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 151/218] ocfs2/dlm: fix race between convert and recovery
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (149 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 150/218] MAINTAINERS: Update mailing list and web page for hwmon subsystem Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 152/218] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Kamal Mostafa
                   ` (66 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joseph Qi, Mark Fasheh, Joel Becker, Tariq Saeed, Junxiao Bi,
	Andrew Morton, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Joseph Qi <joseph.qi@huawei.com>

commit ac7cf246dfdbec3d8fed296c7bf30e16f5099dac upstream.

There is a race window between dlmconvert_remote and
dlm_move_lockres_to_recovery_list, which will cause a lock with
OCFS2_LOCK_BUSY in grant list, thus system hangs.

dlmconvert_remote
{
        spin_lock(&res->spinlock);
        list_move_tail(&lock->list, &res->converting);
        lock->convert_pending = 1;
        spin_unlock(&res->spinlock);

        status = dlm_send_remote_convert_request();
        >>>>>> race window, master has queued ast and return DLM_NORMAL,
               and then down before sending ast.
               this node detects master down and calls
               dlm_move_lockres_to_recovery_list, which will revert the
               lock to grant list.
               Then OCFS2_LOCK_BUSY won't be cleared as new master won't
               send ast any more because it thinks already be authorized.

        spin_lock(&res->spinlock);
        lock->convert_pending = 0;
        if (status != DLM_NORMAL)
                dlm_revert_pending_convert(res, lock);
        spin_unlock(&res->spinlock);
}

In this case, check if res->state has DLM_LOCK_RES_RECOVERING bit set
(res is still in recovering) or res master changed (new master has
finished recovery), reset the status to DLM_RECOVERING, then it will
retry convert.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reported-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Tariq Saeed <tariq.x.saeed@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ocfs2/dlm/dlmconvert.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index e36d63f..84de55e 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -262,6 +262,7 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
 				  struct dlm_lock *lock, int flags, int type)
 {
 	enum dlm_status status;
+	u8 old_owner = res->owner;
 
 	mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type,
 	     lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS);
@@ -316,11 +317,19 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
 	spin_lock(&res->spinlock);
 	res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
 	lock->convert_pending = 0;
-	/* if it failed, move it back to granted queue */
+	/* if it failed, move it back to granted queue.
+	 * if master returns DLM_NORMAL and then down before sending ast,
+	 * it may have already been moved to granted queue, reset to
+	 * DLM_RECOVERING and retry convert */
 	if (status != DLM_NORMAL) {
 		if (status != DLM_NOTQUEUED)
 			dlm_error(status);
 		dlm_revert_pending_convert(res, lock);
+	} else if ((res->state & DLM_LOCK_RES_RECOVERING) ||
+			(old_owner != res->owner)) {
+		mlog(0, "res %.*s is in recovering or has been recovered.\n",
+				res->lockname.len, res->lockname.name);
+		status = DLM_RECOVERING;
 	}
 bail:
 	spin_unlock(&res->spinlock);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 152/218] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (150 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 151/218] ocfs2/dlm: fix race between convert and recovery Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 153/218] mm/page_alloc: prevent merging between isolated and other pageblocks Kamal Mostafa
                   ` (65 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joseph Qi, Junxiao Bi, Mark Fasheh, Joel Becker, Tariq Saeed,
	Andrew Morton, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Joseph Qi <joseph.qi@huawei.com>

commit be12b299a83fc807bbaccd2bcb8ec50cbb0cb55c upstream.

When master handles convert request, it queues ast first and then
returns status.  This may happen that the ast is sent before the request
status because the above two messages are sent by two threads.  And
right after the ast is sent, if master down, it may trigger BUG in
dlm_move_lockres_to_recovery_list in the requested node because ast
handler moves it to grant list without clear lock->convert_pending.  So
remove BUG_ON statement and check if the ast is processed in
dlmconvert_remote.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reported-by: Yiwen Jiang <jiangyiwen@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Tariq Saeed <tariq.x.saeed@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 fs/ocfs2/dlm/dlmconvert.c  | 13 +++++++++++++
 fs/ocfs2/dlm/dlmrecovery.c |  1 -
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index 84de55e..f909313 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -288,6 +288,19 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm,
 		status = DLM_DENIED;
 		goto bail;
 	}
+
+	if (lock->ml.type == type && lock->ml.convert_type == LKM_IVMODE) {
+		mlog(0, "last convert request returned DLM_RECOVERING, but "
+		     "owner has already queued and sent ast to me. res %.*s, "
+		     "(cookie=%u:%llu, type=%d, conv=%d)\n",
+		     res->lockname.len, res->lockname.name,
+		     dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)),
+		     dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)),
+		     lock->ml.type, lock->ml.convert_type);
+		status = DLM_NORMAL;
+		goto bail;
+	}
+
 	res->state |= DLM_LOCK_RES_IN_PROGRESS;
 	/* move lock to local convert queue */
 	/* do not alter lock refcount.  switching lists. */
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index f25ff5d..dad6d84 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -2064,7 +2064,6 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm,
 			dlm_lock_get(lock);
 			if (lock->convert_pending) {
 				/* move converting lock back to granted */
-				BUG_ON(i != DLM_CONVERTING_LIST);
 				mlog(0, "node died with convert pending "
 				     "on %.*s. move back to granted list.\n",
 				     res->lockname.len, res->lockname.name);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 153/218] mm/page_alloc: prevent merging between isolated and other pageblocks
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (151 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 152/218] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 154/218] mac80211: avoid excessive stack usage in sta_info Kamal Mostafa
                   ` (64 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vlastimil Babka, Mel Gorman, Kirill A. Shutemov, Johannes Weiner,
	Minchan Kim, Yasuaki Ishimatsu, Zhang Yanfei, Michal Nazarewicz,
	Naoya Horiguchi, Aneesh Kumar K.V, Andrew Morton, Linus Torvalds,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Vlastimil Babka <vbabka@suse.cz>

commit d9dddbf556674bf125ecd925b24e43a5cf2a568a upstream.

Hanjun Guo has reported that a CMA stress test causes broken accounting of
CMA and free pages:

> Before the test, I got:
> -bash-4.3# cat /proc/meminfo | grep Cma
> CmaTotal:         204800 kB
> CmaFree:          195044 kB
>
>
> After running the test:
> -bash-4.3# cat /proc/meminfo | grep Cma
> CmaTotal:         204800 kB
> CmaFree:         6602584 kB
>
> So the freed CMA memory is more than total..
>
> Also the the MemFree is more than mem total:
>
> -bash-4.3# cat /proc/meminfo
> MemTotal:       16342016 kB
> MemFree:        22367268 kB
> MemAvailable:   22370528 kB

Laura Abbott has confirmed the issue and suspected the freepage accounting
rewrite around 3.18/4.0 by Joonsoo Kim.  Joonsoo had a theory that this is
caused by unexpected merging between MIGRATE_ISOLATE and MIGRATE_CMA
pageblocks:

> CMA isolates MAX_ORDER aligned blocks, but, during the process,
> partialy isolated block exists. If MAX_ORDER is 11 and
> pageblock_order is 9, two pageblocks make up MAX_ORDER
> aligned block and I can think following scenario because pageblock
> (un)isolation would be done one by one.
>
> (each character means one pageblock. 'C', 'I' means MIGRATE_CMA,
> MIGRATE_ISOLATE, respectively.
>
> CC -> IC -> II (Isolation)
> II -> CI -> CC (Un-isolation)
>
> If some pages are freed at this intermediate state such as IC or CI,
> that page could be merged to the other page that is resident on
> different type of pageblock and it will cause wrong freepage count.

This was supposed to be prevented by CMA operating on MAX_ORDER blocks,
but since it doesn't hold the zone->lock between pageblocks, a race
window does exist.

It's also likely that unexpected merging can occur between
MIGRATE_ISOLATE and non-CMA pageblocks.  This should be prevented in
__free_one_page() since commit 3c605096d315 ("mm/page_alloc: restrict
max order of merging on isolated pageblock").  However, we only check
the migratetype of the pageblock where buddy merging has been initiated,
not the migratetype of the buddy pageblock (or group of pageblocks)
which can be MIGRATE_ISOLATE.

Joonsoo has suggested checking for buddy migratetype as part of
page_is_buddy(), but that would add extra checks in allocator hotpath
and bloat-o-meter has shown significant code bloat (the function is
inline).

This patch reduces the bloat at some expense of more complicated code.
The buddy-merging while-loop in __free_one_page() is initially bounded
to pageblock_border and without any migratetype checks.  The checks are
placed outside, bumping the max_order if merging is allowed, and
returning to the while-loop with a statement which can't be possibly
considered harmful.

This fixes the accounting bug and also removes the arguably weird state
in the original commit 3c605096d315 where buddies could be left
unmerged.

Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock")
Link: https://lkml.org/lkml/2016/3/2/280
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Hanjun Guo <guohanjun@huawei.com>
Tested-by: Hanjun Guo <guohanjun@huawei.com>
Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Debugged-by: Laura Abbott <labbott@redhat.com>
Debugged-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ kamal: backport to 4.2-stable: context ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 mm/page_alloc.c | 46 +++++++++++++++++++++++++++++++++-------------
 1 file changed, 33 insertions(+), 13 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5b5240b..240c22d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -635,34 +635,28 @@ static inline void __free_one_page(struct page *page,
 	unsigned long combined_idx;
 	unsigned long uninitialized_var(buddy_idx);
 	struct page *buddy;
-	int max_order = MAX_ORDER;
+	unsigned int max_order;
+
+	max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1);
 
 	VM_BUG_ON(!zone_is_initialized(zone));
 	VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page);
 
 	VM_BUG_ON(migratetype == -1);
-	if (is_migrate_isolate(migratetype)) {
-		/*
-		 * We restrict max order of merging to prevent merge
-		 * between freepages on isolate pageblock and normal
-		 * pageblock. Without this, pageblock isolation
-		 * could cause incorrect freepage accounting.
-		 */
-		max_order = min(MAX_ORDER, pageblock_order + 1);
-	} else {
+	if (likely(!is_migrate_isolate(migratetype)))
 		__mod_zone_freepage_state(zone, 1 << order, migratetype);
-	}
 
-	page_idx = pfn & ((1 << max_order) - 1);
+	page_idx = pfn & ((1 << MAX_ORDER) - 1);
 
 	VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page);
 	VM_BUG_ON_PAGE(bad_range(zone, page), page);
 
+continue_merging:
 	while (order < max_order - 1) {
 		buddy_idx = __find_buddy_index(page_idx, order);
 		buddy = page + (buddy_idx - page_idx);
 		if (!page_is_buddy(page, buddy, order))
-			break;
+			goto done_merging;
 		/*
 		 * Our buddy is free or it is CONFIG_DEBUG_PAGEALLOC guard page,
 		 * merge with it and move up one order.
@@ -679,6 +673,32 @@ static inline void __free_one_page(struct page *page,
 		page_idx = combined_idx;
 		order++;
 	}
+	if (max_order < MAX_ORDER) {
+		/* If we are here, it means order is >= pageblock_order.
+		 * We want to prevent merge between freepages on isolate
+		 * pageblock and normal pageblock. Without this, pageblock
+		 * isolation could cause incorrect freepage or CMA accounting.
+		 *
+		 * We don't want to hit this code for the more frequent
+		 * low-order merging.
+		 */
+		if (unlikely(has_isolate_pageblock(zone))) {
+			int buddy_mt;
+
+			buddy_idx = __find_buddy_index(page_idx, order);
+			buddy = page + (buddy_idx - page_idx);
+			buddy_mt = get_pageblock_migratetype(buddy);
+
+			if (migratetype != buddy_mt
+					&& (is_migrate_isolate(migratetype) ||
+						is_migrate_isolate(buddy_mt)))
+				goto done_merging;
+		}
+		max_order++;
+		goto continue_merging;
+	}
+
+done_merging:
 	set_page_order(page, order);
 
 	/*
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 154/218] mac80211: avoid excessive stack usage in sta_info
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (152 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 153/218] mm/page_alloc: prevent merging between isolated and other pageblocks Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 155/218] clk: xgene: Add missing parenthesis when clearing divider value Kamal Mostafa
                   ` (63 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Johannes Berg, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 0ef049dc1167fe834d0ad5d63f89eddc5c70f6e4 upstream.

When CONFIG_OPTIMIZE_INLINING is set, the sta_info_insert_finish
function consumes more stack than normally, exceeding the
1024 byte limit on ARM:

net/mac80211/sta_info.c: In function 'sta_info_insert_finish':
net/mac80211/sta_info.c:561:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

It turns out that there are two functions that put a 'struct station_info'
on the stack: __sta_info_destroy_part2 and sta_info_insert_finish, and
this structure alone requires up to 792 bytes.

Hoping that both are called rarely enough, this replaces the
on-stack structure with a dynamic allocation, which unfortunately
requires some suboptimal error handling for out-of-memory.

The __sta_info_destroy_part2 function is actually affected by the
stack usage twice because it calls cfg80211_del_sta_sinfo(), which
has another instance of struct station_info on its stack.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 98b6218388e3 ("mac80211/cfg80211: add station events")
Fixes: 6f7a8d26e266 ("mac80211: send statistics with delete station event")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/sta_info.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 666ddac..3389959 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -474,11 +474,17 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
 {
 	struct ieee80211_local *local = sta->local;
 	struct ieee80211_sub_if_data *sdata = sta->sdata;
-	struct station_info sinfo;
+	struct station_info *sinfo;
 	int err = 0;
 
 	lockdep_assert_held(&local->sta_mtx);
 
+	sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
+	if (!sinfo) {
+		err = -ENOMEM;
+		goto out_err;
+	}
+
 	/* check if STA exists already */
 	if (sta_info_get_bss(sdata, sta->sta.addr)) {
 		err = -EEXIST;
@@ -510,10 +516,9 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
 	ieee80211_sta_debugfs_add(sta);
 	rate_control_add_sta_debugfs(sta);
 
-	memset(&sinfo, 0, sizeof(sinfo));
-	sinfo.filled = 0;
-	sinfo.generation = local->sta_generation;
-	cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
+	sinfo->generation = local->sta_generation;
+	cfg80211_new_sta(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);
+	kfree(sinfo);
 
 	sta_dbg(sdata, "Inserted STA %pM\n", sta->sta.addr);
 
@@ -875,7 +880,7 @@ static void __sta_info_destroy_part2(struct sta_info *sta)
 {
 	struct ieee80211_local *local = sta->local;
 	struct ieee80211_sub_if_data *sdata = sta->sdata;
-	struct station_info sinfo = {};
+	struct station_info *sinfo;
 	int ret;
 
 	/*
@@ -913,8 +918,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta)
 
 	sta_dbg(sdata, "Removed STA %pM\n", sta->sta.addr);
 
-	sta_set_sinfo(sta, &sinfo);
-	cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL);
+	sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL);
+	if (sinfo)
+		sta_set_sinfo(sta, sinfo);
+	cfg80211_del_sta_sinfo(sdata->dev, sta->sta.addr, sinfo, GFP_KERNEL);
+	kfree(sinfo);
 
 	rate_control_remove_sta_debugfs(sta);
 	ieee80211_sta_debugfs_remove(sta);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 155/218] clk: xgene: Add missing parenthesis when clearing divider value
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (153 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 154/218] mac80211: avoid excessive stack usage in sta_info Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 156/218] clk: qcom: msm8960: Fix ce3_src register offset Kamal Mostafa
                   ` (62 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Loc Ho, Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Loc Ho <lho@apm.com>

commit 0f4c7a138dfefb0ebdbaf56e3ba2acd2958a6605 upstream.

In the initial fix for non-zero divider shift value, the parenthesis
was missing after the negate operation. This patch adds the required
parenthesis. Otherwise, lower bits may be cleared unintentionally.

Signed-off-by: Loc Ho <lho@apm.com>
Acked-by: Toan Le <toanle@apm.com>
Fixes: 1382ea631ddd ("clk: xgene: Fix divider with non-zero shift value")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/clk-xgene.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c
index 2f9668b..3bea500 100644
--- a/drivers/clk/clk-xgene.c
+++ b/drivers/clk/clk-xgene.c
@@ -353,8 +353,8 @@ static int xgene_clk_set_rate(struct clk_hw *hw, unsigned long rate,
 		/* Set new divider */
 		data = xgene_clk_read(pclk->param.divider_reg +
 				pclk->param.reg_divider_offset);
-		data &= ~((1 << pclk->param.reg_divider_width) - 1)
-				<< pclk->param.reg_divider_shift;
+		data &= ~(((1 << pclk->param.reg_divider_width) - 1)
+				<< pclk->param.reg_divider_shift);
 		data |= divider;
 		xgene_clk_write(data, pclk->param.divider_reg +
 					pclk->param.reg_divider_offset);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 156/218] clk: qcom: msm8960: Fix ce3_src register offset
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (154 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 155/218] clk: xgene: Add missing parenthesis when clearing divider value Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 157/218] xen kconfig: don't "select INPUT_XEN_KBDDEV_FRONTEND" Kamal Mostafa
                   ` (61 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Stephen Boyd <sboyd@codeaurora.org>

commit 0f75e1a370fd843c9e508fc1ccf0662833034827 upstream.

The offset seems to have been copied from the sata clk. Fix it so
that enabling the crypto engine source clk works.

Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Fixes: 5f775498bdc4 ("clk: qcom: Fully support apq8064 global clock control")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/qcom/gcc-msm8960.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c
index eb6a4f9..8470ea4 100644
--- a/drivers/clk/qcom/gcc-msm8960.c
+++ b/drivers/clk/qcom/gcc-msm8960.c
@@ -2753,7 +2753,7 @@ static struct clk_rcg ce3_src = {
 	},
 	.freq_tbl = clk_tbl_ce3,
 	.clkr = {
-		.enable_reg = 0x2c08,
+		.enable_reg = 0x36c0,
 		.enable_mask = BIT(7),
 		.hw.init = &(struct clk_init_data){
 			.name = "ce3_src",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 157/218] xen kconfig: don't "select INPUT_XEN_KBDDEV_FRONTEND"
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (155 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 156/218] clk: qcom: msm8960: Fix ce3_src register offset Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 158/218] ppp: take reference on channels netns Kamal Mostafa
                   ` (60 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Tomi Valkeinen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 13aa38e291bdd4e4018f40dd2f75e464814dcbf3 upstream.

The Xen framebuffer driver selects the xen keyboard driver, so the latter
will be built-in if XEN_FBDEV_FRONTEND=y. However, when CONFIG_INPUT
is a loadable module, this configuration cannot work. On mainline kernels,
the symbol will be enabled but not used, while in combination with
a patch I have to detect such useless configurations, we get the
expected link failure:

drivers/input/built-in.o: In function `xenkbd_remove':
xen-kbdfront.c:(.text+0x2f0): undefined reference to `input_unregister_device'
xen-kbdfront.c:(.text+0x30e): undefined reference to `input_unregister_device'

This removes the extra "select", as it just causes more trouble than
it helps. In theory, some defconfig file might break if it has
XEN_FBDEV_FRONTEND in it but not INPUT_XEN_KBDDEV_FRONTEND. The Kconfig
fragment we ship in the kernel (kernel/configs/xen.config) however
already enables both, and anyone using an old .config file would
keep having both enabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: David Vrabel <david.vrabel@citrix.com>
Fixes: 36c1132e34bd ("xen kconfig: fix select INPUT_XEN_KBDDEV_FRONTEND")
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/video/fbdev/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index f888561..6f2cdec 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -2246,7 +2246,6 @@ config XEN_FBDEV_FRONTEND
 	select FB_SYS_IMAGEBLIT
 	select FB_SYS_FOPS
 	select FB_DEFERRED_IO
-	select INPUT_XEN_KBDDEV_FRONTEND if INPUT_MISC
 	select XEN_XENBUS_FRONTEND
 	default y
 	help
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 158/218] ppp: take reference on channels netns
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (156 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 157/218] xen kconfig: don't "select INPUT_XEN_KBDDEV_FRONTEND" Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 159/218] mdio-sun4i: oops in error handling in probe Kamal Mostafa
                   ` (59 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Guillaume Nault, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Guillaume Nault <g.nault@alphalink.fr>

commit 1f461dcdd296eecedaffffc6bae2bfa90bd7eb89 upstream.

Let channels hold a reference on their network namespace.
Some channel types, like ppp_async and ppp_synctty, can have their
userspace controller running in a different namespace. Therefore they
can't rely on them to preclude their netns from being removed from
under them.

==================================================================
BUG: KASAN: use-after-free in ppp_unregister_channel+0x372/0x3a0 at
addr ffff880064e217e0
Read of size 8 by task syz-executor/11581
=============================================================================
BUG net_namespace (Not tainted): kasan: bad access detected
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Allocated in copy_net_ns+0x6b/0x1a0 age=92569 cpu=3 pid=6906
[<      none      >] ___slab_alloc+0x4c7/0x500 kernel/mm/slub.c:2440
[<      none      >] __slab_alloc+0x4c/0x90 kernel/mm/slub.c:2469
[<     inline     >] slab_alloc_node kernel/mm/slub.c:2532
[<     inline     >] slab_alloc kernel/mm/slub.c:2574
[<      none      >] kmem_cache_alloc+0x23a/0x2b0 kernel/mm/slub.c:2579
[<     inline     >] kmem_cache_zalloc kernel/include/linux/slab.h:597
[<     inline     >] net_alloc kernel/net/core/net_namespace.c:325
[<      none      >] copy_net_ns+0x6b/0x1a0 kernel/net/core/net_namespace.c:360
[<      none      >] create_new_namespaces+0x2f6/0x610 kernel/kernel/nsproxy.c:95
[<      none      >] copy_namespaces+0x297/0x320 kernel/kernel/nsproxy.c:150
[<      none      >] copy_process.part.35+0x1bf4/0x5760 kernel/kernel/fork.c:1451
[<     inline     >] copy_process kernel/kernel/fork.c:1274
[<      none      >] _do_fork+0x1bc/0xcb0 kernel/kernel/fork.c:1723
[<     inline     >] SYSC_clone kernel/kernel/fork.c:1832
[<      none      >] SyS_clone+0x37/0x50 kernel/kernel/fork.c:1826
[<      none      >] entry_SYSCALL_64_fastpath+0x16/0x7a kernel/arch/x86/entry/entry_64.S:185

INFO: Freed in net_drop_ns+0x67/0x80 age=575 cpu=2 pid=2631
[<      none      >] __slab_free+0x1fc/0x320 kernel/mm/slub.c:2650
[<     inline     >] slab_free kernel/mm/slub.c:2805
[<      none      >] kmem_cache_free+0x2a0/0x330 kernel/mm/slub.c:2814
[<     inline     >] net_free kernel/net/core/net_namespace.c:341
[<      none      >] net_drop_ns+0x67/0x80 kernel/net/core/net_namespace.c:348
[<      none      >] cleanup_net+0x4e5/0x600 kernel/net/core/net_namespace.c:448
[<      none      >] process_one_work+0x794/0x1440 kernel/kernel/workqueue.c:2036
[<      none      >] worker_thread+0xdb/0xfc0 kernel/kernel/workqueue.c:2170
[<      none      >] kthread+0x23f/0x2d0 kernel/drivers/block/aoe/aoecmd.c:1303
[<      none      >] ret_from_fork+0x3f/0x70 kernel/arch/x86/entry/entry_64.S:468
INFO: Slab 0xffffea0001938800 objects=3 used=0 fp=0xffff880064e20000
flags=0x5fffc0000004080
INFO: Object 0xffff880064e20000 @offset=0 fp=0xffff880064e24200

CPU: 1 PID: 11581 Comm: syz-executor Tainted: G    B           4.4.0+
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 00000000ffffffff ffff8800662c7790 ffffffff8292049d ffff88003e36a300
 ffff880064e20000 ffff880064e20000 ffff8800662c77c0 ffffffff816f2054
 ffff88003e36a300 ffffea0001938800 ffff880064e20000 0000000000000000
Call Trace:
 [<     inline     >] __dump_stack kernel/lib/dump_stack.c:15
 [<ffffffff8292049d>] dump_stack+0x6f/0xa2 kernel/lib/dump_stack.c:50
 [<ffffffff816f2054>] print_trailer+0xf4/0x150 kernel/mm/slub.c:654
 [<ffffffff816f875f>] object_err+0x2f/0x40 kernel/mm/slub.c:661
 [<     inline     >] print_address_description kernel/mm/kasan/report.c:138
 [<ffffffff816fb0c5>] kasan_report_error+0x215/0x530 kernel/mm/kasan/report.c:236
 [<     inline     >] kasan_report kernel/mm/kasan/report.c:259
 [<ffffffff816fb4de>] __asan_report_load8_noabort+0x3e/0x40 kernel/mm/kasan/report.c:280
 [<     inline     >] ? ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ? ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ppp_pernet kernel/include/linux/compiler.h:218
 [<ffffffff83ad71b2>] ppp_unregister_channel+0x372/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<     inline     >] ? ppp_pernet kernel/drivers/net/ppp/ppp_generic.c:293
 [<ffffffff83ad6f26>] ? ppp_unregister_channel+0xe6/0x3a0 kernel/drivers/net/ppp/ppp_generic.c:2392
 [<ffffffff83ae18f3>] ppp_asynctty_close+0xa3/0x130 kernel/drivers/net/ppp/ppp_async.c:241
 [<ffffffff83ae1850>] ? async_lcp_peek+0x5b0/0x5b0 kernel/drivers/net/ppp/ppp_async.c:1000
 [<ffffffff82c33239>] tty_ldisc_close.isra.1+0x99/0xe0 kernel/drivers/tty/tty_ldisc.c:478
 [<ffffffff82c332c0>] tty_ldisc_kill+0x40/0x170 kernel/drivers/tty/tty_ldisc.c:744
 [<ffffffff82c34943>] tty_ldisc_release+0x1b3/0x260 kernel/drivers/tty/tty_ldisc.c:772
 [<ffffffff82c1ef21>] tty_release+0xac1/0x13e0 kernel/drivers/tty/tty_io.c:1901
 [<ffffffff82c1e460>] ? release_tty+0x320/0x320 kernel/drivers/tty/tty_io.c:1688
 [<ffffffff8174de36>] __fput+0x236/0x780 kernel/fs/file_table.c:208
 [<ffffffff8174e405>] ____fput+0x15/0x20 kernel/fs/file_table.c:244
 [<ffffffff813595ab>] task_work_run+0x16b/0x200 kernel/kernel/task_work.c:115
 [<     inline     >] exit_task_work kernel/include/linux/task_work.h:21
 [<ffffffff81307105>] do_exit+0x8b5/0x2c60 kernel/kernel/exit.c:750
 [<ffffffff813fdd20>] ? debug_check_no_locks_freed+0x290/0x290 kernel/kernel/locking/lockdep.c:4123
 [<ffffffff81306850>] ? mm_update_next_owner+0x6f0/0x6f0 kernel/kernel/exit.c:357
 [<ffffffff813215e6>] ? __dequeue_signal+0x136/0x470 kernel/kernel/signal.c:550
 [<ffffffff8132067b>] ? recalc_sigpending_tsk+0x13b/0x180 kernel/kernel/signal.c:145
 [<ffffffff81309628>] do_group_exit+0x108/0x330 kernel/kernel/exit.c:880
 [<ffffffff8132b9d4>] get_signal+0x5e4/0x14f0 kernel/kernel/signal.c:2307
 [<     inline     >] ? kretprobe_table_lock kernel/kernel/kprobes.c:1113
 [<ffffffff8151d355>] ? kprobe_flush_task+0xb5/0x450 kernel/kernel/kprobes.c:1158
 [<ffffffff8115f7d3>] do_signal+0x83/0x1c90 kernel/arch/x86/kernel/signal.c:712
 [<ffffffff8151d2a0>] ? recycle_rp_inst+0x310/0x310 kernel/include/linux/list.h:655
 [<ffffffff8115f750>] ? setup_sigcontext+0x780/0x780 kernel/arch/x86/kernel/signal.c:165
 [<ffffffff81380864>] ? finish_task_switch+0x424/0x5f0 kernel/kernel/sched/core.c:2692
 [<     inline     >] ? finish_lock_switch kernel/kernel/sched/sched.h:1099
 [<ffffffff81380560>] ? finish_task_switch+0x120/0x5f0 kernel/kernel/sched/core.c:2678
 [<     inline     >] ? context_switch kernel/kernel/sched/core.c:2807
 [<ffffffff85d794e9>] ? __schedule+0x919/0x1bd0 kernel/kernel/sched/core.c:3283
 [<ffffffff81003901>] exit_to_usermode_loop+0xf1/0x1a0 kernel/arch/x86/entry/common.c:247
 [<     inline     >] prepare_exit_to_usermode kernel/arch/x86/entry/common.c:282
 [<ffffffff810062ef>] syscall_return_slowpath+0x19f/0x210 kernel/arch/x86/entry/common.c:344
 [<ffffffff85d88022>] int_ret_from_sys_call+0x25/0x9f kernel/arch/x86/entry/entry_64.S:281
Memory state around the buggy address:
 ffff880064e21680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff880064e21780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff880064e21800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff880064e21880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Fixes: 273ec51dd7ce ("net: ppp_generic - introduce net-namespace functionality v2")
Reported-by: Baozeng Ding <sploving1@gmail.com>
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ppp/ppp_generic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index e82b43c..6fc526b 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -2277,7 +2277,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan)
 
 	pch->ppp = NULL;
 	pch->chan = chan;
-	pch->chan_net = net;
+	pch->chan_net = get_net(net);
 	chan->ppp = pch;
 	init_ppp_file(&pch->file, CHANNEL);
 	pch->file.hdrlen = chan->hdrlen;
@@ -2374,6 +2374,8 @@ ppp_unregister_channel(struct ppp_channel *chan)
 	spin_lock_bh(&pn->all_channels_lock);
 	list_del(&pch->list);
 	spin_unlock_bh(&pn->all_channels_lock);
+	put_net(pch->chan_net);
+	pch->chan_net = NULL;
 
 	pch->file.dead = 1;
 	wake_up_interruptible(&pch->file.rwait);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 159/218] mdio-sun4i: oops in error handling in probe
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (157 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 158/218] ppp: take reference on channels netns Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 160/218] clk: rockchip: free memory in error cases when registering clock branches Kamal Mostafa
                   ` (58 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 227f33beab746aeec4ef3305bd17b1d374df09e7 upstream.

We could end up dereferencing an error pointer when we call
regulator_disable().

Fixes: 4bdcb1dd9feb ('net: Add MDIO bus driver for the Allwinner EMAC')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/phy/mdio-sun4i.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c
index 15bc7f9..529bed2 100644
--- a/drivers/net/phy/mdio-sun4i.c
+++ b/drivers/net/phy/mdio-sun4i.c
@@ -132,6 +132,7 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
 			return -EPROBE_DEFER;
 
 		dev_info(&pdev->dev, "no regulator found\n");
+		data->regulator = NULL;
 	} else {
 		ret = regulator_enable(data->regulator);
 		if (ret)
@@ -147,7 +148,8 @@ static int sun4i_mdio_probe(struct platform_device *pdev)
 	return 0;
 
 err_out_disable_regulator:
-	regulator_disable(data->regulator);
+	if (data->regulator)
+		regulator_disable(data->regulator);
 err_out_free_mdiobus:
 	mdiobus_free(bus);
 	return ret;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 160/218] clk: rockchip: free memory in error cases when registering clock branches
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (158 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 159/218] mdio-sun4i: oops in error handling in probe Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 161/218] ARC: bitops: Remove non relevant comments Kamal Mostafa
                   ` (57 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Shawn Lin, Heiko Stuebner, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Shawn Lin <shawn.lin@rock-chips.com>

commit 2467b6745e0ae9c6cdccff24c4cceeb14b1cce3f upstream.

Add free memeory if rockchip_clk_register_branch fails.

Fixes: a245fecbb806 ("clk: rockchip: add basic infrastructure...")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/rockchip/clk.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 052b94d..051bfe8 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -70,7 +70,7 @@ static struct clk *rockchip_clk_register_branch(const char *name,
 	if (gate_offset >= 0) {
 		gate = kzalloc(sizeof(*gate), GFP_KERNEL);
 		if (!gate)
-			return ERR_PTR(-ENOMEM);
+			goto err_gate;
 
 		gate->flags = gate_flags;
 		gate->reg = base + gate_offset;
@@ -82,7 +82,7 @@ static struct clk *rockchip_clk_register_branch(const char *name,
 	if (div_width > 0) {
 		div = kzalloc(sizeof(*div), GFP_KERNEL);
 		if (!div)
-			return ERR_PTR(-ENOMEM);
+			goto err_div;
 
 		div->flags = div_flags;
 		div->reg = base + muxdiv_offset;
@@ -100,6 +100,11 @@ static struct clk *rockchip_clk_register_branch(const char *name,
 				     flags);
 
 	return clk;
+err_div:
+	kfree(gate);
+err_gate:
+	kfree(mux);
+	return ERR_PTR(-ENOMEM);
 }
 
 static struct clk *rockchip_clk_register_frac_branch(const char *name,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 161/218] ARC: bitops: Remove non relevant comments
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (159 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 160/218] clk: rockchip: free memory in error cases when registering clock branches Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 162/218] mac80211: fix txq queue related crashes Kamal Mostafa
                   ` (56 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Vineet Gupta, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Vineet Gupta <vgupta@synopsys.com>

commit 2a41b6dc28dc71c1a3f1622612a26edc58f7561e upstream.

commit 80f420842ff42 removed the ARC bitops microoptimization but failed
to prune the comments to same effect

Fixes: 80f420842ff42 ("ARC: Make ARC bitops "safer" (add anti-optimization)")
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arc/include/asm/bitops.h | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
index 57c1f33..0352fb8 100644
--- a/arch/arc/include/asm/bitops.h
+++ b/arch/arc/include/asm/bitops.h
@@ -35,21 +35,6 @@ static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\
 									\
 	m += nr >> 5;							\
 									\
-	/*								\
-	 * ARC ISA micro-optimization:					\
-	 *								\
-	 * Instructions dealing with bitpos only consider lower 5 bits	\
-	 * e.g (x << 33) is handled like (x << 1) by ASL instruction	\
-	 *  (mem pointer still needs adjustment to point to next word)	\
-	 *								\
-	 * Hence the masking to clamp @nr arg can be elided in general.	\
-	 *								\
-	 * However if @nr is a constant (above assumed in a register),	\
-	 * and greater than 31, gcc can optimize away (x << 33) to 0,	\
-	 * as overflow, given the 32-bit ISA. Thus masking needs to be	\
-	 * done for const @nr, but no code is generated due to gcc	\
-	 * const prop.							\
-	 */								\
 	nr &= 0x1f;							\
 									\
 	__asm__ __volatile__(						\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 162/218] mac80211: fix txq queue related crashes
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (160 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 161/218] ARC: bitops: Remove non relevant comments Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 163/218] net: Fix use after free in the recvmmsg exit path Kamal Mostafa
                   ` (55 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kazior, Johannes Berg, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Michal Kazior <michal.kazior@tieto.com>

commit 2a58d42c1e018ad514d4e23fd33fb2ded95d3ee6 upstream.

The driver can access the queue simultanously
while mac80211 tears down the interface. Without
spinlock protection this could lead to corrupting
sk_buff_head and subsequently to an invalid
pointer dereference.

Fixes: ba8c3d6f16a1 ("mac80211: add an intermediate software queue implementation")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/iface.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 436c423..2caf837 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -975,7 +975,10 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
 	if (sdata->vif.txq) {
 		struct txq_info *txqi = to_txq_info(sdata->vif.txq);
 
+		spin_lock_bh(&txqi->queue.lock);
 		ieee80211_purge_tx_queue(&local->hw, &txqi->queue);
+		spin_unlock_bh(&txqi->queue.lock);
+
 		atomic_set(&sdata->txqs_len[txqi->txq.ac], 0);
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 163/218] net: Fix use after free in the recvmmsg exit path
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (161 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 162/218] mac80211: fix txq queue related crashes Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 164/218] ath9k: fix misleading indentation Kamal Mostafa
                   ` (54 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Potapenko, Eric Dumazet, Kostya Serebryany,
	Sasha Levin, Arnaldo Carvalho de Melo, David S . Miller,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnaldo Carvalho de Melo <acme@redhat.com>

commit 34b88a68f26a75e4fded796f1a49c40f82234b7d upstream.

The syzkaller fuzzer hit the following use-after-free:

  Call Trace:
   [<ffffffff8175ea0e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:295
   [<ffffffff851cc31a>] __sys_recvmmsg+0x6fa/0x7f0 net/socket.c:2261
   [<     inline     >] SYSC_recvmmsg net/socket.c:2281
   [<ffffffff851cc57f>] SyS_recvmmsg+0x16f/0x180 net/socket.c:2270
   [<ffffffff86332bb6>] entry_SYSCALL_64_fastpath+0x16/0x7a
  arch/x86/entry/entry_64.S:185

And, as Dmitry rightly assessed, that is because we can drop the
reference and then touch it when the underlying recvmsg calls return
some packets and then hit an error, which will make recvmmsg to set
sock->sk->sk_err, oops, fix it.

Reported-and-Tested-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Fixes: a2e2725541fa ("net: Introduce recvmmsg socket syscall")
http://lkml.kernel.org/r/20160122211644.GC2470@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/socket.c | 38 +++++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index f3fbe17..f20cd74 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2244,31 +2244,31 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
 			break;
 	}
 
-out_put:
-	fput_light(sock->file, fput_needed);
-
 	if (err == 0)
-		return datagrams;
+		goto out_put;
 
-	if (datagrams != 0) {
+	if (datagrams == 0) {
+		datagrams = err;
+		goto out_put;
+	}
+
+	/*
+	 * We may return less entries than requested (vlen) if the
+	 * sock is non block and there aren't enough datagrams...
+	 */
+	if (err != -EAGAIN) {
 		/*
-		 * We may return less entries than requested (vlen) if the
-		 * sock is non block and there aren't enough datagrams...
+		 * ... or  if recvmsg returns an error after we
+		 * received some datagrams, where we record the
+		 * error to return on the next call or if the
+		 * app asks about it using getsockopt(SO_ERROR).
 		 */
-		if (err != -EAGAIN) {
-			/*
-			 * ... or  if recvmsg returns an error after we
-			 * received some datagrams, where we record the
-			 * error to return on the next call or if the
-			 * app asks about it using getsockopt(SO_ERROR).
-			 */
-			sock->sk->sk_err = -err;
-		}
-
-		return datagrams;
+		sock->sk->sk_err = -err;
 	}
+out_put:
+	fput_light(sock->file, fput_needed);
 
-	return err;
+	return datagrams;
 }
 
 SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 164/218] ath9k: fix misleading indentation
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (162 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 163/218] net: Fix use after free in the recvmmsg exit path Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 165/218] sctp: fix the transports round robin issue when init is retransmitted Kamal Mostafa
                   ` (53 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 362210e0dff4eb7bb36a9b34dbef3b39d779d95e upstream.

A cleanup patch in linux-3.18 moved around some code in the ath9k
driver and left some code to be indented in a misleading way,
made worse by the addition of some new code for p2p mode, as
discovered by a new gcc-6 warning:

drivers/net/wireless/ath/ath9k/init.c: In function 'ath9k_set_hw_capab':
drivers/net/wireless/ath/ath9k/init.c:851:4: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
    hw->wiphy->iface_combinations = if_comb;
    ^~
drivers/net/wireless/ath/ath9k/init.c:847:3: note: ...this 'if' clause, but it is not
   if (ath9k_is_chanctx_enabled())
   ^~

The code is in fact correct, but the indentation is not, so I'm
reformatting it as it should have been after the original cleanup.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 499afaccf6f3 ("ath9k: Isolate ath9k_use_chanctx module parameter")
Fixes: eb61f9f623f7 ("ath9k: advertise p2p dev support when chanctx")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath9k/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index bfddc9e..fc6dc52 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -855,8 +855,8 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 			BIT(NL80211_IFTYPE_MESH_POINT) |
 			BIT(NL80211_IFTYPE_WDS);
 
-			hw->wiphy->iface_combinations = if_comb;
-			hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
+		hw->wiphy->iface_combinations = if_comb;
+		hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb);
 	}
 
 	hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 165/218] sctp: fix the transports round robin issue when init is retransmitted
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (163 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 164/218] ath9k: fix misleading indentation Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 166/218] ethernet: micrel: fix some error codes Kamal Mostafa
                   ` (52 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Xin Long, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Xin Long <lucien.xin@gmail.com>

commit 39d2adebf137de5f900843f69f5e500932e31047 upstream.

prior to this patch, at the beginning if we have two paths in one assoc,
they may have the same params other than the last_time_heard, it will try
the paths like this:

1st cycle
  try trans1 fail.
  then trans2 is selected.(cause it's last_time_heard is after trans1).

2nd cycle:
  try  trans2 fail
  then trans2 is selected.(cause it's last_time_heard is after trans1).

3rd cycle:
  try  trans2 fail
  then trans2 is selected.(cause it's last_time_heard is after trans1).

....

trans1 will never have change to be selected, which is not what we expect.
we should keeping round robin all the paths if they are just added at the
beginning.

So at first every tranport's last_time_heard should be initialized 0, so
that we ensure they have the same value at the beginning, only by this,
all the transports could get equal chance to be selected.

Then for sctp_trans_elect_best, it should return the trans_next one when
*trans == *trans_next, so that we can try next if it fails,  but now it
always return trans. so we can fix it by exchanging these two params when
we calls sctp_trans_elect_tie().

Fixes: 4c47af4d5eb2 ('net: sctp: rework multihoming retransmission path selection to rfc4960')
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sctp/associola.c | 2 +-
 net/sctp/transport.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 197c3f5..0f8e18f 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1256,7 +1256,7 @@ static struct sctp_transport *sctp_trans_elect_best(struct sctp_transport *curr,
 	if (score_curr > score_best)
 		return curr;
 	else if (score_curr == score_best)
-		return sctp_trans_elect_tie(curr, best);
+		return sctp_trans_elect_tie(best, curr);
 	else
 		return best;
 }
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index a0a4318..f45b05d 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net,
 	 */
 	peer->rto = msecs_to_jiffies(net->sctp.rto_initial);
 
-	peer->last_time_heard = ktime_get();
+	peer->last_time_heard = ktime_set(0, 0);
 	peer->last_time_ecne_reduced = jiffies;
 
 	peer->param_flags = SPP_HB_DISABLE |
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 166/218] ethernet: micrel: fix some error codes
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (164 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 165/218] sctp: fix the transports round robin issue when init is retransmitted Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 167/218] megaraid_sas: add missing curly braces in ioctl handler Kamal Mostafa
                   ` (51 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 3af0d554c1ce11e9d0953381ff566271f9ab81a9 upstream.

There were two issues here:
1) dma_mapping_error() return true/false but we want to return -ENOMEM
2) If dmaengine_prep_slave_sg() failed then "err" wasn't set but
   presumably that should be -ENOMEM as well.

I changed the success path to "return 0;" instead of "return ret;" for
clarity.

Fixes: 94fe8c683cea ('ks8842: Support DMA when accessed via timberdale')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/micrel/ks8842.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c
index 09d2e16..cb0102d 100644
--- a/drivers/net/ethernet/micrel/ks8842.c
+++ b/drivers/net/ethernet/micrel/ks8842.c
@@ -561,8 +561,8 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev)
 		sg_init_table(sg, 1);
 		sg_dma_address(sg) = dma_map_single(adapter->dev,
 			ctl->skb->data, DMA_BUFFER_SIZE, DMA_FROM_DEVICE);
-		err = dma_mapping_error(adapter->dev, sg_dma_address(sg));
-		if (unlikely(err)) {
+		if (dma_mapping_error(adapter->dev, sg_dma_address(sg))) {
+			err = -ENOMEM;
 			sg_dma_address(sg) = 0;
 			goto out;
 		}
@@ -572,8 +572,10 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev)
 		ctl->adesc = dmaengine_prep_slave_sg(ctl->chan,
 			sg, 1, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT);
 
-		if (!ctl->adesc)
+		if (!ctl->adesc) {
+			err = -ENOMEM;
 			goto out;
+		}
 
 		ctl->adesc->callback_param = netdev;
 		ctl->adesc->callback = ks8842_dma_rx_cb;
@@ -584,7 +586,7 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev)
 		goto out;
 	}
 
-	return err;
+	return 0;
 out:
 	if (sg_dma_address(sg))
 		dma_unmap_single(adapter->dev, sg_dma_address(sg),
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 167/218] megaraid_sas: add missing curly braces in ioctl handler
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (165 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 166/218] ethernet: micrel: fix some error codes Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 168/218] clk-divider: make sure read-only dividers do not write to their register Kamal Mostafa
                   ` (50 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 3deb9438d34a09f6796639b652a01d110aca9f75 upstream.

gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl
function:

drivers/scsi/megaraid/megaraid_sas_base.c: In function 'megasas_mgmt_fw_ioctl':
drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
    kbuff_arr[i] = NULL;
    ^~~~~~~~~
drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if' clause, but it is not
   if (kbuff_arr[i])
   ^~

The code is actually correct, as there is no downside in clearing a NULL
pointer again.

This clarifies the code and avoids the warning by adding extra curly
braces.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 90dc9d98f01b ("megaraid_sas : MFI MPT linked list corruption fix")
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index ffe1096..9c385c0 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -6146,12 +6146,13 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	}
 
 	for (i = 0; i < ioc->sge_count; i++) {
-		if (kbuff_arr[i])
+		if (kbuff_arr[i]) {
 			dma_free_coherent(&instance->pdev->dev,
 					  le32_to_cpu(kern_sge32[i].length),
 					  kbuff_arr[i],
 					  le32_to_cpu(kern_sge32[i].phys_addr));
 			kbuff_arr[i] = NULL;
+		}
 	}
 
 	megasas_return_cmd(instance, cmd);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 168/218] clk-divider: make sure read-only dividers do not write to their register
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (166 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 167/218] megaraid_sas: add missing curly braces in ioctl handler Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 169/218] misc/bmp085: Enable building as a module Kamal Mostafa
                   ` (49 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Heiko Stuebner, Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Heiko Stuebner <heiko@sntech.de>

commit 50359819794b4a16ae35051cd80f2dab025f6019 upstream.

Commit e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1") removed
the special ops struct for read-only clocks and instead opted to handle
them inside the regular ops.

On the rk3368 this results in breakage as aclkm now gets set a value.
While it is the same divider value, the A53 core still doesn't like it,
which can result in the cpu ending up in a hang.
The reason being that "ACLKENMasserts one clock cycle before the rising
edge of ACLKM" and the clock should only be touched when STANDBYWFIL2
is asserted.

To fix this, reintroduce the read-only ops but do include the round_rate
callback. That way no writes that may be unsafe are done to the divider
register in any case.

The Rockchip use of the clk_divider_ops is adapted to this split again,
as is the nxp, lpc18xx-ccu driver that was included since the original
commit. On lpc18xx-ccu the divider seems to always be read-only
so only uses the new ops now.

Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1")
Reported-by: Zhang Qing <zhangqing@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/clk-divider.c         | 11 ++++++++++-
 drivers/clk/nxp/clk-lpc18xx-ccu.c |  2 +-
 drivers/clk/rockchip/clk.c        |  4 +++-
 include/linux/clk-provider.h      |  1 +
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 706b578..79f5c78 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -412,6 +412,12 @@ const struct clk_ops clk_divider_ops = {
 };
 EXPORT_SYMBOL_GPL(clk_divider_ops);
 
+const struct clk_ops clk_divider_ro_ops = {
+	.recalc_rate = clk_divider_recalc_rate,
+	.round_rate = clk_divider_round_rate,
+};
+EXPORT_SYMBOL_GPL(clk_divider_ro_ops);
+
 static struct clk *_register_divider(struct device *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 shift, u8 width,
@@ -435,7 +441,10 @@ static struct clk *_register_divider(struct device *dev, const char *name,
 		return ERR_PTR(-ENOMEM);
 
 	init.name = name;
-	init.ops = &clk_divider_ops;
+	if (clk_divider_flags & CLK_DIVIDER_READ_ONLY)
+		init.ops = &clk_divider_ro_ops;
+	else
+		init.ops = &clk_divider_ops;
 	init.flags = flags | CLK_IS_BASIC;
 	init.parent_names = (parent_name ? &parent_name: NULL);
 	init.num_parents = (parent_name ? 1 : 0);
diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c
index eeaee97..d27fd7a 100644
--- a/drivers/clk/nxp/clk-lpc18xx-ccu.c
+++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c
@@ -209,7 +209,7 @@ static void lpc18xx_ccu_register_branch_gate_div(struct lpc18xx_clk_branch *bran
 		div->width = 1;
 
 		div_hw = &div->hw;
-		div_ops = &clk_divider_ops;
+		div_ops = &clk_divider_ro_ops;
 	}
 
 	branch->gate.reg = branch->offset + reg_base;
diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c
index 051bfe8..a9bdfd7 100644
--- a/drivers/clk/rockchip/clk.c
+++ b/drivers/clk/rockchip/clk.c
@@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register_branch(const char *name,
 		div->width = div_width;
 		div->lock = lock;
 		div->table = div_table;
-		div_ops = &clk_divider_ops;
+		div_ops = (div_flags & CLK_DIVIDER_READ_ONLY)
+						? &clk_divider_ro_ops
+						: &clk_divider_ops;
 	}
 
 	clk = clk_register_composite(NULL, name, parent_names, num_parents,
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 78842f4..c707cfbe 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -362,6 +362,7 @@ struct clk_divider {
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 
 extern const struct clk_ops clk_divider_ops;
+extern const struct clk_ops clk_divider_ro_ops;
 
 unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate,
 		unsigned int val, const struct clk_div_table *table,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 169/218] misc/bmp085: Enable building as a module
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (167 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 168/218] clk-divider: make sure read-only dividers do not write to their register Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 170/218] HID: logitech: fix Dual Action gamepad support Kamal Mostafa
                   ` (48 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Andersson, Ben Hutchings, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Ben Hutchings <ben@decadent.org.uk>

commit 50e6315dba721cbc24ccd6d7b299f1782f210a98 upstream.

Commit 985087dbcb02 'misc: add support for bmp18x chips to the bmp085
driver' changed the BMP085 config symbol to a boolean.  I see no
reason why the shared code cannot be built as a module, so change it
back to tristate.

Fixes: 985087dbcb02 ("misc: add support for bmp18x chips to the bmp085 driver")
Cc: Eric Andersson <eric.andersson@unixphere.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/misc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 42c3852..719e375 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -429,7 +429,7 @@ config ARM_CHARLCD
 	  still useful.
 
 config BMP085
-	bool
+	tristate
 	depends on SYSFS
 
 config BMP085_I2C
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 170/218] HID: logitech: fix Dual Action gamepad support
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (168 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 169/218] misc/bmp085: Enable building as a module Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 171/218] net/mlx5: Make command timeout way shorter Kamal Mostafa
                   ` (47 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Vitaly Katraew, Grazvydas Ignotas, Jiri Kosina, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Grazvydas Ignotas <notasas@gmail.com>

commit 5d74325a2201376a95520a4a38a1ce2c65761c49 upstream.

The patch that added Logitech Dual Action gamepad support forgot to
update the special driver list for the device. This caused the logitech
driver not to probe unless kernel module load order was favorable.
Update the special driver list to fix it. Thanks to Simon Wood for the
idea.

Cc: Vitaly Katraew <zawullon@gmail.com>
Fixes: 56d0c8b7c8fb ("HID: add support for Logitech Dual Action gamepads")
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/hid/hid-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 349af67..330a5f9 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1870,6 +1870,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_DUAL_ACTION) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WHEEL) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD) },
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 171/218] net/mlx5: Make command timeout way shorter
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (169 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 170/218] HID: logitech: fix Dual Action gamepad support Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 172/218] ASoC: ssm4567: Reset device before regcache_sync() Kamal Mostafa
                   ` (46 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Or Gerlitz, Leon Romanovsky, Saeed Mahameed, David S . Miller,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Or Gerlitz <ogerlitz@mellanox.com>

commit 6b6c07bdcdc97ccac2596063bfc32a5faddfe884 upstream.

The command timeout is terribly long, whole two hours. Make it 60s so if
things do go wrong, the user gets feedback in relatively short time, so
they can take corrective actions and/or investigate using tools and such.

Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/mlx5/driver.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
index 5722d88..26d92aa 100644
--- a/include/linux/mlx5/driver.h
+++ b/include/linux/mlx5/driver.h
@@ -54,7 +54,7 @@ enum {
 	/* one minute for the sake of bringup. Generally, commands must always
 	 * complete and we may need to increase this timeout value
 	 */
-	MLX5_CMD_TIMEOUT_MSEC	= 7200 * 1000,
+	MLX5_CMD_TIMEOUT_MSEC	= 60 * 1000,
 	MLX5_CMD_WQ_MAX_NAME	= 32,
 };
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 172/218] ASoC: ssm4567: Reset device before regcache_sync()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (170 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 171/218] net/mlx5: Make command timeout way shorter Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 173/218] fbdev: da8xx-fb: fix videomodes of lcd panels Kamal Mostafa
                   ` (45 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Lars-Peter Clausen, Mark Brown, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Lars-Peter Clausen <lars@metafoo.de>

commit 712a8038cc24dba668afe82f0413714ca87184e0 upstream.

When the ssm4567 is powered up the driver calles regcache_sync() to restore
the register map content. regcache_sync() assumes that the device is in its
power-on reset state. Make sure that this is the case by explicitly
resetting the ssm4567 register map before calling regcache_sync() otherwise
we might end up with a incorrect register map which leads to undefined
behaviour.

One such undefined behaviour was observed when returning from system
suspend while a playback stream is active, in that case the ssm4567 was
kept muted after resume.

Fixes: 1ee44ce03011 ("ASoC: ssm4567: Add driver for Analog Devices SSM4567 amplifier")
Reported-by: Harsha Priya <harshapriya.n@intel.com>
Tested-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/soc/codecs/ssm4567.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c
index 84a4f5a..0bfc28b 100644
--- a/sound/soc/codecs/ssm4567.c
+++ b/sound/soc/codecs/ssm4567.c
@@ -338,6 +338,11 @@ static int ssm4567_set_power(struct ssm4567 *ssm4567, bool enable)
 	regcache_cache_only(ssm4567->regmap, !enable);
 
 	if (enable) {
+		ret = regmap_write(ssm4567->regmap, SSM4567_REG_SOFT_RESET,
+			0x00);
+		if (ret)
+			return ret;
+
 		ret = regmap_update_bits(ssm4567->regmap,
 			SSM4567_REG_POWER_CTRL,
 			SSM4567_POWER_SPWDN, 0x00);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 173/218] fbdev: da8xx-fb: fix videomodes of lcd panels
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (171 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 172/218] ASoC: ssm4567: Reset device before regcache_sync() Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 174/218] clk: qcom: msm8960: fix ce3_core clk enable register Kamal Mostafa
                   ` (44 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sushaanth Srirangapathi, Tomi Valkeinen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Sushaanth Srirangapathi <sushaanth.s@ti.com>

commit 713fced8d10fa1c759c8fb6bf9aaa681bae68cad upstream.

Commit 028cd86b794f4a ("video: da8xx-fb: fix the polarities of the
hsync/vsync pulse") fixes polarities of HSYNC/VSYNC pulse but
forgot to update known_lcd_panels[] which had sync values
according to old logic. This breaks LCD at least on DA850 EVM.

This patch fixes this issue and I have tested this for panel
"Sharp_LK043T1DG01" using DA850 EVM board.

Fixes: 028cd86b794f4a ("video: da8xx-fb: fix the polarities of the hsync/vsync pulse")
Signed-off-by: Sushaanth Srirangapathi <sushaanth.s@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/video/fbdev/da8xx-fb.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index 0081725c..d005100 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -209,8 +209,7 @@ static struct fb_videomode known_lcd_panels[] = {
 		.lower_margin   = 2,
 		.hsync_len      = 0,
 		.vsync_len      = 0,
-		.sync           = FB_SYNC_CLK_INVERT |
-			FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.sync           = FB_SYNC_CLK_INVERT,
 	},
 	/* Sharp LK043T1DG01 */
 	[1] = {
@@ -224,7 +223,7 @@ static struct fb_videomode known_lcd_panels[] = {
 		.lower_margin   = 2,
 		.hsync_len      = 41,
 		.vsync_len      = 10,
-		.sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.sync           = 0,
 		.flag           = 0,
 	},
 	[2] = {
@@ -239,7 +238,7 @@ static struct fb_videomode known_lcd_panels[] = {
 		.lower_margin   = 10,
 		.hsync_len      = 10,
 		.vsync_len      = 10,
-		.sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+		.sync           = 0,
 		.flag           = 0,
 	},
 	[3] = {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 174/218] clk: qcom: msm8960: fix ce3_core clk enable register
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (172 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 173/218] fbdev: da8xx-fb: fix videomodes of lcd panels Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 175/218] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Kamal Mostafa
                   ` (43 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Srinivas Kandagatla, Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

commit 732d6913691848db9fabaa6a25b4d6fad10ddccf upstream.

This patch corrects the enable register offset which is actually 0x36cc
instead of 0x36c4

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Fixes: 5f775498bdc4 ("clk: qcom: Fully support apq8064 global clock control")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/qcom/gcc-msm8960.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c
index 8470ea4..476d209 100644
--- a/drivers/clk/qcom/gcc-msm8960.c
+++ b/drivers/clk/qcom/gcc-msm8960.c
@@ -2769,7 +2769,7 @@ static struct clk_branch ce3_core_clk = {
 	.halt_reg = 0x2fdc,
 	.halt_bit = 5,
 	.clkr = {
-		.enable_reg = 0x36c4,
+		.enable_reg = 0x36cc,
 		.enable_mask = BIT(4),
 		.hw.init = &(struct clk_init_data){
 			.name = "ce3_core_clk",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 175/218] ipvs: correct initial offset of Call-ID header search in SIP persistence engine
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (173 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 174/218] clk: qcom: msm8960: fix ce3_core clk enable register Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 176/218] drm/i915: Cleanup phys status page too Kamal Mostafa
                   ` (42 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marco Angaroni, Simon Horman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Marco Angaroni <marcoangaroni@gmail.com>

commit 7617a24f83b5d67f4dab1844956be1cebc44aec8 upstream.

The IPVS SIP persistence engine is not able to parse the SIP header
"Call-ID" when such header is inserted in the first positions of
the SIP message.

When IPVS is configured with "--pe sip" option, like for example:
ipvsadm -A -u 1.2.3.4:5060 -s rr --pe sip -p 120 -o
some particular messages (see below for details) do not create entries
in the connection template table, which can be listed with:
ipvsadm -Lcn --persistent-conn

Problematic SIP messages are SIP responses having "Call-ID" header
positioned just after message first line:
SIP/2.0 200 OK
[Call-ID header here]
[rest of the headers]

When "Call-ID" header is positioned down (after a few other headers)
it is correctly recognized.

This is due to the data offset used in get_callid function call inside
ip_vs_pe_sip.c file: since dptr already points to the start of the
SIP message, the value of dataoff should be initially 0.
Otherwise the header is searched starting from some bytes after the
first character of the SIP message.

Fixes: 758ff0338722 ("IPVS: sip persistence engine")
Signed-off-by: Marco Angaroni <marcoangaroni@gmail.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/netfilter/ipvs/ip_vs_pe_sip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c
index bed5f70..bb318e4 100644
--- a/net/netfilter/ipvs/ip_vs_pe_sip.c
+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c
@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb)
 	dptr = skb->data + dataoff;
 	datalen = skb->len - dataoff;
 
-	if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen))
+	if (get_callid(dptr, 0, datalen, &matchoff, &matchlen))
 		return -EINVAL;
 
 	/* N.B: pe_data is only set on success,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 176/218] drm/i915: Cleanup phys status page too
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (174 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 175/218] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 177/218] spi: rockchip: modify DMA max burst to 1 Kamal Mostafa
                   ` (41 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Wilson, Ville Syrjälä, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= <ville.syrjala@linux.intel.com>

commit 7d3fdfff23852fe458a0d0979a3555fe60f1e563 upstream.

Restore the lost phys status page cleanup.

Fixes the following splat with DMA_API_DEBUG=y:

WARNING: CPU: 0 PID: 21615 at ../lib/dma-debug.c:974 dma_debug_device_change+0x190/0x1f0()
pci 0000:00:02.0: DMA-API: device driver has pending DMA allocations while released from device [count=1]
               One of leaked entries details: [device address=0x0000000023163000] [size=4096 bytes] [mapped with DMA_BIDIRECTIONAL] [mapped as coherent]
Modules linked in: i915(-) i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm sha256_generic hmac drbg ctr ccm sch_fq_codel binfmt_misc joydev mousedev arc4 ath5k iTCO_wdt mac80211 smsc_ircc2 ath snd_intel8x0m snd_intel8x0 snd_ac97_codec ac97_bus psmouse snd_pcm input_leds i2c_i801 pcspkr snd_timer cfg80211 snd soundcore i2c_core ehci_pci firewire_ohci ehci_hcd firewire_core lpc_ich 8139too rfkill crc_itu_t mfd_core mii usbcore rng_core intel_agp intel_gtt usb_common agpgart irda crc_ccitt fujitsu_laptop led_class parport_pc video parport evdev backlight
CPU: 0 PID: 21615 Comm: rmmod Tainted: G     U          4.4.0-rc4-mgm-ovl+ #4
Hardware name: FUJITSU SIEMENS LIFEBOOK S6120/FJNB16C, BIOS Version 1.26  05/10/2004
 e31a3de0 e31a3de0 e31a3d9c c128d4bd e31a3dd0 c1045a0c c15e00c4 e31a3dfc
 0000546f c15dfad2 000003ce c12b3740 000003ce c12b3740 00000000 00000001
 f61fb8a0 e31a3de8 c1045a83 00000009 e31a3de0 c15e00c4 e31a3dfc e31a3e4c
Call Trace:
 [<c128d4bd>] dump_stack+0x16/0x19
 [<c1045a0c>] warn_slowpath_common+0x8c/0xd0
 [<c12b3740>] ? dma_debug_device_change+0x190/0x1f0
 [<c12b3740>] ? dma_debug_device_change+0x190/0x1f0
 [<c1045a83>] warn_slowpath_fmt+0x33/0x40
 [<c12b3740>] dma_debug_device_change+0x190/0x1f0
 [<c1065499>] notifier_call_chain+0x59/0x70
 [<c10655af>] __blocking_notifier_call_chain+0x3f/0x80
 [<c106560f>] blocking_notifier_call_chain+0x1f/0x30
 [<c134cfb3>] __device_release_driver+0xc3/0xf0
 [<c134d0d7>] driver_detach+0x97/0xa0
 [<c134c440>] bus_remove_driver+0x40/0x90
 [<c134db18>] driver_unregister+0x28/0x60
 [<c1079e8c>] ? trace_hardirqs_on_caller+0x12c/0x1d0
 [<c12c0618>] pci_unregister_driver+0x18/0x80
 [<f83e96e7>] drm_pci_exit+0x87/0xb0 [drm]
 [<f8b3be2d>] i915_exit+0x1b/0x1ee [i915]
 [<c10b999c>] SyS_delete_module+0x14c/0x210
 [<c1079e8c>] ? trace_hardirqs_on_caller+0x12c/0x1d0
 [<c115a9bd>] ? ____fput+0xd/0x10
 [<c1002014>] do_fast_syscall_32+0xa4/0x450
 [<c149f6fa>] sysenter_past_esp+0x3b/0x5d
---[ end trace c2ecbc77760f10a0 ]---
Mapped at:
 [<c12b3183>] debug_dma_alloc_coherent+0x33/0x90
 [<f83e989c>] drm_pci_alloc+0x18c/0x1e0 [drm]
 [<f8acd59f>] intel_init_ring_buffer+0x2af/0x490 [i915]
 [<f8acd8b0>] intel_init_render_ring_buffer+0x130/0x750 [i915]
 [<f8aaea4e>] i915_gem_init_rings+0x1e/0x110 [i915]

v2: s/BUG_ON/WARN_ON/ since dim doens't like the former anymore

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Fixes: 5c6c600 ("drm/i915: Remove DRI1 ring accessors and API")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
Link: http://patchwork.freedesktop.org/patch/msgid/1452538112-5331-1-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index ba672aa..ce10f86 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1853,6 +1853,17 @@ i915_dispatch_execbuffer(struct intel_engine_cs *ring,
 	return 0;
 }
 
+static void cleanup_phys_status_page(struct intel_engine_cs *ring)
+{
+	struct drm_i915_private *dev_priv = to_i915(ring->dev);
+
+	if (!dev_priv->status_page_dmah)
+		return;
+
+	drm_pci_free(ring->dev, dev_priv->status_page_dmah);
+	ring->status_page.page_addr = NULL;
+}
+
 static void cleanup_status_page(struct intel_engine_cs *ring)
 {
 	struct drm_i915_gem_object *obj;
@@ -1869,9 +1880,9 @@ static void cleanup_status_page(struct intel_engine_cs *ring)
 
 static int init_status_page(struct intel_engine_cs *ring)
 {
-	struct drm_i915_gem_object *obj;
+	struct drm_i915_gem_object *obj = ring->status_page.obj;
 
-	if ((obj = ring->status_page.obj) == NULL) {
+	if (obj == NULL) {
 		unsigned flags;
 		int ret;
 
@@ -2025,7 +2036,7 @@ static int intel_init_ring_buffer(struct drm_device *dev,
 		if (ret)
 			goto error;
 	} else {
-		BUG_ON(ring->id != RCS);
+		WARN_ON(ring->id != RCS);
 		ret = init_phys_status_page(ring);
 		if (ret)
 			goto error;
@@ -2089,7 +2100,12 @@ void intel_cleanup_ring_buffer(struct intel_engine_cs *ring)
 	if (ring->cleanup)
 		ring->cleanup(ring);
 
-	cleanup_status_page(ring);
+	if (I915_NEED_GFX_HWS(ring->dev)) {
+		cleanup_status_page(ring);
+	} else {
+		WARN_ON(ring->id != RCS);
+		cleanup_phys_status_page(ring);
+	}
 
 	i915_cmd_parser_fini_ring(ring);
 	i915_gem_batch_pool_fini(&ring->batch_pool);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 177/218] spi: rockchip: modify DMA max burst to 1
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (175 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 176/218] drm/i915: Cleanup phys status page too Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 178/218] ata: ahci_xgene: dereferencing uninitialized pointer in probe Kamal Mostafa
                   ` (40 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Addy ke, Shawn Lin, Heiko Stuebner, Olof Johansson,
	Doug Anderson, Sonny Rao, Caesar Wang, Vinod Koul, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Addy Ke <addy.ke@rock-chips.com>

commit 80abf8880cc6e1594c11b7c417f22dde60e25312 upstream.

Generic dma controller on Rockchips' platform cannot support
DMAFLUSHP instruction which make dma to flush the req of non-aligned
or non-multiple of what we need. That will cause an unrecoverable
dma bus error. The saftest way is to set dma max burst to 1.

Signed-off-by: Addy ke <addy.ke@rock-chips.com>
Fixes: 64e36824b32b06 ("spi/rockchip: add driver for Rockchip...")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
cc: Heiko Stuebner <heiko@sntech.de>
cc: Olof Johansson <olof@lixom.net>
cc: Doug Anderson <dianders@chromium.org>
cc: Sonny Rao <sonnyrao@chromium.org>

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/spi/spi-rockchip.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 68e7efe..2fed713 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -199,6 +199,7 @@ struct rockchip_spi {
 	struct sg_table rx_sg;
 	struct rockchip_spi_dma_data dma_rx;
 	struct rockchip_spi_dma_data dma_tx;
+	struct dma_slave_caps dma_caps;
 };
 
 static inline void spi_enable_chip(struct rockchip_spi *rs, int enable)
@@ -449,7 +450,10 @@ static void rockchip_spi_prepare_dma(struct rockchip_spi *rs)
 		rxconf.direction = rs->dma_rx.direction;
 		rxconf.src_addr = rs->dma_rx.addr;
 		rxconf.src_addr_width = rs->n_bytes;
-		rxconf.src_maxburst = rs->n_bytes;
+		if (rs->dma_caps.max_burst > 4)
+			rxconf.src_maxburst = 4;
+		else
+			rxconf.src_maxburst = 1;
 		dmaengine_slave_config(rs->dma_rx.ch, &rxconf);
 
 		rxdesc = dmaengine_prep_slave_sg(
@@ -466,7 +470,10 @@ static void rockchip_spi_prepare_dma(struct rockchip_spi *rs)
 		txconf.direction = rs->dma_tx.direction;
 		txconf.dst_addr = rs->dma_tx.addr;
 		txconf.dst_addr_width = rs->n_bytes;
-		txconf.dst_maxburst = rs->n_bytes;
+		if (rs->dma_caps.max_burst > 4)
+			txconf.dst_maxburst = 4;
+		else
+			txconf.dst_maxburst = 1;
 		dmaengine_slave_config(rs->dma_tx.ch, &txconf);
 
 		txdesc = dmaengine_prep_slave_sg(
@@ -731,6 +738,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 	}
 
 	if (rs->dma_tx.ch && rs->dma_rx.ch) {
+		dma_get_slave_caps(rs->dma_rx.ch, &(rs->dma_caps));
 		rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR);
 		rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR);
 		rs->dma_tx.direction = DMA_MEM_TO_DEV;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 178/218] ata: ahci_xgene: dereferencing uninitialized pointer in probe
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (176 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 177/218] spi: rockchip: modify DMA max burst to 1 Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 179/218] ath9k: fix buffer overrun for ar9287 Kamal Mostafa
                   ` (39 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Dan Carpenter, Tejun Heo, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 8134233e8d346aaa1c929dc510e75482ae318bce upstream.

If the call to acpi_get_object_info() fails then "info" hasn't been
initialized.  In that situation, we already know that "version" should
be XGENE_AHCI_V1 so we don't actually need to dereference "info".

Fixes: c9802a4be661 ('ata: ahci_xgene: Add AHCI Support for 2nd HW version of APM X-Gene SoC AHCI SATA Host controller.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/ata/ahci_xgene.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
index e2c6d9e..e916bff 100644
--- a/drivers/ata/ahci_xgene.c
+++ b/drivers/ata/ahci_xgene.c
@@ -739,9 +739,9 @@ static int xgene_ahci_probe(struct platform_device *pdev)
 				dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n",
 					__func__);
 				version = XGENE_AHCI_V1;
-			}
-			if (info->valid & ACPI_VALID_CID)
+			} else if (info->valid & ACPI_VALID_CID) {
 				version = XGENE_AHCI_V2;
+			}
 		}
 	}
 #endif
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 179/218] ath9k: fix buffer overrun for ar9287
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (177 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 178/218] ata: ahci_xgene: dereferencing uninitialized pointer in probe Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 180/218] perf tools: handle spaces in file names obtained from /proc/pid/maps Kamal Mostafa
                   ` (38 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 83d6f1f15f8cce844b0a131cbc63e444620e48b5 upstream.

Code that was added back in 2.6.38 has an obvious overflow
when accessing a static array, and at the time it was added
only a code comment was put in front of it as a reminder
to have it reviewed properly.

This has not happened, but gcc-6 now points to the specific
overflow:

drivers/net/wireless/ath/ath9k/eeprom.c: In function 'ath9k_hw_get_gain_boundaries_pdadcs':
drivers/net/wireless/ath/ath9k/eeprom.c:483:44: error: array subscript is above array bounds [-Werror=array-bounds]
     maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~

It turns out that the correct array length exists in the local
'intercepts' variable of this function, so we can just use that
instead of hardcoding '4', so this patch changes all three
instances to use that variable. The other two instances were
already correct, but it's more consistent this way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 940cd2c12ebf ("ath9k_hw: merge the ar9287 version of ath9k_hw_get_gain_boundaries_pdadcs")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/wireless/ath/ath9k/eeprom.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c
index cc81482..113a43f 100644
--- a/drivers/net/wireless/ath/ath9k/eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/eeprom.c
@@ -403,10 +403,9 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 
 	if (match) {
 		if (AR_SREV_9287(ah)) {
-			/* FIXME: array overrun? */
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_9287[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_9287[idxL].pwrPdg[i],
 						data_9287[idxL].vpdPdg[i],
@@ -416,7 +415,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 		} else if (eeprom_4k) {
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_4k[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_4k[idxL].pwrPdg[i],
 						data_4k[idxL].vpdPdg[i],
@@ -426,7 +425,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah,
 		} else {
 			for (i = 0; i < numXpdGains; i++) {
 				minPwrT4[i] = data_def[idxL].pwrPdg[i][0];
-				maxPwrT4[i] = data_def[idxL].pwrPdg[i][4];
+				maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1];
 				ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
 						data_def[idxL].pwrPdg[i],
 						data_def[idxL].vpdPdg[i],
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 180/218] perf tools: handle spaces in file names obtained from /proc/pid/maps
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (178 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 179/218] ath9k: fix buffer overrun for ar9287 Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 181/218] rtc: ds1685: passing bogus values to irq_restore Kamal Mostafa
                   ` (37 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Ślusarz, Arnaldo Carvalho de Melo, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= <marcin.slusarz@gmail.com>

commit 89fee59b504f86925894fcc9ba79d5c933842f93 upstream.

Steam frequently puts game binaries in folders with spaces.

Note: "(deleted)" markers are now treated as part of the file name.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Fixes: 6064803313ba ("perf tools: Use sscanf for parsing /proc/pid/maps")
Link: http://lkml.kernel.org/r/20160119190303.GA17579@marcin-Inspiron-7720
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/perf/util/event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 67a977e..075f9ca 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -271,7 +271,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 		strcpy(execname, "");
 
 		/* 00400000-0040c000 r-xp 00000000 fd:01 41038  /bin/cat */
-		n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %s\n",
+		n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %[^\n]\n",
 		       &event->mmap2.start, &event->mmap2.len, prot,
 		       &event->mmap2.pgoff, &event->mmap2.maj,
 		       &event->mmap2.min,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 181/218] rtc: ds1685: passing bogus values to irq_restore
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (179 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 180/218] perf tools: handle spaces in file names obtained from /proc/pid/maps Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 182/218] ARM: davinci: make I2C support optional Kamal Mostafa
                   ` (36 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Alexandre Belloni, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 8c09b9fdecab1f4a289f07b46e2ad174b6641928 upstream.

We call spin_lock_irqrestore with "flags" set to zero instead of to the
value from spin_lock_irqsave().

Fixes: aaaf5fbf56f1 ('rtc: add driver for DS1685 family of real time clocks')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/rtc/rtc-ds1685.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-ds1685.c b/drivers/rtc/rtc-ds1685.c
index 818a363..8686588 100644
--- a/drivers/rtc/rtc-ds1685.c
+++ b/drivers/rtc/rtc-ds1685.c
@@ -187,9 +187,9 @@ ds1685_rtc_end_data_access(struct ds1685_priv *rtc)
  * Only use this where you are certain another lock will not be held.
  */
 static inline void
-ds1685_rtc_begin_ctrl_access(struct ds1685_priv *rtc, unsigned long flags)
+ds1685_rtc_begin_ctrl_access(struct ds1685_priv *rtc, unsigned long *flags)
 {
-	spin_lock_irqsave(&rtc->lock, flags);
+	spin_lock_irqsave(&rtc->lock, *flags);
 	ds1685_rtc_switch_to_bank1(rtc);
 }
 
@@ -1304,7 +1304,7 @@ ds1685_rtc_sysfs_ctrl_regs_store(struct device *dev,
 {
 	struct ds1685_priv *rtc = dev_get_drvdata(dev);
 	u8 reg = 0, bit = 0, tmp;
-	unsigned long flags = 0;
+	unsigned long flags;
 	long int val = 0;
 	const struct ds1685_rtc_ctrl_regs *reg_info =
 		ds1685_rtc_sysfs_ctrl_regs_lookup(attr->attr.name);
@@ -1325,7 +1325,7 @@ ds1685_rtc_sysfs_ctrl_regs_store(struct device *dev,
 	bit = reg_info->bit;
 
 	/* Safe to spinlock during a write. */
-	ds1685_rtc_begin_ctrl_access(rtc, flags);
+	ds1685_rtc_begin_ctrl_access(rtc, &flags);
 	tmp = rtc->read(rtc, reg);
 	rtc->write(rtc, reg, (val ? (tmp | bit) : (tmp & ~(bit))));
 	ds1685_rtc_end_ctrl_access(rtc, flags);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 182/218] ARM: davinci: make I2C support optional
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (180 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 181/218] rtc: ds1685: passing bogus values to irq_restore Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 183/218] drm/amdkfd: uninitialized variable in dbgdev_wave_control_set_registers() Kamal Mostafa
                   ` (35 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Sekhar Nori, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 8e58041114319ad290e85a7a82077dc9e2f93613 upstream.

The davinci platform has tried to get support for the EEPROM right,
but failed to get a clean build so far. At the moment, we get
a warning whenever CONFIG_SYSFS is disabled, as that is needed by
EEPROM_AT24:

warning: (MACH_DAVINCI_EVM && MACH_SFFSDR && MACH_DAVINCI_DM6467_EVM && MACH_DAVINCI_DM365_EVM && MACH_DAVINCI_DA830_EVM && MACH_MITYOMAPL138 && MACH_MINI2440) selects EEPROM_AT24 which has unmet direct dependencies (I2C && SYSFS)

Kevin Hilman initially added the 'select' to ensure that EEPROM_AT24
is always enabled in machines that really want it for normal operation
(i.e. for reading the MAC address). This broke when I2C was disabled,
and Russell King followed up with another patch to select that as
well.

I now see that the SYSFS dependency is still missing, which leaves
us with three options:

a) add 'select SYSFS' in addition to the others
b) change AT24_EEPPROM to work without sysfs (should be possible)
c) remove all those selects again and get the files to build when
   I2C is disabled.

I would really hate to do a) because adding select statements that
hardwire user-selectable symbols is generally a bad idea. I first
tried b) but then ended up redoing the patch from scratch to approach
c), so we can also remove the other selects.

I checked that CONFIG_I2C is still enabled with davinci_all_defconfig,
so that does not have to change.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 45b146d746ea ("ARM: Davinci: Fix I2C build errors")
Fixes: 22ca466847ad ("davinci: kconfig: select at24 eeprom for selected boards")
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-davinci/Kconfig            | 14 +-------------
 arch/arm/mach-davinci/board-dm644x-evm.c |  8 ++++++--
 arch/arm/mach-davinci/board-dm646x-evm.c |  7 +++++++
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index dd8f531..a121d1e 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -67,8 +67,6 @@ config MACH_DAVINCI_EVM
 	bool "TI DM644x EVM"
 	default ARCH_DAVINCI_DM644x
 	depends on ARCH_DAVINCI_DM644x
-	select EEPROM_AT24
-	select I2C
 	help
 	  Configure this option to specify the whether the board used
 	  for development is a DM644x EVM
@@ -76,8 +74,6 @@ config MACH_DAVINCI_EVM
 config MACH_SFFSDR
 	bool "Lyrtech SFFSDR"
 	depends on ARCH_DAVINCI_DM644x
-	select EEPROM_AT24
-	select I2C
 	help
 	  Say Y here to select the Lyrtech Small Form Factor
 	  Software Defined Radio (SFFSDR) board.
@@ -108,8 +104,6 @@ config MACH_DAVINCI_DM6467_EVM
 	bool "TI DM6467 EVM"
 	default ARCH_DAVINCI_DM646x
 	depends on ARCH_DAVINCI_DM646x
-	select EEPROM_AT24
-	select I2C
 	select MACH_DAVINCI_DM6467TEVM
 	help
 	  Configure this option to specify the whether the board used
@@ -122,8 +116,6 @@ config MACH_DAVINCI_DM365_EVM
 	bool "TI DM365 EVM"
 	default ARCH_DAVINCI_DM365
 	depends on ARCH_DAVINCI_DM365
-	select EEPROM_AT24
-	select I2C
 	help
 	  Configure this option to specify whether the board used
 	  for development is a DM365 EVM
@@ -132,9 +124,7 @@ config MACH_DAVINCI_DA830_EVM
 	bool "TI DA830/OMAP-L137/AM17x Reference Platform"
 	default ARCH_DAVINCI_DA830
 	depends on ARCH_DAVINCI_DA830
-	select EEPROM_AT24
-	select GPIO_PCF857X
-	select I2C
+	select GPIO_PCF857X if I2C
 	help
 	  Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module.
 
@@ -203,8 +193,6 @@ endchoice
 config MACH_MITYOMAPL138
 	bool "Critical Link MityDSP-L138/MityARM-1808 SoM"
 	depends on ARCH_DAVINCI_DA850
-	select EEPROM_AT24
-	select I2C
 	help
 	  Say Y here to select the Critical Link MityDSP-L138/MityARM-1808
 	  System on Module.  Information on this SoM may be found at
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 1a0898c..e97f50a 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -267,7 +267,7 @@ static struct platform_device rtc_dev = {
 static struct snd_platform_data dm644x_evm_snd_data;
 
 /*----------------------------------------------------------------------*/
-
+#ifdef CONFIG_I2C
 /*
  * I2C GPIO expanders
  */
@@ -614,6 +614,7 @@ static void __init evm_init_i2c(void)
 	i2c_add_driver(&dm6446evm_msp_driver);
 	i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
 }
+#endif
 
 #define VENC_STD_ALL	(V4L2_STD_NTSC | V4L2_STD_PAL)
 
@@ -782,7 +783,9 @@ static __init void davinci_evm_init(void)
 				pr_warn("%s: Cannot configure AEMIF\n",
 					__func__);
 
+#ifdef CONFIG_I2C
 			evm_leds[7].default_trigger = "nand-disk";
+#endif
 			if (HAS_NOR)
 				pr_warn("WARNING: both NAND and NOR flash are enabled; disable one of them.\n");
 		} else if (HAS_NOR)
@@ -791,9 +794,10 @@ static __init void davinci_evm_init(void)
 
 	platform_add_devices(davinci_evm_devices,
 			     ARRAY_SIZE(davinci_evm_devices));
+#ifdef CONFIG_I2C
 	evm_init_i2c();
-
 	davinci_setup_mmc(0, &dm6446evm_mmc_config);
+#endif
 	dm644x_init_video(&dm644xevm_capture_cfg, &dm644xevm_display_cfg);
 
 	davinci_serial_init(dm644x_serial_device);
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 846a84d..bba710f 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -121,6 +121,7 @@ static struct platform_device davinci_nand_device = {
 
 #define HAS_ATA		IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710)
 
+#ifdef CONFIG_I2C
 /* CPLD Register 0 bits to control ATA */
 #define DM646X_EVM_ATA_RST		BIT(0)
 #define DM646X_EVM_ATA_PWD		BIT(1)
@@ -316,6 +317,7 @@ static struct at24_platform_data eeprom_info = {
 	.setup          = davinci_get_mac_addr,
 	.context	= (void *)0x7f00,
 };
+#endif
 
 static u8 dm646x_iis_serializer_direction[] = {
        TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE,
@@ -346,6 +348,7 @@ static struct snd_platform_data dm646x_evm_snd_data[] = {
 	},
 };
 
+#ifdef CONFIG_I2C
 static struct i2c_client *cpld_client;
 
 static int cpld_video_probe(struct i2c_client *client,
@@ -710,6 +713,7 @@ static void __init evm_init_i2c(void)
 	evm_init_cpld();
 	evm_init_video();
 }
+#endif
 
 #define DM6467T_EVM_REF_FREQ		33000000
 
@@ -764,7 +768,10 @@ static __init void evm_init(void)
 	if (ret)
 		pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
 
+#ifdef CONFIG_I2C
 	evm_init_i2c();
+#endif
+
 	davinci_serial_init(dm646x_serial_device);
 	dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
 	dm646x_init_mcasp1(&dm646x_evm_snd_data[1]);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 183/218] drm/amdkfd: uninitialized variable in dbgdev_wave_control_set_registers()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (181 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 182/218] ARM: davinci: make I2C support optional Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 184/218] mtd: map: fix .set_vpp() documentation Kamal Mostafa
                   ` (34 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Carpenter, Oded Gabbay, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 93fce954427effee89e44a976299b15dd75b4bbc upstream.

At the end of the function we expect "status" to be zero, but it's
either -EINVAL or uninitialized.

Fixes: 788bf83db301 ('drm/amdkfd: Add wave control operation to debugger')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c
index c34c393..d5e19b5 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgdev.c
@@ -513,7 +513,7 @@ static int dbgdev_wave_control_set_registers(
 				union SQ_CMD_BITS *in_reg_sq_cmd,
 				union GRBM_GFX_INDEX_BITS *in_reg_gfx_index)
 {
-	int status;
+	int status = 0;
 	union SQ_CMD_BITS reg_sq_cmd;
 	union GRBM_GFX_INDEX_BITS reg_gfx_index;
 	struct HsaDbgWaveMsgAMDGen2 *pMsg;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 184/218] mtd: map: fix .set_vpp() documentation
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (182 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 183/218] drm/amdkfd: uninitialized variable in dbgdev_wave_control_set_registers() Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 185/218] ARM: OMAP3: Add cpuidle parameters table for omap3430 Kamal Mostafa
                   ` (33 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Russell King, Paul Parsons, Linus Walleij, Brian Norris, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Linus Walleij <linus.walleij@linaro.org>

commit 95a001f22b1c5717eafd500a43832249ddd93662 upstream.

As of commit 876fe76d793d03077eb61ba3afab4a383f46c554
"mtd: maps: physmap: Add reference counter to set_vpp()"
the comment in the header file is incorrect and misleading.
Fix it up.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Paul Parsons <lost.distance@yahoo.com>
Fixes: 876fe76d793d ("mtd: maps: physmap: Add reference counter to set_vpp()")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/linux/mtd/map.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 29975c7..d013559 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -238,8 +238,11 @@ struct map_info {
 	   If there is no cache to care about this can be set to NULL. */
 	void (*inval_cache)(struct map_info *, unsigned long, ssize_t);
 
-	/* set_vpp() must handle being reentered -- enable, enable, disable
-	   must leave it enabled. */
+	/* This will be called with 1 as parameter when the first map user
+	 * needs VPP, and called with 0 when the last user exits. The map
+	 * core maintains a reference counter, and assumes that VPP is a
+	 * global resource applying to all mapped flash chips on the system.
+	 */
 	void (*set_vpp)(struct map_info *, int);
 
 	unsigned long pfow_base;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 185/218] ARM: OMAP3: Add cpuidle parameters table for omap3430
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (183 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 184/218] mtd: map: fix .set_vpp() documentation Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 186/218] efi: Expose non-blocking set_variable() wrapper to efivars Kamal Mostafa
                   ` (32 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Pali Rohár, Tony Lindgren, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com>

commit 98f42221501353067251fbf11e732707dbb68ce3 upstream.

Based on CPU type choose generic omap3 or omap3430 specific cpuidle
parameters. Parameters for omap3430 were measured on Nokia N900 device and
added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters")
which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle -
remove rx51 cpuidle parameters table") due to huge code complexity.

This patch brings cpuidle parameters for omap3430 devices again, but uses
simple condition based on CPU type.

Fixes: 231900afba52 ("ARM: OMAP3: cpuidle - remove rx51 cpuidle
parameters table")
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-omap2/cpuidle34xx.c | 69 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 68 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index aa7b379..2a3db0b 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -34,6 +34,7 @@
 #include "pm.h"
 #include "control.h"
 #include "common.h"
+#include "soc.h"
 
 /* Mach specific information to be recorded in the C-state driver_data */
 struct omap3_idle_statedata {
@@ -315,6 +316,69 @@ static struct cpuidle_driver omap3_idle_driver = {
 	.safe_state_index = 0,
 };
 
+/*
+ * Numbers based on measurements made in October 2009 for PM optimized kernel
+ * with CPU freq enabled on device Nokia N900. Assumes OPP2 (main idle OPP,
+ * and worst case latencies).
+ */
+static struct cpuidle_driver omap3430_idle_driver = {
+	.name             = "omap3430_idle",
+	.owner            = THIS_MODULE,
+	.states = {
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 110 + 162,
+			.target_residency = 5,
+			.name		  = "C1",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 106 + 180,
+			.target_residency = 309,
+			.name		  = "C2",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 107 + 410,
+			.target_residency = 46057,
+			.name		  = "C3",
+			.desc		  = "MPU RET + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 121 + 3374,
+			.target_residency = 46057,
+			.name		  = "C4",
+			.desc		  = "MPU OFF + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 855 + 1146,
+			.target_residency = 46057,
+			.name		  = "C5",
+			.desc		  = "MPU RET + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 7580 + 4134,
+			.target_residency = 484329,
+			.name		  = "C6",
+			.desc		  = "MPU OFF + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 7505 + 15274,
+			.target_residency = 484329,
+			.name		  = "C7",
+			.desc		  = "MPU OFF + CORE OFF",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap3_idle_data),
+	.safe_state_index = 0,
+};
+
 /* Public functions */
 
 /**
@@ -333,5 +397,8 @@ int __init omap3_idle_init(void)
 	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
 		return -ENODEV;
 
-	return cpuidle_register(&omap3_idle_driver, NULL);
+	if (cpu_is_omap3430())
+		return cpuidle_register(&omap3430_idle_driver, NULL);
+	else
+		return cpuidle_register(&omap3_idle_driver, NULL);
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 186/218] efi: Expose non-blocking set_variable() wrapper to efivars
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (184 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 185/218] ARM: OMAP3: Add cpuidle parameters table for omap3430 Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 187/218] rtc: vr41xx: Wire up alarm_irq_enable Kamal Mostafa
                   ` (31 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ard Biesheuvel, Matt Fleming, Borislav Petkov, Brian Gerst,
	Denys Vlasenko, H . Peter Anvin, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, linux-efi, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 9c6672ac9c91f7eb1ec436be1442b8c26d098e55 upstream.

Commit 6d80dba1c9fe ("efi: Provide a non-blocking SetVariable()
operation") implemented a non-blocking alternative for the UEFI
SetVariable() invocation performed by efivars, since it may
occur in atomic context. However, this version of the function
was never exposed via the efivars struct, so the non-blocking
versions was not actually callable. Fix that.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Fixes: 6d80dba1c9fe ("efi: Provide a non-blocking SetVariable() operation")
Link: http://lkml.kernel.org/r/1454364428-494-2-git-send-email-matt@codeblueprint.co.uk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/firmware/efi/efi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index d6144e3..2eb2f57 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -176,6 +176,7 @@ static int generic_ops_register(void)
 {
 	generic_ops.get_variable = efi.get_variable;
 	generic_ops.set_variable = efi.set_variable;
+	generic_ops.set_variable_nonblocking = efi.set_variable_nonblocking;
 	generic_ops.get_next_variable = efi.get_next_variable;
 	generic_ops.query_variable_store = efi_query_variable_store;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 187/218] rtc: vr41xx: Wire up alarm_irq_enable
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (185 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 186/218] efi: Expose non-blocking set_variable() wrapper to efivars Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 188/218] sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race Kamal Mostafa
                   ` (30 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Geert Uytterhoeven, Alexandre Belloni, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Geert Uytterhoeven <geert@linux-m68k.org>

commit a25f4a95ec3cded34c1250364eba704c5e4fdac4 upstream.

drivers/rtc/rtc-vr41xx.c:229: warning: ‘vr41xx_rtc_alarm_irq_enable’ defined but not used

Apparently the conversion to alarm_irq_enable forgot to wire up the
callback.

Fixes: 16380c153a69c378 ("RTC: Convert rtc drivers to use the alarm_irq_enable method")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/rtc/rtc-vr41xx.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index f64c282..e1b86bb 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -272,12 +272,13 @@ static irqreturn_t rtclong1_interrupt(int irq, void *dev_id)
 }
 
 static const struct rtc_class_ops vr41xx_rtc_ops = {
-	.release	= vr41xx_rtc_release,
-	.ioctl		= vr41xx_rtc_ioctl,
-	.read_time	= vr41xx_rtc_read_time,
-	.set_time	= vr41xx_rtc_set_time,
-	.read_alarm	= vr41xx_rtc_read_alarm,
-	.set_alarm	= vr41xx_rtc_set_alarm,
+	.release		= vr41xx_rtc_release,
+	.ioctl			= vr41xx_rtc_ioctl,
+	.read_time		= vr41xx_rtc_read_time,
+	.set_time		= vr41xx_rtc_set_time,
+	.read_alarm		= vr41xx_rtc_read_alarm,
+	.set_alarm		= vr41xx_rtc_set_alarm,
+	.alarm_irq_enable	= vr41xx_rtc_alarm_irq_enable,
 };
 
 static int rtc_probe(struct platform_device *pdev)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 188/218] sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (186 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 187/218] rtc: vr41xx: Wire up alarm_irq_enable Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 189/218] ipv4: fix broadcast packets reception Kamal Mostafa
                   ` (29 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: NeilBrown, J . Bruce Fields, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: NeilBrown <neilb@suse.com>

commit a6ab1e8126d205238defbb55d23661a3a5c6a0d8 upstream.

sunrpc_cache_pipe_upcall() can detect a race if CACHE_PENDING is no longer
set.  In this case it aborts the queuing of the upcall.
However it has already taken a new counted reference on "h" and
doesn't "put" it, even though it frees the data structure holding the reference.

So let's delay the "cache_get" until we know we need it.

Fixes: f9e1aedc6c79 ("sunrpc/cache: remove races with queuing an upcall.")
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/sunrpc/cache.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 8d79e70..9ec709b 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -1175,14 +1175,14 @@ int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h)
 	}
 
 	crq->q.reader = 0;
-	crq->item = cache_get(h);
 	crq->buf = buf;
 	crq->len = 0;
 	crq->readers = 0;
 	spin_lock(&queue_lock);
-	if (test_bit(CACHE_PENDING, &h->flags))
+	if (test_bit(CACHE_PENDING, &h->flags)) {
+		crq->item = cache_get(h);
 		list_add_tail(&crq->q.list, &detail->queue);
-	else
+	} else
 		/* Lost a race, no longer PENDING, so don't enqueue */
 		ret = -EAGAIN;
 	spin_unlock(&queue_lock);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 189/218] ipv4: fix broadcast packets reception
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (187 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 188/218] sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 190/218] lpfc: fix misleading indentation Kamal Mostafa
                   ` (28 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Paolo Abeni, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Paolo Abeni <pabeni@redhat.com>

commit ad0ea1989cc4d5905941d0a9e62c63ad6d859cef upstream.

Currently, ingress ipv4 broadcast datagrams are dropped since,
in udp_v4_early_demux(), ip_check_mc_rcu() is invoked even on
bcast packets.

This patch addresses the issue, invoking ip_check_mc_rcu()
only for mcast packets.

Fixes: 6e5403093261 ("ipv4/udp: Verify multicast group is ours in upd_v4_early_demux()")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/udp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index a390174..031752e 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1979,10 +1979,14 @@ void udp_v4_early_demux(struct sk_buff *skb)
 		if (!in_dev)
 			return;
 
-		ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
-				       iph->protocol);
-		if (!ours)
-			return;
+		/* we are supposed to accept bcast packets */
+		if (skb->pkt_type == PACKET_MULTICAST) {
+			ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr,
+					       iph->protocol);
+			if (!ours)
+				return;
+		}
+
 		sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr,
 						   uh->source, iph->saddr, dif);
 	} else if (skb->pkt_type == PACKET_HOST) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 190/218] lpfc: fix misleading indentation
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (188 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 189/218] ipv4: fix broadcast packets reception Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 191/218] sched/preempt, sh: kmap_coherent relies on disabled preemption Kamal Mostafa
                   ` (27 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Martin K . Petersen, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit aeb6641f8ebdd61939f462a8255b316f9bfab707 upstream.

gcc-6 complains about the indentation of the lpfc_destroy_vport_work_array()
call in lpfc_online(), which clearly doesn't look right:

drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_online':
drivers/scsi/lpfc/lpfc_init.c:2880:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
   lpfc_destroy_vport_work_array(phba, vports);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/lpfc/lpfc_init.c:2863:2: note: ...this 'if' clause, but it is not
  if (vports != NULL)
  ^~

Looking at the patch that introduced this code, it's clear that the
behavior is correct and the indentation is wrong.

This fixes the indentation and adds curly braces around the previous
if() block for clarity, as that is most likely what caused the code
to be misindented in the first place.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 549e55cd2a1b ("[SCSI] lpfc 8.2.2 : Fix locking around HBA's port_list")
Reviewed-by: Sebastian Herbszt <herbszt@gmx.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/scsi/lpfc/lpfc_init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index f962118..6e7df4f 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2848,7 +2848,7 @@ lpfc_online(struct lpfc_hba *phba)
 	}
 
 	vports = lpfc_create_vport_work_array(phba);
-	if (vports != NULL)
+	if (vports != NULL) {
 		for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
 			struct Scsi_Host *shost;
 			shost = lpfc_shost_from_vport(vports[i]);
@@ -2865,7 +2865,8 @@ lpfc_online(struct lpfc_hba *phba)
 			}
 			spin_unlock_irq(shost->host_lock);
 		}
-		lpfc_destroy_vport_work_array(phba, vports);
+	}
+	lpfc_destroy_vport_work_array(phba, vports);
 
 	lpfc_unblock_mgmt_io(phba);
 	return 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 191/218] sched/preempt, sh: kmap_coherent relies on disabled preemption
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (189 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 190/218] lpfc: fix misleading indentation Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 192/218] ipip: Properly mark ipip GRO packets as encapsulated Kamal Mostafa
                   ` (26 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Hildenbrand, Rich Felker, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: David Hildenbrand <dahi@linux.vnet.ibm.com>

commit b15d53d009558d14c4f394a6d1fa2039c7f45c43 upstream.

kmap_coherent needs disabled preemption to not schedule in the critical
section, just like kmap_coherent on mips and kmap_atomic in general.

Fixes: 8222dbe21e79 "sched/preempt, mm/fault: Decouple preemption from the page fault logic"
Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Rich Felker <dalias@libc.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/sh/mm/kmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sh/mm/kmap.c b/arch/sh/mm/kmap.c
index ec29e14..bf25d7c 100644
--- a/arch/sh/mm/kmap.c
+++ b/arch/sh/mm/kmap.c
@@ -36,6 +36,7 @@ void *kmap_coherent(struct page *page, unsigned long addr)
 
 	BUG_ON(!test_bit(PG_dcache_clean, &page->flags));
 
+	preempt_disable();
 	pagefault_disable();
 
 	idx = FIX_CMAP_END -
@@ -64,4 +65,5 @@ void kunmap_coherent(void *kvaddr)
 	}
 
 	pagefault_enable();
+	preempt_enable();
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 192/218] ipip: Properly mark ipip GRO packets as encapsulated.
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (190 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 191/218] sched/preempt, sh: kmap_coherent relies on disabled preemption Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 193/218] spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs Kamal Mostafa
                   ` (25 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jesse Gross, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jesse Gross <jesse@kernel.org>

commit b8cba75bdf6a48ea4811bbefb11a94a5c7281b68 upstream.

ipip encapsulated packets can be merged together by GRO but the result
does not have the proper GSO type set or even marked as being
encapsulated at all. Later retransmission of these packets will likely
fail if the device does not support ipip offloads. This is similar to
the issue resolved in IPv6 sit in feec0cb3
("ipv6: gro: support sit protocol").

Reported-by: Patrick Boutilier <boutilpj@ednet.ns.ca>
Fixes: 9667e9bb ("ipip: Add gro callbacks to ipip offload")
Tested-by: Patrick Boutilier <boutilpj@ednet.ns.ca>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jesse Gross <jesse@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/ipv4/af_inet.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 6de5b8f..7497f15 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1431,6 +1431,13 @@ out_unlock:
 	return err;
 }
 
+static int ipip_gro_complete(struct sk_buff *skb, int nhoff)
+{
+	skb->encapsulation = 1;
+	skb_shinfo(skb)->gso_type |= SKB_GSO_IPIP;
+	return inet_gro_complete(skb, nhoff);
+}
+
 int inet_ctl_sock_create(struct sock **sk, unsigned short family,
 			 unsigned short type, unsigned char protocol,
 			 struct net *net)
@@ -1646,7 +1653,7 @@ static const struct net_offload ipip_offload = {
 	.callbacks = {
 		.gso_segment	= inet_gso_segment,
 		.gro_receive	= inet_gro_receive,
-		.gro_complete	= inet_gro_complete,
+		.gro_complete	= ipip_gro_complete,
 	},
 };
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 193/218] spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (191 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 192/218] ipip: Properly mark ipip GRO packets as encapsulated Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 194/218] ASoC: s3c24xx: use const snd_soc_component_driver pointer Kamal Mostafa
                   ` (24 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Huibin Hong, Mark Brown, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Huibin Hong <huibin.hong@rock-chips.com>

commit b920cc3191d7612f26f36ee494e05b5ffd9044c0 upstream.

Rockchip_spi_set_cs could be called by spi_setup, but
spi_setup may be called by device driver after runtime suspend.
Then the spi clock is closed, rockchip_spi_set_cs may access the
spi registers, which causes cpu block in some socs.

Fixes: 64e36824b32 ("spi/rockchip: add driver for Rockchip RK3xxx")
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/spi/spi-rockchip.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 2fed713..661a416 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -266,7 +266,10 @@ static inline u32 rx_max(struct rockchip_spi *rs)
 static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)
 {
 	u32 ser;
-	struct rockchip_spi *rs = spi_master_get_devdata(spi->master);
+	struct spi_master *master = spi->master;
+	struct rockchip_spi *rs = spi_master_get_devdata(master);
+
+	pm_runtime_get_sync(rs->dev);
 
 	ser = readl_relaxed(rs->regs + ROCKCHIP_SPI_SER) & SER_MASK;
 
@@ -291,6 +294,8 @@ static void rockchip_spi_set_cs(struct spi_device *spi, bool enable)
 		ser &= ~(1 << spi->chip_select);
 
 	writel_relaxed(ser, rs->regs + ROCKCHIP_SPI_SER);
+
+	pm_runtime_put_sync(rs->dev);
 }
 
 static int rockchip_spi_prepare_message(struct spi_master *master,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 194/218] ASoC: s3c24xx: use const snd_soc_component_driver pointer
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (192 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 193/218] spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 195/218] mlx4: add missing braces in verify_qp_parameters Kamal Mostafa
                   ` (23 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Mark Brown, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit ba4bc32eaa39ba7687f0958ae90eec94da613b46 upstream.

An older patch to convert the API in the s3c i2s driver
ended up passing a const pointer into a function that takes
a non-const pointer, so we now get a warning:

sound/soc/samsung/s3c2412-i2s.c: In function 's3c2412_iis_dev_probe':
sound/soc/samsung/s3c2412-i2s.c:172:9: error: passing argument 3 of 's3c_i2sv2_register_component' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

However, the s3c_i2sv2_register_component() function again
passes the pointer into another function taking a const, so
we just need to change its prototype.

Fixes: eca3b01d0885 ("ASoC: switch over to use snd_soc_register_component() on s3c i2s")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 sound/soc/samsung/s3c-i2s-v2.c | 2 +-
 sound/soc/samsung/s3c-i2s-v2.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c
index df65c5b..b6ab3fc 100644
--- a/sound/soc/samsung/s3c-i2s-v2.c
+++ b/sound/soc/samsung/s3c-i2s-v2.c
@@ -709,7 +709,7 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
 #endif
 
 int s3c_i2sv2_register_component(struct device *dev, int id,
-			   struct snd_soc_component_driver *cmp_drv,
+			   const struct snd_soc_component_driver *cmp_drv,
 			   struct snd_soc_dai_driver *dai_drv)
 {
 	struct snd_soc_dai_ops *ops = (struct snd_soc_dai_ops *)dai_drv->ops;
diff --git a/sound/soc/samsung/s3c-i2s-v2.h b/sound/soc/samsung/s3c-i2s-v2.h
index 90abab3..d068414 100644
--- a/sound/soc/samsung/s3c-i2s-v2.h
+++ b/sound/soc/samsung/s3c-i2s-v2.h
@@ -101,7 +101,7 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai,
  * soc core.
  */
 extern int s3c_i2sv2_register_component(struct device *dev, int id,
-					struct snd_soc_component_driver *cmp_drv,
+					const struct snd_soc_component_driver *cmp_drv,
 					struct snd_soc_dai_driver *dai_drv);
 
 #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 195/218] mlx4: add missing braces in verify_qp_parameters
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (193 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 194/218] ASoC: s3c24xx: use const snd_soc_component_driver pointer Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 196/218] clk: meson: Fix meson_clk_register_clks() signature type mismatch Kamal Mostafa
                   ` (22 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit baefd7015cdb304ce6c94f9679d0486c71954766 upstream.

The implementation of QP paravirtualization back in linux-3.7 included
some code that looks very dubious, and gcc-6 has grown smart enough
to warn about it:

drivers/net/ethernet/mellanox/mlx4/resource_tracker.c: In function 'verify_qp_parameters':
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:3154:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
     if (optpar & MLX4_QP_OPTPAR_ALT_ADDR_PATH) {
     ^~
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c:3144:4: note: ...this 'if' clause, but it is not
    if (slave != mlx4_master_func_num(dev))

>From looking at the context, I'm reasonably sure that the indentation
is correct but that it should have contained curly braces from the
start, as the update_gid() function in the same patch correctly does.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 54679e148287 ("mlx4: Implement QP paravirtualization and maintain phys_pkey_cache for smp_snoop")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index b2614a8..b1a964e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -3129,7 +3129,7 @@ static int verify_qp_parameters(struct mlx4_dev *dev,
 		case QP_TRANS_RTS2RTS:
 		case QP_TRANS_SQD2SQD:
 		case QP_TRANS_SQD2RTS:
-			if (slave != mlx4_master_func_num(dev))
+			if (slave != mlx4_master_func_num(dev)) {
 				if (optpar & MLX4_QP_OPTPAR_PRIMARY_ADDR_PATH) {
 					port = (qp_ctx->pri_path.sched_queue >> 6 & 1) + 1;
 					if (dev->caps.port_mask[port] != MLX4_PORT_TYPE_IB)
@@ -3148,6 +3148,7 @@ static int verify_qp_parameters(struct mlx4_dev *dev,
 					if (qp_ctx->alt_path.mgid_index >= num_gids)
 						return -EINVAL;
 				}
+			}
 			break;
 		default:
 			break;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 196/218] clk: meson: Fix meson_clk_register_clks() signature type mismatch
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (194 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 195/218] mlx4: add missing braces in verify_qp_parameters Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 197/218] [media] coda: fix error path in case of missing pdata on non-DT platform Kamal Mostafa
                   ` (21 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andreas Färber, Stephen Boyd, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>

commit bb473593c8099302bfd7befc23de67df907e3a99 upstream.

As preparation for arm64 based mesongxbb, which pulls in this code once
enabling ARCH_MESON, fix a size_t vs. unsigned int type mismatch.
The loop uses a local unsigned int variable, so adopt that type,
matching the header.

Fixes: 7a29a869434e ("clk: meson: Add support for Meson clock controller")
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/meson/clkc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/meson/clkc.c b/drivers/clk/meson/clkc.c
index b8c511c..a19190f 100644
--- a/drivers/clk/meson/clkc.c
+++ b/drivers/clk/meson/clkc.c
@@ -199,7 +199,7 @@ meson_clk_register_fixed_rate(const struct clk_conf *clk_conf,
 }
 
 void __init meson_clk_register_clks(const struct clk_conf *clk_confs,
-				    size_t nr_confs,
+				    unsigned int nr_confs,
 				    void __iomem *clk_base)
 {
 	unsigned int i;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 197/218] [media] coda: fix error path in case of missing pdata on non-DT platform
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (195 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 196/218] clk: meson: Fix meson_clk_register_clks() signature type mismatch Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 198/218] kbuild/mkspec: fix grub2 installkernel issue Kamal Mostafa
                   ` (20 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Philipp Zabel, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Philipp Zabel <p.zabel@pengutronix.de>

commit bc717d5e92c8c079280eb4acbe335c6f25041aa2 upstream.

If we bail out this early, v4l2_device_register() has not been called
yet, so no need to call v4l2_device_unregister().

Fixes: b7bd660a51f0 ("[media] coda: Call v4l2_device_unregister() from a single location")

Reported-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/platform/coda/coda-common.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 58f6548..ee4306d 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -2095,14 +2095,12 @@ static int coda_probe(struct platform_device *pdev)
 
 	pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
 
-	if (of_id) {
+	if (of_id)
 		dev->devtype = of_id->data;
-	} else if (pdev_id) {
+	else if (pdev_id)
 		dev->devtype = &coda_devdata[pdev_id->driver_data];
-	} else {
-		ret = -EINVAL;
-		goto err_v4l2_register;
-	}
+	else
+		return -EINVAL;
 
 	spin_lock_init(&dev->irqlock);
 	INIT_LIST_HEAD(&dev->instances);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 198/218] kbuild/mkspec: fix grub2 installkernel issue
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (196 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 197/218] [media] coda: fix error path in case of missing pdata on non-DT platform Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 199/218] bpf: avoid copying junk bytes in bpf_get_current_comm() Kamal Mostafa
                   ` (19 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Kosina, Michal Marek, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Jiri Kosina <jkosina@suse.cz>

commit c8b08ca558c0067bc9e15ce3f1e70af260410bb2 upstream.

mkspec is copying built kernel to temporrary location

	/boot/vmlinuz-$KERNELRELEASE-rpm

and runs installkernel on it. This however directly leads to grub2
menuentry for this suffixed binary being generated as well during the run
of installkernel script.

Later in the process the temporary -rpm suffixed files are removed, and
therefore we end up with spurious (and non-functional) grub2 menu entries
for each installed kernel RPM.

Fix that by using a different temporary name (prefixed by '.'), so that
the binary is not recognized as an actual kernel binary and no menuentry
is created for it.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fixes: 3c9c7a14b627 ("rpm-pkg: add %post section to create initramfs and grub hooks")
Signed-off-by: Michal Marek <mmarek@suse.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 scripts/package/mkspec | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index d9ab94b..358bec4 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -133,11 +133,11 @@ echo 'rm -rf $RPM_BUILD_ROOT'
 echo ""
 echo "%post"
 echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
-echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm"
-echo "cp /boot/System.map-$KERNELRELEASE /boot/System.map-$KERNELRELEASE-rpm"
+echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm"
+echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm"
 echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
-echo "/sbin/installkernel $KERNELRELEASE /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
-echo "rm -f /boot/vmlinuz-$KERNELRELEASE-rpm /boot/System.map-$KERNELRELEASE-rpm"
+echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
+echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
 echo "fi"
 echo ""
 echo "%files"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 199/218] bpf: avoid copying junk bytes in bpf_get_current_comm()
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (197 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 198/218] kbuild/mkspec: fix grub2 installkernel issue Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 200/218] mac80211: fix unnecessary frame drops in mesh fwding Kamal Mostafa
                   ` (18 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexei Starovoitov, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alexei Starovoitov <ast@fb.com>

commit cdc4e47da8f4c32eeb6b2061a8a834f4362a12b7 upstream.

Lots of places in the kernel use memcpy(buf, comm, TASK_COMM_LEN); but
the result is typically passed to print("%s", buf) and extra bytes
after zero don't cause any harm.
In bpf the result of bpf_get_current_comm() is used as the part of
map key and was causing spurious hash map mismatches.
Use strlcpy() to guarantee zero-terminated string.
bpf verifier checks that output buffer is zero-initialized,
so even for short task names the output buffer don't have junk bytes.
Note it's not a security concern, since kprobe+bpf is root only.

Fixes: ffeedafbf023 ("bpf: introduce current->pid, tgid, uid, gid, comm accessors")
Reported-by: Tobias Waldekranz <tobias@waldekranz.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 kernel/bpf/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 1447ec0..c2e2bad 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -171,7 +171,7 @@ static u64 bpf_get_current_comm(u64 r1, u64 size, u64 r3, u64 r4, u64 r5)
 	if (!task)
 		return -EINVAL;
 
-	memcpy(buf, task->comm, min_t(size_t, size, sizeof(task->comm)));
+	strlcpy(buf, task->comm, min_t(size_t, size, sizeof(task->comm)));
 	return 0;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 200/218] mac80211: fix unnecessary frame drops in mesh fwding
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (198 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 199/218] bpf: avoid copying junk bytes in bpf_get_current_comm() Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 201/218] mtd: brcmnand: Fix v7.1 register offsets Kamal Mostafa
                   ` (17 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michal Kazior, Johannes Berg, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Michal Kazior <michal.kazior@tieto.com>

commit cf44012810ccdd8fd947518e965cb04b7b8498be upstream.

The ieee80211_queue_stopped() expects hw queue
number but it was given raw WMM AC number instead.

This could cause frame drops and problems with
traffic in some cases - most notably if driver
doesn't map AC numbers to queue numbers 1:1 and
uses ieee80211_stop_queues() and
ieee80211_wake_queue() only without ever calling
ieee80211_wake_queues().

On ath10k it was possible to hit this problem in
the following case:

  1. wlan0 uses queue 0
     (ath10k maps queues per vif)
  2. offchannel uses queue 15
  3. queues 1-14 are unused
  4. ieee80211_stop_queues()
  5. ieee80211_wake_queue(q=0)
  6. ieee80211_wake_queue(q=15)
     (other queues are not woken up because both
      driver and mac80211 know other queues are
      unused)
  7. ieee80211_rx_h_mesh_fwding()
  8. ieee80211_select_queue_80211() returns 2
  9. ieee80211_queue_stopped(q=2) returns true
 10. frame is dropped (oops!)

Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/rx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index c06f40d6..3250527 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2213,7 +2213,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	struct ieee80211_local *local = rx->local;
 	struct ieee80211_sub_if_data *sdata = rx->sdata;
 	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-	u16 q, hdrlen;
+	u16 ac, q, hdrlen;
 
 	hdr = (struct ieee80211_hdr *) skb->data;
 	hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -2282,7 +2282,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
 	    ether_addr_equal(sdata->vif.addr, hdr->addr3))
 		return RX_CONTINUE;
 
-	q = ieee80211_select_queue_80211(sdata, skb, hdr);
+	ac = ieee80211_select_queue_80211(sdata, skb, hdr);
+	q = sdata->vif.hw_queue[ac];
 	if (ieee80211_queue_stopped(&local->hw, q)) {
 		IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
 		return RX_DROP_MONITOR;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 201/218] mtd: brcmnand: Fix v7.1 register offsets
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (199 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 200/218] mac80211: fix unnecessary frame drops in mesh fwding Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 202/218] mac80211: fix ibss scan parameters Kamal Mostafa
                   ` (16 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Florian Fainelli, Brian Norris, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit d267aefc54a28efc5bda7f009598dc83b5f98734 upstream.

The BRCMNAND controller revision 7.1 is almost 100% compatible with the
previous v6.0 register offset layout, except for the Correctable Error
Reporting Threshold registers. Fix this by adding another table with the
correct offsets for CORR_THRESHOLD and CORR_THRESHOLD_EXT.

Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/mtd/nand/brcmnand/brcmnand.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c b/drivers/mtd/nand/brcmnand/brcmnand.c
index fddb795..730df5f 100644
--- a/drivers/mtd/nand/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/brcmnand/brcmnand.c
@@ -309,6 +309,36 @@ static const u16 brcmnand_regs_v60[] = {
 	[BRCMNAND_FC_BASE]		= 0x400,
 };
 
+/* BRCMNAND v7.1 */
+static const u16 brcmnand_regs_v71[] = {
+	[BRCMNAND_CMD_START]		=  0x04,
+	[BRCMNAND_CMD_EXT_ADDRESS]	=  0x08,
+	[BRCMNAND_CMD_ADDRESS]		=  0x0c,
+	[BRCMNAND_INTFC_STATUS]		=  0x14,
+	[BRCMNAND_CS_SELECT]		=  0x18,
+	[BRCMNAND_CS_XOR]		=  0x1c,
+	[BRCMNAND_LL_OP]		=  0x20,
+	[BRCMNAND_CS0_BASE]		=  0x50,
+	[BRCMNAND_CS1_BASE]		=     0,
+	[BRCMNAND_CORR_THRESHOLD]	=  0xdc,
+	[BRCMNAND_CORR_THRESHOLD_EXT]	=  0xe0,
+	[BRCMNAND_UNCORR_COUNT]		=  0xfc,
+	[BRCMNAND_CORR_COUNT]		= 0x100,
+	[BRCMNAND_CORR_EXT_ADDR]	= 0x10c,
+	[BRCMNAND_CORR_ADDR]		= 0x110,
+	[BRCMNAND_UNCORR_EXT_ADDR]	= 0x114,
+	[BRCMNAND_UNCORR_ADDR]		= 0x118,
+	[BRCMNAND_SEMAPHORE]		= 0x150,
+	[BRCMNAND_ID]			= 0x194,
+	[BRCMNAND_ID_EXT]		= 0x198,
+	[BRCMNAND_LL_RDATA]		= 0x19c,
+	[BRCMNAND_OOB_READ_BASE]	= 0x200,
+	[BRCMNAND_OOB_READ_10_BASE]	=     0,
+	[BRCMNAND_OOB_WRITE_BASE]	= 0x280,
+	[BRCMNAND_OOB_WRITE_10_BASE]	=     0,
+	[BRCMNAND_FC_BASE]		= 0x400,
+};
+
 enum brcmnand_cs_reg {
 	BRCMNAND_CS_CFG_EXT = 0,
 	BRCMNAND_CS_CFG,
@@ -382,7 +412,9 @@ static int brcmnand_revision_init(struct brcmnand_controller *ctrl)
 	}
 
 	/* Register offsets */
-	if (ctrl->nand_version >= 0x0600)
+	if (ctrl->nand_version >= 0x0701)
+		ctrl->reg_offsets = brcmnand_regs_v71;
+	else if (ctrl->nand_version >= 0x0600)
 		ctrl->reg_offsets = brcmnand_regs_v60;
 	else if (ctrl->nand_version >= 0x0500)
 		ctrl->reg_offsets = brcmnand_regs_v50;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 202/218] mac80211: fix ibss scan parameters
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (200 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 201/218] mtd: brcmnand: Fix v7.1 register offsets Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 203/218] at803x: fix reset handling Kamal Mostafa
                   ` (15 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sara Sharon, Emmanuel Grumbach, Johannes Berg, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Sara Sharon <sara.sharon@intel.com>

commit d321cd014e51baab475efbdec468255b9e0ec822 upstream.

When joining IBSS a full scan should be initiated in order to search
for existing cell, unless the fixed_channel parameter was set.
A default channel to create the IBSS on if no cell was found is
provided as well.
However - a scan is initiated only on the default channel provided
regardless of whether ifibss->fixed_channel is set or not, with the
obvious result of the cell not joining existing IBSS cell that is
on another channel.

Fixes: 76bed0f43b27 ("mac80211: IBSS fix scan request")
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/mac80211/ibss.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 20fa58e..f45c4f8 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -7,6 +7,7 @@
  * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
  * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
+ * Copyright(c) 2016 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -1482,14 +1483,21 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
 
 		sdata_info(sdata, "Trigger new scan to find an IBSS to join\n");
 
-		num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
-							 &ifibss->chandef,
-							 channels,
-							 ARRAY_SIZE(channels));
 		scan_width = cfg80211_chandef_to_scan_width(&ifibss->chandef);
-		ieee80211_request_ibss_scan(sdata, ifibss->ssid,
-					    ifibss->ssid_len, channels, num,
-					    scan_width);
+
+		if (ifibss->fixed_channel) {
+			num = ieee80211_ibss_setup_scan_channels(local->hw.wiphy,
+								 &ifibss->chandef,
+								 channels,
+								 ARRAY_SIZE(channels));
+			ieee80211_request_ibss_scan(sdata, ifibss->ssid,
+						    ifibss->ssid_len, channels,
+						    num, scan_width);
+		} else {
+			ieee80211_request_ibss_scan(sdata, ifibss->ssid,
+						    ifibss->ssid_len, NULL,
+						    0, scan_width);
+		}
 	} else {
 		int interval = IEEE80211_SCAN_INTERVAL;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 203/218] at803x: fix reset handling
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (201 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 202/218] mac80211: fix ibss scan parameters Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 204/218] rtc: hym8563: fix invalid year calculation Kamal Mostafa
                   ` (14 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Shtylyov, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

commit d57019d1858a6f9b3ca05d76d793466ae428cfa3 upstream.

The driver of course "knows" that the chip's reset signal is active low,
so  it drives the GPIO to 0  to reset the PHY and to 1 otherwise; however
all this will only work iff the GPIO  is  specified as active-high in the
device tree!  I think both the driver and the device trees (if there are
any -- I was unable to find them) need to be fixed in this case...

Fixes: 13a56b449325 ("net: phy: at803x: Add support for hardware reset")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/phy/at803x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index fabf11d..5fbca04 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -198,7 +198,7 @@ static int at803x_probe(struct phy_device *phydev)
 	if (!priv)
 		return -ENOMEM;
 
-	gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
+	gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(gpiod_reset))
 		return PTR_ERR(gpiod_reset);
 
@@ -274,10 +274,10 @@ static void at803x_link_change_notify(struct phy_device *phydev)
 
 				at803x_context_save(phydev, &context);
 
-				gpiod_set_value(priv->gpiod_reset, 0);
-				msleep(1);
 				gpiod_set_value(priv->gpiod_reset, 1);
 				msleep(1);
+				gpiod_set_value(priv->gpiod_reset, 0);
+				msleep(1);
 
 				at803x_context_restore(phydev, &context);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 204/218] rtc: hym8563: fix invalid year calculation
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (202 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 203/218] at803x: fix reset handling Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 205/218] perf pmu: Fix misleadingly indented assignment (whitespace) Kamal Mostafa
                   ` (13 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Alexander Kochetkov, Alexandre Belloni, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Alexander Kochetkov <al.kochet@gmail.com>

commit d5861262210067fc01b2fb4f7af2fd85a3453f15 upstream.

Year field must be in BCD format, according to
hym8563 datasheet.

Due to the bug year 2016 became 2010.

Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver")
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/rtc/rtc-hym8563.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c
index e9da795..0b6b40a 100644
--- a/drivers/rtc/rtc-hym8563.c
+++ b/drivers/rtc/rtc-hym8563.c
@@ -144,7 +144,7 @@ static int hym8563_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	 * it does not seem to carry it over a subsequent write/read.
 	 * So we'll limit ourself to 100 years, starting at 2000 for now.
 	 */
-	buf[6] = tm->tm_year - 100;
+	buf[6] = bin2bcd(tm->tm_year - 100);
 
 	/*
 	 * CTL1 only contains TEST-mode bits apart from stop,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 205/218] perf pmu: Fix misleadingly indented assignment (whitespace)
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (203 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 204/218] rtc: hym8563: fix invalid year calculation Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 206/218] nbd: ratelimit error msgs after socket close Kamal Mostafa
                   ` (12 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Markus Trippelsdorf, Ben Hutchings, Matt Fleming, Peter Zijlstra,
	Arnaldo Carvalho de Melo, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Markus Trippelsdorf <markus@trippelsdorf.de>

commit d85ce830eef6c10d1e9617172dea4681f02b8424 upstream.

One line in perf_pmu__parse_unit() is indented wrongly, leading to a
warning (=> error) from gcc 6:

  util/pmu.c:156:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]

    sret = read(fd, alias->unit, UNIT_MAX_LEN);
    ^~~~

  util/pmu.c:153:2: note: ...this 'if' clause, but it is not
    if (fd == -1)
    ^~

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 410136f5dd96 ("tools/perf/stat: Add event unit and scale support")
Link: http://lkml.kernel.org/r/20151214154440.GC1409@x4
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/perf/util/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index ca54a61..284ebd9 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct perf_pmu_alias *alias, char *dir, char *n
 	if (fd == -1)
 		return -1;
 
-		sret = read(fd, alias->unit, UNIT_MAX_LEN);
+	sret = read(fd, alias->unit, UNIT_MAX_LEN);
 	if (sret < 0)
 		goto error;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 206/218] nbd: ratelimit error msgs after socket close
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (204 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 205/218] perf pmu: Fix misleadingly indented assignment (whitespace) Kamal Mostafa
@ 2016-03-31 20:16 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 207/218] paride: make 'verbose' parameter an 'int' again Kamal Mostafa
                   ` (11 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:16 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Dan Streetman, Markus Pargmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Dan Streetman <dan.streetman@canonical.com>

commit da6ccaaa79caca4f38b540b651238f87215217a2 upstream.

Make the "Attempted send on closed socket" error messages generated in
nbd_request_handler() ratelimited.

When the nbd socket is shutdown, the nbd_request_handler() function emits
an error message for every request remaining in its queue.  If the queue
is large, this will spam a large amount of messages to the log.  There's
no need for a separate error message for each request, so this patch
ratelimits it.

In the specific case this was found, the system was virtual and the error
messages were logged to the serial port, which overwhelmed it.

Fixes: 4d48a542b427 ("nbd: fix I/O hang on disconnected nbds")
Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/nbd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 0e385d8..e7bd163 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -556,8 +556,8 @@ static void do_nbd_request(struct request_queue *q)
 			req, req->cmd_type);
 
 		if (unlikely(!nbd->sock)) {
-			dev_err(disk_to_dev(nbd->disk),
-				"Attempted send on closed socket\n");
+			dev_err_ratelimited(disk_to_dev(nbd->disk),
+					    "Attempted send on closed socket\n");
 			req->errors++;
 			nbd_end_request(nbd, req);
 			spin_lock_irq(q->queue_lock);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 207/218] paride: make 'verbose' parameter an 'int' again
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (205 preceding siblings ...)
  2016-03-31 20:16 ` [PATCH 4.2.y-ckt 206/218] nbd: ratelimit error msgs after socket close Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 208/218] regulator: s5m8767: fix get_register() error handling Kamal Mostafa
                   ` (10 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Tim Waugh, Sudip Mukherjee, Jens Axboe,
	Greg Kroah-Hartman, Andrew Morton, Linus Torvalds, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit dec63a4dec2d6d01346fd5d96062e67c0636852b upstream.

gcc-6.0 found an ancient bug in the paride driver, which had a
"module_param(verbose, bool, 0);" since before 2.6.12, but actually uses
it to accept '0', '1' or '2' as arguments:

  drivers/block/paride/pd.c: In function 'pd_init_dev_parms':
  drivers/block/paride/pd.c:298:29: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
   #define DBMSG(msg) ((verbose>1)?(msg):NULL)

In 2012, Rusty did a cleanup patch that also changed the type of the
variable to 'bool', which introduced what is now a gcc warning.

This changes the type back to 'int' and adapts the module_param() line
instead, so it should work as documented in case anyone ever cares about
running the ancient driver with debugging.

Fixes: 90ab5ee94171 ("module_param: make bool parameters really bool (drivers & misc)")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Rusty Russell <rusty@rustcorp.com.au>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/block/paride/pd.c | 4 ++--
 drivers/block/paride/pt.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index b9242d7..d25e59d 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -126,7 +126,7 @@
 */
 #include <linux/types.h>
 
-static bool verbose = 0;
+static int verbose = 0;
 static int major = PD_MAJOR;
 static char *name = PD_NAME;
 static int cluster = 64;
@@ -161,7 +161,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};
 static DEFINE_MUTEX(pd_mutex);
 static DEFINE_SPINLOCK(pd_lock);
 
-module_param(verbose, bool, 0);
+module_param(verbose, int, 0);
 module_param(major, int, 0);
 module_param(name, charp, 0);
 module_param(cluster, int, 0);
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 1740d75..216a94f 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -117,7 +117,7 @@
 
 */
 
-static bool verbose = 0;
+static int verbose = 0;
 static int major = PT_MAJOR;
 static char *name = PT_NAME;
 static int disable = 0;
@@ -152,7 +152,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
 
 #include <asm/uaccess.h>
 
-module_param(verbose, bool, 0);
+module_param(verbose, int, 0);
 module_param(major, int, 0);
 module_param(name, charp, 0);
 module_param_array(drive0, int, NULL, 0);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 208/218] regulator: s5m8767: fix get_register() error handling
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (206 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 207/218] paride: make 'verbose' parameter an 'int' again Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 209/218] ppp: ensure file->private_data can't be overridden Kamal Mostafa
                   ` (9 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Arnd Bergmann, Mark Brown, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit e07ff9434167981c993a26d2edbbcb8e13801dbb upstream.

The s5m8767_pmic_probe() function calls s5m8767_get_register() to
read data without checking the return code, which produces a compile-time
warning when that data is accessed:

drivers/regulator/s5m8767.c: In function 's5m8767_pmic_probe':
drivers/regulator/s5m8767.c:924:7: error: 'enable_reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/regulator/s5m8767.c:944:30: error: 'enable_val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This changes the s5m8767_get_register() function to return a -EINVAL
not just for an invalid register number but also for an invalid
regulator number, as both would result in returning uninitialized
data. The s5m8767_pmic_probe() function is then changed accordingly
to fail on a read error, as all the other callers of s5m8767_get_register()
already do.

In practice this probably cannot happen, as we don't call
s5m8767_get_register() with invalid arguments, but the gcc
warning seems valid in principle, in terms writing safe
error checking.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 9c4c60554acf ("regulator: s5m8767: Convert to use regulator_[enable|disable|is_enabled]_regmap")
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/regulator/s5m8767.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 58f5d3b..27343e1 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -202,9 +202,10 @@ static int s5m8767_get_register(struct s5m8767_info *s5m8767, int reg_id,
 		}
 	}
 
-	if (i < s5m8767->num_regulators)
-		*enable_ctrl =
-		s5m8767_opmode_reg[reg_id][mode] << S5M8767_ENCTRL_SHIFT;
+	if (i >= s5m8767->num_regulators)
+		return -EINVAL;
+
+	*enable_ctrl = s5m8767_opmode_reg[reg_id][mode] << S5M8767_ENCTRL_SHIFT;
 
 	return 0;
 }
@@ -937,8 +938,12 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
 			else
 				regulators[id].vsel_mask = 0xff;
 
-			s5m8767_get_register(s5m8767, id, &enable_reg,
+			ret = s5m8767_get_register(s5m8767, id, &enable_reg,
 					     &enable_val);
+			if (ret) {
+				dev_err(s5m8767->dev, "error reading registers\n");
+				return ret;
+			}
 			regulators[id].enable_reg = enable_reg;
 			regulators[id].enable_mask = S5M8767_ENCTRL_MASK;
 			regulators[id].enable_val = enable_val;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 209/218] ppp: ensure file->private_data can't be overridden
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (207 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 208/218] regulator: s5m8767: fix get_register() error handling Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 210/218] clk: versatile: sp810: support reentrance Kamal Mostafa
                   ` (8 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Guillaume Nault, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Guillaume Nault <g.nault@alphalink.fr>

commit e8e56ffd9d2973398b60ece1f1bebb8d67b4d032 upstream.

Locking ppp_mutex must be done before dereferencing file->private_data,
otherwise it could be modified before ppp_unattached_ioctl() takes the
lock. This could lead ppp_unattached_ioctl() to override ->private_data,
thus leaking reference to the ppp_file previously pointed to.

v2: lock all ppp_ioctl() instead of just checking private_data in
    ppp_unattached_ioctl(), to avoid ambiguous behaviour.

Fixes: f3ff8a4d80e8 ("ppp: push BKL down into the driver")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ppp/ppp_generic.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 6fc526b..02ed8c5 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -565,7 +565,7 @@ static int get_filter(void __user *arg, struct sock_filter **p)
 
 static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	struct ppp_file *pf = file->private_data;
+	struct ppp_file *pf;
 	struct ppp *ppp;
 	int err = -EFAULT, val, val2, i;
 	struct ppp_idle idle;
@@ -575,9 +575,14 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	void __user *argp = (void __user *)arg;
 	int __user *p = argp;
 
-	if (!pf)
-		return ppp_unattached_ioctl(current->nsproxy->net_ns,
-					pf, file, cmd, arg);
+	mutex_lock(&ppp_mutex);
+
+	pf = file->private_data;
+	if (!pf) {
+		err = ppp_unattached_ioctl(current->nsproxy->net_ns,
+					   pf, file, cmd, arg);
+		goto out;
+	}
 
 	if (cmd == PPPIOCDETACH) {
 		/*
@@ -592,7 +597,6 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		 * this fd and reopening /dev/ppp.
 		 */
 		err = -EINVAL;
-		mutex_lock(&ppp_mutex);
 		if (pf->kind == INTERFACE) {
 			ppp = PF_TO_PPP(pf);
 			rtnl_lock();
@@ -606,15 +610,13 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		} else
 			pr_warn("PPPIOCDETACH file->f_count=%ld\n",
 				atomic_long_read(&file->f_count));
-		mutex_unlock(&ppp_mutex);
-		return err;
+		goto out;
 	}
 
 	if (pf->kind == CHANNEL) {
 		struct channel *pch;
 		struct ppp_channel *chan;
 
-		mutex_lock(&ppp_mutex);
 		pch = PF_TO_CHANNEL(pf);
 
 		switch (cmd) {
@@ -636,17 +638,16 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 				err = chan->ops->ioctl(chan, cmd, arg);
 			up_read(&pch->chan_sem);
 		}
-		mutex_unlock(&ppp_mutex);
-		return err;
+		goto out;
 	}
 
 	if (pf->kind != INTERFACE) {
 		/* can't happen */
 		pr_err("PPP: not interface or channel??\n");
-		return -EINVAL;
+		err = -EINVAL;
+		goto out;
 	}
 
-	mutex_lock(&ppp_mutex);
 	ppp = PF_TO_PPP(pf);
 	switch (cmd) {
 	case PPPIOCSMRU:
@@ -821,7 +822,10 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	default:
 		err = -ENOTTY;
 	}
+
+out:
 	mutex_unlock(&ppp_mutex);
+
 	return err;
 }
 
@@ -834,7 +838,6 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
 	struct ppp_net *pn;
 	int __user *p = (int __user *)arg;
 
-	mutex_lock(&ppp_mutex);
 	switch (cmd) {
 	case PPPIOCNEWUNIT:
 		/* Create a new ppp unit */
@@ -884,7 +887,7 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
 	default:
 		err = -ENOTTY;
 	}
-	mutex_unlock(&ppp_mutex);
+
 	return err;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 210/218] clk: versatile: sp810: support reentrance
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (208 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 209/218] ppp: ensure file->private_data can't be overridden Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 211/218] net: add description for len argument of dev_get_phys_port_name Kamal Mostafa
                   ` (7 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Turquette, Pawel Moll, Linus Walleij, Stephen Boyd,
	Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Linus Walleij <linus.walleij@linaro.org>

commit ec7957a6aa0aaf981fb8356dc47a2cdd01cde03c upstream.

Despite care take to allocate clocks state containers the
SP810 driver actually just supports creating one instance:
all clocks registered for every instance will end up with the
exact same name and __clk_init() will fail.

Rename the timclken<0> .. timclken<n> to sp810_<instance>_<n>
so every clock on every instance gets a unique name.

This is necessary for the RealView PBA8 which has two SP810
blocks: the second block will not register its clocks unless
every clock on every instance is unique and results in boot
logs like this:

------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at ../drivers/clk/versatile/clk-sp810.c:137
  clk_sp810_of_setup+0x110/0x154()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.5.0-rc2-00030-g352718fc39f6-dirty #225
Hardware name: ARM RealView Machine (Device Tree Support)
[<c00167f8>] (unwind_backtrace) from [<c0013204>]
             (show_stack+0x10/0x14)
[<c0013204>] (show_stack) from [<c01a049c>]
             (dump_stack+0x84/0x9c)
[<c01a049c>] (dump_stack) from [<c0024990>]
             (warn_slowpath_common+0x74/0xb0)
[<c0024990>] (warn_slowpath_common) from [<c0024a68>]
             (warn_slowpath_null+0x1c/0x24)
[<c0024a68>] (warn_slowpath_null) from [<c051eb44>]
             (clk_sp810_of_setup+0x110/0x154)
[<c051eb44>] (clk_sp810_of_setup) from [<c051e3a4>]
             (of_clk_init+0x12c/0x1c8)
[<c051e3a4>] (of_clk_init) from [<c0504714>]
             (time_init+0x20/0x2c)
[<c0504714>] (time_init) from [<c0501b18>]
             (start_kernel+0x244/0x3c4)
[<c0501b18>] (start_kernel) from [<7000807c>] (0x7000807c)
---[ end trace cb88537fdc8fa200 ]---

Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Fixes: 6e973d2c4385 "clk: vexpress: Add separate SP810 driver"
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/clk/versatile/clk-sp810.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index b674ffc..72af18b 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -141,6 +141,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 	const char *parent_names[2];
 	char name[12];
 	struct clk_init_data init;
+	static int instance;
 	int i;
 
 	if (!sp810) {
@@ -172,7 +173,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 	init.num_parents = ARRAY_SIZE(parent_names);
 
 	for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) {
-		snprintf(name, ARRAY_SIZE(name), "timerclken%d", i);
+		snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);
 
 		sp810->timerclken[i].sp810 = sp810;
 		sp810->timerclken[i].channel = i;
@@ -184,5 +185,6 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 	}
 
 	of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810);
+	instance++;
 }
 CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 211/218] net: add description for len argument of dev_get_phys_port_name
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (209 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 210/218] clk: versatile: sp810: support reentrance Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 212/218] net: bcmgenet: fix dma api length mismatch Kamal Mostafa
                   ` (6 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Luis de Bethencourt, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Luis de Bethencourt <luisbg@osg.samsung.com>

commit ed49e650371008b0e00c8004cc2ca93055740f78 upstream.

When the function dev_get_phys_port_name was added it missed a description
for it's len argument. Adding it.

Fixes: db24a9044ee1 ("net: add support for phys_port_name")
Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 net/core/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index f1f1dd8..79a39de 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6065,6 +6065,7 @@ EXPORT_SYMBOL(dev_get_phys_port_id);
  *	dev_get_phys_port_name - Get device physical port name
  *	@dev: device
  *	@name: port name
+ *	@len: limit of bytes to copy to name
  *
  *	Get device physical port name
  */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 212/218] net: bcmgenet: fix dma api length mismatch
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (210 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 211/218] net: add description for len argument of dev_get_phys_port_name Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 213/218] ARM: prima2: always enable reset controller Kamal Mostafa
                   ` (5 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Eric Dumazet, David S . Miller, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Eric Dumazet <edumazet@google.com>

commit eee577232203842b4dcadb7ab477a298479633ed upstream.

When un-mapping skb->data in __bcmgenet_tx_reclaim(),
we must use the length that was used in original dma_map_single(),
instead of skb->len that might be bigger (includes the frags)

We simply can store skb_len into tx_cb_ptr->dma_len and use it
at unmap time.

Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 93b673b..24eaccd 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1048,7 +1048,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
 			dev->stats.tx_bytes += tx_cb_ptr->skb->len;
 			dma_unmap_single(&dev->dev,
 					 dma_unmap_addr(tx_cb_ptr, dma_addr),
-					 tx_cb_ptr->skb->len,
+					 dma_unmap_len(tx_cb_ptr, dma_len),
 					 DMA_TO_DEVICE);
 			bcmgenet_free_cb(tx_cb_ptr);
 		} else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {
@@ -1159,7 +1159,7 @@ static int bcmgenet_xmit_single(struct net_device *dev,
 	}
 
 	dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping);
-	dma_unmap_len_set(tx_cb_ptr, dma_len, skb->len);
+	dma_unmap_len_set(tx_cb_ptr, dma_len, skb_len);
 	length_status = (skb_len << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
 			(priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT) |
 			DMA_TX_APPEND_CRC;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 213/218] ARM: prima2: always enable reset controller
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (211 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 212/218] net: bcmgenet: fix dma api length mismatch Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 214/218] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Kamal Mostafa
                   ` (4 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Arnd Bergmann, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Arnd Bergmann <arnd@arndb.de>

commit ef2b1d777d643af227a22309d8b79898b90b123c upstream.

The atlas7 clock controller driver registers a reset controller
for itself, which causes a link error when the subsystem is
disabled:

drivers/built-in.o: In function `atlas7_clk_init':
drivers/clk/sirf/clk-atlas7.c:1681: undefined reference to `reset_controller_register'

As the clk driver does not have a Kconfig symbol for itself
but it always built-in when the platform is enabled, we have
to ensure that the reset controller subsystem is also built-in
in this case.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Fixes: 301c5d29402e ("clk: sirf: add CSR atlas7 clk and reset support")
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/arm/mach-prima2/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index 9ab8932..56e55fd 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,6 +1,7 @@
 menuconfig ARCH_SIRF
 	bool "CSR SiRF" if ARCH_MULTI_V7
 	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_IRQ_CHIP
 	select NO_IOPORT_MAP
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 214/218] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (212 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 213/218] ARM: prima2: always enable reset controller Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 215/218] perf stat: Document --detailed option Kamal Mostafa
                   ` (3 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Michael Hennerich, Greg Kroah-Hartman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Michael Hennerich <michael.hennerich@analog.com>

commit f3df53e4d70b5736368a8fe8aa1bb70c1cb1f577 upstream.

Fix RDAC read back errors caused by a typo. Value must shift by 2.

Fixes: a4bd394956f2 ("drivers/misc/ad525x_dpot.c: new features")
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/misc/ad525x_dpot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 15e8807..f1a0b99 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -216,7 +216,7 @@ static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg)
 			 */
 			value = swab16(value);
 
-			if (dpot->uid == DPOT_UID(AD5271_ID))
+			if (dpot->uid == DPOT_UID(AD5274_ID))
 				value = value >> 2;
 		return value;
 	default:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 215/218] perf stat: Document --detailed option
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (213 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 214/218] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 216/218] [media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream Kamal Mostafa
                   ` (2 subsequent siblings)
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Borislav Petkov, Arnaldo Carvalho de Melo, Alexander Shishkin,
	David Ahern, Davidlohr Bueso, Jiri Olsa, Mel Gorman,
	Namhyung Kim, Peter Zijlstra, Peter Zijlstra, Steven Rostedt,
	Thomas Gleixner, Ingo Molnar, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Borislav Petkov <bp@suse.de>

commit f594bae08183fb6b57db55387794ece3e1edf6f6 upstream.

I'm surprised this remained undocumented since at least 2011. And it is
actually a very useful switch, as Steve and I came to realize recently.

Add the text from

  2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")

which added the incrementing aspect to -d.

Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Davidlohr Bueso <dbueso@suse.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mel Gorman <mgorman@suse.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")
Link: http://lkml.kernel.org/r/1457347294-32546-1-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 tools/perf/Documentation/perf-stat.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
index 47469ab..fff765a 100644
--- a/tools/perf/Documentation/perf-stat.txt
+++ b/tools/perf/Documentation/perf-stat.txt
@@ -62,6 +62,14 @@ OPTIONS
 --scale::
 	scale/normalize counter values
 
+-d::
+--detailed::
+	print more detailed statistics, can be specified up to 3 times
+
+	   -d:          detailed events, L1 and LLC data cache
+        -d -d:     more detailed events, dTLB and iTLB events
+     -d -d -d:     very detailed events, adding prefetch events
+
 -r::
 --repeat=<n>::
 	repeat command and print average + stddev (max: 100). 0 means forever.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 216/218] [media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (214 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 215/218] perf stat: Document --detailed option Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 217/218] ipvs: drop first packet to redirect conntrack Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 218/218] rtc: max77686: Properly handle regmap_irq_get_virq() error code Kamal Mostafa
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Laurent Pinchart, Mauro Carvalho Chehab, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

commit f6acfcdc5b8cdc9ddd53a459361820b9efe958c4 upstream.

Commit 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity
controllable during streaming") refactored the stream start code and
removed the SRU CTRL0 register write by mistake. Add it back.

Fixes: 58f896d859ce ("[media] v4l: vsp1: sru: Make the intensity controllable during streaming")

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/media/platform/vsp1/vsp1_sru.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/vsp1/vsp1_sru.c b/drivers/media/platform/vsp1/vsp1_sru.c
index 6310aca..d41ae95 100644
--- a/drivers/media/platform/vsp1/vsp1_sru.c
+++ b/drivers/media/platform/vsp1/vsp1_sru.c
@@ -154,6 +154,7 @@ static int sru_s_stream(struct v4l2_subdev *subdev, int enable)
 	mutex_lock(sru->ctrls.lock);
 	ctrl0 |= vsp1_sru_read(sru, VI6_SRU_CTRL0)
 	       & (VI6_SRU_CTRL0_PARAM0_MASK | VI6_SRU_CTRL0_PARAM1_MASK);
+	vsp1_sru_write(sru, VI6_SRU_CTRL0, ctrl0);
 	mutex_unlock(sru->ctrls.lock);
 
 	vsp1_sru_write(sru, VI6_SRU_CTRL1, VI6_SRU_CTRL1_PARAM5);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 217/218] ipvs: drop first packet to redirect conntrack
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (215 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 216/218] [media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 218/218] rtc: max77686: Properly handle regmap_irq_get_virq() error code Kamal Mostafa
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jiri Bohac, Julian Anastasov, Simon Horman, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Julian Anastasov <ja@ssi.bg>

commit f719e3754ee2f7275437e61a6afd520181fdd43b upstream.

Jiri Bohac is reporting for a problem where the attempt
to reschedule existing connection to another real server
needs proper redirect for the conntrack used by the IPVS
connection. For example, when IPVS connection is created
to NAT-ed real server we alter the reply direction of
conntrack. If we later decide to select different real
server we can not alter again the conntrack. And if we
expire the old connection, the new connection is left
without conntrack.

So, the only way to redirect both the IPVS connection and
the Netfilter's conntrack is to drop the SYN packet that
hits existing connection, to wait for the next jiffie
to expire the old connection and its conntrack and to rely
on client's retransmission to create new connection as
usually.

Jiri Bohac provided a fix that drops all SYNs on rescheduling,
I extended his patch to do such drops only for connections
that use conntrack. Here is the original report from Jiri Bohac:

Since commit dc7b3eb900aa ("ipvs: Fix reuse connection if real server
is dead"), new connections to dead servers are redistributed
immediately to new servers.  The old connection is expired using
ip_vs_conn_expire_now() which sets the connection timer to expire
immediately.

However, before the timer callback, ip_vs_conn_expire(), is run
to clean the connection's conntrack entry, the new redistributed
connection may already be established and its conntrack removed
instead.

Fix this by dropping the first packet of the new connection
instead, like we do when the destination server is not available.
The timer will have deleted the old conntrack entry long before
the first packet of the new connection is retransmitted.

Fixes: dc7b3eb900aa ("ipvs: Fix reuse connection if real server is dead")
Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 include/net/ip_vs.h             | 17 +++++++++++++++++
 net/netfilter/ipvs/ip_vs_core.c | 37 ++++++++++++++++++++++++++++---------
 2 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 4e3731e..cd85945 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1584,6 +1584,23 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp)
 }
 #endif /* CONFIG_IP_VS_NFCT */
 
+/* Really using conntrack? */
+static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp,
+					     struct sk_buff *skb)
+{
+#ifdef CONFIG_IP_VS_NFCT
+	enum ip_conntrack_info ctinfo;
+	struct nf_conn *ct;
+
+	if (!(cp->flags & IP_VS_CONN_F_NFCT))
+		return false;
+	ct = nf_ct_get(skb, &ctinfo);
+	if (ct && !nf_ct_is_untracked(ct))
+		return true;
+#endif
+	return false;
+}
+
 static inline int
 ip_vs_dest_conn_overhead(struct ip_vs_dest *dest)
 {
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 38fbc19..a26bd65 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -1689,15 +1689,34 @@ ip_vs_in(unsigned int hooknum, struct sk_buff *skb, int af)
 	cp = pp->conn_in_get(af, skb, &iph, 0);
 
 	conn_reuse_mode = sysctl_conn_reuse_mode(ipvs);
-	if (conn_reuse_mode && !iph.fragoffs &&
-	    is_new_conn(skb, &iph) && cp &&
-	    ((unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest &&
-	      unlikely(!atomic_read(&cp->dest->weight))) ||
-	     unlikely(is_new_conn_expected(cp, conn_reuse_mode)))) {
-		if (!atomic_read(&cp->n_control))
-			ip_vs_conn_expire_now(cp);
-		__ip_vs_conn_put(cp);
-		cp = NULL;
+	if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) {
+		bool uses_ct = false, resched = false;
+
+		if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest &&
+		    unlikely(!atomic_read(&cp->dest->weight))) {
+			resched = true;
+			uses_ct = ip_vs_conn_uses_conntrack(cp, skb);
+		} else if (is_new_conn_expected(cp, conn_reuse_mode)) {
+			uses_ct = ip_vs_conn_uses_conntrack(cp, skb);
+			if (!atomic_read(&cp->n_control)) {
+				resched = true;
+			} else {
+				/* Do not reschedule controlling connection
+				 * that uses conntrack while it is still
+				 * referenced by controlled connection(s).
+				 */
+				resched = !uses_ct;
+			}
+		}
+
+		if (resched) {
+			if (!atomic_read(&cp->n_control))
+				ip_vs_conn_expire_now(cp);
+			__ip_vs_conn_put(cp);
+			if (uses_ct)
+				return NF_DROP;
+			cp = NULL;
+		}
 	}
 
 	if (unlikely(!cp) && !iph.fragoffs) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* [PATCH 4.2.y-ckt 218/218] rtc: max77686: Properly handle regmap_irq_get_virq() error code
  2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
                   ` (216 preceding siblings ...)
  2016-03-31 20:17 ` [PATCH 4.2.y-ckt 217/218] ipvs: drop first packet to redirect conntrack Kamal Mostafa
@ 2016-03-31 20:17 ` Kamal Mostafa
  217 siblings, 0 replies; 221+ messages in thread
From: Kamal Mostafa @ 2016-03-31 20:17 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Krzysztof Kozlowski, Alexandre Belloni, Kamal Mostafa

4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: Krzysztof Kozlowski <k.kozlowski@samsung.com>

commit fb166ba1d7f0a662f7332f4ff660a0d6f4d76915 upstream.

The regmap_irq_get_virq() can return 0 or -EINVAL in error conditions
but driver checked only for value of 0.

This could lead to a cast of -EINVAL to an unsigned int used as a
interrupt number for devm_request_threaded_irq(). Although this is not
yet fatal (devm_request_threaded_irq() will just fail with -EINVAL) but
might be a misleading when diagnosing errors.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Fixes: 6f1c1e71d933 ("mfd: max77686: Convert to use regmap_irq")
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 drivers/rtc/rtc-max77686.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index 7184a0e..725dcca 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -465,7 +465,7 @@ static int max77686_rtc_probe(struct platform_device *pdev)
 
 	info->virq = regmap_irq_get_virq(max77686->rtc_irq_data,
 					 MAX77686_RTCIRQ_RTCA1);
-	if (!info->virq) {
+	if (info->virq <= 0) {
 		ret = -ENXIO;
 		goto err_rtc;
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 221+ messages in thread

* RE: [PATCH 4.2.y-ckt 092/218] EDAC/sb_edac: Fix computation of channel address
  2016-03-31 20:15 ` [PATCH 4.2.y-ckt 092/218] EDAC/sb_edac: Fix computation of channel address Kamal Mostafa
@ 2016-03-31 20:24   ` Luck, Tony
  0 siblings, 0 replies; 221+ messages in thread
From: Luck, Tony @ 2016-03-31 20:24 UTC (permalink / raw)
  To: Kamal Mostafa, linux-kernel, stable, kernel-team
  Cc: Borislav Petkov, Linus Torvalds, Mauro Carvalho Chehab,
	Peter Zijlstra, Thomas Gleixner, linux-edac, Ingo Molnar

> 4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.

Can you hold it for a bit?  There is a silly error in this which breaks the channel computation.

Also needs to check if address hashing is enabled.

So 1 or 2 follow up patches should be coming out soon and should be batched next to this patch.

-Tony

^ permalink raw reply	[flat|nested] 221+ messages in thread

* Re: [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts
  2016-03-31 20:13 ` [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts Kamal Mostafa
@ 2016-05-03  6:58   ` Geert Uytterhoeven
  0 siblings, 0 replies; 221+ messages in thread
From: Geert Uytterhoeven @ 2016-05-03  6:58 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: linux-kernel, stable, Ubuntu Kernel Team, Geert Uytterhoeven,
	Linus Walleij

Hi Kamal et al,

On Thu, Mar 31, 2016 at 10:13 PM, Kamal Mostafa <kamal@canonical.com> wrote:
> 4.2.8-ckt7 -stable review patch.  If anyone has any objections, please let me know.
>
> ---8<------------------------------------------------------------
>
> From: Geert Uytterhoeven <geert+renesas@glider.be>
>
> commit b26a719bdba9aa926ceaadecc66e07623d2b8a53 upstream.
>
> The R-Car GPIO driver handles Runtime PM for requested GPIOs only.
>
> When using a GPIO purely as an interrupt source, no Runtime PM handling
> is done, and the GPIO module's clock may not be enabled.
>
> To fix this:
>   - Add .irq_request_resources() and .irq_release_resources() callbacks
>     to handle Runtime PM when an interrupt is requested,
>   - Add irq_bus_lock() and sync_unlock() callbacks to handle Runtime PM
>     when e.g. disabling/enabling an interrupt, or configuring the
>     interrupt type.
>
> Fixes: d5c3d84657db57bd "net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS"
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>

This patch, which has been applied to the following stable trees:
  - 3.16.7-ckt26,
  - 3.19.8-ckt17,
  - 4.2.8-ckt7,
has been reverted in mainline:

commit ce0e2c60e69e5f87ab4ac10c935d8bd85d4d11f7
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Tue Apr 12 10:05:22 2016 +0200

    Revert "gpio: rcar: Fine-grained Runtime PM support"

    This reverts commit 65194cb174b873448b208eb6e04ecb72237af76e.


commit 42c25013ca95ce79b4ed192188ca843ae48f8c71
Author: Linus Walleij <linus.walleij@linaro.org>
Date:   Tue Apr 12 10:00:34 2016 +0200

    Revert "gpio: rcar: Add Runtime PM handling for interrupts"

    This reverts commit b26a719bdba9aa926ceaadecc66e07623d2b8a53.


Please apply the two reverts where appropriate.

Unfortunately these reverts don't have much context in their descriptions.
What may happen is:

    BUG: sleeping function called from invalid context at
/home/laurent/src/iob/renesas/linux/drivers/base/power/runtime.c:955
    in_atomic(): 1, irqs_disabled(): 128, pid: 658, name: udevd
    CPU: 3 PID: 658 Comm: udevd Tainted: P                4.6.0-rc3 #756
    Hardware name: Generic R8A7790 (Flattened Device Tree)
    Backtrace:
    [<c0014c98>] (dump_backtrace) from [<c0014fb0>] (show_stack+0x20/0x24)
     r6:00000000 r5:00000000 r4:60000093 r3:00000000
    [<c0014f90>] (show_stack) from [<c01f614c>] (dump_stack+0x8c/0xac)
    [<c01f60c0>] (dump_stack) from [<c00510c8>] (___might_sleep+0x100/0x158)
     r5:000003bb r4:c06ca340
    [<c0050fc8>] (___might_sleep) from [<c005118c>] (__might_sleep+0x6c/0xa8)
     r4:c05b6a24
    [<c0051120>] (__might_sleep) from [<c02d971c>]
(__pm_runtime_resume+0x98/0xa0)
     r6:000000dc r5:00000004 r4:ea280010
    [<c02d9684>] (__pm_runtime_resume) from [<c02282c8>]
(gpio_rcar_irq_request_resources+0x2c/0x34)
     r7:00000000 r6:000000dc r5:e95b3c00 r4:e99f3c00
    [<c022829c>] (gpio_rcar_irq_request_resources) from [<c0077a88>]
(__setup_irq+0x24c/0x5dc)
    [<c007783c>] (__setup_irq) from [<c0077ff4>]
(request_threaded_irq+0xdc/0x180)
     r10:bf0aabc8 r9:000000dc r8:e9bc3000 r7:c0075be8 r6:e99f3c00 r5:00002003
     r4:e95b3c00
    [<c0077f18>] (request_threaded_irq) from [<c007a758>]
(devm_request_threaded_irq+0x6c/0xac)
     r10:ea2db810 r9:ea2db810 r8:00000000 r7:bf0aabc8 r6:000000dc r5:e9bc3000
     r4:e95b3b50 r3:00002003
    [<c007a6ec>] (devm_request_threaded_irq) from [<bf0aab9c>]
(mmc_gpiod_request_cd_irq+0xa4/0xd0 [mmc_core])
     r10:ea2db800 r8:e9bc3000 r7:e9bed598 r6:000000dc r5:e9bed524 r4:e9bc3000
    [<bf0aaaf8>] (mmc_gpiod_request_cd_irq [mmc_core]) from
[<bf09f3bc>] (mmc_start_host+0x70/0x90 [mmc_core])
     r6:e9bc3300 r5:00000000 r4:e9bc3000
    [<bf09f34c>] (mmc_start_host [mmc_core]) from [<bf0a061c>]
(mmc_add_host+0x54/0x78 [mmc_core])
     r4:e9bc3000 r3:00000001
    [<bf0a05c8>] (mmc_add_host [mmc_core]) from [<bf134b3c>]
(tmio_mmc_host_probe+0x3ac/0x450 [tmio_mmc_core])
     r5:ffffffe0 r4:00000000
    [<bf134790>] (tmio_mmc_host_probe [tmio_mmc_core]) from
[<bf1501e8>] (sh_mobile_sdhi_probe+0x198/0x414 [sh_mobile_sdhi])
     r10:bf150d04 r9:e9bed598 r8:00000001 r7:ea2db810 r6:ea2db800 r5:e9bc3300
     r4:e9bed590
    [<bf150050>] (sh_mobile_sdhi_probe [sh_mobile_sdhi]) from
[<c02cf220>] (platform_drv_probe+0x60/0xc0)
     r10:00000011 r9:00000000 r8:bf151464 r7:bf151464 r6:fffffdfb r5:ea2db810
     r4:00000000
    [<c02cf1c0>] (platform_drv_probe) from [<c02ccf80>]
(driver_probe_device+0x224/0x440)
     r7:c06c45f8 r6:c08e2b44 r5:c08e2b3c r4:ea2db810

To fix this, we decided to keep gpio-rcar runtime-resumed all the time,
i.e. revert both of
b26a719bdb ("gpio: rcar: Add Runtime PM handling for interrupts")
65194cb174 ("gpio: rcar: Fine-grained Runtime PM support")
until the irqchip subsystem has support for Runtime PM.

Cfr. the thread at http://www.spinics.net/lists/linux-renesas-soc/msg02710.html

Sorry for the inconvenience.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 221+ messages in thread

end of thread, other threads:[~2016-05-03  6:58 UTC | newest]

Thread overview: 221+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-31 20:13 [4.2.y-ckt stable] Linux 4.2.8-ckt7 stable review Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 001/218] crypto: skcipher - Add crypto_skcipher_has_setkey Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 002/218] crypto: algif_skcipher - Add key check exception for cipher_null Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 003/218] crypto: algif_skcipher - Do not assume that req is unchanged Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 004/218] crypto: algif_skcipher - Do not dereference ctx without socket lock Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 005/218] gpiolib: do not allow to insert an empty gpiochip Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 006/218] gpio: add a data pointer to gpio_chip Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 007/218] gpio: rcar: Add Runtime PM handling for interrupts Kamal Mostafa
2016-05-03  6:58   ` Geert Uytterhoeven
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 008/218] ipv4: Don't do expensive useless work during inetdev destroy Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 009/218] Input: powermate - fix oops with malicious USB descriptors Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 010/218] USB: iowarrior: " Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 011/218] ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk() Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 012/218] ALSA: usb-audio: Add sanity checks for endpoint accesses Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 013/218] include/linux/poison.h: fix LIST_POISON{1,2} offset Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 014/218] Input: ati_remote2 - fix crashes on detecting device with invalid descriptor Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 015/218] USB: cdc-acm: more sanity checking Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 016/218] drm/i915: Workaround CHV pipe C cursor fail Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 017/218] EDAC, amd64_edac: Shift wrapping issue in f1x_get_norm_dct_addr() Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 018/218] crypto: ccp - Add hash state import and export support Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 019/218] clk: rockchip: add pclk_cpu to the list of rk3188 critical clocks Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 020/218] clk: rockchip: Add pclk_peri to critical clocks on RK3066/RK3188 Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 021/218] clk: rockchip: add hclk_cpubus to the list of rk3188 critical clocks Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 022/218] tty: Fix GPF in flush_to_ldisc(), part 2 Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 023/218] [media] media: v4l2-compat-ioctl32: fix missing length copy in put_v4l2_buffer32 Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 024/218] [media] pwc: Add USB id for Philips Spc880nc webcam Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 025/218] crypto: ccp - Limit the amount of information exported Kamal Mostafa
2016-03-31 20:13 ` [PATCH 4.2.y-ckt 026/218] crypto: ccp - Don't assume export/import areas are aligned Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 027/218] 8250: use callbacks to access UART_DLL/UART_DLM Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 028/218] net: irda: Fix use-after-free in irtty_open() Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 029/218] mei: bus: fix drivers and devices names confusion Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 030/218] mei: bus: check if the device is enabled before data transfer Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 031/218] staging: comedi: ni_tiocmd: change mistaken use of start_src for start_arg Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 032/218] tools/hv: Use include/uapi with __EXPORTED_HEADERS__ Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 033/218] tpm: fix the rollback in tpm_chip_register() Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 034/218] tpm: fix the cleanup of struct tpm_chip Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 035/218] ARM: dts: armada-375: use armada-370-sata for SATA Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 036/218] usb: retry reset if a device times out Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 037/218] HID: fix hid_ignore_special_drivers module parameter Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 038/218] scripts/coccinelle: modernize & Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 039/218] [media] adv7511: TX_EDID_PRESENT is still 1 after a disconnect Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 040/218] [media] saa7134: Fix bytesperline not being set correctly for planar formats Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 041/218] tpm_crb: tpm2_shutdown() must be called before tpm_chip_unregister() Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 042/218] perf tools: Dont stop PMU parsing on alias parse error Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 043/218] Bluetooth: btusb: Add new AR3012 ID 13d3:3395 Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 044/218] Bluetooth: Add new AR3012 ID 0489:e095 Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 045/218] aacraid: Fix RRQ overload Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 046/218] aacraid: Fix memory leak in aac_fib_map_free Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 047/218] aic7xxx: Fix queue depth handling Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 048/218] mtd: onenand: fix deadlock in onenand_block_markbad Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 049/218] PCI: Disable IO/MEM decoding for devices with non-compliant BARs Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 050/218] md/raid5: Compare apples to apples (or sectors to sectors) Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 051/218] RAID5: check_reshape() shouldn't call mddev_suspend Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 052/218] RAID5: revert e9e4c377e2f563 to fix a livelock Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 053/218] crypto: ccp - memset request context to zero during import Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 054/218] Bluetooth: btusb: Add a new AR3012 ID 04ca:3014 Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 055/218] mmc: sdhci: fix data timeout (part 1) Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 056/218] mmc: sdhci: fix data timeout (part 2) Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 057/218] perf tools: Fix python extension build Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 058/218] IB/srpt: Simplify srpt_handle_tsk_mgmt() Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 059/218] [media] bttv: Width must be a multiple of 16 when capturing planar formats Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 060/218] watchdog: rc32434_wdt: fix ioctl error handling Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 061/218] nfsd4: fix bad bounds checking Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 062/218] xfs: fix two memory leaks in xfs_attr_list.c error paths Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 063/218] quota: Fix possible GPF due to uninitialised pointers Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 064/218] mtip32xx: Fix broken service thread handling Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 065/218] mtip32xx: Remove unwanted code from taskfile error handler Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 066/218] mtip32xx: Print exact time when an internal command is interrupted Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 067/218] mtip32xx: Avoid issuing standby immediate cmd during FTL rebuild Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 068/218] mtip32xx: Fix for rmmod crash when drive is in " Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 069/218] mtip32xx: Handle safe removal during IO Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 070/218] mtip32xx: Handle FTL rebuild failure state during device initialization Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 071/218] of: alloc anywhere from memblock if range not specified Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 072/218] usb: hub: fix a typo in hub_port_init() leading to wrong logic Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 073/218] KVM: i8254: change PIT discard tick policy Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 074/218] sched/cputime: Fix steal time accounting vs. CPU hotplug Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 075/218] libnvdimm: Fix security issue with DSM IOCTL Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 076/218] rt2x00: add new rt2800usb device Buffalo WLI-UC-G450 Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 077/218] pinctrl-bcm2835: Fix cut-and-paste error in "pull" parsing Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 078/218] perf/core: Fix perf_sched_count derailment Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 079/218] perf/x86/intel: Use PAGE_SIZE for PEBS buffer size on Core2 Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 080/218] perf/x86/intel: Fix PEBS warning by only restoring active PMU in pmi Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 081/218] sched/cputime: Fix steal_account_process_tick() to always return jiffies Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 082/218] bcache: fix race of writeback thread starting before complete initialization Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 083/218] bcache: cleaned up error handling around register_cache() Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 084/218] bcache: fix cache_set_flush() NULL pointer dereference on OOM Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 085/218] x86/PCI: Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs Kamal Mostafa
2016-03-31 20:14 ` [PATCH 4.2.y-ckt 086/218] be2iscsi: set the boot_kset pointer to NULL in case of failure Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 087/218] md/raid5: preserve STRIPE_PREREAD_ACTIVE in break_stripe_batch_list Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 088/218] drm/radeon: Don't drop DP 2.7 Ghz link setup on some cards Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 089/218] sg: fix dxferp in from_to case Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 090/218] jbd2: fix FS corruption possibility in jbd2_journal_destroy() on umount path Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 091/218] ALSA: hda - Apply reboot D3 fix for CX20724 codec, too Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 092/218] EDAC/sb_edac: Fix computation of channel address Kamal Mostafa
2016-03-31 20:24   ` Luck, Tony
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 093/218] Bluetooth: btusb: Add a new AR3012 ID 13d3:3472 Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 094/218] ALSA: pcm: Avoid "BUG:" string for warnings again Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 095/218] dm snapshot: disallow the COW and origin devices from being identical Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 096/218] dm thin metadata: don't issue prefetches if a transaction abort has failed Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 097/218] dm cache: make sure every metadata function checks fail_io Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 098/218] iser-target: Fix identification of login rx descriptor type Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 099/218] iser-target: Add new state ISER_CONN_BOUND to isert_conn Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 100/218] iser-target: Separate flows for np listeners and connections cma events Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 101/218] ALSA: hda - fix the mic mute button and led problem for a Lenovo AIO Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 102/218] xtensa: ISS: don't hang if stdin EOF is reached Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 103/218] xtensa: fix preemption in {clear,copy}_user_highpage Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 104/218] xtensa: clear all DBREAKC registers on start Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 105/218] Bluetooth: Fix potential buffer overflow with Add Advertising Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 106/218] ARC: [BE] readl()/writel() to work in Big Endian CPU configuration Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 107/218] bus: imx-weim: Take the 'status' property value into account Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 108/218] ALSA: intel8x0: Add clock quirk entry for AD1981B on IBM ThinkPad X41 Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 109/218] fuse: do not use iocb after it may have been freed Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 110/218] fuse: Add reference counting for fuse_io_priv Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 111/218] s390/pci: enforce fmb page boundary rule Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 112/218] drm/radeon: rework fbdev handling on chips with no connectors Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 113/218] md: multipath: don't hardcopy bio in .make_request path Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 114/218] net: mvneta: enable change MAC address when interface is up Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 115/218] dm: fix rq_end_stats() NULL pointer in dm_requeue_original_request() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 116/218] HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 117/218] ALSA: hda - Fix unconditional GPIO toggle via automute Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 118/218] mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 119/218] nfsd: fix deadlock secinfo+readdir compound Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 120/218] vfs: show_vfsstat: do not ignore errors from show_devname method Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 121/218] x86/iopl: Fix iopl capability check on Xen PV Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 122/218] crypto: marvell/cesa - forward devm_ioremap_resource() error code Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 123/218] mmc: sdhci: Fix override of timeout clk wrt max_busy_timeout Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 124/218] drm/amdgpu: include the right version of gmc header files for iceland Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 125/218] Input: ims-pcu - sanity check against missing interfaces Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 126/218] watchdog: don't run proc_watchdog_update if new value is same as old Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 127/218] mm: memcontrol: reclaim when shrinking memory.high below usage Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 128/218] mm: memcontrol: reclaim and OOM kill when shrinking memory.max " Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 129/218] Input: synaptics - handle spurious release of trackstick buttons, again Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 130/218] x86/apic: Fix suspicious RCU usage in smp_trace_call_function_interrupt() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 131/218] USB: usb_driver_claim_interface: add sanity checking Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 132/218] USB: uas: Reduce can_queue to MAX_CMNDS Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 133/218] tracing: Have preempt(irqs)off trace preempt disabled functions Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 134/218] tracing: Fix crash from reading trace_pipe with sendfile Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 135/218] splice: handle zero nr_pages in splice_to_pipe() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 136/218] ALSA: usb-audio: add Microsoft HD-5001 to quirks Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 137/218] writeback, cgroup: fix premature wb_put() in locked_inode_to_wb_and_lock_list() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 138/218] fs-writeback: unplug before cond_resched in writeback_sb_inodes Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 139/218] writeback, cgroup: fix use of the wrong bdi_writeback which mismatches the inode Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 140/218] bitops: Do not default to __clear_bit() for __clear_bit_unlock() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 141/218] target: Fix target_release_cmd_kref shutdown comp leak Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 142/218] KVM: VMX: avoid guest hang on invalid invept instruction Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 143/218] KVM: fix spin_lock_init order on x86 Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 144/218] tracing: Fix trace_printk() to print when not using bprintk() Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 145/218] fs/coredump: prevent fsuid=0 dumps into user-controlled directories Kamal Mostafa
2016-03-31 20:15 ` [PATCH 4.2.y-ckt 146/218] rapidio/rionet: fix deadlock on SMP Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 147/218] staging: comedi: ni_mio_common: fix the ni_write[blw]() functions Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 148/218] staging: android: ion_test: fix check of platform_device_register_simple() error code Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 149/218] ideapad-laptop: Add ideapad Y700 (15) to the no_hw_rfkill DMI list Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 150/218] MAINTAINERS: Update mailing list and web page for hwmon subsystem Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 151/218] ocfs2/dlm: fix race between convert and recovery Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 152/218] ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 153/218] mm/page_alloc: prevent merging between isolated and other pageblocks Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 154/218] mac80211: avoid excessive stack usage in sta_info Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 155/218] clk: xgene: Add missing parenthesis when clearing divider value Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 156/218] clk: qcom: msm8960: Fix ce3_src register offset Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 157/218] xen kconfig: don't "select INPUT_XEN_KBDDEV_FRONTEND" Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 158/218] ppp: take reference on channels netns Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 159/218] mdio-sun4i: oops in error handling in probe Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 160/218] clk: rockchip: free memory in error cases when registering clock branches Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 161/218] ARC: bitops: Remove non relevant comments Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 162/218] mac80211: fix txq queue related crashes Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 163/218] net: Fix use after free in the recvmmsg exit path Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 164/218] ath9k: fix misleading indentation Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 165/218] sctp: fix the transports round robin issue when init is retransmitted Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 166/218] ethernet: micrel: fix some error codes Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 167/218] megaraid_sas: add missing curly braces in ioctl handler Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 168/218] clk-divider: make sure read-only dividers do not write to their register Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 169/218] misc/bmp085: Enable building as a module Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 170/218] HID: logitech: fix Dual Action gamepad support Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 171/218] net/mlx5: Make command timeout way shorter Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 172/218] ASoC: ssm4567: Reset device before regcache_sync() Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 173/218] fbdev: da8xx-fb: fix videomodes of lcd panels Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 174/218] clk: qcom: msm8960: fix ce3_core clk enable register Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 175/218] ipvs: correct initial offset of Call-ID header search in SIP persistence engine Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 176/218] drm/i915: Cleanup phys status page too Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 177/218] spi: rockchip: modify DMA max burst to 1 Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 178/218] ata: ahci_xgene: dereferencing uninitialized pointer in probe Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 179/218] ath9k: fix buffer overrun for ar9287 Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 180/218] perf tools: handle spaces in file names obtained from /proc/pid/maps Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 181/218] rtc: ds1685: passing bogus values to irq_restore Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 182/218] ARM: davinci: make I2C support optional Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 183/218] drm/amdkfd: uninitialized variable in dbgdev_wave_control_set_registers() Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 184/218] mtd: map: fix .set_vpp() documentation Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 185/218] ARM: OMAP3: Add cpuidle parameters table for omap3430 Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 186/218] efi: Expose non-blocking set_variable() wrapper to efivars Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 187/218] rtc: vr41xx: Wire up alarm_irq_enable Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 188/218] sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 189/218] ipv4: fix broadcast packets reception Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 190/218] lpfc: fix misleading indentation Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 191/218] sched/preempt, sh: kmap_coherent relies on disabled preemption Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 192/218] ipip: Properly mark ipip GRO packets as encapsulated Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 193/218] spi/rockchip: Make sure spi clk is on in rockchip_spi_set_cs Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 194/218] ASoC: s3c24xx: use const snd_soc_component_driver pointer Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 195/218] mlx4: add missing braces in verify_qp_parameters Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 196/218] clk: meson: Fix meson_clk_register_clks() signature type mismatch Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 197/218] [media] coda: fix error path in case of missing pdata on non-DT platform Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 198/218] kbuild/mkspec: fix grub2 installkernel issue Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 199/218] bpf: avoid copying junk bytes in bpf_get_current_comm() Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 200/218] mac80211: fix unnecessary frame drops in mesh fwding Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 201/218] mtd: brcmnand: Fix v7.1 register offsets Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 202/218] mac80211: fix ibss scan parameters Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 203/218] at803x: fix reset handling Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 204/218] rtc: hym8563: fix invalid year calculation Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 205/218] perf pmu: Fix misleadingly indented assignment (whitespace) Kamal Mostafa
2016-03-31 20:16 ` [PATCH 4.2.y-ckt 206/218] nbd: ratelimit error msgs after socket close Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 207/218] paride: make 'verbose' parameter an 'int' again Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 208/218] regulator: s5m8767: fix get_register() error handling Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 209/218] ppp: ensure file->private_data can't be overridden Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 210/218] clk: versatile: sp810: support reentrance Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 211/218] net: add description for len argument of dev_get_phys_port_name Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 212/218] net: bcmgenet: fix dma api length mismatch Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 213/218] ARM: prima2: always enable reset controller Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 214/218] drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 215/218] perf stat: Document --detailed option Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 216/218] [media] v4l: vsp1: Set the SRU CTRL0 register when starting the stream Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 217/218] ipvs: drop first packet to redirect conntrack Kamal Mostafa
2016-03-31 20:17 ` [PATCH 4.2.y-ckt 218/218] rtc: max77686: Properly handle regmap_irq_get_virq() error code Kamal Mostafa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).