linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.4 000/101] 4.4.42-stable review
@ 2017-01-10 13:36 ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 001/101] ALSA: hda - Fix up GPIO for ASUS ROG Ranger Greg Kroah-Hartman
                     ` (97 more replies)
  0 siblings, 98 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah.kh, patches,
	ben.hutchings, stable

This is the start of the stable review cycle for the 4.4.42 release.
There are 101 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu Jan 12 13:15:04 UTC 2017.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.42-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.4.42-rc1

Thomas Gleixner <tglx@linutronix.de>
    tick/broadcast: Prevent NULL pointer dereference

Michel Dänzer <michel.daenzer@amd.com>
    drm/radeon: Always store CRTC relative radeon_crtc->cursor_x/y values

Mauro Carvalho Chehab <mchehab@osg.samsung.com>
    cx23885-dvb: move initialization of a8293_pdata

Arnd Bergmann <arnd@arndb.de>
    net: vxge: avoid unused function warnings

Paul Burton <paul.burton@imgtec.com>
    net: ti: cpmac: Fix compiler warning due to type confusion

Arnd Bergmann <arnd@arndb.de>
    cred/userns: define current_user_ns() as a function

H Hartley Sweeten <hsweeten@visionengravers.com>
    staging: comedi: dt282x: tidy up register bit defines

Johan Hovold <johan@kernel.org>
    powerpc/pci/rpadlpar: Fix device reference leaks

Shaohua Li <shli@fb.com>
    md: MD_RECOVERY_NEEDED is set for mddev->recovery

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/aes-ce - fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/aes-xts-ce: fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/sha1-ce - fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/aes-neon - fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/aes-ccm-ce: fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm/aes-ce - fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/ghash-ce - fix for big endian

Ard Biesheuvel <ard.biesheuvel@linaro.org>
    crypto: arm64/sha2-ce - fix for big endian

Dan Carpenter <dan.carpenter@oracle.com>
    s390/crypto: unlock on error in prng_tdes_read()

Dan Carpenter <dan.carpenter@oracle.com>
    mmc: mmc_test: Uninitialized return value

Tony Lindgren <tony@atomide.com>
    PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend

Florian Fainelli <f.fainelli@gmail.com>
    irqchip/bcm7038-l1: Implement irq_cpu_offline() callback

Dan Carpenter <dan.carpenter@oracle.com>
    target/iscsi: Fix double free in lio_target_tiqn_addtpg()

Arnd Bergmann <arnd@arndb.de>
    scsi: mvsas: fix command_active typo

Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
    ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call

Xunlei Pang <xlpang@redhat.com>
    iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped

Jacob Pan <jacob.jun.pan@linux.intel.com>
    iommu/vt-d: Fix pasid table size encoding

Huang Rui <ray.huang@amd.com>
    iommu/amd: Fix the left value check of cmd buffer

Dan Carpenter <dan.carpenter@oracle.com>
    iommu/amd: Missing error code in amd_iommu_init_device()

Vladimir Zapolskiy <vz@mleia.com>
    clk: imx31: fix rewritten input argument of mx31_clocks_init()

Pan Bian <bianpan2016@163.com>
    clk: clk-wm831x: fix a logic error

Guenter Roeck <linux@roeck-us.net>
    hwmon: (g762) Fix overflows and crash seen when writing limit attributes

Guenter Roeck <linux@roeck-us.net>
    hwmon: (nct7802) Fix overflows seen when writing into limit attributes

Guenter Roeck <linux@roeck-us.net>
    hwmon: (ds620) Fix overflows seen when writing temperature limits

Jared Bents <jared.bents@rockwellcollins.com>
    hwmon: (amc6821) sign extension temperature

Javier Martinez Canillas <javier@osg.samsung.com>
    hwmon: (scpi) Fix module autoload

Guenter Roeck <linux@roeck-us.net>
    cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected

Nicolas Iooss <nicolas.iooss_linux@m4x.org>
    ath10k: use the right length of "background"

Arnd Bergmann <arnd@arndb.de>
    stable-fixup: hotplug: fix unused function warning

Felipe Balbi <felipe.balbi@linux.intel.com>
    usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb()

Felipe Balbi <felipe.balbi@linux.intel.com>
    usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb()

Felipe Balbi <felipe.balbi@linux.intel.com>
    usb: dwc3: gadget: always unmap EP0 requests

Eva Rachel Retuya <eraretuya@gmail.com>
    staging: iio: ad7606: fix improper setting of oversampling pins

Alexander Usyskin <alexander.usyskin@intel.com>
    mei: bus: fix mei_cldev_enable KDoc

Johan Hovold <johan@kernel.org>
    USB: serial: io_ti: bind to interface after fw download

Johan Hovold <johan@kernel.org>
    USB: phy: am335x-control: fix device and of_node leaks

Geert Uytterhoeven <geert+renesas@glider.be>
    ARM: dts: r8a7794: Correct hsusb parent clock

Pan Bian <bianpan2016@163.com>
    USB: serial: kl5kusb105: abort on open exception path

Takashi Iwai <tiwai@suse.de>
    ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream()

Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
    usb: musb: blackfin: add bfin_fifo_offset in bfin_ops

Geert Uytterhoeven <geert@linux-m68k.org>
    usb: hub: Move hub_port_disable() to fix warning if PM is disabled

Tony Lindgren <tony@atomide.com>
    usb: musb: Fix trying to free already-free IRQ 4

Heikki Krogerus <heikki.krogerus@linux.intel.com>
    usb: dwc3: pci: add Intel Gemini Lake PCI ID

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    xhci: Fix race related to abort operation

OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
    xhci: Use delayed_work instead of timer for command timeout

Dan Carpenter <dan.carpenter@oracle.com>
    usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL

Johan Hovold <johan@kernel.org>
    USB: serial: mos7720: fix parallel probe

Johan Hovold <johan@kernel.org>
    USB: serial: mos7720: fix parport use-after-free on probe errors

Johan Hovold <johan@kernel.org>
    USB: serial: mos7720: fix use-after-free on probe errors

Johan Hovold <johan@kernel.org>
    USB: serial: mos7720: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: mos7840: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: kobil_sct: fix NULL-deref in write

Johan Hovold <johan@kernel.org>
    USB: serial: cyberjack: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: oti6858: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: io_edgeport: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: ti_usb_3410_5052: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: garmin_gps: fix memory leak on failed URB submit

Johan Hovold <johan@kernel.org>
    USB: serial: iuu_phoenix: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: io_ti: fix I/O after disconnect

Johan Hovold <johan@kernel.org>
    USB: serial: io_ti: fix another NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: io_ti: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: spcp8x5: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: keyspan_pda: verify endpoints at probe

Johan Hovold <johan@kernel.org>
    USB: serial: pl2303: fix NULL-deref at open

Johan Hovold <johan@kernel.org>
    USB: serial: quatech2: fix sleep-while-atomic in close

Johan Hovold <johan@kernel.org>
    USB: serial: omninet: fix NULL-derefs at open and disconnect

Lu Baolu <baolu.lu@linux.intel.com>
    usb: xhci: hold lock over xhci_abort_cmd_ring()

Mathias Nyman <mathias.nyman@linux.intel.com>
    xhci: Handle command completion and timeout race

Baolin Wang <baolin.wang@linaro.org>
    usb: host: xhci: Fix possible wild pointer when handling abort command

Lu Baolu <baolu.lu@linux.intel.com>
    usb: xhci: fix return value of xhci_setup_device()

Mathias Nyman <mathias.nyman@linux.intel.com>
    xhci: free xhci virtual devices with leaf nodes first

Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
    usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake

Mathias Nyman <mathias.nyman@linux.intel.com>
    xhci: workaround for hosts missing CAS bit

Lu Baolu <baolu.lu@linux.intel.com>
    usb: xhci: fix possible wild pointer

Felipe Balbi <felipe.balbi@linux.intel.com>
    usb: dwc3: core: avoid Overflow events

Krzysztof Opasiak <k.opasiak@samsung.com>
    usb: gadget: composite: Test get_alt() presence instead of set_alt()

Alan Stern <stern@rowland.harvard.edu>
    USB: dummy-hcd: fix bug in stop_activity (handle ep0)

Alan Stern <stern@rowland.harvard.edu>
    USB: fix problems with duplicate endpoint addresses

Alan Stern <stern@rowland.harvard.edu>
    USB: gadgetfs: fix checks of wTotalLength in config descriptors

Alan Stern <stern@rowland.harvard.edu>
    USB: gadgetfs: fix use-after-free bug

Alan Stern <stern@rowland.harvard.edu>
    USB: gadgetfs: fix unbounded memory allocation bug

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    usb: gadgetfs: restrict upper bound on device configuration size

Oliver Neukum <oneukum@suse.com>
    usb: storage: unusual_uas: Add JMicron JMS56x to unusual device

Bin Liu <b-liu@ti.com>
    usb: musb: dsps: implement clear_ep_rxintr() callback

Bin Liu <b-liu@ti.com>
    usb: musb: core: add clear_ep_rxintr() to musb_platform_ops

James Hogan <james.hogan@imgtec.com>
    KVM: MIPS: Flush KVM entry code from icache globally

Xiao Guangrong <guangrong.xiao@linux.intel.com>
    KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS

Johannes Berg <johannes.berg@intel.com>
    mac80211: initialize fast-xmit 'info' later

Bartosz Golaszewski <bgolaszewski@baylibre.com>
    ARM: davinci: da850: don't add emac clock to lookup table twice

Ioan-Adrian Ratiu <adi@adirat.com>
    ALSA: usb-audio: Fix irq/process data synchronization

Takashi Iwai <tiwai@suse.de>
    ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL

Takashi Iwai <tiwai@suse.de>
    ALSA: hda - Fix up GPIO for ASUS ROG Ranger


-------------

Diffstat:

 Makefile                                       |   4 +-
 arch/arm/boot/dts/r8a7794.dtsi                 |   2 +-
 arch/arm/crypto/aes-ce-glue.c                  |   5 +
 arch/arm/mach-davinci/da850.c                  |  12 +-
 arch/arm64/crypto/aes-ce-ccm-core.S            |  53 +++---
 arch/arm64/crypto/aes-ce-cipher.c              |  25 +--
 arch/arm64/crypto/aes-ce.S                     |   1 +
 arch/arm64/crypto/aes-modes.S                  |   3 +-
 arch/arm64/crypto/aes-neon.S                   |  25 +--
 arch/arm64/crypto/ghash-ce-core.S              |   6 +-
 arch/arm64/crypto/sha1-ce-core.S               |   4 +-
 arch/arm64/crypto/sha2-ce-core.S               |   4 +-
 arch/cris/boot/rescue/Makefile                 |   8 +
 arch/mips/kvm/mips.c                           |   4 +-
 arch/s390/crypto/prng.c                        |   6 +-
 arch/x86/kvm/x86.c                             |   9 +-
 drivers/base/power/power.h                     |  19 ++-
 drivers/base/power/runtime.c                   |   8 +-
 drivers/base/power/wakeirq.c                   |  76 +++++++--
 drivers/clk/clk-wm831x.c                       |   2 +-
 drivers/clk/imx/clk-imx31.c                    |   4 +-
 drivers/gpu/drm/radeon/radeon_cursor.c         |   6 +-
 drivers/hwmon/amc6821.c                        |   4 +-
 drivers/hwmon/ds620.c                          |   2 +-
 drivers/hwmon/g762.c                           |  11 +-
 drivers/hwmon/nct7802.c                        |   8 +-
 drivers/hwmon/scpi-hwmon.c                     |   1 +
 drivers/iommu/amd_iommu.c                      |   2 +-
 drivers/iommu/amd_iommu_v2.c                   |   4 +-
 drivers/iommu/intel-iommu.c                    |  42 ++++-
 drivers/irqchip/irq-bcm7038-l1.c               |  26 +++
 drivers/md/md.c                                |   2 +-
 drivers/media/pci/cx23885/cx23885-dvb.c        |   6 +-
 drivers/misc/mei/bus.c                         |   2 +-
 drivers/mmc/card/mmc_test.c                    |   2 +-
 drivers/net/ethernet/neterion/vxge/vxge-main.c |  31 ++--
 drivers/net/ethernet/ti/cpmac.c                |   5 +-
 drivers/net/wireless/ath/ath10k/spectral.c     |   2 +-
 drivers/pci/hotplug/rpadlpar_core.c            |  10 +-
 drivers/scsi/mvsas/mv_94xx.c                   |   2 +-
 drivers/staging/comedi/drivers/dt282x.c        |  65 ++++----
 drivers/staging/iio/adc/ad7606_core.c          |   2 +-
 drivers/target/iscsi/iscsi_target_tpg.c        |   1 -
 drivers/usb/core/config.c                      |  10 ++
 drivers/usb/core/hub.c                         |  59 ++++---
 drivers/usb/dwc3/core.h                        |   4 +-
 drivers/usb/dwc3/dwc3-pci.c                    |   2 +
 drivers/usb/dwc3/ep0.c                         |  50 +++---
 drivers/usb/dwc3/gadget.c                      |   8 +-
 drivers/usb/gadget/composite.c                 |  12 +-
 drivers/usb/gadget/legacy/inode.c              |  17 +-
 drivers/usb/gadget/udc/dummy_hcd.c             |   6 +-
 drivers/usb/host/xhci-hub.c                    |  37 +++++
 drivers/usb/host/xhci-mem.c                    |  50 +++++-
 drivers/usb/host/xhci-pci.c                    |   9 +-
 drivers/usb/host/xhci-ring.c                   | 219 ++++++++++++++-----------
 drivers/usb/host/xhci.c                        |   4 +-
 drivers/usb/host/xhci.h                        |   8 +-
 drivers/usb/musb/blackfin.c                    |   1 +
 drivers/usb/musb/musb_core.h                   |   7 +
 drivers/usb/musb/musb_dsps.c                   |  12 ++
 drivers/usb/musb/musb_host.c                   |  10 +-
 drivers/usb/musb/musbhsdma.h                   |   2 +-
 drivers/usb/phy/phy-am335x-control.c           |   2 +
 drivers/usb/serial/cyberjack.c                 |  10 ++
 drivers/usb/serial/garmin_gps.c                |   1 +
 drivers/usb/serial/io_edgeport.c               |   5 +
 drivers/usb/serial/io_ti.c                     |  22 ++-
 drivers/usb/serial/iuu_phoenix.c               |  11 ++
 drivers/usb/serial/keyspan_pda.c               |  14 ++
 drivers/usb/serial/kl5kusb105.c                |   2 +
 drivers/usb/serial/kobil_sct.c                 |  12 ++
 drivers/usb/serial/mos7720.c                   |  51 +++---
 drivers/usb/serial/mos7840.c                   |  12 ++
 drivers/usb/serial/omninet.c                   |  13 ++
 drivers/usb/serial/oti6858.c                   |  16 ++
 drivers/usb/serial/pl2303.c                    |   8 +
 drivers/usb/serial/quatech2.c                  |   4 -
 drivers/usb/serial/spcp8x5.c                   |  14 ++
 drivers/usb/serial/ti_usb_3410_5052.c          |   7 +
 drivers/usb/storage/unusual_devs.h             |   7 +
 include/linux/capability.h                     |   2 -
 include/linux/cred.h                           |   5 +-
 kernel/cpu.c                                   |   9 +-
 kernel/time/tick-broadcast.c                   |   3 +
 net/mac80211/tx.c                              |   3 +-
 sound/pci/hda/patch_realtek.c                  |   2 +
 sound/soc/samsung/i2s.c                        |   5 +-
 sound/usb/card.c                               |   1 -
 sound/usb/endpoint.c                           |  17 +-
 sound/usb/endpoint.h                           |   2 +-
 sound/usb/pcm.c                                |  10 +-
 92 files changed, 903 insertions(+), 410 deletions(-)

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

* [PATCH 4.4 001/101] ALSA: hda - Fix up GPIO for ASUS ROG Ranger
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 002/101] ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL Greg Kroah-Hartman
                     ` (96 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

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

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 85bcf96caba8b4a7c0805555638629ba3c67ea0c upstream.

ASUS ROG Ranger VIII with ALC1150 codec requires the extra GPIO pin to
up for the front panel.  Just use the existing fixup for setting up
the GPIO pins.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189411
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2230,6 +2230,7 @@ static const struct snd_pci_quirk alc882
 	SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
 	SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
 	SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
+	SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
 	SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
 	SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
 	SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),

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

* [PATCH 4.4 002/101] ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 001/101] ALSA: hda - Fix up GPIO for ASUS ROG Ranger Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 003/101] ALSA: usb-audio: Fix irq/process data synchronization Greg Kroah-Hartman
                     ` (95 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

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

------------------

From: Takashi Iwai <tiwai@suse.de>

commit c7efff9284dfde95a11aaa811c9d8ec8167f0f6e upstream.

Although the old quirk table showed ASUS X71SL with ALC663 codec being
compatible with asus-mode3 fixup, the bugzilla reporter explained that
asus-model8 fits better for the dual headphone controls.  So be it.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=191781
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/pci/hda/patch_realtek.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6893,6 +6893,7 @@ static const struct snd_pci_quirk alc662
 	SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
 	SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
 	SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
+	SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
 	SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
 	SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
 	SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),

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

* [PATCH 4.4 003/101] ALSA: usb-audio: Fix irq/process data synchronization
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 001/101] ALSA: hda - Fix up GPIO for ASUS ROG Ranger Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 002/101] ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 004/101] ARM: davinci: da850: dont add emac clock to lookup table twice Greg Kroah-Hartman
                     ` (94 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ioan-Adrian Ratiu, Takashi Iwai

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

------------------

From: Ioan-Adrian Ratiu <adi@adirat.com>

commit 1d0f953086f090a022f2c0e1448300c15372db46 upstream.

Commit 16200948d83 ("ALSA: usb-audio: Fix race at stopping the stream") was
incomplete causing another more severe kernel panic, so it got reverted.
This fixes both the original problem and its fallout kernel race/crash.

The original fix is to move the endpoint member NULL clearing logic inside
wait_clear_urbs() so the irq triggering the urb completion doesn't call
retire_capture/playback_urb() after the NULL clearing and generate a panic.

However this creates a new race between snd_usb_endpoint_start()'s call
to wait_clear_urbs() and the irq urb completion handler which again calls
retire_capture/playback_urb() leading to a new NULL dereference.

We keep the EP deactivation code in snd_usb_endpoint_start() because
removing it will break the EP reference counting (see [1] [2] for info),
however we don't need the "can_sleep" mechanism anymore because a new
function was introduced (snd_usb_endpoint_sync_pending_stop()) which
synchronizes pending stops and gets called inside the pcm prepare callback.

It also makes sense to remove can_sleep because it was also removed from
deactivate_urbs() signature in [3] so we benefit from more simplification.

[1] commit 015618b90 ("ALSA: snd-usb: Fix URB cancellation at stream start")
[2] commit e9ba389c5 ("ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM capture stream")
[3] commit ccc1696d5 ("ALSA: usb-audio: simplify endpoint deactivation code")

Fixes: f8114f8583bb ("Revert "ALSA: usb-audio: Fix race at stopping the stream"")

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/usb/endpoint.c |   17 +++++++----------
 sound/usb/endpoint.h |    2 +-
 sound/usb/pcm.c      |   10 +++++-----
 3 files changed, 13 insertions(+), 16 deletions(-)

--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -538,6 +538,11 @@ static int wait_clear_urbs(struct snd_us
 			alive, ep->ep_num);
 	clear_bit(EP_FLAG_STOPPING, &ep->flags);
 
+	ep->data_subs = NULL;
+	ep->sync_slave = NULL;
+	ep->retire_data_urb = NULL;
+	ep->prepare_data_urb = NULL;
+
 	return 0;
 }
 
@@ -902,9 +907,7 @@ int snd_usb_endpoint_set_params(struct s
 /**
  * snd_usb_endpoint_start: start an snd_usb_endpoint
  *
- * @ep:		the endpoint to start
- * @can_sleep:	flag indicating whether the operation is executed in
- * 		non-atomic context
+ * @ep: the endpoint to start
  *
  * A call to this function will increment the use count of the endpoint.
  * In case it is not already running, the URBs for this endpoint will be
@@ -914,7 +917,7 @@ int snd_usb_endpoint_set_params(struct s
  *
  * Returns an error if the URB submission failed, 0 in all other cases.
  */
-int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
+int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
 {
 	int err;
 	unsigned int i;
@@ -928,8 +931,6 @@ int snd_usb_endpoint_start(struct snd_us
 
 	/* just to be sure */
 	deactivate_urbs(ep, false);
-	if (can_sleep)
-		wait_clear_urbs(ep);
 
 	ep->active_mask = 0;
 	ep->unlink_mask = 0;
@@ -1010,10 +1011,6 @@ void snd_usb_endpoint_stop(struct snd_us
 
 	if (--ep->use_count == 0) {
 		deactivate_urbs(ep, false);
-		ep->data_subs = NULL;
-		ep->sync_slave = NULL;
-		ep->retire_data_urb = NULL;
-		ep->prepare_data_urb = NULL;
 		set_bit(EP_FLAG_STOPPING, &ep->flags);
 	}
 }
--- a/sound/usb/endpoint.h
+++ b/sound/usb/endpoint.h
@@ -18,7 +18,7 @@ int snd_usb_endpoint_set_params(struct s
 				struct audioformat *fmt,
 				struct snd_usb_endpoint *sync_ep);
 
-int  snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep);
+int  snd_usb_endpoint_start(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
 int  snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -218,7 +218,7 @@ int snd_usb_init_pitch(struct snd_usb_au
 	}
 }
 
-static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
+static int start_endpoints(struct snd_usb_substream *subs)
 {
 	int err;
 
@@ -231,7 +231,7 @@ static int start_endpoints(struct snd_us
 		dev_dbg(&subs->dev->dev, "Starting data EP @%p\n", ep);
 
 		ep->data_subs = subs;
-		err = snd_usb_endpoint_start(ep, can_sleep);
+		err = snd_usb_endpoint_start(ep);
 		if (err < 0) {
 			clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags);
 			return err;
@@ -260,7 +260,7 @@ static int start_endpoints(struct snd_us
 		dev_dbg(&subs->dev->dev, "Starting sync EP @%p\n", ep);
 
 		ep->sync_slave = subs->data_endpoint;
-		err = snd_usb_endpoint_start(ep, can_sleep);
+		err = snd_usb_endpoint_start(ep);
 		if (err < 0) {
 			clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags);
 			return err;
@@ -839,7 +839,7 @@ static int snd_usb_pcm_prepare(struct sn
 	/* for playback, submit the URBs now; otherwise, the first hwptr_done
 	 * updates for all URBs would happen at the same time when starting */
 	if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
-		ret = start_endpoints(subs, true);
+		ret = start_endpoints(subs);
 
  unlock:
 	snd_usb_unlock_shutdown(subs->stream->chip);
@@ -1655,7 +1655,7 @@ static int snd_usb_substream_capture_tri
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-		err = start_endpoints(subs, false);
+		err = start_endpoints(subs);
 		if (err < 0)
 			return err;
 

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

* [PATCH 4.4 004/101] ARM: davinci: da850: dont add emac clock to lookup table twice
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (2 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 003/101] ALSA: usb-audio: Fix irq/process data synchronization Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 005/101] mac80211: initialize fast-xmit info later Greg Kroah-Hartman
                     ` (93 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Bartosz Golaszewski, Sekhar Nori

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

------------------

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

commit ef37427ac5677331145ab27a17e6f5f1b43f0c11 upstream.

Similarly to the aemif clock - this screws up the linked list of clock
children. Create a separate clock for mdio inheriting the rate from
emac_clk.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
[nsekhar@ti.com: add a comment over mdio_clk to explaing its existence +
		 commit headline updates]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/mach-davinci/da850.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -298,6 +298,16 @@ static struct clk emac_clk = {
 	.gpsc		= 1,
 };
 
+/*
+ * In order to avoid adding the emac_clk to the clock lookup table twice (and
+ * screwing up the linked list in the process) create a separate clock for
+ * mdio inheriting the rate from emac_clk.
+ */
+static struct clk mdio_clk = {
+	.name		= "mdio",
+	.parent		= &emac_clk,
+};
+
 static struct clk mcasp_clk = {
 	.name		= "mcasp",
 	.parent		= &pll0_sysclk2,
@@ -462,7 +472,7 @@ static struct clk_lookup da850_clks[] =
 	CLK(NULL,		"arm",		&arm_clk),
 	CLK(NULL,		"rmii",		&rmii_clk),
 	CLK("davinci_emac.1",	NULL,		&emac_clk),
-	CLK("davinci_mdio.0",	"fck",		&emac_clk),
+	CLK("davinci_mdio.0",	"fck",		&mdio_clk),
 	CLK("davinci-mcasp.0",	NULL,		&mcasp_clk),
 	CLK("da8xx_lcdc.0",	"fck",		&lcdc_clk),
 	CLK("da830-mmc.0",	NULL,		&mmcsd0_clk),

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

* [PATCH 4.4 005/101] mac80211: initialize fast-xmit info later
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (3 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 004/101] ARM: davinci: da850: dont add emac clock to lookup table twice Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 006/101] KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS Greg Kroah-Hartman
                     ` (92 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ben Greear, Johannes Berg

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

------------------

From: Johannes Berg <johannes.berg@intel.com>

commit 35f432a03e41d3bf08c51ede917f94e2288fbe8c upstream.

In ieee80211_xmit_fast(), 'info' is initialized to point to the skb
that's passed in, but that skb may later be replaced by a clone (if
it was shared), leading to an invalid pointer.

This can lead to use-after-free and also later crashes since the
real SKB's info->hw_queue doesn't get initialized properly.

Fix this by assigning info only later, when it's needed, after the
skb replacement (may have) happened.

Reported-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/mac80211/tx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2699,7 +2699,7 @@ static bool ieee80211_xmit_fast(struct i
 	int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
 	int hw_headroom = sdata->local->hw.extra_tx_headroom;
 	struct ethhdr eth;
-	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+	struct ieee80211_tx_info *info;
 	struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
 	struct ieee80211_tx_data tx;
 	ieee80211_tx_result r;
@@ -2761,6 +2761,7 @@ static bool ieee80211_xmit_fast(struct i
 	memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN);
 	memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN);
 
+	info = IEEE80211_SKB_CB(skb);
 	memset(info, 0, sizeof(*info));
 	info->band = fast_tx->band;
 	info->control.vif = &sdata->vif;

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

* [PATCH 4.4 006/101] KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (4 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 005/101] mac80211: initialize fast-xmit info later Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 008/101] usb: musb: core: add clear_ep_rxintr() to musb_platform_ops Greg Kroah-Hartman
                     ` (91 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Xiao Guangrong, Paolo Bonzini

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

------------------

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

commit 6ef4e07ecd2db21025c446327ecf34414366498b upstream.

Otherwise, mismatch between the smm bit in hflags and the MMU role
can cause a NULL pointer dereference.

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kvm/x86.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2949,6 +2949,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_
 	memset(&events->reserved, 0, sizeof(events->reserved));
 }
 
+static void kvm_set_hflags(struct kvm_vcpu *vcpu, unsigned emul_flags);
+
 static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
 					      struct kvm_vcpu_events *events)
 {
@@ -2981,10 +2983,13 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_e
 		vcpu->arch.apic->sipi_vector = events->sipi_vector;
 
 	if (events->flags & KVM_VCPUEVENT_VALID_SMM) {
+		u32 hflags = vcpu->arch.hflags;
 		if (events->smi.smm)
-			vcpu->arch.hflags |= HF_SMM_MASK;
+			hflags |= HF_SMM_MASK;
 		else
-			vcpu->arch.hflags &= ~HF_SMM_MASK;
+			hflags &= ~HF_SMM_MASK;
+		kvm_set_hflags(vcpu, hflags);
+
 		vcpu->arch.smi_pending = events->smi.pending;
 		if (events->smi.smm_inside_nmi)
 			vcpu->arch.hflags |= HF_SMM_INSIDE_NMI_MASK;

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

* [PATCH 4.4 008/101] usb: musb: core: add clear_ep_rxintr() to musb_platform_ops
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (5 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 006/101] KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 009/101] usb: musb: dsps: implement clear_ep_rxintr() callback Greg Kroah-Hartman
                     ` (90 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Bin Liu

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

------------------

From: Bin Liu <b-liu@ti.com>

commit 6def85a396ce7796bd9f4561c6ae8138833f7a52 upstream.

During dma teardown for dequque urb, if musb load is high, musb might
generate bogus rx ep interrupt even when the rx fifo is flushed. In such
case any of the follow log messages could happen.

	musb_host_rx 1853: BOGUS RX2 ready, csr 0000, count 0

	musb_host_rx 1936: RX3 dma busy, csr 2020

As mentioned in the current inline comment, clearing ep interrupt in the
teardown path avoids the bogus interrupt.

Clearing ep interrupt is platform dependent, so this patch adds a
platform callback to allow glue driver to clear the ep interrupt.

This bug seems to be existing since the initial driver for musb support,
but I only validated the fix back to v4.1, so only cc stable for v4.1+.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/musb/musb_core.h |    7 +++++++
 drivers/usb/musb/musb_host.c |   10 ++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -214,6 +214,7 @@ struct musb_platform_ops {
 				dma_addr_t *dma_addr, u32 *len);
 	void	(*pre_root_reset_end)(struct musb *musb);
 	void	(*post_root_reset_end)(struct musb *musb);
+	void	(*clear_ep_rxintr)(struct musb *musb, int epnum);
 };
 
 /*
@@ -612,4 +613,10 @@ static inline void musb_platform_post_ro
 		musb->ops->post_root_reset_end(musb);
 }
 
+static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum)
+{
+	if (musb->ops->clear_ep_rxintr)
+		musb->ops->clear_ep_rxintr(musb, epnum);
+}
+
 #endif	/* __MUSB_CORE_H__ */
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2390,12 +2390,11 @@ static int musb_cleanup_urb(struct urb *
 	int			is_in = usb_pipein(urb->pipe);
 	int			status = 0;
 	u16			csr;
+	struct dma_channel	*dma = NULL;
 
 	musb_ep_select(regs, hw_end);
 
 	if (is_dma_capable()) {
-		struct dma_channel	*dma;
-
 		dma = is_in ? ep->rx_channel : ep->tx_channel;
 		if (dma) {
 			status = ep->musb->dma_controller->channel_abort(dma);
@@ -2412,10 +2411,9 @@ static int musb_cleanup_urb(struct urb *
 		/* giveback saves bulk toggle */
 		csr = musb_h_flush_rxfifo(ep, 0);
 
-		/* REVISIT we still get an irq; should likely clear the
-		 * endpoint's irq status here to avoid bogus irqs.
-		 * clearing that status is platform-specific...
-		 */
+		/* clear the endpoint's irq status here to avoid bogus irqs */
+		if (is_dma_capable() && dma)
+			musb_platform_clear_ep_rxintr(musb, ep->epnum);
 	} else if (ep->epnum) {
 		musb_h_tx_flush_fifo(ep);
 		csr = musb_readw(epio, MUSB_TXCSR);

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

* [PATCH 4.4 009/101] usb: musb: dsps: implement clear_ep_rxintr() callback
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (6 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 008/101] usb: musb: core: add clear_ep_rxintr() to musb_platform_ops Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 010/101] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device Greg Kroah-Hartman
                     ` (89 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Bin Liu

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

------------------

From: Bin Liu <b-liu@ti.com>

commit c48400baa02155a5ddad63e8554602e48782278c upstream.

During dma teardown for dequque urb, if musb load is high, musb might
generate bogus rx ep interrupt even when the rx fifo is flushed. In such
case any of the follow log messages could happen.

    musb_host_rx 1853: BOGUS RX2 ready, csr 0000, count 0

    musb_host_rx 1936: RX3 dma busy, csr 2020

As mentioned in the current inline comment, clearing ep interrupt in the
teardown path avoids the bogus interrupt, so implement clear_ep_rxintr()
callback.

This bug seems to be existing since the initial driver for musb support,
but I only validated the fix back to v4.1, so only cc stable for v4.1+.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/musb/musb_dsps.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -301,6 +301,17 @@ static void otg_timer(unsigned long _mus
 	spin_unlock_irqrestore(&musb->lock, flags);
 }
 
+void dsps_musb_clear_ep_rxintr(struct musb *musb, int epnum)
+{
+	u32 epintr;
+	struct dsps_glue *glue = dev_get_drvdata(musb->controller->parent);
+	const struct dsps_musb_wrapper *wrp = glue->wrp;
+
+	/* musb->lock might already been held */
+	epintr = (1 << epnum) << wrp->rxep_shift;
+	musb_writel(musb->ctrl_base, wrp->epintr_status, epintr);
+}
+
 static irqreturn_t dsps_interrupt(int irq, void *hci)
 {
 	struct musb  *musb = hci;
@@ -647,6 +658,7 @@ static struct musb_platform_ops dsps_ops
 	.try_idle	= dsps_musb_try_idle,
 	.set_mode	= dsps_musb_set_mode,
 	.recover	= dsps_musb_recover,
+	.clear_ep_rxintr = dsps_musb_clear_ep_rxintr,
 };
 
 static u64 musb_dmamask = DMA_BIT_MASK(32);

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

* [PATCH 4.4 010/101] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (7 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 009/101] usb: musb: dsps: implement clear_ep_rxintr() callback Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 011/101] usb: gadgetfs: restrict upper bound on device configuration size Greg Kroah-Hartman
                     ` (88 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, George Cherian, Oliver Neukum

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

------------------

From: Oliver Neukum <oneukum@suse.com>

commit 674aea07e38200ea6f31ff6d5f200f0cf6cdb325 upstream.

This device gives the following error on detection.
xhci_hcd 0000:00:11.0: ERROR Transfer event for disabled endpoint or
incorrect stream ring

The same error is not seen when it is added to unusual_device
list with US_FL_NO_REPORT_OPCODES passed.

Signed-off-by: George Cherian <george.cherian@cavium.com>
Signed-off-by: Oliver Neukum <oneukun@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/storage/unusual_devs.h |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2135,6 +2135,13 @@ UNUSUAL_DEV(  0x22b8, 0x3010, 0x0001, 0x
 		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
 		US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ),
 
+/* Reported-by George Cherian <george.cherian@cavium.com> */
+UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999,
+		"JMicron",
+		"JMS56x",
+		USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+		US_FL_NO_REPORT_OPCODES),
+
 /*
  * Patch by Constantin Baranov <const@tltsu.ru>
  * Report by Andreas Koenecke.

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

* [PATCH 4.4 011/101] usb: gadgetfs: restrict upper bound on device configuration size
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (8 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 010/101] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 012/101] USB: gadgetfs: fix unbounded memory allocation bug Greg Kroah-Hartman
                     ` (87 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Andrey Konovalov, Felipe Balbi

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

------------------

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0994b0a257557e18ee8f0b7c5f0f73fe2b54eec1 upstream.

Andrey Konovalov reported that we were not properly checking the upper
limit before of a device configuration size before calling
memdup_user(), which could cause some problems.

So set the upper limit to PAGE_SIZE * 4, which should be good enough for
all devices.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/legacy/inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1783,7 +1783,8 @@ dev_config (struct file *fd, const char
 	}
 	spin_unlock_irq(&dev->lock);
 
-	if (len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4))
+	if ((len < (USB_DT_CONFIG_SIZE + USB_DT_DEVICE_SIZE + 4)) ||
+	    (len > PAGE_SIZE * 4))
 		return -EINVAL;
 
 	/* we might need to change message format someday */

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

* [PATCH 4.4 012/101] USB: gadgetfs: fix unbounded memory allocation bug
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (9 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 011/101] usb: gadgetfs: restrict upper bound on device configuration size Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 013/101] USB: gadgetfs: fix use-after-free bug Greg Kroah-Hartman
                     ` (86 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alan Stern, Andrey Konovalov, Felipe Balbi

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

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit faab50984fe6636e616c7cc3d30308ba391d36fd upstream.

Andrey Konovalov reports that fuzz testing with syzkaller causes a
KASAN warning in gadgetfs:

BUG: KASAN: slab-out-of-bounds in dev_config+0x86f/0x1190 at addr ffff88003c47e160
Write of size 65537 by task syz-executor0/6356
CPU: 3 PID: 6356 Comm: syz-executor0 Not tainted 4.9.0-rc7+ #19
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 ffff88003c107ad8 ffffffff81f96aba ffffffff3dc11ef0 1ffff10007820eee
 ffffed0007820ee6 ffff88003dc11f00 0000000041b58ab3 ffffffff8598b4c8
 ffffffff81f96828 ffffffff813fb4a0 ffff88003b6eadc0 ffff88003c107738
Call Trace:
 [<     inline     >] __dump_stack lib/dump_stack.c:15
 [<ffffffff81f96aba>] dump_stack+0x292/0x398 lib/dump_stack.c:51
 [<ffffffff817e4dec>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:159
 [<     inline     >] print_address_description mm/kasan/report.c:197
 [<ffffffff817e5080>] kasan_report_error+0x1f0/0x4e0 mm/kasan/report.c:286
 [<ffffffff817e5705>] kasan_report+0x35/0x40 mm/kasan/report.c:306
 [<     inline     >] check_memory_region_inline mm/kasan/kasan.c:308
 [<ffffffff817e3fb9>] check_memory_region+0x139/0x190 mm/kasan/kasan.c:315
 [<ffffffff817e4044>] kasan_check_write+0x14/0x20 mm/kasan/kasan.c:326
 [<     inline     >] copy_from_user arch/x86/include/asm/uaccess.h:689
 [<     inline     >] ep0_write drivers/usb/gadget/legacy/inode.c:1135
 [<ffffffff83228caf>] dev_config+0x86f/0x1190 drivers/usb/gadget/legacy/inode.c:1759
 [<ffffffff817fdd55>] __vfs_write+0x5d5/0x760 fs/read_write.c:510
 [<ffffffff817ff650>] vfs_write+0x170/0x4e0 fs/read_write.c:560
 [<     inline     >] SYSC_write fs/read_write.c:607
 [<ffffffff81803a5b>] SyS_write+0xfb/0x230 fs/read_write.c:599
 [<ffffffff84f47ec1>] entry_SYSCALL_64_fastpath+0x1f/0xc2

Indeed, there is a comment saying that the value of len is restricted
to a 16-bit integer, but the code doesn't actually do this.

This patch fixes the warning.  It replaces the comment with a
computation that forces the amount of data copied from the user in
ep0_write() to be no larger than the wLength size for the control
transfer, which is a 16-bit quantity.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/legacy/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1125,7 +1125,7 @@ ep0_write (struct file *fd, const char _
 	/* data and/or status stage for control request */
 	} else if (dev->state == STATE_DEV_SETUP) {
 
-		/* IN DATA+STATUS caller makes len <= wLength */
+		len = min_t(size_t, len, dev->setup_wLength);
 		if (dev->setup_in) {
 			retval = setup_req (dev->gadget->ep0, dev->req, len);
 			if (retval == 0) {

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

* [PATCH 4.4 013/101] USB: gadgetfs: fix use-after-free bug
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (10 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 012/101] USB: gadgetfs: fix unbounded memory allocation bug Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 014/101] USB: gadgetfs: fix checks of wTotalLength in config descriptors Greg Kroah-Hartman
                     ` (85 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alan Stern, Andrey Konovalov, Felipe Balbi

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

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit add333a81a16abbd4f106266a2553677a165725f upstream.

Andrey Konovalov reports that fuzz testing with syzkaller causes a
KASAN use-after-free bug report in gadgetfs:

BUG: KASAN: use-after-free in gadgetfs_setup+0x208a/0x20e0 at addr ffff88003dfe5bf2
Read of size 2 by task syz-executor0/22994
CPU: 3 PID: 22994 Comm: syz-executor0 Not tainted 4.9.0-rc7+ #16
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 ffff88006df06a18 ffffffff81f96aba ffffffffe0528500 1ffff1000dbe0cd6
 ffffed000dbe0cce ffff88006df068f0 0000000041b58ab3 ffffffff8598b4c8
 ffffffff81f96828 1ffff1000dbe0ccd ffff88006df06708 ffff88006df06748
Call Trace:
 <IRQ> [  201.343209]  [<     inline     >] __dump_stack lib/dump_stack.c:15
 <IRQ> [  201.343209]  [<ffffffff81f96aba>] dump_stack+0x292/0x398 lib/dump_stack.c:51
 [<ffffffff817e4dec>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:159
 [<     inline     >] print_address_description mm/kasan/report.c:197
 [<ffffffff817e5080>] kasan_report_error+0x1f0/0x4e0 mm/kasan/report.c:286
 [<     inline     >] kasan_report mm/kasan/report.c:306
 [<ffffffff817e562a>] __asan_report_load_n_noabort+0x3a/0x40 mm/kasan/report.c:337
 [<     inline     >] config_buf drivers/usb/gadget/legacy/inode.c:1298
 [<ffffffff8322c8fa>] gadgetfs_setup+0x208a/0x20e0 drivers/usb/gadget/legacy/inode.c:1368
 [<ffffffff830fdcd0>] dummy_timer+0x11f0/0x36d0 drivers/usb/gadget/udc/dummy_hcd.c:1858
 [<ffffffff814807c1>] call_timer_fn+0x241/0x800 kernel/time/timer.c:1308
 [<     inline     >] expire_timers kernel/time/timer.c:1348
 [<ffffffff81482de6>] __run_timers+0xa06/0xec0 kernel/time/timer.c:1641
 [<ffffffff814832c1>] run_timer_softirq+0x21/0x80 kernel/time/timer.c:1654
 [<ffffffff84f4af8b>] __do_softirq+0x2fb/0xb63 kernel/softirq.c:284

The cause of the bug is subtle.  The dev_config() routine gets called
twice by the fuzzer.  The first time, the user data contains both a
full-speed configuration descriptor and a high-speed config
descriptor, causing dev->hs_config to be set.  But it also contains an
invalid device descriptor, so the buffer containing the descriptors is
deallocated and dev_config() returns an error.

The second time dev_config() is called, the user data contains only a
full-speed config descriptor.  But dev->hs_config still has the stale
pointer remaining from the first call, causing the routine to think
that there is a valid high-speed config.  Later on, when the driver
dereferences the stale pointer to copy that descriptor, we get a
use-after-free access.

The fix is simple: Clear dev->hs_config if the passed-in data does not
contain a high-speed config descriptor.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/legacy/inode.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1821,6 +1821,8 @@ dev_config (struct file *fd, const char
 			goto fail;
 		kbuf += total;
 		length -= total;
+	} else {
+		dev->hs_config = NULL;
 	}
 
 	/* could support multiple configs, using another encoding! */

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

* [PATCH 4.4 014/101] USB: gadgetfs: fix checks of wTotalLength in config descriptors
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (11 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 013/101] USB: gadgetfs: fix use-after-free bug Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 015/101] USB: fix problems with duplicate endpoint addresses Greg Kroah-Hartman
                     ` (84 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alan Stern, Andrey Konovalov, Felipe Balbi

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

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit 1c069b057dcf64fada952eaa868d35f02bb0cfc2 upstream.

Andrey Konovalov's fuzz testing of gadgetfs showed that we should
improve the driver's checks for valid configuration descriptors passed
in by the user.  In particular, the driver needs to verify that the
wTotalLength value in the descriptor is not too short (smaller
than USB_DT_CONFIG_SIZE).  And the check for whether wTotalLength is
too large has to be changed, because the driver assumes there is
always enough room remaining in the buffer to hold a device descriptor
(at least USB_DT_DEVICE_SIZE bytes).

This patch adds the additional check and fixes the existing check.  It
may do a little more than strictly necessary, but one extra check
won't hurt.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/legacy/inode.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/drivers/usb/gadget/legacy/inode.c
+++ b/drivers/usb/gadget/legacy/inode.c
@@ -1755,10 +1755,12 @@ static struct usb_gadget_driver probe_dr
  * such as configuration notifications.
  */
 
-static int is_valid_config (struct usb_config_descriptor *config)
+static int is_valid_config(struct usb_config_descriptor *config,
+		unsigned int total)
 {
 	return config->bDescriptorType == USB_DT_CONFIG
 		&& config->bLength == USB_DT_CONFIG_SIZE
+		&& total >= USB_DT_CONFIG_SIZE
 		&& config->bConfigurationValue != 0
 		&& (config->bmAttributes & USB_CONFIG_ATT_ONE) != 0
 		&& (config->bmAttributes & USB_CONFIG_ATT_WAKEUP) == 0;
@@ -1808,7 +1810,8 @@ dev_config (struct file *fd, const char
 	/* full or low speed config */
 	dev->config = (void *) kbuf;
 	total = le16_to_cpu(dev->config->wTotalLength);
-	if (!is_valid_config (dev->config) || total >= length)
+	if (!is_valid_config(dev->config, total) ||
+			total > length - USB_DT_DEVICE_SIZE)
 		goto fail;
 	kbuf += total;
 	length -= total;
@@ -1817,7 +1820,8 @@ dev_config (struct file *fd, const char
 	if (kbuf [1] == USB_DT_CONFIG) {
 		dev->hs_config = (void *) kbuf;
 		total = le16_to_cpu(dev->hs_config->wTotalLength);
-		if (!is_valid_config (dev->hs_config) || total >= length)
+		if (!is_valid_config(dev->hs_config, total) ||
+				total > length - USB_DT_DEVICE_SIZE)
 			goto fail;
 		kbuf += total;
 		length -= total;

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

* [PATCH 4.4 015/101] USB: fix problems with duplicate endpoint addresses
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (12 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 014/101] USB: gadgetfs: fix checks of wTotalLength in config descriptors Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 016/101] USB: dummy-hcd: fix bug in stop_activity (handle ep0) Greg Kroah-Hartman
                     ` (83 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alan Stern, Andrey Konovalov

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

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit 0a8fd1346254974c3a852338508e4a4cddbb35f1 upstream.

When checking a new device's descriptors, the USB core does not check
for duplicate endpoint addresses.  This can cause a problem when the
sysfs files for those endpoints are created; trying to create multiple
files with the same name will provoke a WARNING:

WARNING: CPU: 2 PID: 865 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x8a/0xa0
sysfs: cannot create duplicate filename
'/devices/platform/dummy_hcd.0/usb2/2-1/2-1:64.0/ep_05'
Kernel panic - not syncing: panic_on_warn set ...

CPU: 2 PID: 865 Comm: kworker/2:1 Not tainted 4.9.0-rc7+ #34
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: usb_hub_wq hub_event
 ffff88006bee64c8 ffffffff81f96b8a ffffffff00000001 1ffff1000d7dcc2c
 ffffed000d7dcc24 0000000000000001 0000000041b58ab3 ffffffff8598b510
 ffffffff81f968f8 ffffffff850fee20 ffffffff85cff020 dffffc0000000000
Call Trace:
 [<     inline     >] __dump_stack lib/dump_stack.c:15
 [<ffffffff81f96b8a>] dump_stack+0x292/0x398 lib/dump_stack.c:51
 [<ffffffff8168c88e>] panic+0x1cb/0x3a9 kernel/panic.c:179
 [<ffffffff812b80b4>] __warn+0x1c4/0x1e0 kernel/panic.c:542
 [<ffffffff812b8195>] warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:565
 [<ffffffff819e70ca>] sysfs_warn_dup+0x8a/0xa0 fs/sysfs/dir.c:30
 [<ffffffff819e7308>] sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:59
 [<     inline     >] create_dir lib/kobject.c:71
 [<ffffffff81fa1b07>] kobject_add_internal+0x227/0xa60 lib/kobject.c:229
 [<     inline     >] kobject_add_varg lib/kobject.c:366
 [<ffffffff81fa2479>] kobject_add+0x139/0x220 lib/kobject.c:411
 [<ffffffff82737a63>] device_add+0x353/0x1660 drivers/base/core.c:1088
 [<ffffffff82738d8d>] device_register+0x1d/0x20 drivers/base/core.c:1206
 [<ffffffff82cb77d3>] usb_create_ep_devs+0x163/0x260 drivers/usb/core/endpoint.c:195
 [<ffffffff82c9f27b>] create_intf_ep_devs+0x13b/0x200 drivers/usb/core/message.c:1030
 [<ffffffff82ca39d3>] usb_set_configuration+0x1083/0x18d0 drivers/usb/core/message.c:1937
 [<ffffffff82cc9e2e>] generic_probe+0x6e/0xe0 drivers/usb/core/generic.c:172
 [<ffffffff82caa7fa>] usb_probe_device+0xaa/0xe0 drivers/usb/core/driver.c:263

This patch prevents the problem by checking for duplicate endpoint
addresses during enumeration and skipping any duplicates.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/core/config.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -205,6 +205,16 @@ static int usb_parse_endpoint(struct dev
 	if (ifp->desc.bNumEndpoints >= num_ep)
 		goto skip_to_next_endpoint_or_interface_descriptor;
 
+	/* Check for duplicate endpoint addresses */
+	for (i = 0; i < ifp->desc.bNumEndpoints; ++i) {
+		if (ifp->endpoint[i].desc.bEndpointAddress ==
+		    d->bEndpointAddress) {
+			dev_warn(ddev, "config %d interface %d altsetting %d has a duplicate endpoint with address 0x%X, skipping\n",
+			    cfgno, inum, asnum, d->bEndpointAddress);
+			goto skip_to_next_endpoint_or_interface_descriptor;
+		}
+	}
+
 	endpoint = &ifp->endpoint[ifp->desc.bNumEndpoints];
 	++ifp->desc.bNumEndpoints;
 

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

* [PATCH 4.4 016/101] USB: dummy-hcd: fix bug in stop_activity (handle ep0)
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (13 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 015/101] USB: fix problems with duplicate endpoint addresses Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 017/101] usb: gadget: composite: Test get_alt() presence instead of set_alt() Greg Kroah-Hartman
                     ` (82 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Alan Stern, Andrey Konovalov, Felipe Balbi

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

------------------

From: Alan Stern <stern@rowland.harvard.edu>

commit bcdbeb844773333d2d1c08004f3b3e25921040e5 upstream.

The stop_activity() routine in dummy-hcd is supposed to unlink all
active requests for every endpoint, among other things.  But it
doesn't handle ep0.  As a result, fuzz testing can generate a WARNING
like the following:

WARNING: CPU: 0 PID: 4410 at drivers/usb/gadget/udc/dummy_hcd.c:672 dummy_free_request+0x153/0x170
Modules linked in:
CPU: 0 PID: 4410 Comm: syz-executor Not tainted 4.9.0-rc7+ #32
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 ffff88006a64ed10 ffffffff81f96b8a ffffffff41b58ab3 1ffff1000d4c9d35
 ffffed000d4c9d2d ffff880065f8ac00 0000000041b58ab3 ffffffff8598b510
 ffffffff81f968f8 0000000041b58ab3 ffffffff859410e0 ffffffff813f0590
Call Trace:
 [<     inline     >] __dump_stack lib/dump_stack.c:15
 [<ffffffff81f96b8a>] dump_stack+0x292/0x398 lib/dump_stack.c:51
 [<ffffffff812b808f>] __warn+0x19f/0x1e0 kernel/panic.c:550
 [<ffffffff812b831c>] warn_slowpath_null+0x2c/0x40 kernel/panic.c:585
 [<ffffffff830fcb13>] dummy_free_request+0x153/0x170 drivers/usb/gadget/udc/dummy_hcd.c:672
 [<ffffffff830ed1b0>] usb_ep_free_request+0xc0/0x420 drivers/usb/gadget/udc/core.c:195
 [<ffffffff83225031>] gadgetfs_unbind+0x131/0x190 drivers/usb/gadget/legacy/inode.c:1612
 [<ffffffff830ebd8f>] usb_gadget_remove_driver+0x10f/0x2b0 drivers/usb/gadget/udc/core.c:1228
 [<ffffffff830ec084>] usb_gadget_unregister_driver+0x154/0x240 drivers/usb/gadget/udc/core.c:1357

This patch fixes the problem by iterating over all the endpoints in
the driver's ep array instead of iterating over the gadget's ep_list,
which explicitly leaves out ep0.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/udc/dummy_hcd.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -330,7 +330,7 @@ static void nuke(struct dummy *dum, stru
 /* caller must hold lock */
 static void stop_activity(struct dummy *dum)
 {
-	struct dummy_ep	*ep;
+	int i;
 
 	/* prevent any more requests */
 	dum->address = 0;
@@ -338,8 +338,8 @@ static void stop_activity(struct dummy *
 	/* The timer is left running so that outstanding URBs can fail */
 
 	/* nuke any pending requests first, so driver i/o is quiesced */
-	list_for_each_entry(ep, &dum->gadget.ep_list, ep.ep_list)
-		nuke(dum, ep);
+	for (i = 0; i < DUMMY_ENDPOINTS; ++i)
+		nuke(dum, &dum->ep[i]);
 
 	/* driver now does any non-usb quiescing necessary */
 }

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

* [PATCH 4.4 017/101] usb: gadget: composite: Test get_alt() presence instead of set_alt()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (14 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 016/101] USB: dummy-hcd: fix bug in stop_activity (handle ep0) Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 018/101] usb: dwc3: core: avoid Overflow events Greg Kroah-Hartman
                     ` (81 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Krzysztof Opasiak, Felipe Balbi

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

------------------

From: Krzysztof Opasiak <k.opasiak@samsung.com>

commit 7e4da3fcf7c9fe042f2f7cb7bf23861a899b4a8f upstream.

By convention (according to doc) if function does not provide
get_alt() callback composite framework should assume that it has only
altsetting 0 and should respond with error if host tries to set
other one.

After commit dd4dff8b035f ("USB: composite: Fix bug: should test
set_alt function pointer before use it")
we started checking set_alt() callback instead of get_alt().
This check is useless as we check if set_alt() is set inside
usb_add_function() and fail if it's NULL.

Let's fix this check and move comment about why we check the get
method instead of set a little bit closer to prevent future false
fixes.

Fixes: dd4dff8b035f ("USB: composite: Fix bug: should test set_alt function pointer before use it")
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/composite.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1601,9 +1601,7 @@ composite_setup(struct usb_gadget *gadge
 		value = min(w_length, (u16) 1);
 		break;
 
-	/* function drivers must handle get/set altsetting; if there's
-	 * no get() method, we know only altsetting zero works.
-	 */
+	/* function drivers must handle get/set altsetting */
 	case USB_REQ_SET_INTERFACE:
 		if (ctrl->bRequestType != USB_RECIP_INTERFACE)
 			goto unknown;
@@ -1612,7 +1610,13 @@ composite_setup(struct usb_gadget *gadge
 		f = cdev->config->interface[intf];
 		if (!f)
 			break;
-		if (w_value && !f->set_alt)
+
+		/*
+		 * If there's no get_alt() method, we know only altsetting zero
+		 * works. There is no need to check if set_alt() is not NULL
+		 * as we check this in usb_add_function().
+		 */
+		if (w_value && !f->get_alt)
 			break;
 		value = f->set_alt(f, w_index, w_value);
 		if (value == USB_GADGET_DELAYED_STATUS) {

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

* [PATCH 4.4 018/101] usb: dwc3: core: avoid Overflow events
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (15 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 017/101] usb: gadget: composite: Test get_alt() presence instead of set_alt() Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 019/101] usb: xhci: fix possible wild pointer Greg Kroah-Hartman
                     ` (80 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Felipe Balbi

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

------------------

From: Felipe Balbi <felipe.balbi@linux.intel.com>

commit e71d363d9c611c99fb78f53bfee99616e7fe352c upstream.

Now that we're handling so many transfers at a time
and for some dwc3 revisions LPM events *must* be
enabled, we can fall into a situation where too many
events fire and we start receiving Overflow events.

Let's do what XHCI does and allocate a full page for
the Event Ring, this will avoid any future issues.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/dwc3/core.h |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -42,9 +42,7 @@
 #define DWC3_XHCI_RESOURCES_NUM	2
 
 #define DWC3_SCRATCHBUF_SIZE	4096	/* each buffer is assumed to be 4KiB */
-#define DWC3_EVENT_SIZE		4	/* bytes */
-#define DWC3_EVENT_MAX_NUM	64	/* 2 events/endpoint */
-#define DWC3_EVENT_BUFFERS_SIZE	(DWC3_EVENT_SIZE * DWC3_EVENT_MAX_NUM)
+#define DWC3_EVENT_BUFFERS_SIZE	4096
 #define DWC3_EVENT_TYPE_MASK	0xfe
 
 #define DWC3_EVENT_TYPE_DEV	0

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

* [PATCH 4.4 019/101] usb: xhci: fix possible wild pointer
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (16 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 018/101] usb: dwc3: core: avoid Overflow events Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 020/101] xhci: workaround for hosts missing CAS bit Greg Kroah-Hartman
                     ` (79 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Lu Baolu, Mathias Nyman

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

------------------

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 2b985467371a58ae44d76c7ba12b0951fee6ed98 upstream.

handle_cmd_completion() frees a command structure which might be still
referenced by xhci->current_cmd.
This might cause problem when xhci->current_cmd is accessed after that.

A real-life case could be like this. The host takes a very long time to
respond to a command, and the command timer is fired at the same time
when the command completion event arrives. The command completion
handler frees xhci->current_cmd before the timer function can grab
xhci->lock. Afterward, timer function grabs the lock and go ahead with
checking and setting members of xhci->current_cmd.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-ring.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1268,14 +1268,18 @@ void xhci_handle_command_timeout(unsigne
 	bool second_timeout = false;
 	xhci = (struct xhci_hcd *) data;
 
-	/* mark this command to be cancelled */
 	spin_lock_irqsave(&xhci->lock, flags);
-	if (xhci->current_cmd) {
-		if (xhci->current_cmd->status == COMP_CMD_ABORT)
-			second_timeout = true;
-		xhci->current_cmd->status = COMP_CMD_ABORT;
+
+	if (!xhci->current_cmd) {
+		spin_unlock_irqrestore(&xhci->lock, flags);
+		return;
 	}
 
+	/* mark this command to be cancelled */
+	if (xhci->current_cmd->status == COMP_CMD_ABORT)
+		second_timeout = true;
+	xhci->current_cmd->status = COMP_CMD_ABORT;
+
 	/* Make sure command ring is running before aborting it */
 	hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
 	if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&
@@ -1424,6 +1428,8 @@ static void handle_cmd_completion(struct
 		xhci->current_cmd = list_entry(cmd->cmd_list.next,
 					       struct xhci_command, cmd_list);
 		mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
+	} else if (xhci->current_cmd == cmd) {
+		xhci->current_cmd = NULL;
 	}
 
 event_handled:

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

* [PATCH 4.4 020/101] xhci: workaround for hosts missing CAS bit
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (17 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 019/101] usb: xhci: fix possible wild pointer Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 021/101] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake Greg Kroah-Hartman
                     ` (78 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Mathias Nyman

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

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit 346e99736c3ce328fd42d678343b70243aca5f36 upstream.

If a device is unplugged and replugged during Sx system suspend
some  Intel xHC hosts will overwrite the CAS (Cold attach status) flag
and no device connection is noticed in resume.

A device in this state can be identified in resume if its link state
is in polling or compliance mode, and the current connect status is 0.
A device in this state needs to be warm reset.

Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8

Observed on Cherryview and Apollolake as they go into compliance mode
if LFPS times out during polling, and re-plugged devices are not
discovered at resume.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-hub.c |   37 +++++++++++++++++++++++++++++++++++++
 drivers/usb/host/xhci-pci.c |    6 ++++++
 drivers/usb/host/xhci.h     |    3 +++
 3 files changed, 46 insertions(+)

--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1346,6 +1346,35 @@ int xhci_bus_suspend(struct usb_hcd *hcd
 	return 0;
 }
 
+/*
+ * Workaround for missing Cold Attach Status (CAS) if device re-plugged in S3.
+ * warm reset a USB3 device stuck in polling or compliance mode after resume.
+ * See Intel 100/c230 series PCH specification update Doc #332692-006 Errata #8
+ */
+static bool xhci_port_missing_cas_quirk(int port_index,
+					     __le32 __iomem **port_array)
+{
+	u32 portsc;
+
+	portsc = readl(port_array[port_index]);
+
+	/* if any of these are set we are not stuck */
+	if (portsc & (PORT_CONNECT | PORT_CAS))
+		return false;
+
+	if (((portsc & PORT_PLS_MASK) != XDEV_POLLING) &&
+	    ((portsc & PORT_PLS_MASK) != XDEV_COMP_MODE))
+		return false;
+
+	/* clear wakeup/change bits, and do a warm port reset */
+	portsc &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS);
+	portsc |= PORT_WR;
+	writel(portsc, port_array[port_index]);
+	/* flush write */
+	readl(port_array[port_index]);
+	return true;
+}
+
 int xhci_bus_resume(struct usb_hcd *hcd)
 {
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
@@ -1383,6 +1412,14 @@ int xhci_bus_resume(struct usb_hcd *hcd)
 		u32 temp;
 
 		temp = readl(port_array[port_index]);
+
+		/* warm reset CAS limited ports stuck in polling/compliance */
+		if ((xhci->quirks & XHCI_MISSING_CAS) &&
+		    (hcd->speed >= HCD_USB3) &&
+		    xhci_port_missing_cas_quirk(port_index, port_array)) {
+			xhci_dbg(xhci, "reset stuck port %d\n", port_index);
+			continue;
+		}
 		if (DEV_SUPERSPEED_ANY(temp))
 			temp &= ~(PORT_RWC_BITS | PORT_CEC | PORT_WAKE_BITS);
 		else
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -51,6 +51,7 @@
 #define PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI	0x9d2f
 #define PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI		0x0aa8
 #define PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI		0x1aa8
+#define PCI_DEVICE_ID_INTEL_APL_XHCI			0x5aa8
 
 static const char hcd_name[] = "xhci_hcd";
 
@@ -168,6 +169,11 @@ static void xhci_pci_quirks(struct devic
 		 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) {
 		xhci->quirks |= XHCI_PME_STUCK_QUIRK;
 	}
+	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
+	    (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
+	     pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI))
+		xhci->quirks |= XHCI_MISSING_CAS;
+
 	if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
 			pdev->device == PCI_DEVICE_ID_EJ168) {
 		xhci->quirks |= XHCI_RESET_ON_RESUME;
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -312,6 +312,8 @@ struct xhci_op_regs {
 #define XDEV_U2		(0x2 << 5)
 #define XDEV_U3		(0x3 << 5)
 #define XDEV_INACTIVE	(0x6 << 5)
+#define XDEV_POLLING	(0x7 << 5)
+#define XDEV_COMP_MODE  (0xa << 5)
 #define XDEV_RESUME	(0xf << 5)
 /* true: port has power (see HCC_PPC) */
 #define PORT_POWER	(1 << 9)
@@ -1631,6 +1633,7 @@ struct xhci_hcd {
 /* For controllers with a broken beyond repair streams implementation */
 #define XHCI_BROKEN_STREAMS	(1 << 19)
 #define XHCI_PME_STUCK_QUIRK	(1 << 20)
+#define XHCI_MISSING_CAS	(1 << 24)
 	unsigned int		num_active_eps;
 	unsigned int		limit_active_eps;
 	/* There are two roothubs to keep track of bus suspend info for */

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

* [PATCH 4.4 021/101] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (18 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 020/101] xhci: workaround for hosts missing CAS bit Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 022/101] xhci: free xhci virtual devices with leaf nodes first Greg Kroah-Hartman
                     ` (77 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Wan Ahmad Zainie, Mathias Nyman

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

------------------

From: Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>

commit 6c97cfc1a097b1e0786c836e92b7a72b4d031e25 upstream.

Intel Apollo Lake also requires XHCI_PME_STUCK_QUIRK.
Adding its PCI ID to quirk.

Signed-off-by: Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-pci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -166,7 +166,8 @@ static void xhci_pci_quirks(struct devic
 		 pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI ||
 		 pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI ||
 		 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_M_XHCI ||
-		 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI)) {
+		 pdev->device == PCI_DEVICE_ID_INTEL_BROXTON_B_XHCI ||
+		 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI)) {
 		xhci->quirks |= XHCI_PME_STUCK_QUIRK;
 	}
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&

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

* [PATCH 4.4 022/101] xhci: free xhci virtual devices with leaf nodes first
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (19 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 021/101] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 023/101] usb: xhci: fix return value of xhci_setup_device() Greg Kroah-Hartman
                     ` (76 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Guenter Roeck, Mathias Nyman

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

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit ee8665e28e8d90ce69d4abe5a469c14a8707ae0e upstream.

the tt_info provided by a HS hub might be in use to by a child device
Make sure we free the devices in the correct order.

This is needed in special cases such as when xhci controller is
reset when resuming from hibernate, and all virt_devices are freed.

Also free the virt_devices starting from max slot_id as children
more commonly have higher slot_id than parent.

Reported-by: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-mem.c |   38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -964,6 +964,40 @@ void xhci_free_virt_device(struct xhci_h
 	xhci->devs[slot_id] = NULL;
 }
 
+/*
+ * Free a virt_device structure.
+ * If the virt_device added a tt_info (a hub) and has children pointing to
+ * that tt_info, then free the child first. Recursive.
+ * We can't rely on udev at this point to find child-parent relationships.
+ */
+void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_id)
+{
+	struct xhci_virt_device *vdev;
+	struct list_head *tt_list_head;
+	struct xhci_tt_bw_info *tt_info, *next;
+	int i;
+
+	vdev = xhci->devs[slot_id];
+	if (!vdev)
+		return;
+
+	tt_list_head = &(xhci->rh_bw[vdev->real_port - 1].tts);
+	list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) {
+		/* is this a hub device that added a tt_info to the tts list */
+		if (tt_info->slot_id == slot_id) {
+			/* are any devices using this tt_info? */
+			for (i = 1; i < HCS_MAX_SLOTS(xhci->hcs_params1); i++) {
+				vdev = xhci->devs[i];
+				if (vdev && (vdev->tt_info == tt_info))
+					xhci_free_virt_devices_depth_first(
+						xhci, i);
+			}
+		}
+	}
+	/* we are now at a leaf device */
+	xhci_free_virt_device(xhci, slot_id);
+}
+
 int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
 		struct usb_device *udev, gfp_t flags)
 {
@@ -1828,8 +1862,8 @@ void xhci_mem_cleanup(struct xhci_hcd *x
 		}
 	}
 
-	for (i = 1; i < MAX_HC_SLOTS; ++i)
-		xhci_free_virt_device(xhci, i);
+	for (i = HCS_MAX_SLOTS(xhci->hcs_params1); i > 0; i--)
+		xhci_free_virt_devices_depth_first(xhci, i);
 
 	dma_pool_destroy(xhci->segment_pool);
 	xhci->segment_pool = NULL;

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

* [PATCH 4.4 023/101] usb: xhci: fix return value of xhci_setup_device()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (20 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 022/101] xhci: free xhci virtual devices with leaf nodes first Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 024/101] usb: host: xhci: Fix possible wild pointer when handling abort command Greg Kroah-Hartman
                     ` (75 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Lu Baolu, Mathias Nyman

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

------------------

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 90797aee5d6902b49a453c97d83c326408aeb5a8 upstream.

xhci_setup_device() should return failure with correct error number
when xhci host has died, removed or halted.

During usb device enumeration, if usb host is not accessible (died,
removed or halted), the hc_driver->address_device() should return
a corresponding error code to usb core. But current xhci driver just
returns success. This misleads usb core to continue the enumeration
by reading the device descriptor, which will result in failure, and
users will get a misleading message like "device descriptor read/8,
error -110".

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3808,8 +3808,10 @@ static int xhci_setup_device(struct usb_
 
 	mutex_lock(&xhci->mutex);
 
-	if (xhci->xhc_state)	/* dying, removing or halted */
+	if (xhci->xhc_state) {	/* dying, removing or halted */
+		ret = -ESHUTDOWN;
 		goto out;
+	}
 
 	if (!udev->slot_id) {
 		xhci_dbg_trace(xhci, trace_xhci_dbg_address,

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

* [PATCH 4.4 024/101] usb: host: xhci: Fix possible wild pointer when handling abort command
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (21 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 023/101] usb: xhci: fix return value of xhci_setup_device() Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 025/101] xhci: Handle command completion and timeout race Greg Kroah-Hartman
                     ` (74 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Baolin Wang, Mathias Nyman

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

------------------

From: Baolin Wang <baolin.wang@linaro.org>

commit 2a7cfdf37b7c08ac29df4c62ea5ccb01474b6597 upstream.

When current command was supposed to be aborted, host will free the command
in handle_cmd_completion() function. But it might be still referenced by
xhci->current_cmd, which need to set NULL.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-ring.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1365,8 +1365,11 @@ static void handle_cmd_completion(struct
 	 */
 	if (cmd_comp_code == COMP_CMD_ABORT) {
 		xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
-		if (cmd->status == COMP_CMD_ABORT)
+		if (cmd->status == COMP_CMD_ABORT) {
+			if (xhci->current_cmd == cmd)
+				xhci->current_cmd = NULL;
 			goto event_handled;
+		}
 	}
 
 	cmd_type = TRB_FIELD_TO_TYPE(le32_to_cpu(cmd_trb->generic.field[3]));

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

* [PATCH 4.4 025/101] xhci: Handle command completion and timeout race
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (22 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 024/101] usb: host: xhci: Fix possible wild pointer when handling abort command Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 026/101] usb: xhci: hold lock over xhci_abort_cmd_ring() Greg Kroah-Hartman
                     ` (73 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Baolin Wang, Mathias Nyman

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

------------------

From: Mathias Nyman <mathias.nyman@linux.intel.com>

commit a5a1b9514154437aa1ed35c291191f82fd3e941a upstream.

If we get a command completion event at the same time as the command
timeout work starts on another cpu we might end up aborting the wrong
command.

If the command completion takes the xhci lock before the timeout work, it
will handle the command, pick the next command, mark it as current_cmd, and
re-queue the timeout work. When the timeout work finally gets the lock
It will start aborting the wrong command.

This case can be resolved by checking if the timeout work is pending inside
the timeout function itself. A new timeout work can only be pending if the
command completed and a new command was queued.

If there are no more commands pending then command completion will set
the current_cmd to NULL, which is already handled in the timeout work.

Reported-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-ring.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1270,7 +1270,11 @@ void xhci_handle_command_timeout(unsigne
 
 	spin_lock_irqsave(&xhci->lock, flags);
 
-	if (!xhci->current_cmd) {
+	/*
+	 * If timeout work is pending, or current_cmd is NULL, it means we
+	 * raced with command completion. Command is handled so just return.
+	 */
+	if (!xhci->current_cmd || timer_pending(&xhci->cmd_timer)) {
 		spin_unlock_irqrestore(&xhci->lock, flags);
 		return;
 	}

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

* [PATCH 4.4 026/101] usb: xhci: hold lock over xhci_abort_cmd_ring()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (23 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 025/101] xhci: Handle command completion and timeout race Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 027/101] USB: serial: omninet: fix NULL-derefs at open and disconnect Greg Kroah-Hartman
                     ` (72 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Lu Baolu, Mathias Nyman

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

------------------

From: Lu Baolu <baolu.lu@linux.intel.com>

commit 4dea70778c0f48b4385c7720c363ec8d37a401b4 upstream.

In command timer function, xhci_handle_command_timeout(), xhci->lock
is unlocked before call into xhci_abort_cmd_ring(). This might cause
race between the timer function and the event handler.

The xhci_abort_cmd_ring() function sets the CMD_RING_ABORT bit in the
command register and polling it until the setting takes effect. A stop
command ring event might be handled between writing the abort bit and
polling for it. The event handler will restart the command ring, which
causes the failure of polling, and we ever believed that we failed to
stop it.

As a bonus, this also fixes some issues of calling functions without
locking in xhci_handle_command_timeout().

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-ring.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1288,29 +1288,34 @@ void xhci_handle_command_timeout(unsigne
 	hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
 	if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&
 	    (hw_ring_state & CMD_RING_RUNNING))  {
-		spin_unlock_irqrestore(&xhci->lock, flags);
 		xhci_dbg(xhci, "Command timeout\n");
 		ret = xhci_abort_cmd_ring(xhci);
 		if (unlikely(ret == -ESHUTDOWN)) {
 			xhci_err(xhci, "Abort command ring failed\n");
 			xhci_cleanup_command_queue(xhci);
+			spin_unlock_irqrestore(&xhci->lock, flags);
 			usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
 			xhci_dbg(xhci, "xHCI host controller is dead.\n");
+
+			return;
 		}
-		return;
+
+		goto time_out_completed;
 	}
 
 	/* command ring failed to restart, or host removed. Bail out */
 	if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) {
-		spin_unlock_irqrestore(&xhci->lock, flags);
 		xhci_dbg(xhci, "command timed out twice, ring start fail?\n");
 		xhci_cleanup_command_queue(xhci);
-		return;
+
+		goto time_out_completed;
 	}
 
 	/* command timeout on stopped ring, ring can't be aborted */
 	xhci_dbg(xhci, "Command timeout on stopped ring\n");
 	xhci_handle_stopped_cmd_ring(xhci, xhci->current_cmd);
+
+time_out_completed:
 	spin_unlock_irqrestore(&xhci->lock, flags);
 	return;
 }

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

* [PATCH 4.4 027/101] USB: serial: omninet: fix NULL-derefs at open and disconnect
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (24 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 026/101] usb: xhci: hold lock over xhci_abort_cmd_ring() Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 028/101] USB: serial: quatech2: fix sleep-while-atomic in close Greg Kroah-Hartman
                     ` (71 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit a5bc01949e3b19d8a23b5eabc6fc71bb50dc820e upstream.

Fix NULL-pointer dereferences at open() and disconnect() should the
device lack the expected bulk-out endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 000000b4
...
[c0170ff0>] (__lock_acquire) from [<c0172f00>] (lock_acquire+0x108/0x264)
[<c0172f00>] (lock_acquire) from [<c06a5090>] (_raw_spin_lock_irqsave+0x58/0x6c)
[<c06a5090>] (_raw_spin_lock_irqsave) from [<c0470684>] (tty_port_tty_set+0x28/0xa4)
[<c0470684>] (tty_port_tty_set) from [<bf08d384>] (omninet_open+0x30/0x40 [omninet])
[<bf08d384>] (omninet_open [omninet]) from [<bf07c118>] (serial_port_activate+0x68/0x98 [usbserial])

Unable to handle kernel NULL pointer dereference at virtual address 00000234
...
[<bf01f418>] (omninet_disconnect [omninet]) from [<bf0016c0>] (usb_serial_disconnect+0xe4/0x100 [usbserial])

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/omninet.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -38,6 +38,7 @@ static int  omninet_write(struct tty_str
 				const unsigned char *buf, int count);
 static int  omninet_write_room(struct tty_struct *tty);
 static void omninet_disconnect(struct usb_serial *serial);
+static int omninet_attach(struct usb_serial *serial);
 static int omninet_port_probe(struct usb_serial_port *port);
 static int omninet_port_remove(struct usb_serial_port *port);
 
@@ -56,6 +57,7 @@ static struct usb_serial_driver zyxel_om
 	.description =		"ZyXEL - omni.net lcd plus usb",
 	.id_table =		id_table,
 	.num_ports =		1,
+	.attach =		omninet_attach,
 	.port_probe =		omninet_port_probe,
 	.port_remove =		omninet_port_remove,
 	.open =			omninet_open,
@@ -104,6 +106,17 @@ struct omninet_data {
 	__u8	od_outseq;	/* Sequence number for bulk_out URBs */
 };
 
+static int omninet_attach(struct usb_serial *serial)
+{
+	/* The second bulk-out endpoint is used for writing. */
+	if (serial->num_bulk_out < 2) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static int omninet_port_probe(struct usb_serial_port *port)
 {
 	struct omninet_data *od;

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

* [PATCH 4.4 028/101] USB: serial: quatech2: fix sleep-while-atomic in close
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (25 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 027/101] USB: serial: omninet: fix NULL-derefs at open and disconnect Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 029/101] USB: serial: pl2303: fix NULL-deref at open Greg Kroah-Hartman
                     ` (70 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit f09d1886a41e9063b43da493ef0e845ac8afd2fa upstream.

The write URB was being killed using the synchronous interface while
holding a spin lock in close().

Simply drop the lock and busy-flag update, something which would have
been taken care of by the completion handler if the URB was in flight.

Fixes: f7a33e608d9a ("USB: serial: add quatech2 usb to serial driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/quatech2.c |    4 ----
 1 file changed, 4 deletions(-)

--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -408,16 +408,12 @@ static void qt2_close(struct usb_serial_
 {
 	struct usb_serial *serial;
 	struct qt2_port_private *port_priv;
-	unsigned long flags;
 	int i;
 
 	serial = port->serial;
 	port_priv = usb_get_serial_port_data(port);
 
-	spin_lock_irqsave(&port_priv->urb_lock, flags);
 	usb_kill_urb(port_priv->write_urb);
-	port_priv->urb_in_use = false;
-	spin_unlock_irqrestore(&port_priv->urb_lock, flags);
 
 	/* flush the port transmit buffer */
 	i = usb_control_msg(serial->dev,

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

* [PATCH 4.4 029/101] USB: serial: pl2303: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (26 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 028/101] USB: serial: quatech2: fix sleep-while-atomic in close Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 030/101] USB: serial: keyspan_pda: verify endpoints at probe Greg Kroah-Hartman
                     ` (69 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 76ab439ed1b68778e9059c79ecc5d14de76c89a8 upstream.

Fix NULL-pointer dereference in open() should a type-0 or type-1 device
lack the expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at pl2303_open+0x38/0xec [pl2303]

Note that a missing interrupt-in endpoint would have caused open() to
fail.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/pl2303.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -220,9 +220,17 @@ static int pl2303_probe(struct usb_seria
 static int pl2303_startup(struct usb_serial *serial)
 {
 	struct pl2303_serial_private *spriv;
+	unsigned char num_ports = serial->num_ports;
 	enum pl2303_type type = TYPE_01;
 	unsigned char *buf;
 
+	if (serial->num_bulk_in < num_ports ||
+			serial->num_bulk_out < num_ports ||
+			serial->num_interrupt_in < num_ports) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
 	spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
 	if (!spriv)
 		return -ENOMEM;

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

* [PATCH 4.4 030/101] USB: serial: keyspan_pda: verify endpoints at probe
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (27 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 029/101] USB: serial: pl2303: fix NULL-deref at open Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 031/101] USB: serial: spcp8x5: fix NULL-deref at open Greg Kroah-Hartman
                     ` (68 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 5d9b0f859babe96175cd33d7162a9463a875ffde upstream.

Check for the expected endpoints in attach() and fail loudly if not
present.

Note that failing to do this appears to be benign since da280e348866
("USB: keyspan_pda: clean up write-urb busy handling") which prevents a
NULL-pointer dereference in write() by never marking a non-existent
write-urb as free.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/keyspan_pda.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -699,6 +699,19 @@ MODULE_FIRMWARE("keyspan_pda/keyspan_pda
 MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw");
 #endif
 
+static int keyspan_pda_attach(struct usb_serial *serial)
+{
+	unsigned char num_ports = serial->num_ports;
+
+	if (serial->num_bulk_out < num_ports ||
+			serial->num_interrupt_in < num_ports) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static int keyspan_pda_port_probe(struct usb_serial_port *port)
 {
 
@@ -776,6 +789,7 @@ static struct usb_serial_driver keyspan_
 	.break_ctl =		keyspan_pda_break_ctl,
 	.tiocmget =		keyspan_pda_tiocmget,
 	.tiocmset =		keyspan_pda_tiocmset,
+	.attach =		keyspan_pda_attach,
 	.port_probe =		keyspan_pda_port_probe,
 	.port_remove =		keyspan_pda_port_remove,
 };

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

* [PATCH 4.4 031/101] USB: serial: spcp8x5: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (28 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 030/101] USB: serial: keyspan_pda: verify endpoints at probe Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 032/101] USB: serial: io_ti: " Greg Kroah-Hartman
                     ` (67 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit cc0909248258f679c4bb4cd315565d40abaf6bc6 upstream.

Fix NULL-pointer dereference in open() should the device lack the
expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at spcp8x5_open+0x30/0xd0 [spcp8x5]

Fixes: 619a6f1d1423 ("USB: add usb-serial spcp8x5 driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/spcp8x5.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -154,6 +154,19 @@ static int spcp8x5_probe(struct usb_seri
 	return 0;
 }
 
+static int spcp8x5_attach(struct usb_serial *serial)
+{
+	unsigned char num_ports = serial->num_ports;
+
+	if (serial->num_bulk_in < num_ports ||
+			serial->num_bulk_out < num_ports) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static int spcp8x5_port_probe(struct usb_serial_port *port)
 {
 	const struct usb_device_id *id = usb_get_serial_data(port->serial);
@@ -477,6 +490,7 @@ static struct usb_serial_driver spcp8x5_
 	.tiocmget		= spcp8x5_tiocmget,
 	.tiocmset		= spcp8x5_tiocmset,
 	.probe			= spcp8x5_probe,
+	.attach			= spcp8x5_attach,
 	.port_probe		= spcp8x5_port_probe,
 	.port_remove		= spcp8x5_port_remove,
 };

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

* [PATCH 4.4 032/101] USB: serial: io_ti: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (29 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 031/101] USB: serial: spcp8x5: fix NULL-deref at open Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 033/101] USB: serial: io_ti: fix another " Greg Kroah-Hartman
                     ` (66 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit a323fefc6f5079844dc62ffeb54f491d0242ca35 upstream.

Fix NULL-pointer dereference when clearing halt at open should a
malicious device lack the expected endpoints when in download mode.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf011ed8>] (edge_open [io_ti]) from [<bf000118>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf000118>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf000da0>] (serial_open+0x48/0x6c [usbserial])
[<bf000da0>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/io_ti.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2549,6 +2549,13 @@ static int edge_startup(struct usb_seria
 	int status;
 	u16 product_id;
 
+	/* Make sure we have the required endpoints when in download mode. */
+	if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) {
+		if (serial->num_bulk_in < serial->num_ports ||
+				serial->num_bulk_out < serial->num_ports)
+			return -ENODEV;
+	}
+
 	/* create our private serial structure */
 	edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL);
 	if (!edge_serial)

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

* [PATCH 4.4 033/101] USB: serial: io_ti: fix another NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (30 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 032/101] USB: serial: io_ti: " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 034/101] USB: serial: io_ti: fix I/O after disconnect Greg Kroah-Hartman
                     ` (65 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 4f9785cc99feeb3673993b471f646b4dbaec2cc1 upstream.

In case a device is left in "boot-mode" we must not register any port
devices in order to avoid a NULL-pointer dereference on open due to
missing endpoints. This could be used by a malicious device to trigger
an OOPS:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf0caa84>] (edge_open [io_ti]) from [<bf0b0118>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf0b0118>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf0b0da0>] (serial_open+0x48/0x6c [usbserial])
[<bf0b0da0>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/io_ti.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1508,7 +1508,7 @@ stayinbootmode:
 	dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__);
 	serial->product_info.TiMode = TI_MODE_BOOT;
 
-	return 0;
+	return 1;
 }
 
 static int ti_do_config(struct edgeport_port *port, int feature, int on)
@@ -2563,14 +2563,18 @@ static int edge_startup(struct usb_seria
 
 	mutex_init(&edge_serial->es_lock);
 	edge_serial->serial = serial;
+	INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work);
 	usb_set_serial_data(serial, edge_serial);
 
 	status = download_fw(edge_serial);
-	if (status) {
+	if (status < 0) {
 		kfree(edge_serial);
 		return status;
 	}
 
+	if (status > 0)
+		return 1;	/* bind but do not register any ports */
+
 	product_id = le16_to_cpu(
 			edge_serial->serial->dev->descriptor.idProduct);
 
@@ -2582,7 +2586,6 @@ static int edge_startup(struct usb_seria
 		}
 	}
 
-	INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work);
 	edge_heartbeat_schedule(edge_serial);
 
 	return 0;

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

* [PATCH 4.4 034/101] USB: serial: io_ti: fix I/O after disconnect
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (31 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 033/101] USB: serial: io_ti: fix another " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 035/101] USB: serial: iuu_phoenix: fix NULL-deref at open Greg Kroah-Hartman
                     ` (64 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 2330d0a853da260d8a9834a70df448032b9ff623 upstream.

Cancel the heartbeat work on driver unbind in order to avoid I/O after
disconnect in case the port is held open.

Note that the cancel in release() is still needed to stop the heartbeat
after late probe errors.

Fixes: 26c78daade0f ("USB: io_ti: Add heartbeat to keep idle EP/416 ports from disconnecting")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/io_ti.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -2593,6 +2593,9 @@ static int edge_startup(struct usb_seria
 
 static void edge_disconnect(struct usb_serial *serial)
 {
+	struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
+
+	cancel_delayed_work_sync(&edge_serial->heartbeat_work);
 }
 
 static void edge_release(struct usb_serial *serial)

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

* [PATCH 4.4 035/101] USB: serial: iuu_phoenix: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (32 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 034/101] USB: serial: io_ti: fix I/O after disconnect Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 036/101] USB: serial: garmin_gps: fix memory leak on failed URB submit Greg Kroah-Hartman
                     ` (63 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 90507d54f712d81b74815ef3a4bbb555cd9fab2f upstream.

Fix NULL-pointer dereference at open should the device lack a bulk-in or
bulk-out endpoint:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at iuu_open+0x78/0x59c [iuu_phoenix]

Fixes: 07c3b1a10016 ("USB: remove broken usb-serial num_endpoints
check")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/iuu_phoenix.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -68,6 +68,16 @@ struct iuu_private {
 	u32 clk;
 };
 
+static int iuu_attach(struct usb_serial *serial)
+{
+	unsigned char num_ports = serial->num_ports;
+
+	if (serial->num_bulk_in < num_ports || serial->num_bulk_out < num_ports)
+		return -ENODEV;
+
+	return 0;
+}
+
 static int iuu_port_probe(struct usb_serial_port *port)
 {
 	struct iuu_private *priv;
@@ -1196,6 +1206,7 @@ static struct usb_serial_driver iuu_devi
 	.tiocmset = iuu_tiocmset,
 	.set_termios = iuu_set_termios,
 	.init_termios = iuu_init_termios,
+	.attach = iuu_attach,
 	.port_probe = iuu_port_probe,
 	.port_remove = iuu_port_remove,
 };

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

* [PATCH 4.4 036/101] USB: serial: garmin_gps: fix memory leak on failed URB submit
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (33 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 035/101] USB: serial: iuu_phoenix: fix NULL-deref at open Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 037/101] USB: serial: ti_usb_3410_5052: fix NULL-deref at open Greg Kroah-Hartman
                     ` (62 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit c4ac4496e835b78a45dfbf74f6173932217e4116 upstream.

Make sure to free the URB transfer buffer in case submission fails (e.g.
due to a disconnect).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/garmin_gps.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1044,6 +1044,7 @@ static int garmin_write_bulk(struct usb_
 		   "%s - usb_submit_urb(write bulk) failed with status = %d\n",
 				__func__, status);
 		count = status;
+		kfree(buffer);
 	}
 
 	/* we are done with this urb, so let the host driver

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

* [PATCH 4.4 037/101] USB: serial: ti_usb_3410_5052: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (34 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 036/101] USB: serial: garmin_gps: fix memory leak on failed URB submit Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 038/101] USB: serial: io_edgeport: " Greg Kroah-Hartman
                     ` (61 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit ef079936d3cd09e63612834fe2698eeada0d8e3f upstream.

Fix NULL-pointer dereference in open() should a malicious device lack
the expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
..
[<bf06a6b0>] (ti_open [ti_usb_3410_5052]) from [<bf02e118>] (serial_port_activate+0x68/0x98 [usbserial])

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/ti_usb_3410_5052.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -339,6 +339,13 @@ static int ti_startup(struct usb_serial
 		goto free_tdev;
 	}
 
+	if (serial->num_bulk_in < serial->num_ports ||
+			serial->num_bulk_out < serial->num_ports) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		status = -ENODEV;
+		goto free_tdev;
+	}
+
 	return 0;
 
 free_tdev:

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

* [PATCH 4.4 038/101] USB: serial: io_edgeport: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (35 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 037/101] USB: serial: ti_usb_3410_5052: fix NULL-deref at open Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 039/101] USB: serial: oti6858: " Greg Kroah-Hartman
                     ` (60 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 0dd408425eb21ddf26a692b3c8044c9e7d1a7948 upstream.

Fix NULL-pointer dereference when initialising URBs at open should a
non-EPIC device lack a bulk-in or interrupt-in endpoint.

Unable to handle kernel NULL pointer dereference at virtual address 00000028
...
PC is at edge_open+0x24c/0x3e8 [io_edgeport]

Note that the EPIC-device probe path has the required sanity checks so
this makes those checks partially redundant.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/io_edgeport.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2761,6 +2761,11 @@ static int edge_startup(struct usb_seria
 					EDGE_COMPATIBILITY_MASK1,
 					EDGE_COMPATIBILITY_MASK2 };
 
+	if (serial->num_bulk_in < 1 || serial->num_interrupt_in < 1) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
 	dev = serial->dev;
 
 	/* create our private serial structure */

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

* [PATCH 4.4 039/101] USB: serial: oti6858: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (36 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 038/101] USB: serial: io_edgeport: " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 040/101] USB: serial: cyberjack: " Greg Kroah-Hartman
                     ` (59 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 5afeef2366db14587b65558bbfd5a067542e07fb upstream.

Fix NULL-pointer dereference in open() should the device lack the
expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at oti6858_open+0x30/0x1d0 [oti6858]

Note that a missing interrupt-in endpoint would have caused open() to
fail.

Fixes: 49cdee0ed0fc ("USB: oti6858 usb-serial driver (in Nokia CA-42
cable)")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/oti6858.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -134,6 +134,7 @@ static int oti6858_chars_in_buffer(struc
 static int oti6858_tiocmget(struct tty_struct *tty);
 static int oti6858_tiocmset(struct tty_struct *tty,
 				unsigned int set, unsigned int clear);
+static int oti6858_attach(struct usb_serial *serial);
 static int oti6858_port_probe(struct usb_serial_port *port);
 static int oti6858_port_remove(struct usb_serial_port *port);
 
@@ -158,6 +159,7 @@ static struct usb_serial_driver oti6858_
 	.write_bulk_callback =	oti6858_write_bulk_callback,
 	.write_room =		oti6858_write_room,
 	.chars_in_buffer =	oti6858_chars_in_buffer,
+	.attach =		oti6858_attach,
 	.port_probe =		oti6858_port_probe,
 	.port_remove =		oti6858_port_remove,
 };
@@ -324,6 +326,20 @@ static void send_data(struct work_struct
 	usb_serial_port_softint(port);
 }
 
+static int oti6858_attach(struct usb_serial *serial)
+{
+	unsigned char num_ports = serial->num_ports;
+
+	if (serial->num_bulk_in < num_ports ||
+			serial->num_bulk_out < num_ports ||
+			serial->num_interrupt_in < num_ports) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static int oti6858_port_probe(struct usb_serial_port *port)
 {
 	struct oti6858_private *priv;

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

* [PATCH 4.4 040/101] USB: serial: cyberjack: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (37 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 039/101] USB: serial: oti6858: " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 041/101] USB: serial: kobil_sct: fix NULL-deref in write Greg Kroah-Hartman
                     ` (58 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 3dca01114dcecb1cf324534cd8d75fd1306a516b upstream.

Fix NULL-pointer dereference when clearing halt at open should the device
lack a bulk-out endpoint.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at cyberjack_open+0x40/0x9c [cyberjack]

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/cyberjack.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -50,6 +50,7 @@
 #define CYBERJACK_PRODUCT_ID	0x0100
 
 /* Function prototypes */
+static int cyberjack_attach(struct usb_serial *serial);
 static int cyberjack_port_probe(struct usb_serial_port *port);
 static int cyberjack_port_remove(struct usb_serial_port *port);
 static int  cyberjack_open(struct tty_struct *tty,
@@ -77,6 +78,7 @@ static struct usb_serial_driver cyberjac
 	.description =		"Reiner SCT Cyberjack USB card reader",
 	.id_table =		id_table,
 	.num_ports =		1,
+	.attach =		cyberjack_attach,
 	.port_probe =		cyberjack_port_probe,
 	.port_remove =		cyberjack_port_remove,
 	.open =			cyberjack_open,
@@ -100,6 +102,14 @@ struct cyberjack_private {
 	short		wrsent;		/* Data already sent */
 };
 
+static int cyberjack_attach(struct usb_serial *serial)
+{
+	if (serial->num_bulk_out < serial->num_ports)
+		return -ENODEV;
+
+	return 0;
+}
+
 static int cyberjack_port_probe(struct usb_serial_port *port)
 {
 	struct cyberjack_private *priv;

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

* [PATCH 4.4 041/101] USB: serial: kobil_sct: fix NULL-deref in write
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (38 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 040/101] USB: serial: cyberjack: " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 042/101] USB: serial: mos7840: fix NULL-deref at open Greg Kroah-Hartman
                     ` (57 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 21ce57840243c7b70fbc1ebd3dceeb70bb6e9e09 upstream.

Fix NULL-pointer dereference in write() should the device lack the
expected interrupt-out endpoint:

Unable to handle kernel NULL pointer dereference at virtual address 00000054
...
PC is at kobil_write+0x144/0x2a0 [kobil_sct]

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/kobil_sct.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -51,6 +51,7 @@
 
 
 /* Function prototypes */
+static int kobil_attach(struct usb_serial *serial);
 static int kobil_port_probe(struct usb_serial_port *probe);
 static int kobil_port_remove(struct usb_serial_port *probe);
 static int  kobil_open(struct tty_struct *tty, struct usb_serial_port *port);
@@ -86,6 +87,7 @@ static struct usb_serial_driver kobil_de
 	.description =		"KOBIL USB smart card terminal",
 	.id_table =		id_table,
 	.num_ports =		1,
+	.attach =		kobil_attach,
 	.port_probe =		kobil_port_probe,
 	.port_remove =		kobil_port_remove,
 	.ioctl =		kobil_ioctl,
@@ -113,6 +115,16 @@ struct kobil_private {
 };
 
 
+static int kobil_attach(struct usb_serial *serial)
+{
+	if (serial->num_interrupt_out < serial->num_ports) {
+		dev_err(&serial->interface->dev, "missing interrupt-out endpoint\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static int kobil_port_probe(struct usb_serial_port *port)
 {
 	struct usb_serial *serial = port->serial;

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

* [PATCH 4.4 042/101] USB: serial: mos7840: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (39 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 041/101] USB: serial: kobil_sct: fix NULL-deref in write Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 043/101] USB: serial: mos7720: " Greg Kroah-Hartman
                     ` (56 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 5c75633ef751dd4cd8f443dc35152c1ae563162e upstream.

Fix NULL-pointer dereference in open() should the device lack the
expected endpoints:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
PC is at mos7840_open+0x88/0x8dc [mos7840]

Note that we continue to treat the interrupt-in endpoint as optional for
now.

Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/mos7840.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -2116,6 +2116,17 @@ static int mos7840_calc_num_ports(struct
 	return mos7840_num_ports;
 }
 
+static int mos7840_attach(struct usb_serial *serial)
+{
+	if (serial->num_bulk_in < serial->num_ports ||
+			serial->num_bulk_out < serial->num_ports) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
 static int mos7840_port_probe(struct usb_serial_port *port)
 {
 	struct usb_serial *serial = port->serial;
@@ -2391,6 +2402,7 @@ static struct usb_serial_driver moschip7
 	.tiocmset = mos7840_tiocmset,
 	.tiocmiwait = usb_serial_generic_tiocmiwait,
 	.get_icount = usb_serial_generic_get_icount,
+	.attach = mos7840_attach,
 	.port_probe = mos7840_port_probe,
 	.port_remove = mos7840_port_remove,
 	.read_bulk_callback = mos7840_bulk_in_callback,

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

* [PATCH 4.4 043/101] USB: serial: mos7720: fix NULL-deref at open
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (40 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 042/101] USB: serial: mos7840: fix NULL-deref at open Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 044/101] USB: serial: mos7720: fix use-after-free on probe errors Greg Kroah-Hartman
                     ` (55 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit b05aebc25fdc5aeeac3ee29f0dc9f58dd07c13cc upstream.

Fix NULL-pointer dereference at port open if a device lacks the expected
bulk in and out endpoints.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf071c20>] (mos7720_open [mos7720]) from [<bf0490e0>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf0490e0>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf049d98>] (serial_open+0x48/0x6c [usbserial])
[<bf049d98>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

Fixes: 0f64478cbc7a ("USB: add USB serial mos7720 driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/mos7720.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1920,6 +1920,11 @@ static int mos7720_startup(struct usb_se
 	u16 product;
 	int ret_val;
 
+	if (serial->num_bulk_in < 2 || serial->num_bulk_out < 2) {
+		dev_err(&serial->interface->dev, "missing bulk endpoints\n");
+		return -ENODEV;
+	}
+
 	product = le16_to_cpu(serial->dev->descriptor.idProduct);
 	dev = serial->dev;
 

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

* [PATCH 4.4 044/101] USB: serial: mos7720: fix use-after-free on probe errors
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (41 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 043/101] USB: serial: mos7720: " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 045/101] USB: serial: mos7720: fix parport " Greg Kroah-Hartman
                     ` (54 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 91a1ff4d53c5184d383d0baeeaeab6f9736f2ff3 upstream.

The interrupt URB was submitted on probe but never stopped on probe
errors. This can lead to use-after-free issues in the completion
handler when accessing the freed usb-serial struct:

Unable to handle kernel paging request at virtual address 6b6b6be7
...
[<bf052e70>] (mos7715_interrupt_callback [mos7720]) from [<c052a894>] (__usb_hcd_giveback_urb+0x80/0x140)
[<c052a894>] (__usb_hcd_giveback_urb) from [<c052a9a4>] (usb_hcd_giveback_urb+0x50/0x138)
[<c052a9a4>] (usb_hcd_giveback_urb) from [<c0550684>] (musb_giveback+0xc8/0x1cc)

Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/mos7720.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1965,8 +1965,10 @@ static int mos7720_startup(struct usb_se
 #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
 	if (product == MOSCHIP_DEVICE_ID_7715) {
 		ret_val = mos7715_parport_init(serial);
-		if (ret_val < 0)
+		if (ret_val < 0) {
+			usb_kill_urb(serial->port[0]->interrupt_in_urb);
 			return ret_val;
+		}
 	}
 #endif
 	/* LSR For Port 1 */
@@ -1978,6 +1980,8 @@ static int mos7720_startup(struct usb_se
 
 static void mos7720_release(struct usb_serial *serial)
 {
+	usb_kill_urb(serial->port[0]->interrupt_in_urb);
+
 #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
 	/* close the parallel port */
 

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

* [PATCH 4.4 045/101] USB: serial: mos7720: fix parport use-after-free on probe errors
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (42 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 044/101] USB: serial: mos7720: fix use-after-free on probe errors Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:36   ` [PATCH 4.4 046/101] USB: serial: mos7720: fix parallel probe Greg Kroah-Hartman
                     ` (53 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 75dd211e773afcbc264677b0749d1cf7d937ab2d upstream.

Do not submit the interrupt URB until after the parport has been
successfully registered to avoid another use-after-free in the
completion handler when accessing the freed parport private data in case
of a racing completion.

Fixes: b69578df7e98 ("USB: usbserial: mos7720: add support for parallel port on moschip 7715")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/mos7720.c |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1955,22 +1955,20 @@ static int mos7720_startup(struct usb_se
 	usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
 			(__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5000);
 
-	/* start the interrupt urb */
-	ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL);
-	if (ret_val)
-		dev_err(&dev->dev,
-			"%s - Error %d submitting control urb\n",
-			__func__, ret_val);
-
 #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
 	if (product == MOSCHIP_DEVICE_ID_7715) {
 		ret_val = mos7715_parport_init(serial);
-		if (ret_val < 0) {
-			usb_kill_urb(serial->port[0]->interrupt_in_urb);
+		if (ret_val < 0)
 			return ret_val;
-		}
 	}
 #endif
+	/* start the interrupt urb */
+	ret_val = usb_submit_urb(serial->port[0]->interrupt_in_urb, GFP_KERNEL);
+	if (ret_val) {
+		dev_err(&dev->dev, "failed to submit interrupt urb: %d\n",
+			ret_val);
+	}
+
 	/* LSR For Port 1 */
 	read_mos_reg(serial, 0, MOS7720_LSR, &data);
 	dev_dbg(&dev->dev, "LSR:%x\n", data);

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

* [PATCH 4.4 046/101] USB: serial: mos7720: fix parallel probe
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (43 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 045/101] USB: serial: mos7720: fix parport " Greg Kroah-Hartman
@ 2017-01-10 13:36   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 047/101] usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL Greg Kroah-Hartman
                     ` (52 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:36 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit fde1faf872ed86d88e245191bc15a8e57368cd1c upstream.

A static usb-serial-driver structure that is used to initialise the
interrupt URB was modified during probe depending on the currently
probed device type, something which could break a parallel probe of a
device of a different type.

Fix this up by overriding the default completion callback for MCS7715
devices in attach() instead. We may want to use two usb-serial driver
instances for the two types later.

Fixes: fb088e335d78 ("USB: serial: add support for serial port on the moschip 7715")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/mos7720.c |   30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -65,8 +65,6 @@ struct moschip_port {
 	struct urb		*write_urb_pool[NUM_URBS];
 };
 
-static struct usb_serial_driver moschip7720_2port_driver;
-
 #define USB_VENDOR_ID_MOSCHIP		0x9710
 #define MOSCHIP_DEVICE_ID_7720		0x7720
 #define MOSCHIP_DEVICE_ID_7715		0x7715
@@ -970,25 +968,6 @@ static void mos7720_bulk_out_data_callba
 		tty_port_tty_wakeup(&mos7720_port->port->port);
 }
 
-/*
- * mos77xx_probe
- *	this function installs the appropriate read interrupt endpoint callback
- *	depending on whether the device is a 7720 or 7715, thus avoiding costly
- *	run-time checks in the high-frequency callback routine itself.
- */
-static int mos77xx_probe(struct usb_serial *serial,
-			 const struct usb_device_id *id)
-{
-	if (id->idProduct == MOSCHIP_DEVICE_ID_7715)
-		moschip7720_2port_driver.read_int_callback =
-			mos7715_interrupt_callback;
-	else
-		moschip7720_2port_driver.read_int_callback =
-			mos7720_interrupt_callback;
-
-	return 0;
-}
-
 static int mos77xx_calc_num_ports(struct usb_serial *serial)
 {
 	u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
@@ -1949,6 +1928,12 @@ static int mos7720_startup(struct usb_se
 			tmp->interrupt_in_endpointAddress;
 		serial->port[1]->interrupt_in_urb = NULL;
 		serial->port[1]->interrupt_in_buffer = NULL;
+
+		if (serial->port[0]->interrupt_in_urb) {
+			struct urb *urb = serial->port[0]->interrupt_in_urb;
+
+			urb->complete = mos7715_interrupt_callback;
+		}
 	}
 
 	/* setting configuration feature to one */
@@ -2063,7 +2048,6 @@ static struct usb_serial_driver moschip7
 	.close			= mos7720_close,
 	.throttle		= mos7720_throttle,
 	.unthrottle		= mos7720_unthrottle,
-	.probe			= mos77xx_probe,
 	.attach			= mos7720_startup,
 	.release		= mos7720_release,
 	.port_probe		= mos7720_port_probe,
@@ -2077,7 +2061,7 @@ static struct usb_serial_driver moschip7
 	.chars_in_buffer	= mos7720_chars_in_buffer,
 	.break_ctl		= mos7720_break,
 	.read_bulk_callback	= mos7720_bulk_in_callback,
-	.read_int_callback	= NULL  /* dynamically assigned in probe() */
+	.read_int_callback	= mos7720_interrupt_callback,
 };
 
 static struct usb_serial_driver * const serial_drivers[] = {

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

* [PATCH 4.4 047/101] usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (44 preceding siblings ...)
  2017-01-10 13:36   ` [PATCH 4.4 046/101] USB: serial: mos7720: fix parallel probe Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 048/101] xhci: Use delayed_work instead of timer for command timeout Greg Kroah-Hartman
                     ` (51 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mathias Nyman, Dan Carpenter,
	Sebastian Andrzej Siewior

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

------------------

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

commit c95a9f83711bf53faeb4ed9bbb63a3f065613dfb upstream.

We normally use the passed in gfp flags for allocations, it's just these
two which were missed.

Fixes: 22d45f01a836 ("usb/xhci: replace pci_*_consistent() with dma_*_coherent()")
Cc: Mathias Nyman <mathias.nyman@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-mem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2436,7 +2436,7 @@ int xhci_mem_init(struct xhci_hcd *xhci,
 	 * "physically contiguous and 64-byte (cache line) aligned".
 	 */
 	xhci->dcbaa = dma_alloc_coherent(dev, sizeof(*xhci->dcbaa), &dma,
-			GFP_KERNEL);
+			flags);
 	if (!xhci->dcbaa)
 		goto fail;
 	memset(xhci->dcbaa, 0, sizeof *(xhci->dcbaa));
@@ -2532,7 +2532,7 @@ int xhci_mem_init(struct xhci_hcd *xhci,
 
 	xhci->erst.entries = dma_alloc_coherent(dev,
 			sizeof(struct xhci_erst_entry) * ERST_NUM_SEGS, &dma,
-			GFP_KERNEL);
+			flags);
 	if (!xhci->erst.entries)
 		goto fail;
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,

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

* [PATCH 4.4 048/101] xhci: Use delayed_work instead of timer for command timeout
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (45 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 047/101] usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 049/101] xhci: Fix race related to abort operation Greg Kroah-Hartman
                     ` (50 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, OGAWA Hirofumi, Mathias Nyman

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

------------------

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

commit cb4d5ce588c5ff68e0fdd30370a0e6bc2c0a736b upstream.

This is preparation to fix abort operation race (See "xhci: Fix race
related to abort operation"). To make timeout sleepable, use
delayed_work instead of timer.

[change a newly added pending timer fix to pending work -Mathias]
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-mem.c  |    7 +++----
 drivers/usb/host/xhci-ring.c |   26 ++++++++++++++++----------
 drivers/usb/host/xhci.h      |    4 ++--
 3 files changed, 21 insertions(+), 16 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1829,7 +1829,7 @@ void xhci_mem_cleanup(struct xhci_hcd *x
 	int size;
 	int i, j, num_ports;
 
-	del_timer_sync(&xhci->cmd_timer);
+	cancel_delayed_work_sync(&xhci->cmd_timer);
 
 	/* Free the Event Ring Segment Table and the actual Event Ring */
 	size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
@@ -2395,9 +2395,8 @@ int xhci_mem_init(struct xhci_hcd *xhci,
 
 	INIT_LIST_HEAD(&xhci->cmd_list);
 
-	/* init command timeout timer */
-	setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout,
-		    (unsigned long)xhci);
+	/* init command timeout work */
+	INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout);
 
 	page_size = readl(&xhci->op_regs->page_size);
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -280,6 +280,11 @@ void xhci_ring_cmd_db(struct xhci_hcd *x
 	readl(&xhci->dba->doorbell[0]);
 }
 
+static bool xhci_mod_cmd_timer(struct xhci_hcd *xhci, unsigned long delay)
+{
+	return mod_delayed_work(system_wq, &xhci->cmd_timer, delay);
+}
+
 static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
 {
 	u64 temp_64;
@@ -296,7 +301,7 @@ static int xhci_abort_cmd_ring(struct xh
 	 * but the completion event in never sent. Use the cmd timeout timer to
 	 * handle those cases. Use twice the time to cover the bit polling retry
 	 */
-	mod_timer(&xhci->cmd_timer, jiffies + (2 * XHCI_CMD_DEFAULT_TIMEOUT));
+	xhci_mod_cmd_timer(xhci, 2 * XHCI_CMD_DEFAULT_TIMEOUT);
 	xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,
 			&xhci->op_regs->cmd_ring);
 
@@ -321,7 +326,7 @@ static int xhci_abort_cmd_ring(struct xh
 
 		xhci_err(xhci, "Stopped the command ring failed, "
 				"maybe the host is dead\n");
-		del_timer(&xhci->cmd_timer);
+		cancel_delayed_work(&xhci->cmd_timer);
 		xhci->xhc_state |= XHCI_STATE_DYING;
 		xhci_quiesce(xhci);
 		xhci_halt(xhci);
@@ -1252,21 +1257,22 @@ static void xhci_handle_stopped_cmd_ring
 	if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
 	    !(xhci->xhc_state & XHCI_STATE_DYING)) {
 		xhci->current_cmd = cur_cmd;
-		mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
+		xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
 		xhci_ring_cmd_db(xhci);
 	}
 	return;
 }
 
 
-void xhci_handle_command_timeout(unsigned long data)
+void xhci_handle_command_timeout(struct work_struct *work)
 {
 	struct xhci_hcd *xhci;
 	int ret;
 	unsigned long flags;
 	u64 hw_ring_state;
 	bool second_timeout = false;
-	xhci = (struct xhci_hcd *) data;
+
+	xhci = container_of(to_delayed_work(work), struct xhci_hcd, cmd_timer);
 
 	spin_lock_irqsave(&xhci->lock, flags);
 
@@ -1274,7 +1280,7 @@ void xhci_handle_command_timeout(unsigne
 	 * If timeout work is pending, or current_cmd is NULL, it means we
 	 * raced with command completion. Command is handled so just return.
 	 */
-	if (!xhci->current_cmd || timer_pending(&xhci->cmd_timer)) {
+	if (!xhci->current_cmd || delayed_work_pending(&xhci->cmd_timer)) {
 		spin_unlock_irqrestore(&xhci->lock, flags);
 		return;
 	}
@@ -1348,7 +1354,7 @@ static void handle_cmd_completion(struct
 
 	cmd = list_entry(xhci->cmd_list.next, struct xhci_command, cmd_list);
 
-	del_timer(&xhci->cmd_timer);
+	cancel_delayed_work(&xhci->cmd_timer);
 
 	trace_xhci_cmd_completion(cmd_trb, (struct xhci_generic_trb *) event);
 
@@ -1439,7 +1445,7 @@ static void handle_cmd_completion(struct
 	if (cmd->cmd_list.next != &xhci->cmd_list) {
 		xhci->current_cmd = list_entry(cmd->cmd_list.next,
 					       struct xhci_command, cmd_list);
-		mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
+		xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
 	} else if (xhci->current_cmd == cmd) {
 		xhci->current_cmd = NULL;
 	}
@@ -4074,9 +4080,9 @@ static int queue_command(struct xhci_hcd
 
 	/* if there are no other commands queued we start the timeout timer */
 	if (xhci->cmd_list.next == &cmd->cmd_list &&
-	    !timer_pending(&xhci->cmd_timer)) {
+	    !delayed_work_pending(&xhci->cmd_timer)) {
 		xhci->current_cmd = cmd;
-		mod_timer(&xhci->cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT);
+		xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
 	}
 
 	queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3,
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1552,7 +1552,7 @@ struct xhci_hcd {
 #define CMD_RING_STATE_STOPPED         (1 << 2)
 	struct list_head        cmd_list;
 	unsigned int		cmd_ring_reserved_trbs;
-	struct timer_list	cmd_timer;
+	struct delayed_work	cmd_timer;
 	struct xhci_command	*current_cmd;
 	struct xhci_ring	*event_ring;
 	struct xhci_erst	erst;
@@ -1915,7 +1915,7 @@ void xhci_queue_config_ep_quirk(struct x
 		unsigned int slot_id, unsigned int ep_index,
 		struct xhci_dequeue_state *deq_state);
 void xhci_stop_endpoint_command_watchdog(unsigned long arg);
-void xhci_handle_command_timeout(unsigned long data);
+void xhci_handle_command_timeout(struct work_struct *work);
 
 void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id,
 		unsigned int ep_index, unsigned int stream_id);

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

* [PATCH 4.4 049/101] xhci: Fix race related to abort operation
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (46 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 048/101] xhci: Use delayed_work instead of timer for command timeout Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 050/101] usb: dwc3: pci: add Intel Gemini Lake PCI ID Greg Kroah-Hartman
                     ` (49 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, OGAWA Hirofumi, Mathias Nyman

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

------------------

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

commit 1c111b6c3844a142e03bcfc2fa17bfbdea08e9dc upstream.

Current abort operation has race.

    xhci_handle_command_timeout()
      xhci_abort_cmd_ring()
        xhci_write_64(CMD_RING_ABORT)
        xhci_handshake(5s)
	  do {
	    check CMD_RING_RUNNING
            udelay(1)
					 ...
					 COMP_CMD_ABORT event
					 COMP_CMD_STOP event
					 xhci_handle_stopped_cmd_ring()
					   restart cmd_ring
                                           CMD_RING_RUNNING become 1 again
	  } while ()
          return -ETIMEDOUT
        xhci_write_64(CMD_RING_ABORT)
        /* can abort random command */

To do abort operation correctly, we have to wait both of COMP_CMD_STOP
event and negation of CMD_RING_RUNNING.

But like above, while timeout handler is waiting negation of
CMD_RING_RUNNING, event handler can restart cmd_ring. So timeout
handler never be notice negation of CMD_RING_RUNNING, and retry of
CMD_RING_ABORT can abort random command (BTW, I guess retry of
CMD_RING_ABORT was workaround of this race).

To fix this race, this moves xhci_handle_stopped_cmd_ring() to
xhci_abort_cmd_ring().  And timeout handler waits COMP_CMD_STOP event.

At this point, timeout handler is owner of cmd_ring, and safely
restart cmd_ring by using xhci_handle_stopped_cmd_ring().

[FWIW, as bonus, this way would be easily extend to add CMD_RING_PAUSE
operation]

[locks edited as patch is rebased on other locking fixes -Mathias]
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/host/xhci-mem.c  |    1 
 drivers/usb/host/xhci-ring.c |  169 ++++++++++++++++++++++---------------------
 drivers/usb/host/xhci.h      |    1 
 3 files changed, 91 insertions(+), 80 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2397,6 +2397,7 @@ int xhci_mem_init(struct xhci_hcd *xhci,
 
 	/* init command timeout work */
 	INIT_DELAYED_WORK(&xhci->cmd_timer, xhci_handle_command_timeout);
+	init_completion(&xhci->cmd_ring_stop_completion);
 
 	page_size = readl(&xhci->op_regs->page_size);
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -285,23 +285,71 @@ static bool xhci_mod_cmd_timer(struct xh
 	return mod_delayed_work(system_wq, &xhci->cmd_timer, delay);
 }
 
-static int xhci_abort_cmd_ring(struct xhci_hcd *xhci)
+static struct xhci_command *xhci_next_queued_cmd(struct xhci_hcd *xhci)
+{
+	return list_first_entry_or_null(&xhci->cmd_list, struct xhci_command,
+					cmd_list);
+}
+
+/*
+ * Turn all commands on command ring with status set to "aborted" to no-op trbs.
+ * If there are other commands waiting then restart the ring and kick the timer.
+ * This must be called with command ring stopped and xhci->lock held.
+ */
+static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
+					 struct xhci_command *cur_cmd)
+{
+	struct xhci_command *i_cmd;
+	u32 cycle_state;
+
+	/* Turn all aborted commands in list to no-ops, then restart */
+	list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) {
+
+		if (i_cmd->status != COMP_CMD_ABORT)
+			continue;
+
+		i_cmd->status = COMP_CMD_STOP;
+
+		xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
+			 i_cmd->command_trb);
+		/* get cycle state from the original cmd trb */
+		cycle_state = le32_to_cpu(
+			i_cmd->command_trb->generic.field[3]) &	TRB_CYCLE;
+		/* modify the command trb to no-op command */
+		i_cmd->command_trb->generic.field[0] = 0;
+		i_cmd->command_trb->generic.field[1] = 0;
+		i_cmd->command_trb->generic.field[2] = 0;
+		i_cmd->command_trb->generic.field[3] = cpu_to_le32(
+			TRB_TYPE(TRB_CMD_NOOP) | cycle_state);
+
+		/*
+		 * caller waiting for completion is called when command
+		 *  completion event is received for these no-op commands
+		 */
+	}
+
+	xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
+
+	/* ring command ring doorbell to restart the command ring */
+	if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
+	    !(xhci->xhc_state & XHCI_STATE_DYING)) {
+		xhci->current_cmd = cur_cmd;
+		xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
+		xhci_ring_cmd_db(xhci);
+	}
+}
+
+/* Must be called with xhci->lock held, releases and aquires lock back */
+static int xhci_abort_cmd_ring(struct xhci_hcd *xhci, unsigned long flags)
 {
 	u64 temp_64;
 	int ret;
 
 	xhci_dbg(xhci, "Abort command ring\n");
 
-	temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
-	xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
+	reinit_completion(&xhci->cmd_ring_stop_completion);
 
-	/*
-	 * Writing the CMD_RING_ABORT bit should cause a cmd completion event,
-	 * however on some host hw the CMD_RING_RUNNING bit is correctly cleared
-	 * but the completion event in never sent. Use the cmd timeout timer to
-	 * handle those cases. Use twice the time to cover the bit polling retry
-	 */
-	xhci_mod_cmd_timer(xhci, 2 * XHCI_CMD_DEFAULT_TIMEOUT);
+	temp_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
 	xhci_write_64(xhci, temp_64 | CMD_RING_ABORT,
 			&xhci->op_regs->cmd_ring);
 
@@ -321,16 +369,30 @@ static int xhci_abort_cmd_ring(struct xh
 		udelay(1000);
 		ret = xhci_handshake(&xhci->op_regs->cmd_ring,
 				     CMD_RING_RUNNING, 0, 3 * 1000 * 1000);
-		if (ret == 0)
-			return 0;
-
-		xhci_err(xhci, "Stopped the command ring failed, "
-				"maybe the host is dead\n");
-		cancel_delayed_work(&xhci->cmd_timer);
-		xhci->xhc_state |= XHCI_STATE_DYING;
-		xhci_quiesce(xhci);
-		xhci_halt(xhci);
-		return -ESHUTDOWN;
+		if (ret < 0) {
+			xhci_err(xhci, "Stopped the command ring failed, "
+				 "maybe the host is dead\n");
+			xhci->xhc_state |= XHCI_STATE_DYING;
+			xhci_quiesce(xhci);
+			xhci_halt(xhci);
+			return -ESHUTDOWN;
+		}
+	}
+	/*
+	 * Writing the CMD_RING_ABORT bit should cause a cmd completion event,
+	 * however on some host hw the CMD_RING_RUNNING bit is correctly cleared
+	 * but the completion event in never sent. Wait 2 secs (arbitrary
+	 * number) to handle those cases after negation of CMD_RING_RUNNING.
+	 */
+	spin_unlock_irqrestore(&xhci->lock, flags);
+	ret = wait_for_completion_timeout(&xhci->cmd_ring_stop_completion,
+					  msecs_to_jiffies(2000));
+	spin_lock_irqsave(&xhci->lock, flags);
+	if (!ret) {
+		xhci_dbg(xhci, "No stop event for abort, ring start fail?\n");
+		xhci_cleanup_command_queue(xhci);
+	} else {
+		xhci_handle_stopped_cmd_ring(xhci, xhci_next_queued_cmd(xhci));
 	}
 
 	return 0;
@@ -1213,64 +1275,12 @@ void xhci_cleanup_command_queue(struct x
 		xhci_complete_del_and_free_cmd(cur_cmd, COMP_CMD_ABORT);
 }
 
-/*
- * Turn all commands on command ring with status set to "aborted" to no-op trbs.
- * If there are other commands waiting then restart the ring and kick the timer.
- * This must be called with command ring stopped and xhci->lock held.
- */
-static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
-					 struct xhci_command *cur_cmd)
-{
-	struct xhci_command *i_cmd, *tmp_cmd;
-	u32 cycle_state;
-
-	/* Turn all aborted commands in list to no-ops, then restart */
-	list_for_each_entry_safe(i_cmd, tmp_cmd, &xhci->cmd_list,
-				 cmd_list) {
-
-		if (i_cmd->status != COMP_CMD_ABORT)
-			continue;
-
-		i_cmd->status = COMP_CMD_STOP;
-
-		xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
-			 i_cmd->command_trb);
-		/* get cycle state from the original cmd trb */
-		cycle_state = le32_to_cpu(
-			i_cmd->command_trb->generic.field[3]) &	TRB_CYCLE;
-		/* modify the command trb to no-op command */
-		i_cmd->command_trb->generic.field[0] = 0;
-		i_cmd->command_trb->generic.field[1] = 0;
-		i_cmd->command_trb->generic.field[2] = 0;
-		i_cmd->command_trb->generic.field[3] = cpu_to_le32(
-			TRB_TYPE(TRB_CMD_NOOP) | cycle_state);
-
-		/*
-		 * caller waiting for completion is called when command
-		 *  completion event is received for these no-op commands
-		 */
-	}
-
-	xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
-
-	/* ring command ring doorbell to restart the command ring */
-	if ((xhci->cmd_ring->dequeue != xhci->cmd_ring->enqueue) &&
-	    !(xhci->xhc_state & XHCI_STATE_DYING)) {
-		xhci->current_cmd = cur_cmd;
-		xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT);
-		xhci_ring_cmd_db(xhci);
-	}
-	return;
-}
-
-
 void xhci_handle_command_timeout(struct work_struct *work)
 {
 	struct xhci_hcd *xhci;
 	int ret;
 	unsigned long flags;
 	u64 hw_ring_state;
-	bool second_timeout = false;
 
 	xhci = container_of(to_delayed_work(work), struct xhci_hcd, cmd_timer);
 
@@ -1284,18 +1294,17 @@ void xhci_handle_command_timeout(struct
 		spin_unlock_irqrestore(&xhci->lock, flags);
 		return;
 	}
-
 	/* mark this command to be cancelled */
-	if (xhci->current_cmd->status == COMP_CMD_ABORT)
-		second_timeout = true;
 	xhci->current_cmd->status = COMP_CMD_ABORT;
 
 	/* Make sure command ring is running before aborting it */
 	hw_ring_state = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
 	if ((xhci->cmd_ring_state & CMD_RING_STATE_RUNNING) &&
 	    (hw_ring_state & CMD_RING_RUNNING))  {
+		/* Prevent new doorbell, and start command abort */
+		xhci->cmd_ring_state = CMD_RING_STATE_ABORTED;
 		xhci_dbg(xhci, "Command timeout\n");
-		ret = xhci_abort_cmd_ring(xhci);
+		ret = xhci_abort_cmd_ring(xhci, flags);
 		if (unlikely(ret == -ESHUTDOWN)) {
 			xhci_err(xhci, "Abort command ring failed\n");
 			xhci_cleanup_command_queue(xhci);
@@ -1309,9 +1318,9 @@ void xhci_handle_command_timeout(struct
 		goto time_out_completed;
 	}
 
-	/* command ring failed to restart, or host removed. Bail out */
-	if (second_timeout || xhci->xhc_state & XHCI_STATE_REMOVING) {
-		xhci_dbg(xhci, "command timed out twice, ring start fail?\n");
+	/* host removed. Bail out */
+	if (xhci->xhc_state & XHCI_STATE_REMOVING) {
+		xhci_dbg(xhci, "host removed, ring start fail?\n");
 		xhci_cleanup_command_queue(xhci);
 
 		goto time_out_completed;
@@ -1362,7 +1371,7 @@ static void handle_cmd_completion(struct
 
 	/* If CMD ring stopped we own the trbs between enqueue and dequeue */
 	if (cmd_comp_code == COMP_CMD_STOP) {
-		xhci_handle_stopped_cmd_ring(xhci, cmd);
+		complete_all(&xhci->cmd_ring_stop_completion);
 		return;
 	}
 
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1553,6 +1553,7 @@ struct xhci_hcd {
 	struct list_head        cmd_list;
 	unsigned int		cmd_ring_reserved_trbs;
 	struct delayed_work	cmd_timer;
+	struct completion	cmd_ring_stop_completion;
 	struct xhci_command	*current_cmd;
 	struct xhci_ring	*event_ring;
 	struct xhci_erst	erst;

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

* [PATCH 4.4 050/101] usb: dwc3: pci: add Intel Gemini Lake PCI ID
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (47 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 049/101] xhci: Fix race related to abort operation Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 051/101] usb: musb: Fix trying to free already-free IRQ 4 Greg Kroah-Hartman
                     ` (48 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Heikki Krogerus, Felipe Balbi

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

------------------

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

commit 8f8983a5683623b62b339d159573f95a1fce44f3 upstream.

Intel Gemini Lake SoC has the same DWC3 than Broxton. Add
the new ID to the supported Devices.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/dwc3/dwc3-pci.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/dwc3/dwc3-pci.c
+++ b/drivers/usb/dwc3/dwc3-pci.c
@@ -37,6 +37,7 @@
 #define PCI_DEVICE_ID_INTEL_BXT			0x0aaa
 #define PCI_DEVICE_ID_INTEL_APL			0x5aaa
 #define PCI_DEVICE_ID_INTEL_KBP			0xa2b0
+#define PCI_DEVICE_ID_INTEL_GLK			0x31aa
 
 static const struct acpi_gpio_params reset_gpios = { 0, 0, false };
 static const struct acpi_gpio_params cs_gpios = { 1, 0, false };
@@ -216,6 +217,7 @@ static const struct pci_device_id dwc3_p
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BXT), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_APL), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_KBP), },
+	{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_GLK), },
 	{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB), },
 	{  }	/* Terminating Entry */
 };

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

* [PATCH 4.4 051/101] usb: musb: Fix trying to free already-free IRQ 4
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (48 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 050/101] usb: dwc3: pci: add Intel Gemini Lake PCI ID Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 054/101] ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() Greg Kroah-Hartman
                     ` (47 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tony Lindgren, Bin Liu

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

------------------

From: Tony Lindgren <tony@atomide.com>

commit 8c300fe282fa254ea730c92cb0983e2642dc1fff upstream.

When unloading omap2430, we can get the following splat:

WARNING: CPU: 1 PID: 295 at kernel/irq/manage.c:1478 __free_irq+0xa8/0x2c8
Trying to free already-free IRQ 4
...
[<c01a8b78>] (free_irq) from [<bf0aea84>]
(musbhs_dma_controller_destroy+0x28/0xb0 [musb_hdrc])
[<bf0aea84>] (musbhs_dma_controller_destroy [musb_hdrc]) from
[<bf09f88c>] (musb_remove+0xf0/0x12c [musb_hdrc])
[<bf09f88c>] (musb_remove [musb_hdrc]) from [<c056a384>]
(platform_drv_remove+0x24/0x3c)
...

This is because the irq number in use is 260 nowadays, and the dma
controller is using u8 instead of int.

Fixes: 6995eb68aab7 ("USB: musb: enable low level DMA operation for Blackfin")
Signed-off-by: Tony Lindgren <tony@atomide.com>
[b-liu@ti.com: added Fixes tag]
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/musb/musbhsdma.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/usb/musb/musbhsdma.h
+++ b/drivers/usb/musb/musbhsdma.h
@@ -157,5 +157,5 @@ struct musb_dma_controller {
 	void __iomem			*base;
 	u8				channel_count;
 	u8				used_channels;
-	u8				irq;
+	int				irq;
 };

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

* [PATCH 4.4 054/101] ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (49 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 051/101] usb: musb: Fix trying to free already-free IRQ 4 Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 055/101] USB: serial: kl5kusb105: abort on open exception path Greg Kroah-Hartman
                     ` (46 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Takashi Iwai

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

------------------

From: Takashi Iwai <tiwai@suse.de>

commit 4763601a56f155ddf94ef35fc2c41504a2de15f5 upstream.

The function returns -EINVAL even if it builds the stream properly.
The bogus error code sneaked in during the code refactoring, but it
wasn't noticed until now since the returned error code itself is
ignored in anyway.  Kill it here, but there is no behavior change by
this patch, obviously.

Fixes: e5779998bf8b ('ALSA: usb-audio: refactor code')
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/usb/card.c |    1 -
 1 file changed, 1 deletion(-)

--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -202,7 +202,6 @@ static int snd_usb_create_stream(struct
 	if (! snd_usb_parse_audio_interface(chip, interface)) {
 		usb_set_interface(dev, interface, 0); /* reset the current interface */
 		usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
-		return -EINVAL;
 	}
 
 	return 0;

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

* [PATCH 4.4 055/101] USB: serial: kl5kusb105: abort on open exception path
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (50 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 054/101] ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 056/101] ARM: dts: r8a7794: Correct hsusb parent clock Greg Kroah-Hartman
                     ` (45 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Pan Bian, Johan Hovold

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

------------------

From: Pan Bian <bianpan2016@163.com>

commit 3c3dd1e058cb01e835dcade4b54a6f13ffaeaf7c upstream.

Function klsi_105_open() calls usb_control_msg() (to "enable read") and
checks its return value. When the return value is unexpected, it only
assigns the error code to the return variable retval, but does not
terminate the exception path. This patch fixes the bug by inserting
"goto err_generic_close;" when the call to usb_control_msg() fails.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Pan Bian <bianpan2016@163.com>
[johan: rebase on prerequisite fix and amend commit message]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/kl5kusb105.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -311,6 +311,7 @@ static int  klsi_105_open(struct tty_str
 	if (rc < 0) {
 		dev_err(&port->dev, "Enabling read failed (error = %d)\n", rc);
 		retval = rc;
+		goto err_generic_close;
 	} else
 		dev_dbg(&port->dev, "%s - enabled reading\n", __func__);
 
@@ -337,6 +338,7 @@ err_disable_read:
 			     0, /* index */
 			     NULL, 0,
 			     KLSI_TIMEOUT);
+err_generic_close:
 	usb_serial_generic_close(port);
 err_free_cfg:
 	kfree(cfg);

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

* [PATCH 4.4 056/101] ARM: dts: r8a7794: Correct hsusb parent clock
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (51 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 055/101] USB: serial: kl5kusb105: abort on open exception path Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 057/101] USB: phy: am335x-control: fix device and of_node leaks Greg Kroah-Hartman
                     ` (44 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Geert Uytterhoeven,
	Yoshihiro Shimoda, Simon Horman

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

------------------

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

commit dc8ee9dbdba509fb58e23ba79f2e6059fe5d8b3b upstream.

The parent clock of the HSUSB clock is the HP clock, not the MP clock.

Fixes: c7bab9f929e51761 ("ARM: shmobile: r8a7794: Add USB clocks to device tree")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/boot/dts/r8a7794.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -1023,7 +1023,7 @@
 		mstp7_clks: mstp7_clks@e615014c {
 			compatible = "renesas,r8a7794-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe615014c 0 4>, <0 0xe61501c4 0 4>;
-			clocks = <&mp_clk>, <&mp_clk>,
+			clocks = <&mp_clk>, <&hp_clk>,
 				 <&zs_clk>, <&p_clk>, <&p_clk>, <&zs_clk>,
 				 <&zs_clk>, <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>;
 			#clock-cells = <1>;

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

* [PATCH 4.4 057/101] USB: phy: am335x-control: fix device and of_node leaks
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (52 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 056/101] ARM: dts: r8a7794: Correct hsusb parent clock Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 058/101] USB: serial: io_ti: bind to interface after fw download Greg Kroah-Hartman
                     ` (43 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Bin Liu, Johan Hovold, Felipe Balbi

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 015105b12183556771e111e93f5266851e7c5582 upstream.

Make sure to drop the references taken by of_parse_phandle() and
bus_find_device() before returning from am335x_get_phy_control().

Note that there is no guarantee that the devres-managed struct
phy_control will be valid for the lifetime of the sibling phy device
regardless of this change.

Fixes: 3bb869c8b3f1 ("usb: phy: Add AM335x PHY driver")
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/phy/phy-am335x-control.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/phy/phy-am335x-control.c
+++ b/drivers/usb/phy/phy-am335x-control.c
@@ -126,10 +126,12 @@ struct phy_control *am335x_get_phy_contr
 		return NULL;
 
 	dev = bus_find_device(&platform_bus_type, NULL, node, match);
+	of_node_put(node);
 	if (!dev)
 		return NULL;
 
 	ctrl_usb = dev_get_drvdata(dev);
+	put_device(dev);
 	if (!ctrl_usb)
 		return NULL;
 	return &ctrl_usb->phy_ctrl;

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

* [PATCH 4.4 058/101] USB: serial: io_ti: bind to interface after fw download
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (53 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 057/101] USB: phy: am335x-control: fix device and of_node leaks Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 059/101] mei: bus: fix mei_cldev_enable KDoc Greg Kroah-Hartman
                     ` (42 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold

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

------------------

From: Johan Hovold <johan@kernel.org>

commit e35d6d7c4e6532a89732cf4bace0e910ee684c88 upstream.

Bind to the interface, but do not register any ports, after having
downloaded the firmware. The device will still disconnect and
re-enumerate, but this way we avoid an error messages from being logged
as part of the process:

io_ti: probe of 1-1.3:1.0 failed with error -5

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/serial/io_ti.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -1499,8 +1499,7 @@ static int do_boot_mode(struct edgeport_
 
 		dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__);
 
-		/* return an error on purpose */
-		return -ENODEV;
+		return 1;
 	}
 
 stayinbootmode:

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

* [PATCH 4.4 059/101] mei: bus: fix mei_cldev_enable KDoc
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (54 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 058/101] USB: serial: io_ti: bind to interface after fw download Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 060/101] staging: iio: ad7606: fix improper setting of oversampling pins Greg Kroah-Hartman
                     ` (41 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Alexander Usyskin, Tomas Winkler

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

------------------

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

commit 5026c9cb0744a9cd40242743ca91a5d712f468c6 upstream.

Adjust function name in KDoc.

Fixes: d49dc5e76fc9 (mei: bus: use mei_cldev_ prefix for the API functions)
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>

---
 drivers/misc/mei/bus.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -399,7 +399,7 @@ bool mei_cldev_enabled(struct mei_cl_dev
 EXPORT_SYMBOL_GPL(mei_cldev_enabled);
 
 /**
- * mei_cldev_enable_device - enable me client device
+ * mei_cldev_enable - enable me client device
  *     create connection with me client
  *
  * @cldev: me client device

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

* [PATCH 4.4 060/101] staging: iio: ad7606: fix improper setting of oversampling pins
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (55 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 059/101] mei: bus: fix mei_cldev_enable KDoc Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 061/101] usb: dwc3: gadget: always unmap EP0 requests Greg Kroah-Hartman
                     ` (40 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eva Rachel Retuya,
	Lars-Peter Clausen, Jonathan Cameron

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

------------------

From: Eva Rachel Retuya <eraretuya@gmail.com>

commit b321a38d2407c7e425c54bc09be909a34e49f740 upstream.

The oversampling ratio is controlled using the oversampling pins,
OS [2:0] with OS2 being the MSB control bit, and OS0 the LSB control
bit.

The gpio connected to the OS2 pin is not being set correctly, only OS0
and OS1 pins are being set. Fix the typo to allow proper control of the
oversampling pins.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Fixes: b9618c0 ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4")
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/staging/iio/adc/ad7606_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/iio/adc/ad7606_core.c
+++ b/drivers/staging/iio/adc/ad7606_core.c
@@ -189,7 +189,7 @@ static ssize_t ad7606_store_oversampling
 	mutex_lock(&indio_dev->mlock);
 	gpio_set_value(st->pdata->gpio_os0, (ret >> 0) & 1);
 	gpio_set_value(st->pdata->gpio_os1, (ret >> 1) & 1);
-	gpio_set_value(st->pdata->gpio_os1, (ret >> 2) & 1);
+	gpio_set_value(st->pdata->gpio_os2, (ret >> 2) & 1);
 	st->oversampling = lval;
 	mutex_unlock(&indio_dev->mlock);
 

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

* [PATCH 4.4 061/101] usb: dwc3: gadget: always unmap EP0 requests
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (56 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 060/101] staging: iio: ad7606: fix improper setting of oversampling pins Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 062/101] usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb() Greg Kroah-Hartman
                     ` (39 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Tomasz Medrek, Janusz Dziedzic, Felipe Balbi

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

------------------

From: Felipe Balbi <felipe.balbi@linux.intel.com>

commit d62145929992f331fdde924d5963ab49588ccc7d upstream.

commit 0416e494ce7d ("usb: dwc3: ep0: correct cache
sync issue in case of ep0_bounced") introduced a bug
where we would leak DMA resources which would cause
us to starve the system of them resulting in failing
DMA transfers.

Fix the bug by making sure that we always unmap EP0
requests since those are *always* mapped.

Fixes: 0416e494ce7d ("usb: dwc3: ep0: correct cache
	sync issue in case of ep0_bounced")
Cc: <stable@vger.kernel.org>
Tested-by: Tomasz Medrek <tomaszx.medrek@intel.com>
Reported-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/dwc3/gadget.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -259,11 +259,11 @@ void dwc3_gadget_giveback(struct dwc3_ep
 	if (req->request.status == -EINPROGRESS)
 		req->request.status = status;
 
-	if (dwc->ep0_bounced && dep->number == 0)
+	if (dwc->ep0_bounced && dep->number <= 1)
 		dwc->ep0_bounced = false;
-	else
-		usb_gadget_unmap_request(&dwc->gadget, &req->request,
-				req->direction);
+
+	usb_gadget_unmap_request(&dwc->gadget, &req->request,
+			req->direction);
 
 	dev_dbg(dwc->dev, "request %p from %s completed %d/%d ===> %d\n",
 			req, dep->name, req->request.actual,

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

* [PATCH 4.4 062/101] usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (57 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 061/101] usb: dwc3: gadget: always unmap EP0 requests Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 063/101] usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb() Greg Kroah-Hartman
                     ` (38 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Janusz Dziedzic, Felipe Balbi

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

------------------

From: Felipe Balbi <felipe.balbi@linux.intel.com>

commit 7931ec86c1b738e4e90e58c6d95e5f720d45ee56 upstream.

For now this is just a cleanup patch, no functional
changes. We will be using the new function to fix a
bug introduced long ago by commit 0416e494ce7d
("usb: dwc3: ep0: correct cache sync issue in case
of ep0_bounced") and further worsened by commit
c0bd5456a470 ("usb: dwc3: ep0: handle non maxpacket
aligned transfers > 512")

Reported-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


---
 drivers/usb/dwc3/ep0.c |   30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -55,20 +55,13 @@ static const char *dwc3_ep0_state_string
 	}
 }
 
-static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
-		u32 len, u32 type, bool chain)
+static void dwc3_ep0_prepare_one_trb(struct dwc3 *dwc, u8 epnum,
+		dma_addr_t buf_dma, u32 len, u32 type, bool chain)
 {
-	struct dwc3_gadget_ep_cmd_params params;
 	struct dwc3_trb			*trb;
 	struct dwc3_ep			*dep;
 
-	int				ret;
-
 	dep = dwc->eps[epnum];
-	if (dep->flags & DWC3_EP_BUSY) {
-		dwc3_trace(trace_dwc3_ep0, "%s still busy", dep->name);
-		return 0;
-	}
 
 	trb = &dwc->ep0_trb[dep->free_slot];
 
@@ -89,15 +82,28 @@ static int dwc3_ep0_start_trans(struct d
 		trb->ctrl |= (DWC3_TRB_CTRL_IOC
 				| DWC3_TRB_CTRL_LST);
 
-	if (chain)
+	trace_dwc3_prepare_trb(dep, trb);
+}
+
+static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
+		u32 len, u32 type, bool chain)
+{
+	struct dwc3_gadget_ep_cmd_params params;
+	struct dwc3_ep			*dep;
+	int				ret;
+
+	dep = dwc->eps[epnum];
+	if (dep->flags & DWC3_EP_BUSY) {
+		dwc3_trace(trace_dwc3_ep0, "%s still busy", dep->name);
 		return 0;
+	}
+
+	dwc3_ep0_prepare_one_trb(dwc, epnum, buf_dma, len, type, chain);
 
 	memset(&params, 0, sizeof(params));
 	params.param0 = upper_32_bits(dwc->ep0_trb_addr);
 	params.param1 = lower_32_bits(dwc->ep0_trb_addr);
 
-	trace_dwc3_prepare_trb(dep, trb);
-
 	ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
 			DWC3_DEPCMD_STARTTRANSFER, &params);
 	if (ret < 0) {

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

* [PATCH 4.4 063/101] usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (58 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 062/101] usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb() Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 064/101] stable-fixup: hotplug: fix unused function warning Greg Kroah-Hartman
                     ` (37 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Janusz Dziedzic, Felipe Balbi

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

------------------

From: Felipe Balbi <felipe.balbi@linux.intel.com>

commit 19ec31230eb3084431bc2e565fd085f79f564274 upstream.

Let's call dwc3_ep0_prepare_one_trb() explicitly
because there are occasions where we will need more
than one TRB to handle an EP0 transfer.

A follow-up patch will fix one bug related to
multiple-TRB Data Phases when it comes to
mapping/unmapping requests for DMA.

Reported-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


---
 drivers/usb/dwc3/ep0.c |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -85,8 +85,7 @@ static void dwc3_ep0_prepare_one_trb(str
 	trace_dwc3_prepare_trb(dep, trb);
 }
 
-static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
-		u32 len, u32 type, bool chain)
+static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum)
 {
 	struct dwc3_gadget_ep_cmd_params params;
 	struct dwc3_ep			*dep;
@@ -98,8 +97,6 @@ static int dwc3_ep0_start_trans(struct d
 		return 0;
 	}
 
-	dwc3_ep0_prepare_one_trb(dwc, epnum, buf_dma, len, type, chain);
-
 	memset(&params, 0, sizeof(params));
 	params.param0 = upper_32_bits(dwc->ep0_trb_addr);
 	params.param1 = lower_32_bits(dwc->ep0_trb_addr);
@@ -317,8 +314,9 @@ void dwc3_ep0_out_start(struct dwc3 *dwc
 {
 	int				ret;
 
-	ret = dwc3_ep0_start_trans(dwc, 0, dwc->ctrl_req_addr, 8,
+	dwc3_ep0_prepare_one_trb(dwc, 0, dwc->ctrl_req_addr, 8,
 			DWC3_TRBCTL_CONTROL_SETUP, false);
+	ret = dwc3_ep0_start_trans(dwc, 0);
 	WARN_ON(ret < 0);
 }
 
@@ -877,9 +875,9 @@ static void dwc3_ep0_complete_data(struc
 
 			dwc->ep0_next_event = DWC3_EP0_COMPLETE;
 
-			ret = dwc3_ep0_start_trans(dwc, epnum,
-					dwc->ctrl_req_addr, 0,
-					DWC3_TRBCTL_CONTROL_DATA, false);
+			dwc3_ep0_prepare_one_trb(dwc, epnum, dwc->ctrl_req_addr,
+					0, DWC3_TRBCTL_CONTROL_DATA, false);
+			ret = dwc3_ep0_start_trans(dwc, epnum);
 			WARN_ON(ret < 0);
 		}
 	}
@@ -961,9 +959,10 @@ static void __dwc3_ep0_do_control_data(s
 	req->direction = !!dep->number;
 
 	if (req->request.length == 0) {
-		ret = dwc3_ep0_start_trans(dwc, dep->number,
+		dwc3_ep0_prepare_one_trb(dwc, dep->number,
 				dwc->ctrl_req_addr, 0,
 				DWC3_TRBCTL_CONTROL_DATA, false);
+		ret = dwc3_ep0_start_trans(dwc, dep->number);
 	} else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
 			&& (dep->number == 0)) {
 		u32	transfer_size = 0;
@@ -981,7 +980,7 @@ static void __dwc3_ep0_do_control_data(s
 		if (req->request.length > DWC3_EP0_BOUNCE_SIZE) {
 			transfer_size = ALIGN(req->request.length - maxpacket,
 					      maxpacket);
-			ret = dwc3_ep0_start_trans(dwc, dep->number,
+			dwc3_ep0_prepare_one_trb(dwc, dep->number,
 						   req->request.dma,
 						   transfer_size,
 						   DWC3_TRBCTL_CONTROL_DATA,
@@ -993,9 +992,10 @@ static void __dwc3_ep0_do_control_data(s
 
 		dwc->ep0_bounced = true;
 
-		ret = dwc3_ep0_start_trans(dwc, dep->number,
+		dwc3_ep0_prepare_one_trb(dwc, dep->number,
 				dwc->ep0_bounce_addr, transfer_size,
 				DWC3_TRBCTL_CONTROL_DATA, false);
+		ret = dwc3_ep0_start_trans(dwc, dep->number);
 	} else {
 		ret = usb_gadget_map_request(&dwc->gadget, &req->request,
 				dep->number);
@@ -1004,9 +1004,10 @@ static void __dwc3_ep0_do_control_data(s
 			return;
 		}
 
-		ret = dwc3_ep0_start_trans(dwc, dep->number, req->request.dma,
+		dwc3_ep0_prepare_one_trb(dwc, dep->number, req->request.dma,
 				req->request.length, DWC3_TRBCTL_CONTROL_DATA,
 				false);
+		ret = dwc3_ep0_start_trans(dwc, dep->number);
 	}
 
 	WARN_ON(ret < 0);
@@ -1020,8 +1021,9 @@ static int dwc3_ep0_start_control_status
 	type = dwc->three_stage_setup ? DWC3_TRBCTL_CONTROL_STATUS3
 		: DWC3_TRBCTL_CONTROL_STATUS2;
 
-	return dwc3_ep0_start_trans(dwc, dep->number,
+	dwc3_ep0_prepare_one_trb(dwc, dep->number,
 			dwc->ctrl_req_addr, 0, type, false);
+	return dwc3_ep0_start_trans(dwc, dep->number);
 }
 
 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep *dep)

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

* [PATCH 4.4 064/101] stable-fixup: hotplug: fix unused function warning
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (59 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 063/101] usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb() Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 065/101] ath10k: use the right length of "background" Greg Kroah-Hartman
                     ` (36 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann

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

------------------

From: Arnd Bergmann <arnd@arndb.de>

[resolves a messed up backport, so no matching upstream commit]

The backport of upstream commit 777c6e0daebb ("hotplug: Make
register and unregister notifier API symmetric") to linux-4.4.y
introduced a harmless warning in 'allnoconfig' builds as spotted by
kernelci.org:

kernel/cpu.c:226:13: warning: 'cpu_notify_nofail' defined but not used [-Wunused-function]

So far, this is the only stable tree that is affected, as linux-4.6 and
higher contain commit 984581728eb4 ("cpu/hotplug: Split out cpu down functions")
that makes the function used in all configurations, while older longterm
releases so far don't seem to have a backport of 777c6e0daebb.

The fix for the warning is trivial: move the unused function back
into the #ifdef section where it was before.

Link: https://kernelci.org/build/id/586fcacb59b514049ef6c3aa/logs/
Fixes: 1c0f4e0ebb79 ("hotplug: Make register and unregister notifier API symmetric") in v4.4.y
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/cpu.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -223,10 +223,6 @@ static int cpu_notify(unsigned long val,
 	return __cpu_notify(val, v, -1, NULL);
 }
 
-static void cpu_notify_nofail(unsigned long val, void *v)
-{
-	BUG_ON(cpu_notify(val, v));
-}
 EXPORT_SYMBOL(register_cpu_notifier);
 EXPORT_SYMBOL(__register_cpu_notifier);
 
@@ -245,6 +241,11 @@ void __unregister_cpu_notifier(struct no
 EXPORT_SYMBOL(__unregister_cpu_notifier);
 
 #ifdef CONFIG_HOTPLUG_CPU
+static void cpu_notify_nofail(unsigned long val, void *v)
+{
+	BUG_ON(cpu_notify(val, v));
+}
+
 /**
  * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU
  * @cpu: a CPU id

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

* [PATCH 4.4 065/101] ath10k: use the right length of "background"
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (60 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 064/101] stable-fixup: hotplug: fix unused function warning Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 066/101] cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected Greg Kroah-Hartman
                     ` (35 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Nicolas Iooss, Kalle Valo

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

------------------

From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

commit 31b239824ece321c09bdb8e61e1d14814eaba38b upstream.

The word "background" contains 10 characters so the third argument of
strncmp() need to be 10 in order to match this prefix correctly.

Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Fixes: 855aed1220d2 ("ath10k: add spectral scan feature")
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/ath/ath10k/spectral.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/wireless/ath/ath10k/spectral.c
+++ b/drivers/net/wireless/ath/ath10k/spectral.c
@@ -338,7 +338,7 @@ static ssize_t write_file_spec_scan_ctl(
 		} else {
 			res = -EINVAL;
 		}
-	} else if (strncmp("background", buf, 9) == 0) {
+	} else if (strncmp("background", buf, 10) == 0) {
 		res = ath10k_spectral_scan_config(ar, SPECTRAL_BACKGROUND);
 	} else if (strncmp("manual", buf, 6) == 0) {
 		res = ath10k_spectral_scan_config(ar, SPECTRAL_MANUAL);

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

* [PATCH 4.4 066/101] cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (61 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 065/101] ath10k: use the right length of "background" Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 067/101] hwmon: (scpi) Fix module autoload Greg Kroah-Hartman
                     ` (34 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, kbuild test robot, Guenter Roeck,
	Jesper Nilsson

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

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit 328cf6927bb72cadefddebbc9a23c793108147a2 upstream.

If CONFIG_ETRAX_AXISFLASHMAP is not configured, the flash rescue image
object file is empty. With recent versions of binutils, this results
in the following build error.

cris-linux-objcopy: error:
	the input file 'arch/cris/boot/rescue/rescue.o' has no sections

This is seen, for example, when trying to build cris:allnoconfig
with recently generated toolchains.

Since it does not make sense to build a flash rescue image if there is
no flash, only build it if CONFIG_ETRAX_AXISFLASHMAP is enabled.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: 66ab3a74c5ce ("CRIS: Merge machine dependent boot/compressed ..")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/cris/boot/rescue/Makefile |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/arch/cris/boot/rescue/Makefile
+++ b/arch/cris/boot/rescue/Makefile
@@ -10,6 +10,9 @@
 
 asflags-y += $(LINUXINCLUDE)
 ccflags-y += -O2 $(LINUXINCLUDE)
+
+ifdef CONFIG_ETRAX_AXISFLASHMAP
+
 arch-$(CONFIG_ETRAX_ARCH_V10) = v10
 arch-$(CONFIG_ETRAX_ARCH_V32) = v32
 
@@ -28,6 +31,11 @@ $(obj)/rescue.bin: $(obj)/rescue.o FORCE
 	$(call if_changed,objcopy)
 	cp -p $(obj)/rescue.bin $(objtree)
 
+else
+$(obj)/rescue.bin:
+
+endif
+
 $(obj)/testrescue.bin: $(obj)/testrescue.o
 	$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
 # Pad it to 784 bytes

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

* [PATCH 4.4 067/101] hwmon: (scpi) Fix module autoload
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (62 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 066/101] cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 068/101] hwmon: (amc6821) sign extension temperature Greg Kroah-Hartman
                     ` (33 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Javier Martinez Canillas, Guenter Roeck

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

------------------

From: Javier Martinez Canillas <javier@osg.samsung.com>

commit 13edb767aa609b6efb7c0c2b57fbd72a6ded0eed upstream.

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/hwmon/scpi-hwmon.ko | grep alias
$

After this patch:

$ modinfo drivers/hwmon/scpi-hwmon.ko | grep alias
alias:          of:N*T*Carm,scpi-sensorsC*
alias:          of:N*T*Carm,scpi-sensors

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Fixes: ea98b29a05e9c ("hwmon: Support sensors exported via ARM SCP interface")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/scpi-hwmon.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/hwmon/scpi-hwmon.c
+++ b/drivers/hwmon/scpi-hwmon.c
@@ -272,6 +272,7 @@ static const struct of_device_id scpi_of
 	{.compatible = "arm,scpi-sensors"},
 	{},
 };
+MODULE_DEVICE_TABLE(of, scpi_of_match);
 
 static struct platform_driver scpi_hwmon_platdrv = {
 	.driver = {

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

* [PATCH 4.4 068/101] hwmon: (amc6821) sign extension temperature
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (63 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 067/101] hwmon: (scpi) Fix module autoload Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 069/101] hwmon: (ds620) Fix overflows seen when writing temperature limits Greg Kroah-Hartman
                     ` (32 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Jared Bents, Matt Weber, Guenter Roeck

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

------------------

From: Jared Bents <jared.bents@rockwellcollins.com>

commit 4538bfbf2d9f1fc48c07ac0cc0ee58716fe7fe96 upstream.

Converts the unsigned temperature values from the i2c read
to be sign extended as defined in the datasheet so that
negative temperatures are properly read.

Fixes: 28e6274d8fa67 ("hwmon: (amc6821) Avoid forward declaration")
Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
[groeck: Dropped unnecessary continuation line]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/amc6821.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -188,8 +188,8 @@ static struct amc6821_data *amc6821_upda
 			!data->valid) {
 
 		for (i = 0; i < TEMP_IDX_LEN; i++)
-			data->temp[i] = i2c_smbus_read_byte_data(client,
-				temp_reg[i]);
+			data->temp[i] = (int8_t)i2c_smbus_read_byte_data(
+				client, temp_reg[i]);
 
 		data->stat1 = i2c_smbus_read_byte_data(client,
 			AMC6821_REG_STAT1);

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

* [PATCH 4.4 069/101] hwmon: (ds620) Fix overflows seen when writing temperature limits
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (64 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 068/101] hwmon: (amc6821) sign extension temperature Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 070/101] hwmon: (nct7802) Fix overflows seen when writing into limit attributes Greg Kroah-Hartman
                     ` (31 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jean Delvare, Guenter Roeck

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

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit e36ce99ee0815d7919a7b589bfb66f3de50b6bc7 upstream.

Module test reports:

temp1_max: Suspected overflow: [160000 vs. 0]
temp1_min: Suspected overflow: [160000 vs. 0]

This is seen because the values passed when writing temperature limits
are unbound.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Fixes: 6099469805c2 ("hwmon: Support for Dallas Semiconductor DS620")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/ds620.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/hwmon/ds620.c
+++ b/drivers/hwmon/ds620.c
@@ -166,7 +166,7 @@ static ssize_t set_temp(struct device *d
 	if (res)
 		return res;
 
-	val = (val * 10 / 625) * 8;
+	val = (clamp_val(val, -128000, 128000) * 10 / 625) * 8;
 
 	mutex_lock(&data->update_lock);
 	data->temp[attr->index] = val;

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

* [PATCH 4.4 070/101] hwmon: (nct7802) Fix overflows seen when writing into limit attributes
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (65 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 069/101] hwmon: (ds620) Fix overflows seen when writing temperature limits Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 071/101] hwmon: (g762) Fix overflows and crash seen when writing " Greg Kroah-Hartman
                     ` (30 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Jean Delvare, Guenter Roeck

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

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit c0d04e9112ad59d73f23f3b0f6726c5e798dfcbf upstream.

Fix overflows seen when writing voltage and temperature limit attributes.

The value passed to DIV_ROUND_CLOSEST() needs to be clamped, and the
value parameter passed to nct7802_write_fan_min() is an unsigned long.

Also, writing values larger than 2700000 into a fan limit attribute results
in writing 0 into the chip's limit registers. The exact behavior when
writing this value is unspecified. For consistency, report a limit of
1350000 if the chip register reads 0. This may be wrong, and the chip
behavior should be verified with the actual chip, but it is better than
reporting a value of 0 (which, when written, results in writing a value
of 0x1fff into the chip register).

Fixes: 3434f3783580 ("hwmon: Driver for Nuvoton NCT7802Y")
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/nct7802.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/hwmon/nct7802.c
+++ b/drivers/hwmon/nct7802.c
@@ -259,13 +259,15 @@ static int nct7802_read_fan_min(struct n
 		ret = 0;
 	else if (ret)
 		ret = DIV_ROUND_CLOSEST(1350000U, ret);
+	else
+		ret = 1350000U;
 abort:
 	mutex_unlock(&data->access_lock);
 	return ret;
 }
 
 static int nct7802_write_fan_min(struct nct7802_data *data, u8 reg_fan_low,
-				 u8 reg_fan_high, unsigned int limit)
+				 u8 reg_fan_high, unsigned long limit)
 {
 	int err;
 
@@ -326,8 +328,8 @@ static int nct7802_write_voltage(struct
 	int shift = 8 - REG_VOLTAGE_LIMIT_MSB_SHIFT[index - 1][nr];
 	int err;
 
+	voltage = clamp_val(voltage, 0, 0x3ff * nct7802_vmul[nr]);
 	voltage = DIV_ROUND_CLOSEST(voltage, nct7802_vmul[nr]);
-	voltage = clamp_val(voltage, 0, 0x3ff);
 
 	mutex_lock(&data->access_lock);
 	err = regmap_write(data->regmap,
@@ -402,7 +404,7 @@ static ssize_t store_temp(struct device
 	if (err < 0)
 		return err;
 
-	val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), -128, 127);
+	val = DIV_ROUND_CLOSEST(clamp_val(val, -128000, 127000), 1000);
 
 	err = regmap_write(data->regmap, nr, val & 0xff);
 	return err ? : count;

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

* [PATCH 4.4 071/101] hwmon: (g762) Fix overflows and crash seen when writing limit attributes
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (66 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 070/101] hwmon: (nct7802) Fix overflows seen when writing into limit attributes Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 072/101] clk: clk-wm831x: fix a logic error Greg Kroah-Hartman
                     ` (29 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnaud Ebalard, Jean Delvare, Guenter Roeck

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

------------------

From: Guenter Roeck <linux@roeck-us.net>

commit 4fccd4a1e8944033bcd7693ea4e8fb478cd2059a upstream.

Fix overflows seen when writing into fan speed limit attributes.
Also fix crash due to division by zero, seen when certain very
large values (such as 2147483648, or 0x80000000) are written
into fan speed limit attributes.

Fixes: 594fbe713bf60 ("Add support for GMT G762/G763 PWM fan controllers")
Cc: Arnaud Ebalard <arno@natisbad.org>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/hwmon/g762.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

--- a/drivers/hwmon/g762.c
+++ b/drivers/hwmon/g762.c
@@ -193,14 +193,17 @@ static inline unsigned int rpm_from_cnt(
  * Convert fan RPM value from sysfs into count value for fan controller
  * register (FAN_SET_CNT).
  */
-static inline unsigned char cnt_from_rpm(u32 rpm, u32 clk_freq, u16 p,
+static inline unsigned char cnt_from_rpm(unsigned long rpm, u32 clk_freq, u16 p,
 					 u8 clk_div, u8 gear_mult)
 {
-	if (!rpm)         /* to stop the fan, set cnt to 255 */
+	unsigned long f1 = clk_freq * 30 * gear_mult;
+	unsigned long f2 = p * clk_div;
+
+	if (!rpm)	/* to stop the fan, set cnt to 255 */
 		return 0xff;
 
-	return clamp_val(((clk_freq * 30 * gear_mult) / (rpm * p * clk_div)),
-			 0, 255);
+	rpm = clamp_val(rpm, f1 / (255 * f2), ULONG_MAX / f2);
+	return DIV_ROUND_CLOSEST(f1, rpm * f2);
 }
 
 /* helper to grab and cache data, at most one time per second */

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

* [PATCH 4.4 072/101] clk: clk-wm831x: fix a logic error
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (67 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 071/101] hwmon: (g762) Fix overflows and crash seen when writing " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 074/101] iommu/amd: Missing error code in amd_iommu_init_device() Greg Kroah-Hartman
                     ` (28 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pan Bian, Charles Keepax, Stephen Boyd

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

------------------

From: Pan Bian <bianpan2016@163.com>

commit 20979202ee6e4c68dab7bcf408787225a656d18e upstream.

Fix bug https://bugzilla.kernel.org/show_bug.cgi?id=188561. Function
wm831x_clkout_is_prepared() returns "true" when it fails to read
CLOCK_CONTROL_1. "true" means the device is already prepared. So
return "true" on the read failure seems improper.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Fixes: f05259a6ffa4 ("clk: wm831x: Add initial WM831x clock driver")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/clk/clk-wm831x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/clk/clk-wm831x.c
+++ b/drivers/clk/clk-wm831x.c
@@ -247,7 +247,7 @@ static int wm831x_clkout_is_prepared(str
 	if (ret < 0) {
 		dev_err(wm831x->dev, "Unable to read CLOCK_CONTROL_1: %d\n",
 			ret);
-		return true;
+		return false;
 	}
 
 	return (ret & WM831X_CLKOUT_ENA) != 0;

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

* [PATCH 4.4 074/101] iommu/amd: Missing error code in amd_iommu_init_device()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (68 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 072/101] clk: clk-wm831x: fix a logic error Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 075/101] iommu/amd: Fix the left value check of cmd buffer Greg Kroah-Hartman
                     ` (27 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Joerg Roedel

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

------------------

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

commit 24c790fbf5d8f54c8c82979db11edea8855b74bf upstream.

We should set "ret" to -EINVAL if iommu_group_get() fails.

Fixes: 55c99a4dc50f ("iommu/amd: Use iommu_attach_group()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/amd_iommu_v2.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/iommu/amd_iommu_v2.c
+++ b/drivers/iommu/amd_iommu_v2.c
@@ -809,8 +809,10 @@ int amd_iommu_init_device(struct pci_dev
 		goto out_free_domain;
 
 	group = iommu_group_get(&pdev->dev);
-	if (!group)
+	if (!group) {
+		ret = -EINVAL;
 		goto out_free_domain;
+	}
 
 	ret = iommu_attach_group(dev_state->domain, group);
 	if (ret != 0)

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

* [PATCH 4.4 075/101] iommu/amd: Fix the left value check of cmd buffer
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (69 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 074/101] iommu/amd: Missing error code in amd_iommu_init_device() Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 076/101] iommu/vt-d: Fix pasid table size encoding Greg Kroah-Hartman
                     ` (26 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Huang Rui, Joerg Roedel

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

------------------

From: Huang Rui <ray.huang@amd.com>

commit 432abf68a79332282329286d190e21fe3ac02a31 upstream.

The generic command buffer entry is 128 bits (16 bytes), so the offset
of tail and head pointer should be 16 bytes aligned and increased with
0x10 per command.

When cmd buf is full, head = (tail + 0x10) % CMD_BUFFER_SIZE.

So when left space of cmd buf should be able to store only two
command, we should be issued one COMPLETE_WAIT additionally to wait
all older commands completed. Then the left space should be increased
after IOMMU fetching from cmd buf.

So left check value should be left <= 0x20 (two commands).

Signed-off-by: Huang Rui <ray.huang@amd.com>
Fixes: ac0ea6e92b222 ('x86/amd-iommu: Improve handling of full command buffer')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/amd_iommu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -926,7 +926,7 @@ again:
 	next_tail = (tail + sizeof(*cmd)) % CMD_BUFFER_SIZE;
 	left      = (head - next_tail) % CMD_BUFFER_SIZE;
 
-	if (left <= 2) {
+	if (left <= 0x20) {
 		struct iommu_cmd sync_cmd;
 		volatile u64 sem = 0;
 		int ret;

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

* [PATCH 4.4 076/101] iommu/vt-d: Fix pasid table size encoding
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (70 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 075/101] iommu/amd: Fix the left value check of cmd buffer Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 077/101] iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped Greg Kroah-Hartman
                     ` (25 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mika Kuoppala, Ashok Raj, Jacob Pan,
	Mika Kuoppala, Joerg Roedel

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

------------------

From: Jacob Pan <jacob.jun.pan@linux.intel.com>

commit 65ca7f5f7d1cdde6c25172fe6107cd16902f826f upstream.

Different encodings are used to represent supported PASID bits
and number of PASID table entries.
The current code assigns ecap_pss directly to extended context
table entry PTS which is wrong and could result in writing
non-zero bits to the reserved fields. IOMMU fault reason
11 will be reported when reserved bits are nonzero.
This patch converts ecap_pss to extend context entry pts encoding
based on VT-d spec. Chapter 9.4 as follows:
 - number of PASID bits = ecap_pss + 1
 - number of PASID table entries = 2^(pts + 5)
Software assigned limit of pasid_max value is also respected to
match the allocation limitation of PASID table.

cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
cc: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Tested-by: Mika Kuoppala <mika.kuoppala@intel.com>
Fixes: 2f26e0a9c9860 ('iommu/vt-d: Add basic SVM PASID support')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/intel-iommu.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -5020,6 +5020,25 @@ static void intel_iommu_remove_device(st
 }
 
 #ifdef CONFIG_INTEL_IOMMU_SVM
+#define MAX_NR_PASID_BITS (20)
+static inline unsigned long intel_iommu_get_pts(struct intel_iommu *iommu)
+{
+	/*
+	 * Convert ecap_pss to extend context entry pts encoding, also
+	 * respect the soft pasid_max value set by the iommu.
+	 * - number of PASID bits = ecap_pss + 1
+	 * - number of PASID table entries = 2^(pts + 5)
+	 * Therefore, pts = ecap_pss - 4
+	 * e.g. KBL ecap_pss = 0x13, PASID has 20 bits, pts = 15
+	 */
+	if (ecap_pss(iommu->ecap) < 5)
+		return 0;
+
+	/* pasid_max is encoded as actual number of entries not the bits */
+	return find_first_bit((unsigned long *)&iommu->pasid_max,
+			MAX_NR_PASID_BITS) - 5;
+}
+
 int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct intel_svm_dev *sdev)
 {
 	struct device_domain_info *info;
@@ -5052,7 +5071,9 @@ int intel_iommu_enable_pasid(struct inte
 
 	if (!(ctx_lo & CONTEXT_PASIDE)) {
 		context[1].hi = (u64)virt_to_phys(iommu->pasid_state_table);
-		context[1].lo = (u64)virt_to_phys(iommu->pasid_table) | ecap_pss(iommu->ecap);
+		context[1].lo = (u64)virt_to_phys(iommu->pasid_table) |
+			intel_iommu_get_pts(iommu);
+
 		wmb();
 		/* CONTEXT_TT_MULTI_LEVEL and CONTEXT_TT_DEV_IOTLB are both
 		 * extended to permit requests-with-PASID if the PASIDE bit

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

* [PATCH 4.4 077/101] iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (71 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 076/101] iommu/vt-d: Fix pasid table size encoding Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 078/101] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call Greg Kroah-Hartman
                     ` (24 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Myron Stowe, Joseph Szczypek,
	Don Brace, Baoquan He, Dave Young, Xunlei Pang, Joerg Roedel

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

------------------

From: Xunlei Pang <xlpang@redhat.com>

commit aec0e86172a79eb5e44aff1055bb953fe4d47c59 upstream.

We met the DMAR fault both on hpsa P420i and P421 SmartArray controllers
under kdump, it can be steadily reproduced on several different machines,
the dmesg log is like:
HP HPSA Driver (v 3.4.16-0)
hpsa 0000:02:00.0: using doorbell to reset controller
hpsa 0000:02:00.0: board ready after hard reset.
hpsa 0000:02:00.0: Waiting for controller to respond to no-op
DMAR: Setting identity map for device 0000:02:00.0 [0xe8000 - 0xe8fff]
DMAR: Setting identity map for device 0000:02:00.0 [0xf4000 - 0xf4fff]
DMAR: Setting identity map for device 0000:02:00.0 [0xbdf6e000 - 0xbdf6efff]
DMAR: Setting identity map for device 0000:02:00.0 [0xbdf6f000 - 0xbdf7efff]
DMAR: Setting identity map for device 0000:02:00.0 [0xbdf7f000 - 0xbdf82fff]
DMAR: Setting identity map for device 0000:02:00.0 [0xbdf83000 - 0xbdf84fff]
DMAR: DRHD: handling fault status reg 2
DMAR: [DMA Read] Request device [02:00.0] fault addr fffff000 [fault reason 06] PTE Read access is not set
hpsa 0000:02:00.0: controller message 03:00 timed out
hpsa 0000:02:00.0: no-op failed; re-trying

After some debugging, we found that the fault addr is from DMA initiated at
the driver probe stage after reset(not in-flight DMA), and the corresponding
pte entry value is correct, the fault is likely due to the old iommu caches
of the in-flight DMA before it.

Thus we need to flush the old cache after context mapping is setup for the
device, where the device is supposed to finish reset at its driver probe
stage and no in-flight DMA exists hereafter.

I'm not sure if the hardware is responsible for invalidating all the related
caches allocated in the iommu hardware before, but seems not the case for hpsa,
actually many device drivers have problems in properly resetting the hardware.
Anyway flushing (again) by software in kdump kernel when the device gets context
mapped which is a quite infrequent operation does little harm.

With this patch, the problematic machine can survive the kdump tests.

CC: Myron Stowe <myron.stowe@gmail.com>
CC: Joseph Szczypek <jszczype@redhat.com>
CC: Don Brace <don.brace@microsemi.com>
CC: Baoquan He <bhe@redhat.com>
CC: Dave Young <dyoung@redhat.com>
Fixes: 091d42e43d21 ("iommu/vt-d: Copy translation tables from old kernel")
Fixes: dbcd861f252d ("iommu/vt-d: Do not re-use domain-ids from the old kernel")
Fixes: cf484d0e6939 ("iommu/vt-d: Mark copied context entries")
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Tested-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/iommu/intel-iommu.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1993,6 +1993,25 @@ static int domain_context_mapping_one(st
 	if (context_present(context))
 		goto out_unlock;
 
+	/*
+	 * For kdump cases, old valid entries may be cached due to the
+	 * in-flight DMA and copied pgtable, but there is no unmapping
+	 * behaviour for them, thus we need an explicit cache flush for
+	 * the newly-mapped device. For kdump, at this point, the device
+	 * is supposed to finish reset at its driver probe stage, so no
+	 * in-flight DMA will exist, and we don't need to worry anymore
+	 * hereafter.
+	 */
+	if (context_copied(context)) {
+		u16 did_old = context_domain_id(context);
+
+		if (did_old >= 0 && did_old < cap_ndoms(iommu->cap))
+			iommu->flush.flush_context(iommu, did_old,
+						   (((u16)bus) << 8) | devfn,
+						   DMA_CCMD_MASK_NOBIT,
+						   DMA_CCMD_DEVICE_INVL);
+	}
+
 	pgd = domain->pgd;
 
 	context_clear_entry(context);

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

* [PATCH 4.4 078/101] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (72 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 077/101] iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 079/101] scsi: mvsas: fix command_active typo Greg Kroah-Hartman
                     ` (23 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Charles Keepax, Krzysztof Kozlowski,
	Sylwester Nawrocki, Mark Brown

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

------------------

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

commit 5faf071d08ddd1c1be66deaa93a09ccf43f5b538 upstream.

Unfortunately, I seem to have missed a case where an IRQ safe spinlock was
required, in samsung_i2s_dai_remove, when I fixed up the other calls in
this patch:

316fa9e09ad7 ("ASoC: samsung: Use IRQ safe spin lock calls")

This causes a lockdep warning when unbinding and rebinding the audio card:

[  104.357664]        CPU0                    CPU1
[  104.362174]        ----                    ----
[  104.366692]   lock(&(&pri_dai->spinlock)->rlock);
[  104.371372]                                local_irq_disable();
[  104.377283]                                lock(&(&substream->self_group.lock)->rlock);
[  104.385259]                                lock(&(&pri_dai->spinlock)->rlock);
[  104.392469]   <Interrupt>
[  104.395072]     lock(&(&substream->self_group.lock)->rlock);
[  104.400710]
[  104.400710]  *** DEADLOCK ***

Fixes: ce8bcdbb61d9 ("ASoC: samsung: i2s: Protect more registers with a spinlock")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/soc/samsung/i2s.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1027,12 +1027,13 @@ static int samsung_i2s_dai_probe(struct
 static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
 {
 	struct i2s_dai *i2s = snd_soc_dai_get_drvdata(dai);
+	unsigned long flags;
 
 	if (!is_secondary(i2s)) {
 		if (i2s->quirks & QUIRK_NEED_RSTCLR) {
-			spin_lock(i2s->lock);
+			spin_lock_irqsave(i2s->lock, flags);
 			writel(0, i2s->addr + I2SCON);
-			spin_unlock(i2s->lock);
+			spin_unlock_irqrestore(i2s->lock, flags);
 		}
 	}
 

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

* [PATCH 4.4 079/101] scsi: mvsas: fix command_active typo
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (73 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 078/101] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 080/101] target/iscsi: Fix double free in lio_target_tiqn_addtpg() Greg Kroah-Hartman
                     ` (22 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Johannes Thumshirn,
	Martin K. Petersen

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

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit af15769ffab13d777e55fdef09d0762bf0c249c4 upstream.

gcc-7 notices that the condition in mvs_94xx_command_active looks
suspicious:

drivers/scsi/mvsas/mv_94xx.c: In function 'mvs_94xx_command_active':
drivers/scsi/mvsas/mv_94xx.c:671:15: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]

This was introduced when the mv_printk() statement got added, and leads
to the condition being ignored. This is probably harmless.

Changing '&&' to '&' makes the code look reasonable, as we check the
command bit before setting and printing it.

Fixes: a4632aae8b66 ("[SCSI] mvsas: Add new macros and functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/mvsas/mv_94xx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/mvsas/mv_94xx.c
+++ b/drivers/scsi/mvsas/mv_94xx.c
@@ -621,7 +621,7 @@ static void mvs_94xx_command_active(stru
 {
 	u32 tmp;
 	tmp = mvs_cr32(mvi, MVS_COMMAND_ACTIVE+(slot_idx >> 3));
-	if (tmp && 1 << (slot_idx % 32)) {
+	if (tmp & 1 << (slot_idx % 32)) {
 		mv_printk("command active %08X,  slot [%x].\n", tmp, slot_idx);
 		mvs_cw32(mvi, MVS_COMMAND_ACTIVE + (slot_idx >> 3),
 			1 << (slot_idx % 32));

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

* [PATCH 4.4 080/101] target/iscsi: Fix double free in lio_target_tiqn_addtpg()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (74 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 079/101] scsi: mvsas: fix command_active typo Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 081/101] irqchip/bcm7038-l1: Implement irq_cpu_offline() callback Greg Kroah-Hartman
                     ` (21 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, David Disseldorp,
	Bart Van Assche

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

------------------

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

commit a91918cd3ea11f91c68e08e1e8ce1b560447a80e upstream.

This iscsit_tpg_add_portal_group() function is only called from
lio_target_tiqn_addtpg().  Both functions free the "tpg" pointer on
error so it's a double free bug.  The memory is allocated in the caller
so it should be freed in the caller and not here.

Fixes: e48354ce078c ("iscsi-target: Add iSCSI fabric support for target v4.1")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
[ bvanassche: Added "Fix" at start of patch title ]
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/iscsi/iscsi_target_tpg.c |    1 -
 1 file changed, 1 deletion(-)

--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -260,7 +260,6 @@ err_out:
 		iscsi_release_param_list(tpg->param_list);
 		tpg->param_list = NULL;
 	}
-	kfree(tpg);
 	return -ENOMEM;
 }
 

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

* [PATCH 4.4 081/101] irqchip/bcm7038-l1: Implement irq_cpu_offline() callback
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (75 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 080/101] target/iscsi: Fix double free in lio_target_tiqn_addtpg() Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 082/101] PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend Greg Kroah-Hartman
                     ` (20 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Florian Fainelli, linux-mips, jason,
	marc.zyngier, cernekee, jaedon.shin, ralf, justinpopo6,
	Thomas Gleixner

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

------------------

From: Florian Fainelli <f.fainelli@gmail.com>

commit 34c535793bcbf9263cf22f8a52101f796cdfab8e upstream.

We did not implement an irq_cpu_offline callback for our irqchip, yet we
support setting a given IRQ's affinity. This resulted in interrupts
whose affinity mask included CPUs being taken offline not to work
correctly once the CPU had been put offline.

Fixes: 5f7f0317ed28 ("IRQCHIP: Add new driver for BCM7038-style level 1 interrupt controllers")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: jason@lakedaemon.net
Cc: marc.zyngier@arm.com
Cc: cernekee@gmail.com
Cc: jaedon.shin@gmail.com
Cc: ralf@linux-mips.org
Cc: justinpopo6@gmail.com
Link: http://lkml.kernel.org/r/1477948656-12966-2-git-send-email-f.fainelli@gmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/irqchip/irq-bcm7038-l1.c |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -216,6 +216,31 @@ static int bcm7038_l1_set_affinity(struc
 	return 0;
 }
 
+static void bcm7038_l1_cpu_offline(struct irq_data *d)
+{
+	struct cpumask *mask = irq_data_get_affinity_mask(d);
+	int cpu = smp_processor_id();
+	cpumask_t new_affinity;
+
+	/* This CPU was not on the affinity mask */
+	if (!cpumask_test_cpu(cpu, mask))
+		return;
+
+	if (cpumask_weight(mask) > 1) {
+		/*
+		 * Multiple CPU affinity, remove this CPU from the affinity
+		 * mask
+		 */
+		cpumask_copy(&new_affinity, mask);
+		cpumask_clear_cpu(cpu, &new_affinity);
+	} else {
+		/* Only CPU, put on the lowest online CPU */
+		cpumask_clear(&new_affinity);
+		cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);
+	}
+	irq_set_affinity_locked(d, &new_affinity, false);
+}
+
 static int __init bcm7038_l1_init_one(struct device_node *dn,
 				      unsigned int idx,
 				      struct bcm7038_l1_chip *intc)
@@ -267,6 +292,7 @@ static struct irq_chip bcm7038_l1_irq_ch
 	.irq_mask		= bcm7038_l1_mask,
 	.irq_unmask		= bcm7038_l1_unmask,
 	.irq_set_affinity	= bcm7038_l1_set_affinity,
+	.irq_cpu_offline	= bcm7038_l1_cpu_offline,
 };
 
 static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,

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

* [PATCH 4.4 082/101] PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (76 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 081/101] irqchip/bcm7038-l1: Implement irq_cpu_offline() callback Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 083/101] mmc: mmc_test: Uninitialized return value Greg Kroah-Hartman
                     ` (19 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tony Lindgren, Rafael J. Wysocki

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

------------------

From: Tony Lindgren <tony@atomide.com>

commit bed570307ed78f21b77cb04a1df781dee4a8f05a upstream.

I noticed some wakeirq flakeyness with consumer drivers not using
autosuspend. For drivers not using autosuspend, the wakeirq may never
get unmasked in rpm_suspend() because of irq desc->depth.

We are configuring dedicated wakeirqs to start with IRQ_NOAUTOEN as we
naturally don't want them running until rpm_suspend() is called.

However, when a consumer driver initially calls pm_runtime_get(), we
now wrongly start with disable_irq_nosync() call on the dedicated
wakeirq that is disabled to start with.

This causes desc->depth to toggle between 1 and 2 instead of the usual
0 and 1. This can prevent enable_irq() from unmasking the wakeirq as
that only happens at desc->depth 1.

This does not necessarily show up with drivers using autosuspend as
there is time for disable_irq_nosync() before rpm_suspend() gets called
after the autosuspend timeout.

Let's fix the issue by adding wirq->status that lazily gets set on
the first rpm_suspend(). We also need PM runtime core private functions
for dev_pm_enable_wake_irq_check() and dev_pm_disable_wake_irq_check()
so we can enable the dedicated wakeirq on the first rpm_suspend().

While at it, let's also fix the comments for dev_pm_enable_wake_irq()
and dev_pm_disable_wake_irq(). Those can still be used by the consumer
drivers as needed because the IRQ core manages the interrupt usecount
for us.

Fixes: 4990d4fe327b (PM / Wakeirq: Add automated device wake IRQ handling)
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/base/power/power.h   |   19 ++++++++++
 drivers/base/power/runtime.c |    8 ++--
 drivers/base/power/wakeirq.c |   76 +++++++++++++++++++++++++++++++++++++------
 3 files changed, 88 insertions(+), 15 deletions(-)

--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -20,14 +20,22 @@ static inline void pm_runtime_early_init
 extern void pm_runtime_init(struct device *dev);
 extern void pm_runtime_remove(struct device *dev);
 
+#define WAKE_IRQ_DEDICATED_ALLOCATED	BIT(0)
+#define WAKE_IRQ_DEDICATED_MANAGED	BIT(1)
+#define WAKE_IRQ_DEDICATED_MASK		(WAKE_IRQ_DEDICATED_ALLOCATED | \
+					 WAKE_IRQ_DEDICATED_MANAGED)
+
 struct wake_irq {
 	struct device *dev;
+	unsigned int status;
 	int irq;
-	bool dedicated_irq:1;
 };
 
 extern void dev_pm_arm_wake_irq(struct wake_irq *wirq);
 extern void dev_pm_disarm_wake_irq(struct wake_irq *wirq);
+extern void dev_pm_enable_wake_irq_check(struct device *dev,
+					 bool can_change_status);
+extern void dev_pm_disable_wake_irq_check(struct device *dev);
 
 #ifdef CONFIG_PM_SLEEP
 
@@ -102,6 +110,15 @@ static inline void dev_pm_disarm_wake_ir
 {
 }
 
+static inline void dev_pm_enable_wake_irq_check(struct device *dev,
+						bool can_change_status)
+{
+}
+
+static inline void dev_pm_disable_wake_irq_check(struct device *dev)
+{
+}
+
 #endif
 
 #ifdef CONFIG_PM_SLEEP
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -515,7 +515,7 @@ static int rpm_suspend(struct device *de
 
 	callback = RPM_GET_CALLBACK(dev, runtime_suspend);
 
-	dev_pm_enable_wake_irq(dev);
+	dev_pm_enable_wake_irq_check(dev, true);
 	retval = rpm_callback(callback, dev);
 	if (retval)
 		goto fail;
@@ -554,7 +554,7 @@ static int rpm_suspend(struct device *de
 	return retval;
 
  fail:
-	dev_pm_disable_wake_irq(dev);
+	dev_pm_disable_wake_irq_check(dev);
 	__update_runtime_status(dev, RPM_ACTIVE);
 	dev->power.deferred_resume = false;
 	wake_up_all(&dev->power.wait_queue);
@@ -737,12 +737,12 @@ static int rpm_resume(struct device *dev
 
 	callback = RPM_GET_CALLBACK(dev, runtime_resume);
 
-	dev_pm_disable_wake_irq(dev);
+	dev_pm_disable_wake_irq_check(dev);
 	retval = rpm_callback(callback, dev);
 	if (retval) {
 		__update_runtime_status(dev, RPM_SUSPENDED);
 		pm_runtime_cancel_pending(dev);
-		dev_pm_enable_wake_irq(dev);
+		dev_pm_enable_wake_irq_check(dev, false);
 	} else {
  no_callback:
 		__update_runtime_status(dev, RPM_ACTIVE);
--- a/drivers/base/power/wakeirq.c
+++ b/drivers/base/power/wakeirq.c
@@ -110,8 +110,10 @@ void dev_pm_clear_wake_irq(struct device
 	dev->power.wakeirq = NULL;
 	spin_unlock_irqrestore(&dev->power.lock, flags);
 
-	if (wirq->dedicated_irq)
+	if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) {
 		free_irq(wirq->irq, wirq);
+		wirq->status &= ~WAKE_IRQ_DEDICATED_MASK;
+	}
 	kfree(wirq);
 }
 EXPORT_SYMBOL_GPL(dev_pm_clear_wake_irq);
@@ -179,7 +181,6 @@ int dev_pm_set_dedicated_wake_irq(struct
 
 	wirq->dev = dev;
 	wirq->irq = irq;
-	wirq->dedicated_irq = true;
 	irq_set_status_flags(irq, IRQ_NOAUTOEN);
 
 	/*
@@ -195,6 +196,8 @@ int dev_pm_set_dedicated_wake_irq(struct
 	if (err)
 		goto err_free_irq;
 
+	wirq->status = WAKE_IRQ_DEDICATED_ALLOCATED;
+
 	return err;
 
 err_free_irq:
@@ -210,9 +213,9 @@ EXPORT_SYMBOL_GPL(dev_pm_set_dedicated_w
  * dev_pm_enable_wake_irq - Enable device wake-up interrupt
  * @dev: Device
  *
- * Called from the bus code or the device driver for
- * runtime_suspend() to enable the wake-up interrupt while
- * the device is running.
+ * Optionally called from the bus code or the device driver for
+ * runtime_resume() to override the PM runtime core managed wake-up
+ * interrupt handling to enable the wake-up interrupt.
  *
  * Note that for runtime_suspend()) the wake-up interrupts
  * should be unconditionally enabled unlike for suspend()
@@ -222,7 +225,7 @@ void dev_pm_enable_wake_irq(struct devic
 {
 	struct wake_irq *wirq = dev->power.wakeirq;
 
-	if (wirq && wirq->dedicated_irq)
+	if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED))
 		enable_irq(wirq->irq);
 }
 EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq);
@@ -231,20 +234,73 @@ EXPORT_SYMBOL_GPL(dev_pm_enable_wake_irq
  * dev_pm_disable_wake_irq - Disable device wake-up interrupt
  * @dev: Device
  *
- * Called from the bus code or the device driver for
- * runtime_resume() to disable the wake-up interrupt while
- * the device is running.
+ * Optionally called from the bus code or the device driver for
+ * runtime_suspend() to override the PM runtime core managed wake-up
+ * interrupt handling to disable the wake-up interrupt.
  */
 void dev_pm_disable_wake_irq(struct device *dev)
 {
 	struct wake_irq *wirq = dev->power.wakeirq;
 
-	if (wirq && wirq->dedicated_irq)
+	if (wirq && (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED))
 		disable_irq_nosync(wirq->irq);
 }
 EXPORT_SYMBOL_GPL(dev_pm_disable_wake_irq);
 
 /**
+ * dev_pm_enable_wake_irq_check - Checks and enables wake-up interrupt
+ * @dev: Device
+ * @can_change_status: Can change wake-up interrupt status
+ *
+ * Enables wakeirq conditionally. We need to enable wake-up interrupt
+ * lazily on the first rpm_suspend(). This is needed as the consumer device
+ * starts in RPM_SUSPENDED state, and the the first pm_runtime_get() would
+ * otherwise try to disable already disabled wakeirq. The wake-up interrupt
+ * starts disabled with IRQ_NOAUTOEN set.
+ *
+ * Should be only called from rpm_suspend() and rpm_resume() path.
+ * Caller must hold &dev->power.lock to change wirq->status
+ */
+void dev_pm_enable_wake_irq_check(struct device *dev,
+				  bool can_change_status)
+{
+	struct wake_irq *wirq = dev->power.wakeirq;
+
+	if (!wirq || !((wirq->status & WAKE_IRQ_DEDICATED_MASK)))
+		return;
+
+	if (likely(wirq->status & WAKE_IRQ_DEDICATED_MANAGED)) {
+		goto enable;
+	} else if (can_change_status) {
+		wirq->status |= WAKE_IRQ_DEDICATED_MANAGED;
+		goto enable;
+	}
+
+	return;
+
+enable:
+	enable_irq(wirq->irq);
+}
+
+/**
+ * dev_pm_disable_wake_irq_check - Checks and disables wake-up interrupt
+ * @dev: Device
+ *
+ * Disables wake-up interrupt conditionally based on status.
+ * Should be only called from rpm_suspend() and rpm_resume() path.
+ */
+void dev_pm_disable_wake_irq_check(struct device *dev)
+{
+	struct wake_irq *wirq = dev->power.wakeirq;
+
+	if (!wirq || !((wirq->status & WAKE_IRQ_DEDICATED_MASK)))
+		return;
+
+	if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED)
+		disable_irq_nosync(wirq->irq);
+}
+
+/**
  * dev_pm_arm_wake_irq - Arm device wake-up
  * @wirq: Device wake-up interrupt
  *

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

* [PATCH 4.4 083/101] mmc: mmc_test: Uninitialized return value
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (77 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 082/101] PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 084/101] s390/crypto: unlock on error in prng_tdes_read() Greg Kroah-Hartman
                     ` (18 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Ulf Hansson

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

------------------

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

commit 16652a936e96f5dae53c3fbd38a570497baadaa8 upstream.

We never set "ret" to RESULT_OK.

Fixes: 9f9c4180f88d ("mmc: mmc_test: add test for non-blocking transfers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mmc/card/mmc_test.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -791,7 +791,7 @@ static int mmc_test_nonblock_transfer(st
 	struct mmc_async_req *cur_areq = &test_areq[0].areq;
 	struct mmc_async_req *other_areq = &test_areq[1].areq;
 	int i;
-	int ret;
+	int ret = RESULT_OK;
 
 	test_areq[0].test = test;
 	test_areq[1].test = test;

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

* [PATCH 4.4 084/101] s390/crypto: unlock on error in prng_tdes_read()
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (78 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 083/101] mmc: mmc_test: Uninitialized return value Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 085/101] crypto: arm64/sha2-ce - fix for big endian Greg Kroah-Hartman
                     ` (17 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Martin Schwidefsky

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

------------------

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

commit 9e6e7c74315095fd40f41003850690c711e44420 upstream.

We added some new locking but forgot to unlock on error.

Fixes: 57127645d79d ("s390/zcrypt: Introduce new SHA-512 based Pseudo Random Generator.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/s390/crypto/prng.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -565,8 +565,10 @@ static ssize_t prng_tdes_read(struct fil
 		prng_data->prngws.byte_counter += n;
 		prng_data->prngws.reseed_counter += n;
 
-		if (copy_to_user(ubuf, prng_data->buf, chunk))
-			return -EFAULT;
+		if (copy_to_user(ubuf, prng_data->buf, chunk)) {
+			ret = -EFAULT;
+			break;
+		}
 
 		nbytes -= chunk;
 		ret += chunk;

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

* [PATCH 4.4 085/101] crypto: arm64/sha2-ce - fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (79 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 084/101] s390/crypto: unlock on error in prng_tdes_read() Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 086/101] crypto: arm64/ghash-ce " Greg Kroah-Hartman
                     ` (16 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 174122c39c369ed924d2608fc0be0171997ce800 upstream.

The SHA256 digest is an array of 8 32-bit quantities, so we should refer
to them as such in order for this code to work correctly when built for
big endian. So replace 16 byte scalar loads and stores with 4x32 vector
ones where appropriate.

Fixes: 6ba6c74dfc6b ("arm64/crypto: SHA-224/SHA-256 using ARMv8 Crypto Extensions")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/sha2-ce-core.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm64/crypto/sha2-ce-core.S
+++ b/arch/arm64/crypto/sha2-ce-core.S
@@ -85,7 +85,7 @@ ENTRY(sha2_ce_transform)
 	ld1		{v12.4s-v15.4s}, [x8]
 
 	/* load state */
-	ldp		dga, dgb, [x0]
+	ld1		{dgav.4s, dgbv.4s}, [x0]
 
 	/* load sha256_ce_state::finalize */
 	ldr		w4, [x0, #:lo12:sha256_ce_offsetof_finalize]
@@ -148,6 +148,6 @@ CPU_LE(	rev32		v19.16b, v19.16b	)
 	b		1b
 
 	/* store new state */
-3:	stp		dga, dgb, [x0]
+3:	st1		{dgav.4s, dgbv.4s}, [x0]
 	ret
 ENDPROC(sha2_ce_transform)

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

* [PATCH 4.4 086/101] crypto: arm64/ghash-ce - fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (80 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 085/101] crypto: arm64/sha2-ce - fix for big endian Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 087/101] crypto: arm/aes-ce " Greg Kroah-Hartman
                     ` (15 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 9c433ad5083fd4a4a3c721d86cbfbd0b2a2326a5 upstream.

The GHASH key and digest are both pairs of 64-bit quantities, but the
GHASH code does not always refer to them as such, causing failures when
built for big endian. So replace the 16x1 loads and stores with 2x8 ones.

Fixes: b913a6404ce2 ("arm64/crypto: improve performance of GHASH algorithm")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/ghash-ce-core.S |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/arm64/crypto/ghash-ce-core.S
+++ b/arch/arm64/crypto/ghash-ce-core.S
@@ -29,8 +29,8 @@
 	 *			   struct ghash_key const *k, const char *head)
 	 */
 ENTRY(pmull_ghash_update)
-	ld1		{SHASH.16b}, [x3]
-	ld1		{XL.16b}, [x1]
+	ld1		{SHASH.2d}, [x3]
+	ld1		{XL.2d}, [x1]
 	movi		MASK.16b, #0xe1
 	ext		SHASH2.16b, SHASH.16b, SHASH.16b, #8
 	shl		MASK.2d, MASK.2d, #57
@@ -74,6 +74,6 @@ CPU_LE(	rev64		T1.16b, T1.16b	)
 
 	cbnz		w0, 0b
 
-	st1		{XL.16b}, [x1]
+	st1		{XL.2d}, [x1]
 	ret
 ENDPROC(pmull_ghash_update)

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

* [PATCH 4.4 087/101] crypto: arm/aes-ce - fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (81 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 086/101] crypto: arm64/ghash-ce " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 088/101] crypto: arm64/aes-ccm-ce: " Greg Kroah-Hartman
                     ` (14 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 58010fa6f71c9577922b22e46014b95a4ec80fa0 upstream.

The AES key schedule generation is mostly endian agnostic, with the
exception of the rotation and the incorporation of the round constant
at the start of each round. So implement a big endian specific version
of that part to make the whole routine big endian compatible.

Fixes: 86464859cc77 ("crypto: arm - AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm/crypto/aes-ce-glue.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/arch/arm/crypto/aes-ce-glue.c
+++ b/arch/arm/crypto/aes-ce-glue.c
@@ -87,8 +87,13 @@ static int ce_aes_expandkey(struct crypt
 		u32 *rki = ctx->key_enc + (i * kwords);
 		u32 *rko = rki + kwords;
 
+#ifndef CONFIG_CPU_BIG_ENDIAN
 		rko[0] = ror32(ce_aes_sub(rki[kwords - 1]), 8);
 		rko[0] = rko[0] ^ rki[0] ^ rcon[i];
+#else
+		rko[0] = rol32(ce_aes_sub(rki[kwords - 1]), 8);
+		rko[0] = rko[0] ^ rki[0] ^ (rcon[i] << 24);
+#endif
 		rko[1] = rko[0] ^ rki[1];
 		rko[2] = rko[1] ^ rki[2];
 		rko[3] = rko[2] ^ rki[3];

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

* [PATCH 4.4 088/101] crypto: arm64/aes-ccm-ce: fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (82 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 087/101] crypto: arm/aes-ce " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 089/101] crypto: arm64/aes-neon - " Greg Kroah-Hartman
                     ` (13 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 56e4e76c68fcb51547b5299e5b66a135935ff414 upstream.

The AES-CCM implementation that uses ARMv8 Crypto Extensions instructions
refers to the AES round keys as pairs of 64-bit quantities, which causes
failures when building the code for big endian. In addition, it byte swaps
the input counter unconditionally, while this is only required for little
endian builds. So fix both issues.

Fixes: 12ac3efe74f8 ("arm64/crypto: use crypto instructions to generate AES key schedule")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/aes-ce-ccm-core.S |   53 ++++++++++++++++++------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

--- a/arch/arm64/crypto/aes-ce-ccm-core.S
+++ b/arch/arm64/crypto/aes-ce-ccm-core.S
@@ -9,6 +9,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 	.text
 	.arch	armv8-a+crypto
@@ -19,7 +20,7 @@
 	 */
 ENTRY(ce_aes_ccm_auth_data)
 	ldr	w8, [x3]			/* leftover from prev round? */
-	ld1	{v0.2d}, [x0]			/* load mac */
+	ld1	{v0.16b}, [x0]			/* load mac */
 	cbz	w8, 1f
 	sub	w8, w8, #16
 	eor	v1.16b, v1.16b, v1.16b
@@ -31,7 +32,7 @@ ENTRY(ce_aes_ccm_auth_data)
 	beq	8f				/* out of input? */
 	cbnz	w8, 0b
 	eor	v0.16b, v0.16b, v1.16b
-1:	ld1	{v3.2d}, [x4]			/* load first round key */
+1:	ld1	{v3.16b}, [x4]			/* load first round key */
 	prfm	pldl1strm, [x1]
 	cmp	w5, #12				/* which key size? */
 	add	x6, x4, #16
@@ -41,17 +42,17 @@ ENTRY(ce_aes_ccm_auth_data)
 	mov	v5.16b, v3.16b
 	b	4f
 2:	mov	v4.16b, v3.16b
-	ld1	{v5.2d}, [x6], #16		/* load 2nd round key */
+	ld1	{v5.16b}, [x6], #16		/* load 2nd round key */
 3:	aese	v0.16b, v4.16b
 	aesmc	v0.16b, v0.16b
-4:	ld1	{v3.2d}, [x6], #16		/* load next round key */
+4:	ld1	{v3.16b}, [x6], #16		/* load next round key */
 	aese	v0.16b, v5.16b
 	aesmc	v0.16b, v0.16b
-5:	ld1	{v4.2d}, [x6], #16		/* load next round key */
+5:	ld1	{v4.16b}, [x6], #16		/* load next round key */
 	subs	w7, w7, #3
 	aese	v0.16b, v3.16b
 	aesmc	v0.16b, v0.16b
-	ld1	{v5.2d}, [x6], #16		/* load next round key */
+	ld1	{v5.16b}, [x6], #16		/* load next round key */
 	bpl	3b
 	aese	v0.16b, v4.16b
 	subs	w2, w2, #16			/* last data? */
@@ -60,7 +61,7 @@ ENTRY(ce_aes_ccm_auth_data)
 	ld1	{v1.16b}, [x1], #16		/* load next input block */
 	eor	v0.16b, v0.16b, v1.16b		/* xor with mac */
 	bne	1b
-6:	st1	{v0.2d}, [x0]			/* store mac */
+6:	st1	{v0.16b}, [x0]			/* store mac */
 	beq	10f
 	adds	w2, w2, #16
 	beq	10f
@@ -79,7 +80,7 @@ ENTRY(ce_aes_ccm_auth_data)
 	adds	w7, w7, #1
 	bne	9b
 	eor	v0.16b, v0.16b, v1.16b
-	st1	{v0.2d}, [x0]
+	st1	{v0.16b}, [x0]
 10:	str	w8, [x3]
 	ret
 ENDPROC(ce_aes_ccm_auth_data)
@@ -89,27 +90,27 @@ ENDPROC(ce_aes_ccm_auth_data)
 	 * 			 u32 rounds);
 	 */
 ENTRY(ce_aes_ccm_final)
-	ld1	{v3.2d}, [x2], #16		/* load first round key */
-	ld1	{v0.2d}, [x0]			/* load mac */
+	ld1	{v3.16b}, [x2], #16		/* load first round key */
+	ld1	{v0.16b}, [x0]			/* load mac */
 	cmp	w3, #12				/* which key size? */
 	sub	w3, w3, #2			/* modified # of rounds */
-	ld1	{v1.2d}, [x1]			/* load 1st ctriv */
+	ld1	{v1.16b}, [x1]			/* load 1st ctriv */
 	bmi	0f
 	bne	3f
 	mov	v5.16b, v3.16b
 	b	2f
 0:	mov	v4.16b, v3.16b
-1:	ld1	{v5.2d}, [x2], #16		/* load next round key */
+1:	ld1	{v5.16b}, [x2], #16		/* load next round key */
 	aese	v0.16b, v4.16b
 	aesmc	v0.16b, v0.16b
 	aese	v1.16b, v4.16b
 	aesmc	v1.16b, v1.16b
-2:	ld1	{v3.2d}, [x2], #16		/* load next round key */
+2:	ld1	{v3.16b}, [x2], #16		/* load next round key */
 	aese	v0.16b, v5.16b
 	aesmc	v0.16b, v0.16b
 	aese	v1.16b, v5.16b
 	aesmc	v1.16b, v1.16b
-3:	ld1	{v4.2d}, [x2], #16		/* load next round key */
+3:	ld1	{v4.16b}, [x2], #16		/* load next round key */
 	subs	w3, w3, #3
 	aese	v0.16b, v3.16b
 	aesmc	v0.16b, v0.16b
@@ -120,47 +121,47 @@ ENTRY(ce_aes_ccm_final)
 	aese	v1.16b, v4.16b
 	/* final round key cancels out */
 	eor	v0.16b, v0.16b, v1.16b		/* en-/decrypt the mac */
-	st1	{v0.2d}, [x0]			/* store result */
+	st1	{v0.16b}, [x0]			/* store result */
 	ret
 ENDPROC(ce_aes_ccm_final)
 
 	.macro	aes_ccm_do_crypt,enc
 	ldr	x8, [x6, #8]			/* load lower ctr */
-	ld1	{v0.2d}, [x5]			/* load mac */
-	rev	x8, x8				/* keep swabbed ctr in reg */
+	ld1	{v0.16b}, [x5]			/* load mac */
+CPU_LE(	rev	x8, x8			)	/* keep swabbed ctr in reg */
 0:	/* outer loop */
-	ld1	{v1.1d}, [x6]			/* load upper ctr */
+	ld1	{v1.8b}, [x6]			/* load upper ctr */
 	prfm	pldl1strm, [x1]
 	add	x8, x8, #1
 	rev	x9, x8
 	cmp	w4, #12				/* which key size? */
 	sub	w7, w4, #2			/* get modified # of rounds */
 	ins	v1.d[1], x9			/* no carry in lower ctr */
-	ld1	{v3.2d}, [x3]			/* load first round key */
+	ld1	{v3.16b}, [x3]			/* load first round key */
 	add	x10, x3, #16
 	bmi	1f
 	bne	4f
 	mov	v5.16b, v3.16b
 	b	3f
 1:	mov	v4.16b, v3.16b
-	ld1	{v5.2d}, [x10], #16		/* load 2nd round key */
+	ld1	{v5.16b}, [x10], #16		/* load 2nd round key */
 2:	/* inner loop: 3 rounds, 2x interleaved */
 	aese	v0.16b, v4.16b
 	aesmc	v0.16b, v0.16b
 	aese	v1.16b, v4.16b
 	aesmc	v1.16b, v1.16b
-3:	ld1	{v3.2d}, [x10], #16		/* load next round key */
+3:	ld1	{v3.16b}, [x10], #16		/* load next round key */
 	aese	v0.16b, v5.16b
 	aesmc	v0.16b, v0.16b
 	aese	v1.16b, v5.16b
 	aesmc	v1.16b, v1.16b
-4:	ld1	{v4.2d}, [x10], #16		/* load next round key */
+4:	ld1	{v4.16b}, [x10], #16		/* load next round key */
 	subs	w7, w7, #3
 	aese	v0.16b, v3.16b
 	aesmc	v0.16b, v0.16b
 	aese	v1.16b, v3.16b
 	aesmc	v1.16b, v1.16b
-	ld1	{v5.2d}, [x10], #16		/* load next round key */
+	ld1	{v5.16b}, [x10], #16		/* load next round key */
 	bpl	2b
 	aese	v0.16b, v4.16b
 	aese	v1.16b, v4.16b
@@ -177,14 +178,14 @@ ENDPROC(ce_aes_ccm_final)
 	eor	v0.16b, v0.16b, v2.16b		/* xor mac with pt ^ rk[last] */
 	st1	{v1.16b}, [x0], #16		/* write output block */
 	bne	0b
-	rev	x8, x8
-	st1	{v0.2d}, [x5]			/* store mac */
+CPU_LE(	rev	x8, x8			)
+	st1	{v0.16b}, [x5]			/* store mac */
 	str	x8, [x6, #8]			/* store lsb end of ctr (BE) */
 5:	ret
 
 6:	eor	v0.16b, v0.16b, v5.16b		/* final round mac */
 	eor	v1.16b, v1.16b, v5.16b		/* final round enc */
-	st1	{v0.2d}, [x5]			/* store mac */
+	st1	{v0.16b}, [x5]			/* store mac */
 	add	w2, w2, #16			/* process partial tail block */
 7:	ldrb	w9, [x1], #1			/* get 1 byte of input */
 	umov	w6, v1.b[0]			/* get top crypted ctr byte */

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

* [PATCH 4.4 089/101] crypto: arm64/aes-neon - fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (83 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 088/101] crypto: arm64/aes-ccm-ce: " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 090/101] crypto: arm64/sha1-ce " Greg Kroah-Hartman
                     ` (12 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit a2c435cc99862fd3d165e1b66bf48ac72c839c62 upstream.

The AES implementation using pure NEON instructions relies on the generic
AES key schedule generation routines, which store the round keys as arrays
of 32-bit quantities stored in memory using native endianness. This means
we should refer to these round keys using 4x4 loads rather than 16x1 loads.
In addition, the ShiftRows tables are loading using a single scalar load,
which is also affected by endianness, so emit these tables in the correct
order depending on whether we are building for big endian or not.

Fixes: 49788fe2a128 ("arm64/crypto: AES-ECB/CBC/CTR/XTS using ARMv8 NEON and Crypto Extensions")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/aes-neon.S |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

--- a/arch/arm64/crypto/aes-neon.S
+++ b/arch/arm64/crypto/aes-neon.S
@@ -9,6 +9,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #define AES_ENTRY(func)		ENTRY(neon_ ## func)
 #define AES_ENDPROC(func)	ENDPROC(neon_ ## func)
@@ -83,13 +84,13 @@
 	.endm
 
 	.macro		do_block, enc, in, rounds, rk, rkp, i
-	ld1		{v15.16b}, [\rk]
+	ld1		{v15.4s}, [\rk]
 	add		\rkp, \rk, #16
 	mov		\i, \rounds
 1111:	eor		\in\().16b, \in\().16b, v15.16b		/* ^round key */
 	tbl		\in\().16b, {\in\().16b}, v13.16b	/* ShiftRows */
 	sub_bytes	\in
-	ld1		{v15.16b}, [\rkp], #16
+	ld1		{v15.4s}, [\rkp], #16
 	subs		\i, \i, #1
 	beq		2222f
 	.if		\enc == 1
@@ -229,7 +230,7 @@
 	.endm
 
 	.macro		do_block_2x, enc, in0, in1 rounds, rk, rkp, i
-	ld1		{v15.16b}, [\rk]
+	ld1		{v15.4s}, [\rk]
 	add		\rkp, \rk, #16
 	mov		\i, \rounds
 1111:	eor		\in0\().16b, \in0\().16b, v15.16b	/* ^round key */
@@ -237,7 +238,7 @@
 	sub_bytes_2x	\in0, \in1
 	tbl		\in0\().16b, {\in0\().16b}, v13.16b	/* ShiftRows */
 	tbl		\in1\().16b, {\in1\().16b}, v13.16b	/* ShiftRows */
-	ld1		{v15.16b}, [\rkp], #16
+	ld1		{v15.4s}, [\rkp], #16
 	subs		\i, \i, #1
 	beq		2222f
 	.if		\enc == 1
@@ -254,7 +255,7 @@
 	.endm
 
 	.macro		do_block_4x, enc, in0, in1, in2, in3, rounds, rk, rkp, i
-	ld1		{v15.16b}, [\rk]
+	ld1		{v15.4s}, [\rk]
 	add		\rkp, \rk, #16
 	mov		\i, \rounds
 1111:	eor		\in0\().16b, \in0\().16b, v15.16b	/* ^round key */
@@ -266,7 +267,7 @@
 	tbl		\in1\().16b, {\in1\().16b}, v13.16b	/* ShiftRows */
 	tbl		\in2\().16b, {\in2\().16b}, v13.16b	/* ShiftRows */
 	tbl		\in3\().16b, {\in3\().16b}, v13.16b	/* ShiftRows */
-	ld1		{v15.16b}, [\rkp], #16
+	ld1		{v15.4s}, [\rkp], #16
 	subs		\i, \i, #1
 	beq		2222f
 	.if		\enc == 1
@@ -306,12 +307,16 @@
 	.text
 	.align		4
 .LForward_ShiftRows:
-	.byte		0x0, 0x5, 0xa, 0xf, 0x4, 0x9, 0xe, 0x3
-	.byte		0x8, 0xd, 0x2, 0x7, 0xc, 0x1, 0x6, 0xb
+CPU_LE(	.byte		0x0, 0x5, 0xa, 0xf, 0x4, 0x9, 0xe, 0x3	)
+CPU_LE(	.byte		0x8, 0xd, 0x2, 0x7, 0xc, 0x1, 0x6, 0xb	)
+CPU_BE(	.byte		0xb, 0x6, 0x1, 0xc, 0x7, 0x2, 0xd, 0x8	)
+CPU_BE(	.byte		0x3, 0xe, 0x9, 0x4, 0xf, 0xa, 0x5, 0x0	)
 
 .LReverse_ShiftRows:
-	.byte		0x0, 0xd, 0xa, 0x7, 0x4, 0x1, 0xe, 0xb
-	.byte		0x8, 0x5, 0x2, 0xf, 0xc, 0x9, 0x6, 0x3
+CPU_LE(	.byte		0x0, 0xd, 0xa, 0x7, 0x4, 0x1, 0xe, 0xb	)
+CPU_LE(	.byte		0x8, 0x5, 0x2, 0xf, 0xc, 0x9, 0x6, 0x3	)
+CPU_BE(	.byte		0x3, 0x6, 0x9, 0xc, 0xf, 0x2, 0x5, 0x8	)
+CPU_BE(	.byte		0xb, 0xe, 0x1, 0x4, 0x7, 0xa, 0xd, 0x0	)
 
 .LForward_Sbox:
 	.byte		0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5

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

* [PATCH 4.4 090/101] crypto: arm64/sha1-ce - fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (84 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 089/101] crypto: arm64/aes-neon - " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 091/101] crypto: arm64/aes-xts-ce: " Greg Kroah-Hartman
                     ` (11 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit ee71e5f1e7d25543ee63a80451871f8985b8d431 upstream.

The SHA1 digest is an array of 5 32-bit quantities, so we should refer
to them as such in order for this code to work correctly when built for
big endian. So replace 16 byte scalar loads and stores with 4x4 vector
ones where appropriate.

Fixes: 2c98833a42cd ("arm64/crypto: SHA-1 using ARMv8 Crypto Extensions")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/sha1-ce-core.S |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/arm64/crypto/sha1-ce-core.S
+++ b/arch/arm64/crypto/sha1-ce-core.S
@@ -78,7 +78,7 @@ ENTRY(sha1_ce_transform)
 	ld1r		{k3.4s}, [x6]
 
 	/* load state */
-	ldr		dga, [x0]
+	ld1		{dgav.4s}, [x0]
 	ldr		dgb, [x0, #16]
 
 	/* load sha1_ce_state::finalize */
@@ -144,7 +144,7 @@ CPU_LE(	rev32		v11.16b, v11.16b	)
 	b		1b
 
 	/* store new state */
-3:	str		dga, [x0]
+3:	st1		{dgav.4s}, [x0]
 	str		dgb, [x0, #16]
 	ret
 ENDPROC(sha1_ce_transform)

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

* [PATCH 4.4 091/101] crypto: arm64/aes-xts-ce: fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (85 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 090/101] crypto: arm64/sha1-ce " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 092/101] crypto: arm64/aes-ce - " Greg Kroah-Hartman
                     ` (10 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit caf4b9e2b326cc2a5005a5c557274306536ace61 upstream.

Emit the XTS tweak literal constants in the appropriate order for a
single 128-bit scalar literal load.

Fixes: 49788fe2a128 ("arm64/crypto: AES-ECB/CBC/CTR/XTS using ARMv8 NEON and Crypto Extensions")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/aes-ce.S    |    1 +
 arch/arm64/crypto/aes-modes.S |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

--- a/arch/arm64/crypto/aes-ce.S
+++ b/arch/arm64/crypto/aes-ce.S
@@ -10,6 +10,7 @@
  */
 
 #include <linux/linkage.h>
+#include <asm/assembler.h>
 
 #define AES_ENTRY(func)		ENTRY(ce_ ## func)
 #define AES_ENDPROC(func)	ENDPROC(ce_ ## func)
--- a/arch/arm64/crypto/aes-modes.S
+++ b/arch/arm64/crypto/aes-modes.S
@@ -386,7 +386,8 @@ AES_ENDPROC(aes_ctr_encrypt)
 	.endm
 
 .Lxts_mul_x:
-	.word		1, 0, 0x87, 0
+CPU_LE(	.quad		1, 0x87		)
+CPU_BE(	.quad		0x87, 1		)
 
 AES_ENTRY(aes_xts_encrypt)
 	FRAME_PUSH

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

* [PATCH 4.4 092/101] crypto: arm64/aes-ce - fix for big endian
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (86 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 091/101] crypto: arm64/aes-xts-ce: " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 093/101] md: MD_RECOVERY_NEEDED is set for mddev->recovery Greg Kroah-Hartman
                     ` (9 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ard Biesheuvel, Herbert Xu

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

------------------

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

commit 1803b9a52c4e5a5dbb8a27126f6bc06939359753 upstream.

The core AES cipher implementation that uses ARMv8 Crypto Extensions
instructions erroneously loads the round keys as 64-bit quantities,
which causes the algorithm to fail when built for big endian. In
addition, the key schedule generation routine fails to take endianness
into account as well, when loading the combining the input key with
the round constants. So fix both issues.

Fixes: 12ac3efe74f8 ("arm64/crypto: use crypto instructions to generate AES key schedule")
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/crypto/aes-ce-cipher.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

--- a/arch/arm64/crypto/aes-ce-cipher.c
+++ b/arch/arm64/crypto/aes-ce-cipher.c
@@ -47,24 +47,24 @@ static void aes_cipher_encrypt(struct cr
 	kernel_neon_begin_partial(4);
 
 	__asm__("	ld1	{v0.16b}, %[in]			;"
-		"	ld1	{v1.2d}, [%[key]], #16		;"
+		"	ld1	{v1.16b}, [%[key]], #16		;"
 		"	cmp	%w[rounds], #10			;"
 		"	bmi	0f				;"
 		"	bne	3f				;"
 		"	mov	v3.16b, v1.16b			;"
 		"	b	2f				;"
 		"0:	mov	v2.16b, v1.16b			;"
-		"	ld1	{v3.2d}, [%[key]], #16		;"
+		"	ld1	{v3.16b}, [%[key]], #16		;"
 		"1:	aese	v0.16b, v2.16b			;"
 		"	aesmc	v0.16b, v0.16b			;"
-		"2:	ld1	{v1.2d}, [%[key]], #16		;"
+		"2:	ld1	{v1.16b}, [%[key]], #16		;"
 		"	aese	v0.16b, v3.16b			;"
 		"	aesmc	v0.16b, v0.16b			;"
-		"3:	ld1	{v2.2d}, [%[key]], #16		;"
+		"3:	ld1	{v2.16b}, [%[key]], #16		;"
 		"	subs	%w[rounds], %w[rounds], #3	;"
 		"	aese	v0.16b, v1.16b			;"
 		"	aesmc	v0.16b, v0.16b			;"
-		"	ld1	{v3.2d}, [%[key]], #16		;"
+		"	ld1	{v3.16b}, [%[key]], #16		;"
 		"	bpl	1b				;"
 		"	aese	v0.16b, v2.16b			;"
 		"	eor	v0.16b, v0.16b, v3.16b		;"
@@ -92,24 +92,24 @@ static void aes_cipher_decrypt(struct cr
 	kernel_neon_begin_partial(4);
 
 	__asm__("	ld1	{v0.16b}, %[in]			;"
-		"	ld1	{v1.2d}, [%[key]], #16		;"
+		"	ld1	{v1.16b}, [%[key]], #16		;"
 		"	cmp	%w[rounds], #10			;"
 		"	bmi	0f				;"
 		"	bne	3f				;"
 		"	mov	v3.16b, v1.16b			;"
 		"	b	2f				;"
 		"0:	mov	v2.16b, v1.16b			;"
-		"	ld1	{v3.2d}, [%[key]], #16		;"
+		"	ld1	{v3.16b}, [%[key]], #16		;"
 		"1:	aesd	v0.16b, v2.16b			;"
 		"	aesimc	v0.16b, v0.16b			;"
-		"2:	ld1	{v1.2d}, [%[key]], #16		;"
+		"2:	ld1	{v1.16b}, [%[key]], #16		;"
 		"	aesd	v0.16b, v3.16b			;"
 		"	aesimc	v0.16b, v0.16b			;"
-		"3:	ld1	{v2.2d}, [%[key]], #16		;"
+		"3:	ld1	{v2.16b}, [%[key]], #16		;"
 		"	subs	%w[rounds], %w[rounds], #3	;"
 		"	aesd	v0.16b, v1.16b			;"
 		"	aesimc	v0.16b, v0.16b			;"
-		"	ld1	{v3.2d}, [%[key]], #16		;"
+		"	ld1	{v3.16b}, [%[key]], #16		;"
 		"	bpl	1b				;"
 		"	aesd	v0.16b, v2.16b			;"
 		"	eor	v0.16b, v0.16b, v3.16b		;"
@@ -173,7 +173,12 @@ int ce_aes_expandkey(struct crypto_aes_c
 		u32 *rki = ctx->key_enc + (i * kwords);
 		u32 *rko = rki + kwords;
 
+#ifndef CONFIG_CPU_BIG_ENDIAN
 		rko[0] = ror32(aes_sub(rki[kwords - 1]), 8) ^ rcon[i] ^ rki[0];
+#else
+		rko[0] = rol32(aes_sub(rki[kwords - 1]), 8) ^ (rcon[i] << 24) ^
+			 rki[0];
+#endif
 		rko[1] = rko[0] ^ rki[1];
 		rko[2] = rko[1] ^ rki[2];
 		rko[3] = rko[2] ^ rki[3];

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

* [PATCH 4.4 093/101] md: MD_RECOVERY_NEEDED is set for mddev->recovery
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (87 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 092/101] crypto: arm64/aes-ce - " Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 094/101] powerpc/pci/rpadlpar: Fix device reference leaks Greg Kroah-Hartman
                     ` (8 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, NeilBrown, Shaohua Li

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

------------------

From: Shaohua Li <shli@fb.com>

commit 82a301cb0ea2df8a5c88213094a01660067c7fb4 upstream.

Fixes: 90f5f7ad4f38("md: Wait for md_check_recovery before attempting device
removal.")

Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6771,7 +6771,7 @@ static int md_ioctl(struct block_device
 		/* need to ensure recovery thread has run */
 		wait_event_interruptible_timeout(mddev->sb_wait,
 						 !test_bit(MD_RECOVERY_NEEDED,
-							   &mddev->flags),
+							   &mddev->recovery),
 						 msecs_to_jiffies(5000));
 	if (cmd == STOP_ARRAY || cmd == STOP_ARRAY_RO) {
 		/* Need to flush page cache, and ensure no-one else opens

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

* [PATCH 4.4 094/101] powerpc/pci/rpadlpar: Fix device reference leaks
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (88 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 093/101] md: MD_RECOVERY_NEEDED is set for mddev->recovery Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 095/101] staging: comedi: dt282x: tidy up register bit defines Greg Kroah-Hartman
                     ` (7 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Johan Hovold, Michael Ellerman

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

------------------

From: Johan Hovold <johan@kernel.org>

commit 99e5cde5eae78bef95bfe7c16ccda87fb070149b upstream.

Make sure to drop any device reference taken by vio_find_node() when
adding and removing virtual I/O slots.

Fixes: 5eeb8c63a38f ("[PATCH] PCI Hotplug: rpaphp: Move VIO registration")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pci/hotplug/rpadlpar_core.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -258,8 +258,13 @@ static int dlpar_add_phb(char *drc_name,
 
 static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn)
 {
-	if (vio_find_node(dn))
+	struct vio_dev *vio_dev;
+
+	vio_dev = vio_find_node(dn);
+	if (vio_dev) {
+		put_device(&vio_dev->dev);
 		return -EINVAL;
+	}
 
 	if (!vio_register_device_node(dn)) {
 		printk(KERN_ERR
@@ -335,6 +340,9 @@ static int dlpar_remove_vio_slot(char *d
 		return -EINVAL;
 
 	vio_unregister_device(vio_dev);
+
+	put_device(&vio_dev->dev);
+
 	return 0;
 }
 

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

* [PATCH 4.4 095/101] staging: comedi: dt282x: tidy up register bit defines
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (89 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 094/101] powerpc/pci/rpadlpar: Fix device reference leaks Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 096/101] cred/userns: define current_user_ns() as a function Greg Kroah-Hartman
                     ` (6 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, H Hartley Sweeten, Arnd Bergmann, Ian Abbott

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

------------------

From: H Hartley Sweeten <hsweeten@visionengravers.com>

commit f6b1160eb27f990cc1c48b67a5f83cb63115284e upstream.

Arnd Bergmann pointed out that gcc-6 warns about passing negative signed
integer into swab16() due to the macro expansion of 'outw'.

It appears that the register map constants are causing the warnings.
Actually, it might just be the (1 << 15) ones...

Convert all the constants as suggested by checkpatch.pl:
CHECK: Prefer using the BIT macro

The BIT() macro will make all the constants explicitly 'unsigned', which
helps to avoid the warning.

Fix the, unsused, DT2821_CHANCSR_PRESLA() macro. The "Present List
Address" (PRESLA) bits in the CHANCSR register are read only. This
define was meant to extract the bits from the read value.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Tested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/staging/comedi/drivers/dt282x.c |   65 ++++++++++++++++----------------
 1 file changed, 33 insertions(+), 32 deletions(-)

--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -69,48 +69,49 @@
  * Register map
  */
 #define DT2821_ADCSR_REG		0x00
-#define DT2821_ADCSR_ADERR		(1 << 15)
-#define DT2821_ADCSR_ADCLK		(1 << 9)
-#define DT2821_ADCSR_MUXBUSY		(1 << 8)
-#define DT2821_ADCSR_ADDONE		(1 << 7)
-#define DT2821_ADCSR_IADDONE		(1 << 6)
+#define DT2821_ADCSR_ADERR		BIT(15)
+#define DT2821_ADCSR_ADCLK		BIT(9)
+#define DT2821_ADCSR_MUXBUSY		BIT(8)
+#define DT2821_ADCSR_ADDONE		BIT(7)
+#define DT2821_ADCSR_IADDONE		BIT(6)
 #define DT2821_ADCSR_GS(x)		(((x) & 0x3) << 4)
 #define DT2821_ADCSR_CHAN(x)		(((x) & 0xf) << 0)
 #define DT2821_CHANCSR_REG		0x02
-#define DT2821_CHANCSR_LLE		(1 << 15)
-#define DT2821_CHANCSR_PRESLA(x)	(((x) & 0xf) >> 8)
+#define DT2821_CHANCSR_LLE		BIT(15)
+#define DT2821_CHANCSR_TO_PRESLA(x)	(((x) >> 8) & 0xf)
 #define DT2821_CHANCSR_NUMB(x)		((((x) - 1) & 0xf) << 0)
 #define DT2821_ADDAT_REG		0x04
 #define DT2821_DACSR_REG		0x06
-#define DT2821_DACSR_DAERR		(1 << 15)
+#define DT2821_DACSR_DAERR		BIT(15)
 #define DT2821_DACSR_YSEL(x)		((x) << 9)
-#define DT2821_DACSR_SSEL		(1 << 8)
-#define DT2821_DACSR_DACRDY		(1 << 7)
-#define DT2821_DACSR_IDARDY		(1 << 6)
-#define DT2821_DACSR_DACLK		(1 << 5)
-#define DT2821_DACSR_HBOE		(1 << 1)
-#define DT2821_DACSR_LBOE		(1 << 0)
+#define DT2821_DACSR_SSEL		BIT(8)
+#define DT2821_DACSR_DACRDY		BIT(7)
+#define DT2821_DACSR_IDARDY		BIT(6)
+#define DT2821_DACSR_DACLK		BIT(5)
+#define DT2821_DACSR_HBOE		BIT(1)
+#define DT2821_DACSR_LBOE		BIT(0)
 #define DT2821_DADAT_REG		0x08
 #define DT2821_DIODAT_REG		0x0a
 #define DT2821_SUPCSR_REG		0x0c
-#define DT2821_SUPCSR_DMAD		(1 << 15)
-#define DT2821_SUPCSR_ERRINTEN		(1 << 14)
-#define DT2821_SUPCSR_CLRDMADNE		(1 << 13)
-#define DT2821_SUPCSR_DDMA		(1 << 12)
-#define DT2821_SUPCSR_DS_PIO		(0 << 10)
-#define DT2821_SUPCSR_DS_AD_CLK		(1 << 10)
-#define DT2821_SUPCSR_DS_DA_CLK		(2 << 10)
-#define DT2821_SUPCSR_DS_AD_TRIG	(3 << 10)
-#define DT2821_SUPCSR_BUFFB		(1 << 9)
-#define DT2821_SUPCSR_SCDN		(1 << 8)
-#define DT2821_SUPCSR_DACON		(1 << 7)
-#define DT2821_SUPCSR_ADCINIT		(1 << 6)
-#define DT2821_SUPCSR_DACINIT		(1 << 5)
-#define DT2821_SUPCSR_PRLD		(1 << 4)
-#define DT2821_SUPCSR_STRIG		(1 << 3)
-#define DT2821_SUPCSR_XTRIG		(1 << 2)
-#define DT2821_SUPCSR_XCLK		(1 << 1)
-#define DT2821_SUPCSR_BDINIT		(1 << 0)
+#define DT2821_SUPCSR_DMAD		BIT(15)
+#define DT2821_SUPCSR_ERRINTEN		BIT(14)
+#define DT2821_SUPCSR_CLRDMADNE		BIT(13)
+#define DT2821_SUPCSR_DDMA		BIT(12)
+#define DT2821_SUPCSR_DS(x)		(((x) & 0x3) << 10)
+#define DT2821_SUPCSR_DS_PIO		DT2821_SUPCSR_DS(0)
+#define DT2821_SUPCSR_DS_AD_CLK		DT2821_SUPCSR_DS(1)
+#define DT2821_SUPCSR_DS_DA_CLK		DT2821_SUPCSR_DS(2)
+#define DT2821_SUPCSR_DS_AD_TRIG	DT2821_SUPCSR_DS(3)
+#define DT2821_SUPCSR_BUFFB		BIT(9)
+#define DT2821_SUPCSR_SCDN		BIT(8)
+#define DT2821_SUPCSR_DACON		BIT(7)
+#define DT2821_SUPCSR_ADCINIT		BIT(6)
+#define DT2821_SUPCSR_DACINIT		BIT(5)
+#define DT2821_SUPCSR_PRLD		BIT(4)
+#define DT2821_SUPCSR_STRIG		BIT(3)
+#define DT2821_SUPCSR_XTRIG		BIT(2)
+#define DT2821_SUPCSR_XCLK		BIT(1)
+#define DT2821_SUPCSR_BDINIT		BIT(0)
 #define DT2821_TMRCTR_REG		0x0e
 
 static const struct comedi_lrange range_dt282x_ai_lo_bipolar = {

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

* [PATCH 4.4 096/101] cred/userns: define current_user_ns() as a function
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (90 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 095/101] staging: comedi: dt282x: tidy up register bit defines Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 097/101] net: ti: cpmac: Fix compiler warning due to type confusion Greg Kroah-Hartman
                     ` (5 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Serge Hallyn,
	David Howells, Yaowei Bai, James Morris, Paul E. McKenney,
	Andrew Morton, Linus Torvalds

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

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 0335695dfa4df01edff5bb102b9a82a0668ee51e upstream.

The current_user_ns() macro currently returns &init_user_ns when user
namespaces are disabled, and that causes several warnings when building
with gcc-6.0 in code that compares the result of the macro to
&init_user_ns itself:

  fs/xfs/xfs_ioctl.c: In function 'xfs_ioctl_setattr_check_projid':
  fs/xfs/xfs_ioctl.c:1249:22: error: self-comparison always evaluates to true [-Werror=tautological-compare]
    if (current_user_ns() == &init_user_ns)

This is a legitimate warning in principle, but here it isn't really
helpful, so I'm reprasing the definition in a way that shuts up the
warning.  Apparently gcc only warns when comparing identical literals,
but it can figure out that the result of an inline function can be
identical to a constant expression in order to optimize a condition yet
not warn about the fact that the condition is known at compile time.
This is exactly what we want here, and it looks reasonable because we
generally prefer inline functions over macros anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/capability.h |    2 --
 include/linux/cred.h       |    5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -40,8 +40,6 @@ struct inode;
 struct dentry;
 struct user_namespace;
 
-struct user_namespace *current_user_ns(void);
-
 extern const kernel_cap_t __cap_empty_set;
 extern const kernel_cap_t __cap_init_eff_set;
 
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -377,7 +377,10 @@ extern struct user_namespace init_user_n
 #ifdef CONFIG_USER_NS
 #define current_user_ns()	(current_cred_xxx(user_ns))
 #else
-#define current_user_ns()	(&init_user_ns)
+static inline struct user_namespace *current_user_ns(void)
+{
+	return &init_user_ns;
+}
 #endif
 
 

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

* [PATCH 4.4 097/101] net: ti: cpmac: Fix compiler warning due to type confusion
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (91 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 096/101] cred/userns: define current_user_ns() as a function Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 098/101] net: vxge: avoid unused function warnings Greg Kroah-Hartman
                     ` (4 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Paul Burton, David S. Miller

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

------------------

From: Paul Burton <paul.burton@imgtec.com>

commit 2f5281ba2a8feaf6f0aee93356f350855bb530fc upstream.

cpmac_start_xmit() used the max() macro on skb->len (an unsigned int)
and ETH_ZLEN (a signed int literal). This led to the following compiler
warning:

  In file included from include/linux/list.h:8:0,
                   from include/linux/module.h:9,
                   from drivers/net/ethernet/ti/cpmac.c:19:
  drivers/net/ethernet/ti/cpmac.c: In function 'cpmac_start_xmit':
  include/linux/kernel.h:748:17: warning: comparison of distinct pointer
  types lacks a cast
    (void) (&_max1 == &_max2);  \
                   ^
  drivers/net/ethernet/ti/cpmac.c:560:8: note: in expansion of macro 'max'
    len = max(skb->len, ETH_ZLEN);
          ^

On top of this, it assigned the result of the max() macro to a signed
integer whilst all further uses of it result in it being cast to varying
widths of unsigned integer.

Fix this up by using max_t to ensure the comparison is performed as
unsigned integers, and for consistency change the type of the len
variable to unsigned int.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/ti/cpmac.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/drivers/net/ethernet/ti/cpmac.c
+++ b/drivers/net/ethernet/ti/cpmac.c
@@ -549,7 +549,8 @@ fatal_error:
 
 static int cpmac_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	int queue, len;
+	int queue;
+	unsigned int len;
 	struct cpmac_desc *desc;
 	struct cpmac_priv *priv = netdev_priv(dev);
 
@@ -559,7 +560,7 @@ static int cpmac_start_xmit(struct sk_bu
 	if (unlikely(skb_padto(skb, ETH_ZLEN)))
 		return NETDEV_TX_OK;
 
-	len = max(skb->len, ETH_ZLEN);
+	len = max_t(unsigned int, skb->len, ETH_ZLEN);
 	queue = skb_get_queue_mapping(skb);
 	netif_stop_subqueue(dev, queue);
 

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

* [PATCH 4.4 098/101] net: vxge: avoid unused function warnings
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (92 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 097/101] net: ti: cpmac: Fix compiler warning due to type confusion Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 099/101] [media] cx23885-dvb: move initialization of a8293_pdata Greg Kroah-Hartman
                     ` (3 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, David S. Miller

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

------------------

From: Arnd Bergmann <arnd@arndb.de>

commit 57e7c8cef224af166b8ec932b5e383641418c005 upstream.

When CONFIG_PCI_MSI is disabled, we get warnings about unused functions
in the vxge driver:

drivers/net/ethernet/neterion/vxge/vxge-main.c:2121:13: warning: 'adaptive_coalesce_tx_interrupts' defined but not used [-Wunused-function]
drivers/net/ethernet/neterion/vxge/vxge-main.c:2149:13: warning: 'adaptive_coalesce_rx_interrupts' defined but not used [-Wunused-function]

We could add another #ifdef here, but it's nicer to avoid those warnings
for good by converting the existing #ifdef to if(IS_ENABLED()), which has
the same effect but provides better compile-time coverage in general,
and lets the compiler understand better when the function is intentionally
unused.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/neterion/vxge/vxge-main.c |   31 +++++++++----------------
 1 file changed, 12 insertions(+), 19 deletions(-)

--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -2223,8 +2223,6 @@ static irqreturn_t vxge_isr_napi(int irq
 	return IRQ_NONE;
 }
 
-#ifdef CONFIG_PCI_MSI
-
 static irqreturn_t vxge_tx_msix_handle(int irq, void *dev_id)
 {
 	struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id;
@@ -2442,16 +2440,13 @@ static void vxge_rem_msix_isr(struct vxg
 	if (vdev->config.intr_type == MSI_X)
 		pci_disable_msix(vdev->pdev);
 }
-#endif
 
 static void vxge_rem_isr(struct vxgedev *vdev)
 {
-#ifdef CONFIG_PCI_MSI
-	if (vdev->config.intr_type == MSI_X) {
+	if (IS_ENABLED(CONFIG_PCI_MSI) &&
+	    vdev->config.intr_type == MSI_X) {
 		vxge_rem_msix_isr(vdev);
-	} else
-#endif
-	if (vdev->config.intr_type == INTA) {
+	} else if (vdev->config.intr_type == INTA) {
 			synchronize_irq(vdev->pdev->irq);
 			free_irq(vdev->pdev->irq, vdev);
 	}
@@ -2460,11 +2455,10 @@ static void vxge_rem_isr(struct vxgedev
 static int vxge_add_isr(struct vxgedev *vdev)
 {
 	int ret = 0;
-#ifdef CONFIG_PCI_MSI
 	int vp_idx = 0, intr_idx = 0, intr_cnt = 0, msix_idx = 0, irq_req = 0;
 	int pci_fun = PCI_FUNC(vdev->pdev->devfn);
 
-	if (vdev->config.intr_type == MSI_X)
+	if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X)
 		ret = vxge_enable_msix(vdev);
 
 	if (ret) {
@@ -2475,7 +2469,7 @@ static int vxge_add_isr(struct vxgedev *
 		vdev->config.intr_type = INTA;
 	}
 
-	if (vdev->config.intr_type == MSI_X) {
+	if (IS_ENABLED(CONFIG_PCI_MSI) && vdev->config.intr_type == MSI_X) {
 		for (intr_idx = 0;
 		     intr_idx < (vdev->no_of_vpath *
 			VXGE_HW_VPATH_MSIX_ACTIVE); intr_idx++) {
@@ -2576,9 +2570,8 @@ static int vxge_add_isr(struct vxgedev *
 		vdev->vxge_entries[intr_cnt].in_use = 1;
 		vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0];
 	}
-INTA_MODE:
-#endif
 
+INTA_MODE:
 	if (vdev->config.intr_type == INTA) {
 		snprintf(vdev->desc[0], VXGE_INTR_STRLEN,
 			"%s:vxge:INTA", vdev->ndev->name);
@@ -3889,12 +3882,12 @@ static void vxge_device_config_init(stru
 	if (max_mac_vpath > VXGE_MAX_MAC_ADDR_COUNT)
 		max_mac_vpath = VXGE_MAX_MAC_ADDR_COUNT;
 
-#ifndef CONFIG_PCI_MSI
-	vxge_debug_init(VXGE_ERR,
-		"%s: This Kernel does not support "
-		"MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME);
-	*intr_type = INTA;
-#endif
+	if (!IS_ENABLED(CONFIG_PCI_MSI)) {
+		vxge_debug_init(VXGE_ERR,
+			"%s: This Kernel does not support "
+			"MSI-X. Defaulting to INTA", VXGE_DRIVER_NAME);
+		*intr_type = INTA;
+	}
 
 	/* Configure whether MSI-X or IRQL. */
 	switch (*intr_type) {

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

* [PATCH 4.4 099/101] [media] cx23885-dvb: move initialization of a8293_pdata
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (93 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 098/101] net: vxge: avoid unused function warnings Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 13:37   ` [PATCH 4.4 101/101] tick/broadcast: Prevent NULL pointer dereference Greg Kroah-Hartman
                     ` (2 subsequent siblings)
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, David Howells, Mauro Carvalho Chehab

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

------------------

From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

commit f0b0faff78c2c2e8efe843de55405a1f0470b8c4 upstream.

Smatch complains about where the au8293_data is placed:

drivers/media/pci/cx23885/cx23885-dvb.c:2174 dvb_register() info: 'a8293_pdata' is not actually initialized (unreached code).

It is not actually expected to have such initialization at

switch {
	foo = bar;

	case:
...
}

Not really sure how gcc does that, but this is something that I would
expect that different compilers would do different things.

David Howells checked with the compiler people: it's not really expected to
initialise as expected.

So, move the initialization outside the switch(), making smatch to
shut up one warning.

Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/pci/cx23885/cx23885-dvb.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -2168,11 +2168,12 @@ static int dvb_register(struct cx23885_t
 		}
 		port->i2c_client_tuner = client_tuner;
 		break;
-	case CX23885_BOARD_HAUPPAUGE_HVR5525:
-		switch (port->nr) {
+	case CX23885_BOARD_HAUPPAUGE_HVR5525: {
 		struct m88rs6000t_config m88rs6000t_config;
 		struct a8293_platform_data a8293_pdata = {};
 
+		switch (port->nr) {
+
 		/* port b - satellite */
 		case 1:
 			/* attach frontend */
@@ -2267,6 +2268,7 @@ static int dvb_register(struct cx23885_t
 			break;
 		}
 		break;
+	}
 	default:
 		printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
 			" isn't supported yet\n",

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

* [PATCH 4.4 101/101] tick/broadcast: Prevent NULL pointer dereference
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (94 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 099/101] [media] cx23885-dvb: move initialization of a8293_pdata Greg Kroah-Hartman
@ 2017-01-10 13:37   ` Greg Kroah-Hartman
  2017-01-10 17:34   ` [PATCH 4.4 000/101] 4.4.42-stable review Shuah Khan
  2017-01-10 22:26   ` Guenter Roeck
  97 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-01-10 13:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mason, Thomas Gleixner, Mark Rutland,
	Anna-Maria Gleixner, Richard Cochran, Sebastian Andrzej Siewior,
	Daniel Lezcano, Sebastian Frias, Thibaud Cornic, Robin Murphy,
	Peter Zijlstra

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

------------------

From: Thomas Gleixner <tglx@linutronix.de>

commit c1a9eeb938b5433947e5ea22f89baff3182e7075 upstream.

When a disfunctional timer, e.g. dummy timer, is installed, the tick core
tries to setup the broadcast timer.

If no broadcast device is installed, the kernel crashes with a NULL pointer
dereference in tick_broadcast_setup_oneshot() because the function has no
sanity check.

Reported-by: Mason <slash.tmp@free.fr>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Richard Cochran <rcochran@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Cc: Sebastian Frias <sf84@laposte.net>
Cc: Thibaud Cornic <thibaud_cornic@sigmadesigns.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Link: http://lkml.kernel.org/r/1147ef90-7877-e4d2-bb2b-5c4fa8d3144b@free.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/time/tick-broadcast.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -871,6 +871,9 @@ void tick_broadcast_setup_oneshot(struct
 {
 	int cpu = smp_processor_id();
 
+	if (!bc)
+		return;
+
 	/* Set it up only once ! */
 	if (bc->event_handler != tick_handle_oneshot_broadcast) {
 		int was_periodic = clockevent_state_periodic(bc);

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

* Re: [PATCH 4.4 000/101] 4.4.42-stable review
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (95 preceding siblings ...)
  2017-01-10 13:37   ` [PATCH 4.4 101/101] tick/broadcast: Prevent NULL pointer dereference Greg Kroah-Hartman
@ 2017-01-10 17:34   ` Shuah Khan
  2017-01-10 22:26   ` Guenter Roeck
  97 siblings, 0 replies; 99+ messages in thread
From: Shuah Khan @ 2017-01-10 17:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, patches, ben.hutchings, stable, Shuah Khan

On 01/10/2017 06:36 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.42 release.
> There are 101 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Thu Jan 12 13:15:04 UTC 2017.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.42-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com

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

* Re: [PATCH 4.4 000/101] 4.4.42-stable review
  2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
                     ` (96 preceding siblings ...)
  2017-01-10 17:34   ` [PATCH 4.4 000/101] 4.4.42-stable review Shuah Khan
@ 2017-01-10 22:26   ` Guenter Roeck
  97 siblings, 0 replies; 99+ messages in thread
From: Guenter Roeck @ 2017-01-10 22:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuah.kh, patches, ben.hutchings, stable

On Tue, Jan 10, 2017 at 02:36:13PM +0100, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.4.42 release.
> There are 101 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Thu Jan 12 13:15:04 UTC 2017.
> Anything received after that time might be too late.
> 

Build results:
	total: 150 pass: 150 fail: 0
Qemu test results:
	total: 115 pass: 115 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

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

end of thread, other threads:[~2017-01-10 22:27 UTC | newest]

Thread overview: 99+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170110134113epcas3p4f03897bb91bfb9896af546cda8d12e7e@epcas3p4.samsung.com>
2017-01-10 13:36 ` [PATCH 4.4 000/101] 4.4.42-stable review Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 001/101] ALSA: hda - Fix up GPIO for ASUS ROG Ranger Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 002/101] ALSA: hda - Apply asus-mode8 fixup to ASUS X71SL Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 003/101] ALSA: usb-audio: Fix irq/process data synchronization Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 004/101] ARM: davinci: da850: dont add emac clock to lookup table twice Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 005/101] mac80211: initialize fast-xmit info later Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 006/101] KVM: x86: reset MMU on KVM_SET_VCPU_EVENTS Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 008/101] usb: musb: core: add clear_ep_rxintr() to musb_platform_ops Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 009/101] usb: musb: dsps: implement clear_ep_rxintr() callback Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 010/101] usb: storage: unusual_uas: Add JMicron JMS56x to unusual device Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 011/101] usb: gadgetfs: restrict upper bound on device configuration size Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 012/101] USB: gadgetfs: fix unbounded memory allocation bug Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 013/101] USB: gadgetfs: fix use-after-free bug Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 014/101] USB: gadgetfs: fix checks of wTotalLength in config descriptors Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 015/101] USB: fix problems with duplicate endpoint addresses Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 016/101] USB: dummy-hcd: fix bug in stop_activity (handle ep0) Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 017/101] usb: gadget: composite: Test get_alt() presence instead of set_alt() Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 018/101] usb: dwc3: core: avoid Overflow events Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 019/101] usb: xhci: fix possible wild pointer Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 020/101] xhci: workaround for hosts missing CAS bit Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 021/101] usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Apollo Lake Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 022/101] xhci: free xhci virtual devices with leaf nodes first Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 023/101] usb: xhci: fix return value of xhci_setup_device() Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 024/101] usb: host: xhci: Fix possible wild pointer when handling abort command Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 025/101] xhci: Handle command completion and timeout race Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 026/101] usb: xhci: hold lock over xhci_abort_cmd_ring() Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 027/101] USB: serial: omninet: fix NULL-derefs at open and disconnect Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 028/101] USB: serial: quatech2: fix sleep-while-atomic in close Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 029/101] USB: serial: pl2303: fix NULL-deref at open Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 030/101] USB: serial: keyspan_pda: verify endpoints at probe Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 031/101] USB: serial: spcp8x5: fix NULL-deref at open Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 032/101] USB: serial: io_ti: " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 033/101] USB: serial: io_ti: fix another " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 034/101] USB: serial: io_ti: fix I/O after disconnect Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 035/101] USB: serial: iuu_phoenix: fix NULL-deref at open Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 036/101] USB: serial: garmin_gps: fix memory leak on failed URB submit Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 037/101] USB: serial: ti_usb_3410_5052: fix NULL-deref at open Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 038/101] USB: serial: io_edgeport: " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 039/101] USB: serial: oti6858: " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 040/101] USB: serial: cyberjack: " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 041/101] USB: serial: kobil_sct: fix NULL-deref in write Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 042/101] USB: serial: mos7840: fix NULL-deref at open Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 043/101] USB: serial: mos7720: " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 044/101] USB: serial: mos7720: fix use-after-free on probe errors Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 045/101] USB: serial: mos7720: fix parport " Greg Kroah-Hartman
2017-01-10 13:36   ` [PATCH 4.4 046/101] USB: serial: mos7720: fix parallel probe Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 047/101] usb: xhci-mem: use passed in GFP flags instead of GFP_KERNEL Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 048/101] xhci: Use delayed_work instead of timer for command timeout Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 049/101] xhci: Fix race related to abort operation Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 050/101] usb: dwc3: pci: add Intel Gemini Lake PCI ID Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 051/101] usb: musb: Fix trying to free already-free IRQ 4 Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 054/101] ALSA: usb-audio: Fix bogus error return in snd_usb_create_stream() Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 055/101] USB: serial: kl5kusb105: abort on open exception path Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 056/101] ARM: dts: r8a7794: Correct hsusb parent clock Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 057/101] USB: phy: am335x-control: fix device and of_node leaks Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 058/101] USB: serial: io_ti: bind to interface after fw download Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 059/101] mei: bus: fix mei_cldev_enable KDoc Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 060/101] staging: iio: ad7606: fix improper setting of oversampling pins Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 061/101] usb: dwc3: gadget: always unmap EP0 requests Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 062/101] usb: dwc3: ep0: add dwc3_ep0_prepare_one_trb() Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 063/101] usb: dwc3: ep0: explicitly call dwc3_ep0_prepare_one_trb() Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 064/101] stable-fixup: hotplug: fix unused function warning Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 065/101] ath10k: use the right length of "background" Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 066/101] cris: Only build flash rescue image if CONFIG_ETRAX_AXISFLASHMAP is selected Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 067/101] hwmon: (scpi) Fix module autoload Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 068/101] hwmon: (amc6821) sign extension temperature Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 069/101] hwmon: (ds620) Fix overflows seen when writing temperature limits Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 070/101] hwmon: (nct7802) Fix overflows seen when writing into limit attributes Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 071/101] hwmon: (g762) Fix overflows and crash seen when writing " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 072/101] clk: clk-wm831x: fix a logic error Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 074/101] iommu/amd: Missing error code in amd_iommu_init_device() Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 075/101] iommu/amd: Fix the left value check of cmd buffer Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 076/101] iommu/vt-d: Fix pasid table size encoding Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 077/101] iommu/vt-d: Flush old iommu caches for kdump when the device gets context mapped Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 078/101] ASoC: samsung: i2s: Fixup last IRQ unsafe spin lock call Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 079/101] scsi: mvsas: fix command_active typo Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 080/101] target/iscsi: Fix double free in lio_target_tiqn_addtpg() Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 081/101] irqchip/bcm7038-l1: Implement irq_cpu_offline() callback Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 082/101] PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 083/101] mmc: mmc_test: Uninitialized return value Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 084/101] s390/crypto: unlock on error in prng_tdes_read() Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 085/101] crypto: arm64/sha2-ce - fix for big endian Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 086/101] crypto: arm64/ghash-ce " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 087/101] crypto: arm/aes-ce " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 088/101] crypto: arm64/aes-ccm-ce: " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 089/101] crypto: arm64/aes-neon - " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 090/101] crypto: arm64/sha1-ce " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 091/101] crypto: arm64/aes-xts-ce: " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 092/101] crypto: arm64/aes-ce - " Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 093/101] md: MD_RECOVERY_NEEDED is set for mddev->recovery Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 094/101] powerpc/pci/rpadlpar: Fix device reference leaks Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 095/101] staging: comedi: dt282x: tidy up register bit defines Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 096/101] cred/userns: define current_user_ns() as a function Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 097/101] net: ti: cpmac: Fix compiler warning due to type confusion Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 098/101] net: vxge: avoid unused function warnings Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 099/101] [media] cx23885-dvb: move initialization of a8293_pdata Greg Kroah-Hartman
2017-01-10 13:37   ` [PATCH 4.4 101/101] tick/broadcast: Prevent NULL pointer dereference Greg Kroah-Hartman
2017-01-10 17:34   ` [PATCH 4.4 000/101] 4.4.42-stable review Shuah Khan
2017-01-10 22:26   ` Guenter Roeck

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).