Skip to contentSkip to conversation

Linux 4.4.2

DISCUSSION Greg KH 7 participants 25 messages Feb 17, 2016 – Feb 29, 2016 Stable branch

lore
Share & tools
lore

Greg KH

author maintainer
#0 lore raw

I'm announcing the release of the 4.4.2 kernel.

All users of the 4.4 kernel series must upgrade.

The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.4.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h

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

 Makefile                                            |    2 
 arch/parisc/include/asm/hugetlb.h                   |   20 -
 arch/parisc/include/uapi/asm/siginfo.h              |    4 
 arch/parisc/mm/hugetlbpage.c                        |   60 +++-
 arch/x86/crypto/chacha20-ssse3-x86_64.S             |    6 
 block/blk-merge.c                                   |   31 ++
 crypto/af_alg.c                                     |   55 +++-
 crypto/ahash.c                                      |    5 
 crypto/algif_hash.c                                 |  169 ++++++++++++-
 crypto/algif_skcipher.c                             |  252 +++++++++++++++-----
 crypto/crc32c_generic.c                             |    1 
 crypto/crypto_user.c                                |    6 
 crypto/shash.c                                      |    5 
 crypto/skcipher.c                                   |    2 
 drivers/ata/ahci.c                                  |   20 +
 drivers/ata/libahci.c                               |    4 
 drivers/base/platform.c                             |   13 -
 drivers/block/zram/zcomp.c                          |    4 
 drivers/block/zram/zcomp_lz4.c                      |   23 +
 drivers/block/zram/zcomp_lzo.c                      |   23 +
 drivers/block/zram/zram_drv.c                       |    7 
 drivers/crypto/atmel-sha.c                          |   23 -
 drivers/crypto/caam/ctrl.c                          |    4 
 drivers/crypto/marvell/cesa.c                       |    2 
 drivers/crypto/sunxi-ss/sun4i-ss-core.c             |    2 
 drivers/hid/hid-multitouch.c                        |   15 +
 drivers/hid/usbhid/hid-core.c                       |    4 
 drivers/iommu/io-pgtable-arm.c                      |   11 
 drivers/md/md.c                                     |   28 +-
 drivers/md/md.h                                     |    2 
 drivers/md/multipath.c                              |    6 
 drivers/md/raid1.c                                  |    6 
 drivers/md/raid10.c                                 |    6 
 drivers/media/i2c/ir-kbd-i2c.c                      |    1 
 drivers/media/pci/saa7134/saa7134-alsa.c            |    5 
 drivers/mtd/nand/nand_base.c                        |    3 
 drivers/net/wireless/realtek/rtlwifi/regd.c         |    2 
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c |    9 
 drivers/net/wireless/ti/wlcore/io.h                 |   10 
 drivers/net/wireless/ti/wlcore/spi.c                |   10 
 drivers/pci/bus.c                                   |    6 
 drivers/pci/host/pci-dra7xx.c                       |    3 
 drivers/pci/host/pci-exynos.c                       |    3 
 drivers/pci/host/pci-imx6.c                         |    3 
 drivers/pci/host/pci-tegra.c                        |    2 
 drivers/pci/host/pcie-rcar.c                        |    6 
 drivers/pci/host/pcie-spear13xx.c                   |    3 
 drivers/pci/host/pcie-xilinx.c                      |    3 
 drivers/tty/n_tty.c                                 |    7 
 drivers/tty/tty_io.c                                |   44 +++
 drivers/tty/tty_mutex.c                             |    8 
 drivers/usb/class/cdc-acm.c                         |    9 
 drivers/usb/class/cdc-acm.h                         |    1 
 drivers/usb/core/hub.c                              |    8 
 drivers/usb/host/xhci-pci.c                         |   52 ++--
 drivers/usb/phy/phy-msm-usb.c                       |   37 +-
 drivers/usb/serial/cp210x.c                         |    1 
 drivers/usb/serial/ftdi_sio.c                       |    1 
 drivers/usb/serial/ftdi_sio_ids.h                   |    1 
 drivers/usb/serial/option.c                         |   18 +
 drivers/usb/serial/visor.c                          |   11 
 fs/ext4/crypto_key.c                                |    4 
 fs/nfs/nfs4proc.c                                   |    1 
 fs/ocfs2/dlm/dlmmaster.c                            |   26 +-
 fs/ocfs2/dlm/dlmrecovery.c                          |    2 
 fs/ocfs2/dlmglue.c                                  |    6 
 include/crypto/hash.h                               |    6 
 include/crypto/if_alg.h                             |   11 
 include/crypto/skcipher.h                           |    7 
 include/linux/console.h                             |    1 
 include/linux/hrtimer.h                             |   34 ++
 include/linux/tty.h                                 |    1 
 include/sound/rawmidi.h                             |    4 
 kernel/panic.c                                      |    3 
 kernel/printk/printk.c                              |   35 ++
 kernel/sched/core.c                                 |    2 
 kernel/time/hrtimer.c                               |   55 ++--
 kernel/time/timer_list.c                            |    2 
 kernel/trace/trace.c                                |    2 
 kernel/trace/trace_stack.c                          |    7 
 lib/libcrc32c.c                                     |    1 
 mm/backing-dev.c                                    |    2 
 mm/zsmalloc.c                                       |   14 +
 security/integrity/evm/evm_main.c                   |    3 
 sound/core/compress_offload.c                       |   11 
 sound/core/oss/pcm_oss.c                            |   21 +
 sound/core/rawmidi.c                                |  134 +++++++---
 sound/core/seq/oss/seq_oss_init.c                   |    2 
 sound/core/seq/oss/seq_oss_synth.c                  |    2 
 sound/core/seq/seq_clientmgr.c                      |    3 
 sound/core/seq/seq_ports.c                          |  233 ++++++++++--------
 sound/core/seq/seq_timer.c                          |   87 +++++-
 sound/core/seq/seq_virmidi.c                        |   23 +
 sound/core/timer.c                                  |   98 ++++---
 sound/drivers/dummy.c                               |   35 +-
 sound/firewire/bebob/bebob_stream.c                 |   14 -
 sound/isa/Kconfig                                   |    4 
 sound/pci/Kconfig                                   |    3 
 sound/pci/hda/hda_generic.c                         |   91 +++++--
 sound/pci/hda/hda_intel.c                           |   13 +
 sound/pci/hda/hda_jack.c                            |    2 
 sound/pci/hda/hda_jack.h                            |    2 
 sound/pci/hda/patch_ca0132.c                        |    5 
 sound/pci/hda/patch_cirrus.c                        |   27 ++
 sound/pci/hda/patch_hdmi.c                          |    5 
 sound/pci/hda/patch_realtek.c                       |   85 ++++++
 sound/pci/hda/patch_sigmatel.c                      |    6 
 sound/soc/codecs/rt5645.c                           |    2 
 sound/soc/soc-pcm.c                                 |    3 
 sound/sparc/Kconfig                                 |    1 
 sound/usb/midi.c                                    |    1 
 sound/usb/quirks.c                                  |   18 +
 112 files changed, 1680 insertions(+), 568 deletions(-)

Alexandra Yates (1):
ahci: Intel DNV device IDs SATA

Andrey Konovalov (1):
ALSA: usb-audio: avoid freeing umidi object twice

Bard Liao (1):
ASoC: rt5645: fix the shift bit of IN1 boost

Benjamin Tissoires (1):
HID: multitouch: fix input mode switching on some Elan panels

Boris BREZILLON (1):
crypto: marvell/cesa - fix test in mv_cesa_dev_dma_init()

Brian Norris (1):
mtd: nand: assign reasonable default name for NAND drivers

Christoph Biedl (1):
PCI: Fix minimum allocation address overwrite

Cyrille Pitchen (2):
crypto: atmel-sha - fix atmel_sha_remove()
crypto: atmel-sha - remove calls of clk_prepare() from atomic contexts

Dan Williams (1):
md/raid: only permit hot-add of compatible integrity profiles

Daniele Palmas (1):
USB: serial: option: Adding support for Telit LE922

David Henningsson (1):
ALSA: hda - Fix static checker warning in patch_hdmi.c

Du, Changbin (1):
usb: hub: do not clear BOS field during reset device

Eli Cooper (1):
crypto: chacha20-ssse3 - Align stack pointer to 64 bytes

Greg Kroah-Hartman (2):
USB: serial: ftdi_sio: add support for Yaesu SCU-18 cable Linux 4.4.2

Grygorii Strashko (1):
PCI: host: Mark PCIe/PCI (MSI) IRQ cascade handlers as IRQF_NO_THREAD

Guillaume Fougnies (1):

      ALSA: usb-audio: Fix TEAC UD-501/UD-503/NT-503 usb delay

Helge Deller (2):
parisc: Protect huge page pte changes with spinlocks
parisc: Fix __ARCH_SI_PREAMBLE_SIZE

Herbert Xu (21):
crypto: algif_skcipher - Require setkey before accept(2)
crypto: af_alg - Disallow bind/setkey/... after accept(2)
crypto: af_alg - Fix socket double-free when accept fails
crypto: af_alg - Add nokey compatibility path
crypto: algif_skcipher - Add nokey compatibility path
crypto: hash - Add crypto_ahash_has_setkey
crypto: algif_hash - Require setkey before accept(2)
crypto: skcipher - Add crypto_skcipher_has_setkey
crypto: algif_skcipher - Add key check exception for cipher_null
crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path
crypto: algif_hash - Remove custom release parent function
crypto: algif_skcipher - Remove custom release parent function
crypto: af_alg - Forbid bind(2) when nokey child sockets are present
crypto: algif_hash - Fix race condition in hash_check_key
crypto: algif_skcipher - Fix race condition in skcipher_check_key
crypto: algif_skcipher - Load TX SG list after waiting
crypto: algif_skcipher - sendmsg SG marking is off by one
crypto: shash - Fix has_key setting
crypto: algif_skcipher - Do not assume that req is unchanged
crypto: algif_skcipher - Do not dereference ctx without socket lock
crypto: algif_skcipher - Do not set MAY_BACKLOG on the async path

Horia Geant? (1):
crypto: caam - make write transactions bufferable on PPC platforms

Ioan-Adrian Ratiu (1):
HID: usbhid: fix recursive deadlock

Javier Martinez Canillas (1):
media: i2c: Don't export ir-kbd-i2c module alias

Jean Delvare (1):
crypto: crc32c - Fix crc32c soft dependency

Jerome Marchand (1):
zram: don't call idr_remove() from zram_remove()

Johan Hovold (1):
USB: visor: fix null-deref at probe

John Ernberg (1):
USB: option: fix Cinterion AHxx enumeration

Junil Lee (1):
zsmalloc: fix migrate_zspage-zs_free race condition

Jurgen Kramer (2):
ALSA: usb-audio: Fix OPPO HA-1 vendor ID
ALSA: usb-audio: Add native DSD support for PS Audio NuWave DAC

Kailang Yang (3):
ALSA: hda/realtek - New codec support of ALC225
ALSA: hda/realtek - Support headset mode for ALC225
ALSA: hda/realtek - Support Dell headset mode for ALC225

Keith Busch (1):
block: split bios to max possible length

Kyeongdon Kim (1):
zram: try vmalloc() after kmalloc()

LABBE Corentin (1):
crypto: sun4i-ss - add missing statesize

Larry Finger (2):
rtlwifi: rtl8821ae: Fix errors in parameter initialization
rtlwifi: rtl8821ae: Fix 5G failure when EEPROM is incorrectly encoded

Lev Lybin (1):
ALSA: usb-audio: Add quirk for Microsoft LifeCam HD-6000

Libin Yang (1):
ALSA: hda - disable dynamic clock gating on Broxton before reset

Lu Baolu (4):
usb: cdc-acm: handle unlinked urb in acm read callback
usb: cdc-acm: send zero packet for intel 7260 modem
usb: xhci: handle both SSIC ports in PME stuck quirk
usb: xhci: apply XHCI_PME_STUCK_QUIRK to Intel Broxton-M platforms

Lucas Tanure (1):
ALSA: bebob: Use a signed return type for get_formation_index

Martin Wilck (1):
base/platform: Fix platform drivers with no probe callback

Mathias Krause (1):
crypto: user - lock crypto_alg_list on alg dump

Mauro Carvalho Chehab (1):
saa7134-alsa: Only frees registered sound cards

Ming Lei (1):
block: fix bio splitting on max sectors

Peter Dedecker (1):

      USB: cp210x: add ID for IAI USB to RS485 adaptor

Peter Hurley (4):
n_tty: Fix unsafe reference to "other" ldisc
tty: Wait interruptibly for tty lock on reopen
tty: Retry failed reopen if tty teardown in-progress
tty: Fix unsafe ldisc reference via ioctl(TIOCGETD)

Raghavendra K T (1):
sched: Fix crash in sched_init_numa()

Ryan Ware (1):
EVM: Use crypto_memneq() for digest comparisons

Sergey Senozhatsky (1):
zram/zcomp: use GFP_NOIO to allocate streams

Srinivas Kandagatla (1):
usb: phy: msm: fix error handling in probe.

Steven Rostedt (1):
tracing/stacktrace: Show entire trace if passed in function not found

Steven Rostedt (Red Hat) (1):
tracing: Fix stacktrace skip depth in trace_buffer_unlock_commit_regs()

Takashi Iwai (24):
ALSA: hda - Implement loopback control switch for Realtek and other codecs
ALSA: Add missing dependency on CONFIG_SND_TIMER
ALSA: compress: Disable GET_CODEC_CAPS ioctl for some architectures
ALSA: dummy: Disable switching timer backend via sysfs
ALSA: seq: Fix incorrect sanity check at snd_seq_oss_synth_cleanup()
ALSA: seq: Degrade the error message for too many opens
ALSA: rawmidi: Make snd_rawmidi_transmit() race-free
ALSA: rawmidi: Remove kernel WARNING for NULL user-space buffer check
ALSA: rawmidi: Fix race at copying & updating the position
ALSA: pcm: Fix potential deadlock in OSS emulation
ALSA: seq: Fix yet another races among ALSA timer accesses
ALSA: seq: Fix race at closing in virmidi driver
ALSA: seq: Fix lockdep warnings due to double mutex locks
ALSA: timer: Code cleanup
ALSA: timer: Fix leftover link at closing
ALSA: timer: Fix link corruption due to double start or stop
ALSA: timer: Fix race at concurrent reads
ALSA: timer: Fix wrong instance passed to slave callbacks
ALSA: timer: Fix race between stop and interrupt
ALSA: hda - Add fixup for Mac Mini 7,1 model
Revert "ALSA: hda - Fix noise on Gigabyte Z170X mobo"
ALSA: hda - Fix speaker output from VAIO AiO machines
ALSA: hda - Fix bad dereference of jack object
ALSA: dummy: Implement timer backend switching more safely

Tariq Saeed (1):
ocfs2: NFS hangs in __ocfs2_cluster_lock due to race with ocfs2_unblock_lock

Tejun Heo (2):
printk: do cond_resched() between lines while outputting to consoles
libata: disable forced PORTS_IMPL for >= AHCI 1.3

Tetsuo Handa (1):
mm, vmstat: fix wrong WQ sleep when memory reclaim doesn't make any progress

Theodore Ts'o (1):
ext4 crypto: add missing locking for keyring_key access

Thomas Gleixner (1):
hrtimer: Handle remaining time proper for TIME_LOW_RES

Trond Myklebust (1):

      NFSv4.1/pnfs: Fixup an lo->plh_block_lgets imbalance in layoutreturn

Uri Mashiach (2):
wlcore/wl12xx: spi: fix oops on firmware load wlcore/wl12xx: spi: fix NULL pointer dereference (Oops)

Vinod Koul (1):
ASoC: dpcm: fix the BE state on hw_free

Vladis Dronov (1):
USB: serial: visor: fix crash on detecting device without write_urbs

Wang, Rui Y (1):
crypto: algif_hash - wait for crypto_ahash_init() to complete

Will Deacon (1):
iommu/io-pgtable-arm: Ensure we free the final level on teardown

xuejiufei (2):
ocfs2/dlm: ignore cleaning the migration mle that is inuse ocfs2/dlm: clear refmap bit of recovery lock while doing local recovery cleanup

author maintainer
#1 lore raw
Makefile +1 -1
index c6a265b52c93..e7a2958eb771 100644
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 1
+SUBLEVEL = 2
 EXTRAVERSION =
 NAME = Blurry Fish Butt
 
arch/parisc/include/asm/hugetlb.h +4 -16
index 7d56a9ccb752..a65d888716c4 100644
@@ -54,24 +54,12 @@ static inline pte_t huge_pte_wrprotect(pte_t pte)
 	return pte_wrprotect(pte);
 }
 
-static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
-					   unsigned long addr, pte_t *ptep)
-{
-	pte_t old_pte = *ptep;
-	set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
-}
+void huge_ptep_set_wrprotect(struct mm_struct *mm,
+					   unsigned long addr, pte_t *ptep);
 
-static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
+int huge_ptep_set_access_flags(struct vm_area_struct *vma,
 					     unsigned long addr, pte_t *ptep,
-					     pte_t pte, int dirty)
-{
-	int changed = !pte_same(*ptep, pte);
-	if (changed) {
-		set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
-		flush_tlb_page(vma, addr);
-	}
-	return changed;
-}
+					     pte_t pte, int dirty);
 
 static inline pte_t huge_ptep_get(pte_t *ptep)
 {
arch/parisc/include/uapi/asm/siginfo.h +4 -0
index d7034728f377..1c75565d984b 100644
@@ -1,6 +1,10 @@
 #ifndef _PARISC_SIGINFO_H
 #define _PARISC_SIGINFO_H
 
+#if defined(__LP64__)
+#define __ARCH_SI_PREAMBLE_SIZE   (4 * sizeof(int))
+#endif
+
 #include <asm-generic/siginfo.h>
 
 #undef NSIGTRAP
arch/parisc/mm/hugetlbpage.c +48 -12

95 lines not on this page · raw message

arch/x86/crypto/chacha20-ssse3-x86_64.S +4 -2
index 712b13047b41..3a33124e9112 100644
@@ -157,7 +157,9 @@ ENTRY(chacha20_4block_xor_ssse3)
 	# done with the slightly better performing SSSE3 byte shuffling,
 	# 7/12-bit word rotation uses traditional shift+OR.
 
-	sub		$0x40,%rsp
+	mov		%rsp,%r11
+	sub		$0x80,%rsp
+	and		$~63,%rsp
 
 	# x0..15[0-3] = s0..3[0..3]
 	movq		0x00(%rdi),%xmm1
@@ -620,6 +622,6 @@ ENTRY(chacha20_4block_xor_ssse3)
 	pxor		%xmm1,%xmm15
 	movdqu		%xmm15,0xf0(%rsi)
 
-	add		$0x40,%rsp
+	mov		%r11,%rsp
 	ret
 ENDPROC(chacha20_4block_xor_ssse3)
block/blk-merge.c +28 -3
index e01405a3e8b3..b966db8f3556 100644
@@ -68,6 +68,18 @@ static struct bio *blk_bio_write_same_split(struct request_queue *q,
 	return bio_split(bio, q->limits.max_write_same_sectors, GFP_NOIO, bs);
 }
 
+static inline unsigned get_max_io_size(struct request_queue *q,
+				       struct bio *bio)
+{
+	unsigned sectors = blk_max_size_offset(q, bio->bi_iter.bi_sector);
+	unsigned mask = queue_logical_block_size(q) - 1;
+
+	/* aligned to logical block size */
+	sectors &= ~(mask >> 9);
+
+	return sectors;
+}
+
 static struct bio *blk_bio_segment_split(struct request_queue *q,
 					 struct bio *bio,
 					 struct bio_set *bs,
@@ -79,11 +91,9 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
 	unsigned front_seg_size = bio->bi_seg_front_size;
 	bool do_split = true;
 	struct bio *new = NULL;
+	const unsigned max_sectors = get_max_io_size(q, bio);
 
 	bio_for_each_segment(bv, bio, iter) {
-		if (sectors + (bv.bv_len >> 9) > queue_max_sectors(q))
-			goto split;
-
 		/*
 		 * If the queue doesn't support SG gaps and adding this
 		 * offset would create a gap, disallow it.
@@ -91,6 +101,21 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
 		if (bvprvp && bvec_gap_to_prev(q, bvprvp, bv.bv_offset))
 			goto split;
 
+		if (sectors + (bv.bv_len >> 9) > max_sectors) {
+			/*
+			 * Consider this a new segment if we're splitting in
+			 * the middle of this vector.
+			 */
+			if (nsegs < queue_max_segments(q) &&
+			    sectors < max_sectors) {
+				nsegs++;
+				sectors = max_sectors;
+			}
+			if (sectors)
+				goto split;
+			/* Make this single bvec as the 1st segment */
+		}
+
 		if (bvprvp && blk_queue_cluster(q)) {
 			if (seg_size + bv.bv_len > queue_max_segment_size(q))
 				goto new_segment;
crypto/af_alg.c +49 -6

120 lines not on this page · raw message

crypto/ahash.c +4 -1
index 9c1dc8d6106a..d19b52324cf5 100644
@@ -451,6 +451,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 	struct ahash_alg *alg = crypto_ahash_alg(hash);
 
 	hash->setkey = ahash_nosetkey;
+	hash->has_setkey = false;
 	hash->export = ahash_no_export;
 	hash->import = ahash_no_import;
 
@@ -463,8 +464,10 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
 	hash->finup = alg->finup ?: ahash_def_finup;
 	hash->digest = alg->digest;
 
-	if (alg->setkey)
+	if (alg->setkey) {
 		hash->setkey = alg->setkey;
+		hash->has_setkey = true;
+	}
 	if (alg->export)
 		hash->export = alg->export;
 	if (alg->import)
crypto/algif_hash.c +161 -8

230 lines not on this page · raw message

crypto/algif_skcipher.c +198 -54

400 lines not on this page · raw message

crypto/crc32c_generic.c +0 -1
index 06f1b60f02b2..4c0a0e271876 100644
@@ -172,4 +172,3 @@ MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations wrapper for lib/crc32c");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS_CRYPTO("crc32c");
 MODULE_ALIAS_CRYPTO("crc32c-generic");
-MODULE_SOFTDEP("pre: crc32c");
crypto/crypto_user.c +5 -1
index 237f3795cfaa..43fe85f20d57 100644
@@ -499,6 +499,7 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 		if (link->dump == NULL)
 			return -EINVAL;
 
+		down_read(&crypto_alg_sem);
 		list_for_each_entry(alg, &crypto_alg_list, cra_list)
 			dump_alloc += CRYPTO_REPORT_MAXSIZE;
 
@@ -508,8 +509,11 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 				.done = link->done,
 				.min_dump_alloc = dump_alloc,
 			};
-			return netlink_dump_start(crypto_nlsk, skb, nlh, &c);
+			err = netlink_dump_start(crypto_nlsk, skb, nlh, &c);
 		}
+		up_read(&crypto_alg_sem);
+
+		return err;
 	}
 
 	err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX,
crypto/shash.c +3 -2
index ecb1e3d39bf0..359754591653 100644
@@ -354,9 +354,10 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
 	crt->final = shash_async_final;
 	crt->finup = shash_async_finup;
 	crt->digest = shash_async_digest;
+	crt->setkey = shash_async_setkey;
+
+	crt->has_setkey = alg->setkey != shash_no_setkey;
 
-	if (alg->setkey)
-		crt->setkey = shash_async_setkey;
 	if (alg->export)
 		crt->export = shash_async_export;
 	if (alg->import)
crypto/skcipher.c +2 -0
index 7591928be7ca..d199c0b1751c 100644
@@ -118,6 +118,7 @@ static int crypto_init_skcipher_ops_blkcipher(struct crypto_tfm *tfm)
 	skcipher->decrypt = skcipher_decrypt_blkcipher;
 
 	skcipher->ivsize = crypto_blkcipher_ivsize(blkcipher);
+	skcipher->has_setkey = calg->cra_blkcipher.max_keysize;
 
 	return 0;
 }
@@ -210,6 +211,7 @@ static int crypto_init_skcipher_ops_ablkcipher(struct crypto_tfm *tfm)
 	skcipher->ivsize = crypto_ablkcipher_ivsize(ablkcipher);
 	skcipher->reqsize = crypto_ablkcipher_reqsize(ablkcipher) +
 			    sizeof(struct ablkcipher_request);
+	skcipher->has_setkey = calg->cra_ablkcipher.max_keysize;
 
 	return 0;
 }
drivers/ata/ahci.c +20 -0
index cdfbcc54821f..99921aa0daca 100644
@@ -264,6 +264,26 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 	{ PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */
 	{ PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */
 	{ PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b2), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b3), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b4), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b5), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b6), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19b7), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19bE), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19bF), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c0), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c1), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c2), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c3), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c4), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c5), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c6), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19c7), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */
+	{ PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */
 	{ PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */
 	{ PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */
 	{ PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */
drivers/ata/libahci.c +2 -2
index 4665512dae44..1f225cc1827f 100644
@@ -495,8 +495,8 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
 		}
 	}
 
-	/* fabricate port_map from cap.nr_ports */
-	if (!port_map) {
+	/* fabricate port_map from cap.nr_ports for < AHCI 1.3 */
+	if (!port_map && vers < 0x10300) {
 		port_map = (1 << ahci_nr_ports(cap)) - 1;
 		dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map);
 
drivers/base/platform.c +9 -4
index 1dd6d3bf1098..176b59f5bc47 100644
@@ -513,10 +513,15 @@ static int platform_drv_probe(struct device *_dev)
 		return ret;
 
 	ret = dev_pm_domain_attach(_dev, true);
-	if (ret != -EPROBE_DEFER && drv->probe) {
-		ret = drv->probe(dev);
-		if (ret)
-			dev_pm_domain_detach(_dev, true);
+	if (ret != -EPROBE_DEFER) {
+		if (drv->probe) {
+			ret = drv->probe(dev);
+			if (ret)
+				dev_pm_domain_detach(_dev, true);
+		} else {
+			/* don't fail if just dev_pm_domain_attach failed */
+			ret = 0;
+		}
 	}
 
 	if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
drivers/block/zram/zcomp.c +2 -2
index 5cb13ca3a3ac..c53617752b93 100644
@@ -76,7 +76,7 @@ static void zcomp_strm_free(struct zcomp *comp, struct zcomp_strm *zstrm)
  */
 static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp)
 {
-	struct zcomp_strm *zstrm = kmalloc(sizeof(*zstrm), GFP_KERNEL);
+	struct zcomp_strm *zstrm = kmalloc(sizeof(*zstrm), GFP_NOIO);
 	if (!zstrm)
 		return NULL;
 
@@ -85,7 +85,7 @@ static struct zcomp_strm *zcomp_strm_alloc(struct zcomp *comp)
 	 * allocate 2 pages. 1 for compressed data, plus 1 extra for the
 	 * case when compressed size is larger than the original one
 	 */
-	zstrm->buffer = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
+	zstrm->buffer = (void *)__get_free_pages(GFP_NOIO | __GFP_ZERO, 1);
 	if (!zstrm->private || !zstrm->buffer) {
 		zcomp_strm_free(comp, zstrm);
 		zstrm = NULL;
drivers/block/zram/zcomp_lz4.c +21 -2
index f2afb7e988c3..dd6083124276 100644
@@ -10,17 +10,36 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/lz4.h>
+#include <linux/vmalloc.h>
+#include <linux/mm.h>
 
 #include "zcomp_lz4.h"
 
 static void *zcomp_lz4_create(void)
 {
-	return kzalloc(LZ4_MEM_COMPRESS, GFP_KERNEL);
+	void *ret;
+
+	/*
+	 * This function can be called in swapout/fs write path
+	 * so we can't use GFP_FS|IO. And it assumes we already
+	 * have at least one stream in zram initialization so we
+	 * don't do best effort to allocate more stream in here.
+	 * A default stream will work well without further multiple
+	 * streams. That's why we use NORETRY | NOWARN.
+	 */
+	ret = kzalloc(LZ4_MEM_COMPRESS, GFP_NOIO | __GFP_NORETRY |
+					__GFP_NOWARN);
+	if (!ret)
+		ret = __vmalloc(LZ4_MEM_COMPRESS,
+				GFP_NOIO | __GFP_NORETRY | __GFP_NOWARN |
+				__GFP_ZERO | __GFP_HIGHMEM,
+				PAGE_KERNEL);
+	return ret;
 }
 
 static void zcomp_lz4_destroy(void *private)
 {
-	kfree(private);
+	kvfree(private);
 }
 
 static int zcomp_lz4_compress(const unsigned char *src, unsigned char *dst,
drivers/block/zram/zcomp_lzo.c +21 -2
index da1bc47d588e..edc549920fa0 100644
@@ -10,17 +10,36 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/lzo.h>
+#include <linux/vmalloc.h>
+#include <linux/mm.h>
 
 #include "zcomp_lzo.h"
 
 static void *lzo_create(void)
 {
-	return kzalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
+	void *ret;
+
+	/*
+	 * This function can be called in swapout/fs write path
+	 * so we can't use GFP_FS|IO. And it assumes we already
+	 * have at least one stream in zram initialization so we
+	 * don't do best effort to allocate more stream in here.
+	 * A default stream will work well without further multiple
+	 * streams. That's why we use NORETRY | NOWARN.
+	 */
+	ret = kzalloc(LZO1X_MEM_COMPRESS, GFP_NOIO | __GFP_NORETRY |
+					__GFP_NOWARN);
+	if (!ret)
+		ret = __vmalloc(LZO1X_MEM_COMPRESS,
+				GFP_NOIO | __GFP_NORETRY | __GFP_NOWARN |
+				__GFP_ZERO | __GFP_HIGHMEM,
+				PAGE_KERNEL);
+	return ret;
 }
 
 static void lzo_destroy(void *private)
 {
-	kfree(private);
+	kvfree(private);
 }
 
 static int lzo_compress(const unsigned char *src, unsigned char *dst,
drivers/block/zram/zram_drv.c +4 -3
index 47915d736f8d..370c2f76016d 100644
@@ -1325,7 +1325,6 @@ static int zram_remove(struct zram *zram)
 
 	pr_info("Removed device: %s\n", zram->disk->disk_name);
 
-	idr_remove(&zram_index_idr, zram->disk->first_minor);
 	blk_cleanup_queue(zram->disk->queue);
 	del_gendisk(zram->disk);
 	put_disk(zram->disk);
@@ -1367,10 +1366,12 @@ static ssize_t hot_remove_store(struct class *class,
 	mutex_lock(&zram_index_mutex);
 
 	zram = idr_find(&zram_index_idr, dev_id);
-	if (zram)
+	if (zram) {
 		ret = zram_remove(zram);
-	else
+		idr_remove(&zram_index_idr, dev_id);
+	} else {
 		ret = -ENODEV;
+	}
 
 	mutex_unlock(&zram_index_mutex);
 	return ret ? ret : count;
drivers/crypto/atmel-sha.c +12 -11
index 660d8c06540b..3178f84d2757 100644
@@ -783,7 +783,7 @@ static void atmel_sha_finish_req(struct ahash_request *req, int err)
 	dd->flags &= ~(SHA_FLAGS_BUSY | SHA_FLAGS_FINAL | SHA_FLAGS_CPU |
 			SHA_FLAGS_DMA_READY | SHA_FLAGS_OUTPUT_READY);
 
-	clk_disable_unprepare(dd->iclk);
+	clk_disable(dd->iclk);
 
 	if (req->base.complete)
 		req->base.complete(&req->base, err);
@@ -796,7 +796,7 @@ static int atmel_sha_hw_init(struct atmel_sha_dev *dd)
 {
 	int err;
 
-	err = clk_prepare_enable(dd->iclk);
+	err = clk_enable(dd->iclk);
 	if (err)
 		return err;
 
@@ -823,7 +823,7 @@ static void atmel_sha_hw_version_init(struct atmel_sha_dev *dd)
 	dev_info(dd->dev,
 			"version: 0x%x\n", dd->hw_version);
 
-	clk_disable_unprepare(dd->iclk);
+	clk_disable(dd->iclk);
 }
 
 static int atmel_sha_handle_queue(struct atmel_sha_dev *dd,
@@ -1411,6 +1411,10 @@ static int atmel_sha_probe(struct platform_device *pdev)
 		goto res_err;
 	}
 
+	err = clk_prepare(sha_dd->iclk);
+	if (err)
+		goto res_err;
+
 	atmel_sha_hw_version_init(sha_dd);
 
 	atmel_sha_get_cap(sha_dd);
@@ -1422,12 +1426,12 @@ static int atmel_sha_probe(struct platform_device *pdev)
 			if (IS_ERR(pdata)) {
 				dev_err(&pdev->dev, "platform data not available\n");
 				err = PTR_ERR(pdata);
-				goto res_err;
+				goto iclk_unprepare;
 			}
 		}
 		if (!pdata->dma_slave) {
 			err = -ENXIO;
-			goto res_err;
+			goto iclk_unprepare;
 		}
 		err = atmel_sha_dma_init(sha_dd, pdata);
 		if (err)
@@ -1458,6 +1462,8 @@ err_algs:
 	if (sha_dd->caps.has_dma)
 		atmel_sha_dma_cleanup(sha_dd);
 err_sha_dma:
+iclk_unprepare:
+	clk_unprepare(sha_dd->iclk);
 res_err:
 	tasklet_kill(&sha_dd->done_task);
 sha_dd_err:
@@ -1484,12 +1490,7 @@ static int atmel_sha_remove(struct platform_device *pdev)
 	if (sha_dd->caps.has_dma)
 		atmel_sha_dma_cleanup(sha_dd);
 
-	iounmap(sha_dd->io_base);
-
-	clk_put(sha_dd->iclk);
-
-	if (sha_dd->irq >= 0)
-		free_irq(sha_dd->irq, sha_dd);
+	clk_unprepare(sha_dd->iclk);
 
 	return 0;
 }
drivers/crypto/caam/ctrl.c +2 -2
index 8abb4bc548cc..69d4a1326fee 100644
@@ -534,8 +534,8 @@ static int caam_probe(struct platform_device *pdev)
 	 * long pointers in master configuration register
 	 */
 	clrsetbits_32(&ctrl->mcr, MCFGR_AWCACHE_MASK, MCFGR_AWCACHE_CACH |
-		      MCFGR_WDENABLE | (sizeof(dma_addr_t) == sizeof(u64) ?
-					MCFGR_LONG_PTR : 0));
+		      MCFGR_AWCACHE_BUFF | MCFGR_WDENABLE |
+		      (sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0));
 
 	/*
 	 *  Read the Compile Time paramters and SCFGR to determine
drivers/crypto/marvell/cesa.c +1 -1
index 0643e3366e33..c0656e7f37b5 100644
@@ -306,7 +306,7 @@ static int mv_cesa_dev_dma_init(struct mv_cesa_dev *cesa)
 		return -ENOMEM;
 
 	dma->padding_pool = dmam_pool_create("cesa_padding", dev, 72, 1, 0);
-	if (!dma->cache_pool)
+	if (!dma->padding_pool)
 		return -ENOMEM;
 
 	cesa->dma = dma;
drivers/crypto/sunxi-ss/sun4i-ss-core.c +2 -0
index eab6fe227fa0..107cd2a41cae 100644
@@ -39,6 +39,7 @@ static struct sun4i_ss_alg_template ss_algs[] = {
 		.import = sun4i_hash_import_md5,
 		.halg = {
 			.digestsize = MD5_DIGEST_SIZE,
+			.statesize = sizeof(struct md5_state),
 			.base = {
 				.cra_name = "md5",
 				.cra_driver_name = "md5-sun4i-ss",
@@ -66,6 +67,7 @@ static struct sun4i_ss_alg_template ss_algs[] = {
 		.import = sun4i_hash_import_sha1,
 		.halg = {
 			.digestsize = SHA1_DIGEST_SIZE,
+			.statesize = sizeof(struct sha1_state),
 			.base = {
 				.cra_name = "sha1",
 				.cra_driver_name = "sha1-sun4i-ss",
drivers/hid/hid-multitouch.c +13 -2
index 3d664d01305e..2b8ff18d3713 100644
@@ -357,8 +357,19 @@ static void mt_feature_mapping(struct hid_device *hdev,
 			break;
 		}
 
-		td->inputmode = field->report->id;
-		td->inputmode_index = usage->usage_index;
+		if (td->inputmode < 0) {
+			td->inputmode = field->report->id;
+			td->inputmode_index = usage->usage_index;
+		} else {
+			/*
+			 * Some elan panels wrongly declare 2 input mode
+			 * features, and silently ignore when we set the
+			 * value in the second field. Skip the second feature
+			 * and hope for the best.
+			 */
+			dev_info(&hdev->dev,
+				 "Ignoring the extra HID_DG_INPUTMODE\n");
+		}
 
 		break;
 	case HID_DG_CONTACTMAX:
drivers/hid/usbhid/hid-core.c +2 -2
index 36712e9f56c2..5dd426fee8cc 100644
@@ -477,8 +477,6 @@ static void hid_ctrl(struct urb *urb)
 	struct usbhid_device *usbhid = hid->driver_data;
 	int unplug = 0, status = urb->status;
 
-	spin_lock(&usbhid->lock);
-
 	switch (status) {
 	case 0:			/* success */
 		if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
@@ -498,6 +496,8 @@ static void hid_ctrl(struct urb *urb)
 		hid_warn(urb->dev, "ctrl urb status %d received\n", status);
 	}
 
+	spin_lock(&usbhid->lock);
+
 	if (unplug) {
 		usbhid->ctrltail = usbhid->ctrlhead;
 	} else {
drivers/iommu/io-pgtable-arm.c +6 -5
index 7df97777662d..dad768caa9c5 100644
@@ -405,17 +405,18 @@ static void __arm_lpae_free_pgtable(struct arm_lpae_io_pgtable *data, int lvl,
 	arm_lpae_iopte *start, *end;
 	unsigned long table_size;
 
-	/* Only leaf entries at the last level */
-	if (lvl == ARM_LPAE_MAX_LEVELS - 1)
-		return;
-
 	if (lvl == ARM_LPAE_START_LVL(data))
 		table_size = data->pgd_size;
 	else
 		table_size = 1UL << data->pg_shift;
 
 	start = ptep;
-	end = (void *)ptep + table_size;
+
+	/* Only leaf entries at the last level */
+	if (lvl == ARM_LPAE_MAX_LEVELS - 1)
+		end = ptep;
+	else
+		end = (void *)ptep + table_size;
 
 	while (ptep != end) {
 		arm_lpae_iopte pte = *ptep++;
drivers/md/md.c +16 -12
index 61aacab424cf..b1e1f6b95782 100644
@@ -2017,28 +2017,32 @@ int md_integrity_register(struct mddev *mddev)
 }
 EXPORT_SYMBOL(md_integrity_register);
 
-/* Disable data integrity if non-capable/non-matching disk is being added */
-void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev)
+/*
+ * Attempt to add an rdev, but only if it is consistent with the current
+ * integrity profile
+ */
+int md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev)
 {
 	struct blk_integrity *bi_rdev;
 	struct blk_integrity *bi_mddev;
+	char name[BDEVNAME_SIZE];
 
 	if (!mddev->gendisk)
-		return;
+		return 0;
 
 	bi_rdev = bdev_get_integrity(rdev->bdev);
 	bi_mddev = blk_get_integrity(mddev->gendisk);
 
 	if (!bi_mddev) /* nothing to do */
-		return;
-	if (rdev->raid_disk < 0) /* skip spares */
-		return;
-	if (bi_rdev && blk_integrity_compare(mddev->gendisk,
-					     rdev->bdev->bd_disk) >= 0)
-		return;
-	WARN_ON_ONCE(!mddev->suspended);
-	printk(KERN_NOTICE "disabling data integrity on %s\n", mdname(mddev));
-	blk_integrity_unregister(mddev->gendisk);
+		return 0;
+
+	if (blk_integrity_compare(mddev->gendisk, rdev->bdev->bd_disk) != 0) {
+		printk(KERN_NOTICE "%s: incompatible integrity profile for %s\n",
+				mdname(mddev), bdevname(rdev->bdev, name));
+		return -ENXIO;
+	}
+
+	return 0;
 }
 EXPORT_SYMBOL(md_integrity_add_rdev);
 
drivers/md/md.h +1 -1
index ca0b643fe3c1..dfa57b41541b 100644
@@ -657,7 +657,7 @@ extern void md_wait_for_blocked_rdev(struct md_rdev *rdev, struct mddev *mddev);
 extern void md_set_array_sectors(struct mddev *mddev, sector_t array_sectors);
 extern int md_check_no_bitmap(struct mddev *mddev);
 extern int md_integrity_register(struct mddev *mddev);
-extern void md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev);
+extern int md_integrity_add_rdev(struct md_rdev *rdev, struct mddev *mddev);
 extern int strict_strtoul_scaled(const char *cp, unsigned long *res, int scale);
 
 extern void mddev_init(struct mddev *mddev);
drivers/md/multipath.c +3 -3
index 7331a80d89f1..0a72ab6e6c20 100644
@@ -257,6 +257,9 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 			disk_stack_limits(mddev->gendisk, rdev->bdev,
 					  rdev->data_offset << 9);
 
+			err = md_integrity_add_rdev(rdev, mddev);
+			if (err)
+				break;
 			spin_lock_irq(&conf->device_lock);
 			mddev->degraded--;
 			rdev->raid_disk = path;
@@ -264,9 +267,6 @@ static int multipath_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 			spin_unlock_irq(&conf->device_lock);
 			rcu_assign_pointer(p->rdev, rdev);
 			err = 0;
-			mddev_suspend(mddev);
-			md_integrity_add_rdev(rdev, mddev);
-			mddev_resume(mddev);
 			break;
 		}
 
drivers/md/raid1.c +3 -3
index e2169ff6e0f0..c4b913409226 100644
@@ -1589,6 +1589,9 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 	if (mddev->recovery_disabled == conf->recovery_disabled)
 		return -EBUSY;
 
+	if (md_integrity_add_rdev(rdev, mddev))
+		return -ENXIO;
+
 	if (rdev->raid_disk >= 0)
 		first = last = rdev->raid_disk;
 
@@ -1632,9 +1635,6 @@ static int raid1_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 			break;
 		}
 	}
-	mddev_suspend(mddev);
-	md_integrity_add_rdev(rdev, mddev);
-	mddev_resume(mddev);
 	if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev)))
 		queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
 	print_conf(conf);
drivers/md/raid10.c +3 -3
index 84e597e1c489..ce959b4ae4df 100644
@@ -1698,6 +1698,9 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 	if (rdev->saved_raid_disk < 0 && !_enough(conf, 1, -1))
 		return -EINVAL;
 
+	if (md_integrity_add_rdev(rdev, mddev))
+		return -ENXIO;
+
 	if (rdev->raid_disk >= 0)
 		first = last = rdev->raid_disk;
 
@@ -1739,9 +1742,6 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 		rcu_assign_pointer(p->rdev, rdev);
 		break;
 	}
-	mddev_suspend(mddev);
-	md_integrity_add_rdev(rdev, mddev);
-	mddev_resume(mddev);
 	if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev)))
 		queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
 
drivers/media/i2c/ir-kbd-i2c.c +0 -1
index 728d2cc8a3e7..175a76114953 100644
@@ -478,7 +478,6 @@ static const struct i2c_device_id ir_kbd_id[] = {
 	{ "ir_rx_z8f0811_hdpvr", 0 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, ir_kbd_id);
 
 static struct i2c_driver ir_kbd_driver = {
 	.driver = {
drivers/media/pci/saa7134/saa7134-alsa.c +4 -1
index 1d2c310ce838..94f816244407 100644
@@ -1211,6 +1211,8 @@ static int alsa_device_init(struct saa7134_dev *dev)
 
 static int alsa_device_exit(struct saa7134_dev *dev)
 {
+	if (!snd_saa7134_cards[dev->nr])
+		return 1;
 
 	snd_card_free(snd_saa7134_cards[dev->nr]);
 	snd_saa7134_cards[dev->nr] = NULL;
@@ -1260,7 +1262,8 @@ static void saa7134_alsa_exit(void)
 	int idx;
 
 	for (idx = 0; idx < SNDRV_CARDS; idx++) {
-		snd_card_free(snd_saa7134_cards[idx]);
+		if (snd_saa7134_cards[idx])
+			snd_card_free(snd_saa7134_cards[idx]);
 	}
 
 	saa7134_dmasound_init = NULL;
drivers/mtd/nand/nand_base.c +3 -0
index ece544efccc3..3ff583f165cd 100644
@@ -3995,6 +3995,9 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
 			return ret;
 	}
 
+	if (!mtd->name && mtd->dev.parent)
+		mtd->name = dev_name(mtd->dev.parent);
+
 	/* Set the default functions */
 	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
 
drivers/net/wireless/realtek/rtlwifi/regd.c +1 -1
index a62bf0a65c32..5be34118e0af 100644
@@ -351,7 +351,6 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select(
 	case COUNTRY_CODE_SPAIN:
 	case COUNTRY_CODE_FRANCE:
 	case COUNTRY_CODE_ISRAEL:
-	case COUNTRY_CODE_WORLD_WIDE_13:
 		return &rtl_regdom_12_13;
 	case COUNTRY_CODE_MKK:
 	case COUNTRY_CODE_MKK1:
@@ -360,6 +359,7 @@ static const struct ieee80211_regdomain *_rtl_regdomain_select(
 		return &rtl_regdom_14_60_64;
 	case COUNTRY_CODE_GLOBAL_DOMAIN:
 		return &rtl_regdom_14;
+	case COUNTRY_CODE_WORLD_WIDE_13:
 	case COUNTRY_CODE_WORLD_WIDE_13_5G_ALL:
 		return &rtl_regdom_12_13_5g_all;
 	default:
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c +5 -4
index 142bdff4ed60..4159f9b14db6 100644
@@ -95,8 +95,6 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
 	struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
 
 	rtl8821ae_bt_reg_init(hw);
-	rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
-	rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
 	rtlpriv->btcoexist.btc_ops = rtl_btc_get_ops_pointer();
 
 	rtlpriv->dm.dm_initialgain_enable = 1;
@@ -168,12 +166,15 @@ int rtl8821ae_init_sw_vars(struct ieee80211_hw *hw)
 	rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
 	rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
 	rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
-	rtlpci->msi_support = rtlpriv->cfg->mod_params->int_clear;
+	rtlpci->int_clear = rtlpriv->cfg->mod_params->int_clear;
+	rtlpriv->cfg->mod_params->sw_crypto =
+		rtlpriv->cfg->mod_params->sw_crypto;
+	rtlpriv->cfg->mod_params->disable_watchdog =
+		rtlpriv->cfg->mod_params->disable_watchdog;
 	if (rtlpriv->cfg->mod_params->disable_watchdog)
 		pr_info("watchdog disabled\n");
 	rtlpriv->psc.reg_fwctrl_lps = 3;
 	rtlpriv->psc.reg_max_lps_awakeintvl = 5;
-	rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support;
 
 	/* for ASPM, you can close aspm through
 	 * set const_support_pciaspm = 0
drivers/net/wireless/ti/wlcore/io.h +7 -3
index 0305729d0986..10cf3747694d 100644
@@ -207,19 +207,23 @@ static inline int __must_check wlcore_write_reg(struct wl1271 *wl, int reg,
 
 static inline void wl1271_power_off(struct wl1271 *wl)
 {
-	int ret;
+	int ret = 0;
 
 	if (!test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags))
 		return;
 
-	ret = wl->if_ops->power(wl->dev, false);
+	if (wl->if_ops->power)
+		ret = wl->if_ops->power(wl->dev, false);
 	if (!ret)
 		clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
 }
 
 static inline int wl1271_power_on(struct wl1271 *wl)
 {
-	int ret = wl->if_ops->power(wl->dev, true);
+	int ret = 0;
+
+	if (wl->if_ops->power)
+		ret = wl->if_ops->power(wl->dev, true);
 	if (ret == 0)
 		set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
 
drivers/net/wireless/ti/wlcore/spi.c +7 -3
index 236b41090827..44f059f7f34e 100644
@@ -73,7 +73,10 @@
  */
 #define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE)
 
-#define WSPI_MAX_NUM_OF_CHUNKS (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE)
+/* Maximum number of SPI write chunks */
+#define WSPI_MAX_NUM_OF_CHUNKS \
+	((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1)
+
 
 struct wl12xx_spi_glue {
 	struct device *dev;
@@ -268,9 +271,10 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
 					     void *buf, size_t len, bool fixed)
 {
 	struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
-	struct spi_transfer t[2 * (WSPI_MAX_NUM_OF_CHUNKS + 1)];
+	/* SPI write buffers - 2 for each chunk */
+	struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS];
 	struct spi_message m;
-	u32 commands[WSPI_MAX_NUM_OF_CHUNKS];
+	u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; /* 1 command per chunk */
 	u32 *cmd;
 	u32 chunk_len;
 	int i;
drivers/pci/bus.c +4 -2
index d3346d23963b..89b3befc7155 100644
@@ -140,6 +140,8 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
 	type_mask |= IORESOURCE_TYPE_BITS;
 
 	pci_bus_for_each_resource(bus, r, i) {
+		resource_size_t min_used = min;
+
 		if (!r)
 			continue;
 
@@ -163,12 +165,12 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res,
 		 * overrides "min".
 		 */
 		if (avail.start)
-			min = avail.start;
+			min_used = avail.start;
 
 		max = avail.end;
 
 		/* Ok, try it out.. */
-		ret = allocate_resource(r, res, size, min, max,
+		ret = allocate_resource(r, res, size, min_used, max,
 					align, alignf, alignf_data);
 		if (ret == 0)
 			return 0;
drivers/pci/host/pci-dra7xx.c +2 -1
index 8c3688046c02..923607bdabc5 100644
@@ -302,7 +302,8 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
 	}
 
 	ret = devm_request_irq(&pdev->dev, pp->irq,
-			       dra7xx_pcie_msi_irq_handler, IRQF_SHARED,
+			       dra7xx_pcie_msi_irq_handler,
+			       IRQF_SHARED | IRQF_NO_THREAD,
 			       "dra7-pcie-msi",	pp);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to request irq\n");
drivers/pci/host/pci-exynos.c +2 -1
index 01095e1160a4..d997d22d4231 100644
@@ -522,7 +522,8 @@ static int __init exynos_add_pcie_port(struct pcie_port *pp,
 
 		ret = devm_request_irq(&pdev->dev, pp->msi_irq,
 					exynos_pcie_msi_irq_handler,
-					IRQF_SHARED, "exynos-pcie", pp);
+					IRQF_SHARED | IRQF_NO_THREAD,
+					"exynos-pcie", pp);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to request msi irq\n");
 			return ret;
drivers/pci/host/pci-imx6.c +2 -1
index 22e8224126fd..9ce7cd148c86 100644
@@ -537,7 +537,8 @@ static int __init imx6_add_pcie_port(struct pcie_port *pp,
 
 		ret = devm_request_irq(&pdev->dev, pp->msi_irq,
 				       imx6_pcie_msi_handler,
-				       IRQF_SHARED, "mx6-pcie-msi", pp);
+				       IRQF_SHARED | IRQF_NO_THREAD,
+				       "mx6-pcie-msi", pp);
 		if (ret) {
 			dev_err(&pdev->dev, "failed to request MSI irq\n");
 			return ret;
drivers/pci/host/pci-tegra.c +1 -1
index 3018ae52e092..30323114c53c 100644
@@ -1288,7 +1288,7 @@ static int tegra_pcie_enable_msi(struct tegra_pcie *pcie)
 
 	msi->irq = err;
 
-	err = request_irq(msi->irq, tegra_pcie_msi_irq, 0,
+	err = request_irq(msi->irq, tegra_pcie_msi_irq, IRQF_NO_THREAD,
 			  tegra_msi_irq_chip.name, pcie);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to request IRQ: %d\n", err);
drivers/pci/host/pcie-rcar.c +4 -2
index f4fa6c537448..414c33686621 100644
@@ -720,14 +720,16 @@ static int rcar_pcie_enable_msi(struct rcar_pcie *pcie)
 
 	/* Two irqs are for MSI, but they are also used for non-MSI irqs */
 	err = devm_request_irq(&pdev->dev, msi->irq1, rcar_pcie_msi_irq,
-			       IRQF_SHARED, rcar_msi_irq_chip.name, pcie);
+			       IRQF_SHARED | IRQF_NO_THREAD,
+			       rcar_msi_irq_chip.name, pcie);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to request IRQ: %d\n", err);
 		goto err;
 	}
 
 	err = devm_request_irq(&pdev->dev, msi->irq2, rcar_pcie_msi_irq,
-			       IRQF_SHARED, rcar_msi_irq_chip.name, pcie);
+			       IRQF_SHARED | IRQF_NO_THREAD,
+			       rcar_msi_irq_chip.name, pcie);
 	if (err < 0) {
 		dev_err(&pdev->dev, "failed to request IRQ: %d\n", err);
 		goto err;
drivers/pci/host/pcie-spear13xx.c +2 -1
index b95b7563c052..a6cd8233e8c0 100644
@@ -279,7 +279,8 @@ static int spear13xx_add_pcie_port(struct pcie_port *pp,
 		return -ENODEV;
 	}
 	ret = devm_request_irq(dev, pp->irq, spear13xx_pcie_irq_handler,
-			       IRQF_SHARED, "spear1340-pcie", pp);
+			       IRQF_SHARED | IRQF_NO_THREAD,
+			       "spear1340-pcie", pp);
 	if (ret) {
 		dev_err(dev, "failed to request irq %d\n", pp->irq);
 		return ret;
drivers/pci/host/pcie-xilinx.c +2 -1
index 3c7a0d580b1e..4cfa46360d12 100644
@@ -781,7 +781,8 @@ static int xilinx_pcie_parse_dt(struct xilinx_pcie_port *port)
 
 	port->irq = irq_of_parse_and_map(node, 0);
 	err = devm_request_irq(dev, port->irq, xilinx_pcie_intr_handler,
-			       IRQF_SHARED, "xilinx-pcie", port);
+			       IRQF_SHARED | IRQF_NO_THREAD,
+			       "xilinx-pcie", port);
 	if (err) {
 		dev_err(dev, "unable to request irq %d\n", port->irq);
 		return err;
drivers/tty/n_tty.c +2 -5
index e49c2bce551d..cf000b331eed 100644
@@ -258,16 +258,13 @@ static void n_tty_check_throttle(struct tty_struct *tty)
 
 static void n_tty_check_unthrottle(struct tty_struct *tty)
 {
-	if (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
-	    tty->link->ldisc->ops->write_wakeup == n_tty_write_wakeup) {
+	if (tty->driver->type == TTY_DRIVER_TYPE_PTY) {
 		if (chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
 			return;
 		if (!tty->count)
 			return;
 		n_tty_kick_worker(tty);
-		n_tty_write_wakeup(tty->link);
-		if (waitqueue_active(&tty->link->write_wait))
-			wake_up_interruptible_poll(&tty->link->write_wait, POLLOUT);
+		tty_wakeup(tty->link);
 		return;
 	}
 
drivers/tty/tty_io.c +38 -6

84 lines not on this page · raw message

drivers/tty/tty_mutex.c +8 -0
index 0efcf713b756..d09293bc0e04 100644
@@ -22,6 +22,14 @@ void __lockfunc tty_lock(struct tty_struct *tty)
 }
 EXPORT_SYMBOL(tty_lock);
 
+int tty_lock_interruptible(struct tty_struct *tty)
+{
+	if (WARN(tty->magic != TTY_MAGIC, "L Bad %p\n", tty))
+		return -EIO;
+	tty_kref_get(tty);
+	return mutex_lock_interruptible(&tty->legacy_mutex);
+}
+
 void __lockfunc tty_unlock(struct tty_struct *tty)
 {
 	if (tty->magic != TTY_MAGIC) {
drivers/usb/class/cdc-acm.c +8 -1
index 26ca4f910cb0..e4c70dce3e7c 100644
@@ -428,7 +428,8 @@ static void acm_read_bulk_callback(struct urb *urb)
 		set_bit(rb->index, &acm->read_urbs_free);
 		dev_dbg(&acm->data->dev, "%s - non-zero urb status: %d\n",
 							__func__, status);
-		return;
+		if ((status != -ENOENT) || (urb->actual_length == 0))
+			return;
 	}
 
 	usb_mark_last_busy(acm->dev);
@@ -1404,6 +1405,8 @@ made_compressed_probe:
 				usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
 				NULL, acm->writesize, acm_write_bulk, snd);
 		snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+		if (quirks & SEND_ZERO_PACKET)
+			snd->urb->transfer_flags |= URB_ZERO_PACKET;
 		snd->instance = acm;
 	}
 
@@ -1861,6 +1864,10 @@ static const struct usb_device_id acm_ids[] = {
 	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
 		USB_CDC_ACM_PROTO_AT_CDMA) },
 
+	{ USB_DEVICE(0x1519, 0x0452), /* Intel 7260 modem */
+	.driver_info = SEND_ZERO_PACKET,
+	},
+
 	{ }
 };
 
drivers/usb/class/cdc-acm.h +1 -0
index dd9af38e7cda..ccfaba9ab4e4 100644
@@ -134,3 +134,4 @@ struct acm {
 #define IGNORE_DEVICE			BIT(5)
 #define QUIRK_CONTROL_LINE_STATE	BIT(6)
 #define CLEAR_HALT_CONDITIONS		BIT(7)
+#define SEND_ZERO_PACKET		BIT(8)
drivers/usb/core/hub.c +5 -3
index 8683436788c3..1560f3f3e756 100644
@@ -5386,7 +5386,6 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
 	}
 
 	bos = udev->bos;
-	udev->bos = NULL;
 
 	for (i = 0; i < SET_CONFIG_TRIES; ++i) {
 
@@ -5479,8 +5478,11 @@ done:
 	usb_set_usb2_hardware_lpm(udev, 1);
 	usb_unlocked_enable_lpm(udev);
 	usb_enable_ltm(udev);
-	usb_release_bos_descriptor(udev);
-	udev->bos = bos;
+	/* release the new BOS descriptor allocated  by hub_port_init() */
+	if (udev->bos != bos) {
+		usb_release_bos_descriptor(udev);
+		udev->bos = bos;
+	}
 	return 0;
 
 re_enumerate:
drivers/usb/host/xhci-pci.c +32 -20

80 lines not on this page · raw message

drivers/usb/phy/phy-msm-usb.c +24 -13
index 0d19a6d61a71..970a30e155cb 100644
@@ -1599,6 +1599,8 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
 						&motg->id.nb);
 		if (ret < 0) {
 			dev_err(&pdev->dev, "register ID notifier failed\n");
+			extcon_unregister_notifier(motg->vbus.extcon,
+						   EXTCON_USB, &motg->vbus.nb);
 			return ret;
 		}
 
@@ -1660,15 +1662,6 @@ static int msm_otg_probe(struct platform_device *pdev)
 	if (!motg)
 		return -ENOMEM;
 
-	pdata = dev_get_platdata(&pdev->dev);
-	if (!pdata) {
-		if (!np)
-			return -ENXIO;
-		ret = msm_otg_read_dt(pdev, motg);
-		if (ret)
-			return ret;
-	}
-
 	motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
 				     GFP_KERNEL);
 	if (!motg->phy.otg)
@@ -1710,6 +1703,15 @@ static int msm_otg_probe(struct platform_device *pdev)
 	if (!motg->regs)
 		return -ENOMEM;
 
+	pdata = dev_get_platdata(&pdev->dev);
+	if (!pdata) {
+		if (!np)
+			return -ENXIO;
+		ret = msm_otg_read_dt(pdev, motg);
+		if (ret)
+			return ret;
+	}
+
 	/*
 	 * NOTE: The PHYs can be multiplexed between the chipidea controller
 	 * and the dwc3 controller, using a single bit. It is important that
@@ -1717,8 +1719,10 @@ static int msm_otg_probe(struct platform_device *pdev)
 	 */
 	if (motg->phy_number) {
 		phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
-		if (!phy_select)
-			return -ENOMEM;
+		if (!phy_select) {
+			ret = -ENOMEM;
+			goto unregister_extcon;
+		}
 		/* Enable second PHY with the OTG port */
 		writel(0x1, phy_select);
 	}
@@ -1728,7 +1732,8 @@ static int msm_otg_probe(struct platform_device *pdev)
 	motg->irq = platform_get_irq(pdev, 0);
 	if (motg->irq < 0) {
 		dev_err(&pdev->dev, "platform_get_irq failed\n");
-		return motg->irq;
+		ret = motg->irq;
+		goto unregister_extcon;
 	}
 
 	regs[0].supply = "vddcx";
@@ -1737,7 +1742,7 @@ static int msm_otg_probe(struct platform_device *pdev)
 
 	ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
 	if (ret)
-		return ret;
+		goto unregister_extcon;
 
 	motg->vddcx = regs[0].consumer;
 	motg->v3p3  = regs[1].consumer;
@@ -1834,6 +1839,12 @@ disable_clks:
 	clk_disable_unprepare(motg->clk);
 	if (!IS_ERR(motg->core_clk))
 		clk_disable_unprepare(motg->core_clk);
+unregister_extcon:
+	extcon_unregister_notifier(motg->id.extcon,
+				   EXTCON_USB_HOST, &motg->id.nb);
+	extcon_unregister_notifier(motg->vbus.extcon,
+				   EXTCON_USB, &motg->vbus.nb);
+
 	return ret;
 }
 
drivers/usb/serial/cp210x.c +1 -0
index 59b2126b21a3..1dd9919081f8 100644
@@ -98,6 +98,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */
 	{ USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */
 	{ USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
+	{ USB_DEVICE(0x10C4, 0x81D7) }, /* IAI Corp. RCB-CV-USB USB to RS485 Adaptor */
 	{ USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
 	{ USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
 	{ USB_DEVICE(0x10C4, 0x81E8) }, /* Zephyr Bioharness */
drivers/usb/serial/ftdi_sio.c +1 -0
index a5a0376bbd48..8c660ae401d8 100644
@@ -824,6 +824,7 @@ static const struct usb_device_id id_table_combined[] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
+	{ USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) },
 	{ USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
 
 	/* Papouch devices based on FTDI chip */
drivers/usb/serial/ftdi_sio_ids.h +1 -0
index 67c6d4469730..a84df2513994 100644
@@ -615,6 +615,7 @@
  */
 #define RATOC_VENDOR_ID		0x0584
 #define RATOC_PRODUCT_ID_USB60F	0xb020
+#define RATOC_PRODUCT_ID_SCU18	0xb03a
 
 /*
  * Infineon Technologies
drivers/usb/serial/option.c +17 -1
index f2280606b73c..db86e512e0fc 100644
@@ -268,6 +268,8 @@ static void option_instat_callback(struct urb *urb);
 #define TELIT_PRODUCT_CC864_SINGLE		0x1006
 #define TELIT_PRODUCT_DE910_DUAL		0x1010
 #define TELIT_PRODUCT_UE910_V2			0x1012
+#define TELIT_PRODUCT_LE922_USBCFG0		0x1042
+#define TELIT_PRODUCT_LE922_USBCFG3		0x1043
 #define TELIT_PRODUCT_LE920			0x1200
 #define TELIT_PRODUCT_LE910			0x1201
 
@@ -615,6 +617,16 @@ static const struct option_blacklist_info telit_le920_blacklist = {
 	.reserved = BIT(1) | BIT(5),
 };
 
+static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = {
+	.sendsetup = BIT(2),
+	.reserved = BIT(0) | BIT(1) | BIT(3),
+};
+
+static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = {
+	.sendsetup = BIT(0),
+	.reserved = BIT(1) | BIT(2) | BIT(3),
+};
+
 static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -1160,6 +1172,10 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0),
+		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 },
+	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3),
+		.driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
 		.driver_info = (kernel_ulong_t)&telit_le910_blacklist },
 	{ USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
@@ -1679,7 +1695,7 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8),
 		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
 		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 
drivers/usb/serial/visor.c +9 -2
index 60afb39eb73c..337a0be89fcf 100644
@@ -544,6 +544,11 @@ static int treo_attach(struct usb_serial *serial)
 		(serial->num_interrupt_in == 0))
 		return 0;
 
+	if (serial->num_bulk_in < 2 || serial->num_interrupt_in < 2) {
+		dev_err(&serial->interface->dev, "missing endpoints\n");
+		return -ENODEV;
+	}
+
 	/*
 	* It appears that Treos and Kyoceras want to use the
 	* 1st bulk in endpoint to communicate with the 2nd bulk out endpoint,
@@ -597,8 +602,10 @@ static int clie_5_attach(struct usb_serial *serial)
 	 */
 
 	/* some sanity check */
-	if (serial->num_ports < 2)
-		return -1;
+	if (serial->num_bulk_out < 2) {
+		dev_err(&serial->interface->dev, "missing bulk out endpoints\n");
+		return -ENODEV;
+	}
 
 	/* port 0 now uses the modified endpoint Address */
 	port = serial->port[0];
fs/ext4/crypto_key.c +4 -0
index c5882b36e558..9a16d1e75a49 100644
@@ -213,9 +213,11 @@ retry:
 		res = -ENOKEY;
 		goto out;
 	}
+	down_read(&keyring_key->sem);
 	ukp = user_key_payload(keyring_key);
 	if (ukp->datalen != sizeof(struct ext4_encryption_key)) {
 		res = -EINVAL;
+		up_read(&keyring_key->sem);
 		goto out;
 	}
 	master_key = (struct ext4_encryption_key *)ukp->data;
@@ -226,10 +228,12 @@ retry:
 			    "ext4: key size incorrect: %d\n",
 			    master_key->size);
 		res = -ENOKEY;
+		up_read(&keyring_key->sem);
 		goto out;
 	}
 	res = ext4_derive_key_aes(ctx.nonce, master_key->raw,
 				  raw_key);
+	up_read(&keyring_key->sem);
 	if (res)
 		goto out;
 got_key:
fs/nfs/nfs4proc.c +0 -1
index 89818036f035..343b0f1f15b1 100644
@@ -8054,7 +8054,6 @@ static void nfs4_layoutreturn_release(void *calldata)
 		pnfs_set_layout_stateid(lo, &lrp->res.stateid, true);
 	pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range);
 	pnfs_clear_layoutreturn_waitbit(lo);
-	lo->plh_block_lgets--;
 	spin_unlock(&lo->plh_inode->i_lock);
 	pnfs_free_lseg_list(&freeme);
 	pnfs_put_layout_hdr(lrp->args.layout);
fs/ocfs2/dlm/dlmmaster.c +15 -11
index 84f2f8079466..4e2162b355db 100644
@@ -2519,6 +2519,11 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm,
 	spin_lock(&dlm->master_lock);
 	ret = dlm_add_migration_mle(dlm, res, mle, &oldmle, name,
 				    namelen, target, dlm->node_num);
+	/* get an extra reference on the mle.
+	 * otherwise the assert_master from the new
+	 * master will destroy this.
+	 */
+	dlm_get_mle_inuse(mle);
 	spin_unlock(&dlm->master_lock);
 	spin_unlock(&dlm->spinlock);
 
@@ -2554,6 +2559,7 @@ fail:
 		if (mle_added) {
 			dlm_mle_detach_hb_events(dlm, mle);
 			dlm_put_mle(mle);
+			dlm_put_mle_inuse(mle);
 		} else if (mle) {
 			kmem_cache_free(dlm_mle_cache, mle);
 			mle = NULL;
@@ -2571,17 +2577,6 @@ fail:
 	 * ensure that all assert_master work is flushed. */
 	flush_workqueue(dlm->dlm_worker);
 
-	/* get an extra reference on the mle.
-	 * otherwise the assert_master from the new
-	 * master will destroy this.
-	 * also, make sure that all callers of dlm_get_mle
-	 * take both dlm->spinlock and dlm->master_lock */
-	spin_lock(&dlm->spinlock);
-	spin_lock(&dlm->master_lock);
-	dlm_get_mle_inuse(mle);
-	spin_unlock(&dlm->master_lock);
-	spin_unlock(&dlm->spinlock);
-
 	/* notify new node and send all lock state */
 	/* call send_one_lockres with migration flag.
 	 * this serves as notice to the target node that a
@@ -3312,6 +3307,15 @@ top:
 			    mle->new_master != dead_node)
 				continue;
 
+			if (mle->new_master == dead_node && mle->inuse) {
+				mlog(ML_NOTICE, "%s: target %u died during "
+						"migration from %u, the MLE is "
+						"still keep used, ignore it!\n",
+						dlm->name, dead_node,
+						mle->master);
+				continue;
+			}
+
 			/* If we have reached this point, this mle needs to be
 			 * removed from the list and freed. */
 			dlm_clean_migration_mle(dlm, mle);
fs/ocfs2/dlm/dlmrecovery.c +2 -0
index 9e4f862d20fe..42f0cae93a0a 100644
@@ -2360,6 +2360,8 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
 						break;
 					}
 				}
+				dlm_lockres_clear_refmap_bit(dlm, res,
+						dead_node);
 				spin_unlock(&res->spinlock);
 				continue;
 			}
fs/ocfs2/dlmglue.c +6 -0
index 20276e340339..b002acf50203 100644
@@ -1390,6 +1390,7 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
 	unsigned int gen;
 	int noqueue_attempted = 0;
 	int dlm_locked = 0;
+	int kick_dc = 0;
 
 	if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED)) {
 		mlog_errno(-EINVAL);
@@ -1524,7 +1525,12 @@ update_holders:
 unlock:
 	lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
 
+	/* ocfs2_unblock_lock reques on seeing OCFS2_LOCK_UPCONVERT_FINISHING */
+	kick_dc = (lockres->l_flags & OCFS2_LOCK_BLOCKED);
+
 	spin_unlock_irqrestore(&lockres->l_lock, flags);
+	if (kick_dc)
+		ocfs2_wake_downconvert_thread(osb);
 out:
 	/*
 	 * This is helping work around a lock inversion between the page lock
include/crypto/hash.h +6 -0
index 3d69c93d50e8..6361892ea737 100644
@@ -204,6 +204,7 @@ struct crypto_ahash {
 		      unsigned int keylen);
 
 	unsigned int reqsize;
+	bool has_setkey;
 	struct crypto_tfm base;
 };
 
@@ -375,6 +376,11 @@ static inline void *ahash_request_ctx(struct ahash_request *req)
 int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
 			unsigned int keylen);
 
+static inline bool crypto_ahash_has_setkey(struct crypto_ahash *tfm)
+{
+	return tfm->has_setkey;
+}
+
 /**
  * crypto_ahash_finup() - update and finalize message digest
  * @req: reference to the ahash_request handle that holds all information
include/crypto/if_alg.h +6 -5
index 018afb264ac2..a2bfd7843f18 100644
@@ -30,6 +30,9 @@ struct alg_sock {
 
 	struct sock *parent;
 
+	unsigned int refcnt;
+	unsigned int nokey_refcnt;
+
 	const struct af_alg_type *type;
 	void *private;
 };
@@ -50,9 +53,11 @@ struct af_alg_type {
 	void (*release)(void *private);
 	int (*setkey)(void *private, const u8 *key, unsigned int keylen);
 	int (*accept)(void *private, struct sock *sk);
+	int (*accept_nokey)(void *private, struct sock *sk);
 	int (*setauthsize)(void *private, unsigned int authsize);
 
 	struct proto_ops *ops;
+	struct proto_ops *ops_nokey;
 	struct module *owner;
 	char name[14];
 };
@@ -67,6 +72,7 @@ int af_alg_register_type(const struct af_alg_type *type);
 int af_alg_unregister_type(const struct af_alg_type *type);
 
 int af_alg_release(struct socket *sock);
+void af_alg_release_parent(struct sock *sk);
 int af_alg_accept(struct sock *sk, struct socket *newsock);
 
 int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len);
@@ -83,11 +89,6 @@ static inline struct alg_sock *alg_sk(struct sock *sk)
 	return (struct alg_sock *)sk;
 }
 
-static inline void af_alg_release_parent(struct sock *sk)
-{
-	sock_put(alg_sk(sk)->parent);
-}
-
 static inline void af_alg_init_completion(struct af_alg_completion *completion)
 {
 	init_completion(&completion->completion);
include/crypto/skcipher.h +7 -0
index d8dd41fb034f..fd8742a40ff3 100644
@@ -61,6 +61,8 @@ struct crypto_skcipher {
 	unsigned int ivsize;
 	unsigned int reqsize;
 
+	bool has_setkey;
+
 	struct crypto_tfm base;
 };
 
@@ -305,6 +307,11 @@ static inline int crypto_skcipher_setkey(struct crypto_skcipher *tfm,
 	return tfm->setkey(tfm, key, keylen);
 }
 
+static inline bool crypto_skcipher_has_setkey(struct crypto_skcipher *tfm)
+{
+	return tfm->has_setkey;
+}
+
 /**
  * crypto_skcipher_reqtfm() - obtain cipher handle from request
  * @req: skcipher_request out of which the cipher handle is to be obtained
include/linux/console.h +1 -0
index bd194343c346..ea731af2451e 100644
@@ -150,6 +150,7 @@ extern int console_trylock(void);
 extern void console_unlock(void);
 extern void console_conditional_schedule(void);
 extern void console_unblank(void);
+extern void console_flush_on_panic(void);
 extern struct tty_driver *console_device(int *);
 extern void console_stop(struct console *);
 extern void console_start(struct console *);
include/linux/hrtimer.h +31 -3
index 76dd4f0da5ca..2ead22dd74a0 100644
@@ -87,7 +87,8 @@ enum hrtimer_restart {
  * @function:	timer expiry callback function
  * @base:	pointer to the timer base (per cpu and per clock)
  * @state:	state information (See bit values above)
- * @start_pid: timer statistics field to store the pid of the task which
+ * @is_rel:	Set if the timer was armed relative
+ * @start_pid:  timer statistics field to store the pid of the task which
  *		started the timer
  * @start_site:	timer statistics field to store the site where the timer
  *		was started
@@ -101,7 +102,8 @@ struct hrtimer {
 	ktime_t				_softexpires;
 	enum hrtimer_restart		(*function)(struct hrtimer *);
 	struct hrtimer_clock_base	*base;
-	unsigned long			state;
+	u8				state;
+	u8				is_rel;
 #ifdef CONFIG_TIMER_STATS
 	int				start_pid;
 	void				*start_site;
@@ -321,6 +323,27 @@ static inline void clock_was_set_delayed(void) { }
 
 #endif
 
+static inline ktime_t
+__hrtimer_expires_remaining_adjusted(const struct hrtimer *timer, ktime_t now)
+{
+	ktime_t rem = ktime_sub(timer->node.expires, now);
+
+	/*
+	 * Adjust relative timers for the extra we added in
+	 * hrtimer_start_range_ns() to prevent short timeouts.
+	 */
+	if (IS_ENABLED(CONFIG_TIME_LOW_RES) && timer->is_rel)
+		rem.tv64 -= hrtimer_resolution;
+	return rem;
+}
+
+static inline ktime_t
+hrtimer_expires_remaining_adjusted(const struct hrtimer *timer)
+{
+	return __hrtimer_expires_remaining_adjusted(timer,
+						    timer->base->get_time());
+}
+
 extern void clock_was_set(void);
 #ifdef CONFIG_TIMERFD
 extern void timerfd_clock_was_set(void);
@@ -390,7 +413,12 @@ static inline void hrtimer_restart(struct hrtimer *timer)
 }
 
 /* Query timers: */
-extern ktime_t hrtimer_get_remaining(const struct hrtimer *timer);
+extern ktime_t __hrtimer_get_remaining(const struct hrtimer *timer, bool adjust);
+
+static inline ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
+{
+	return __hrtimer_get_remaining(timer, false);
+}
 
 extern u64 hrtimer_get_next_event(void);
 
include/linux/tty.h +1 -0
index 5e31f1b99037..6b6e811f4575 100644
@@ -654,6 +654,7 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
 /* tty_mutex.c */
 /* functions for preparation of BKL removal */
 extern void __lockfunc tty_lock(struct tty_struct *tty);
+extern int  tty_lock_interruptible(struct tty_struct *tty);
 extern void __lockfunc tty_unlock(struct tty_struct *tty);
 extern void __lockfunc tty_lock_slave(struct tty_struct *tty);
 extern void __lockfunc tty_unlock_slave(struct tty_struct *tty);
include/sound/rawmidi.h +4 -0
index f6cbef78db62..3b91ad5d5115 100644
@@ -167,6 +167,10 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
 int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count);
 int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
 			 unsigned char *buffer, int count);
+int __snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
+			      unsigned char *buffer, int count);
+int __snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream,
+			       int count);
 
 /* main midi functions */
 
kernel/panic.c +1 -2
index 4b150bc0c6c1..41e2b54f36b5 100644
@@ -157,8 +157,7 @@ void panic(const char *fmt, ...)
 	 * panic() is not being callled from OOPS.
 	 */
 	debug_locks_off();
-	console_trylock();
-	console_unlock();
+	console_flush_on_panic();
 
 	if (!panic_blink)
 		panic_blink = no_blink;
kernel/printk/printk.c +34 -1
index 2ce8826f1053..c048e34b177f 100644
@@ -2233,13 +2233,24 @@ void console_unlock(void)
 	static u64 seen_seq;
 	unsigned long flags;
 	bool wake_klogd = false;
-	bool retry;
+	bool do_cond_resched, retry;
 
 	if (console_suspended) {
 		up_console_sem();
 		return;
 	}
 
+	/*
+	 * Console drivers are called under logbuf_lock, so
+	 * @console_may_schedule should be cleared before; however, we may
+	 * end up dumping a lot of lines, for example, if called from
+	 * console registration path, and should invoke cond_resched()
+	 * between lines if allowable.  Not doing so can cause a very long
+	 * scheduling stall on a slow console leading to RCU stall and
+	 * softlockup warnings which exacerbate the issue with more
+	 * messages practically incapacitating the system.
+	 */
+	do_cond_resched = console_may_schedule;
 	console_may_schedule = 0;
 
 	/* flush buffered message fragment immediately to console */
@@ -2311,6 +2322,9 @@ skip:
 		call_console_drivers(level, ext_text, ext_len, text, len);
 		start_critical_timings();
 		local_irq_restore(flags);
+
+		if (do_cond_resched)
+			cond_resched();
 	}
 	console_locked = 0;
 
@@ -2378,6 +2392,25 @@ void console_unblank(void)
 	console_unlock();
 }
 
+/**
+ * console_flush_on_panic - flush console content on panic
+ *
+ * Immediately output all pending messages no matter what.
+ */
+void console_flush_on_panic(void)
+{
+	/*
+	 * If someone else is holding the console lock, trylock will fail
+	 * and may_schedule may be set.  Ignore and proceed to unlock so
+	 * that messages are flushed out.  As this can be called from any
+	 * context and we don't want to get preempted while flushing,
+	 * ensure may_schedule is cleared.
+	 */
+	console_trylock();
+	console_may_schedule = 0;
+	console_unlock();
+}
+
 /*
  * Return the console tty driver structure and its associated index
  */
kernel/sched/core.c +1 -1
index 732e993b564b..eb70592f03f6 100644
@@ -6738,7 +6738,7 @@ static void sched_init_numa(void)
 
 			sched_domains_numa_masks[i][j] = mask;
 
-			for (k = 0; k < nr_node_ids; k++) {
+			for_each_node(k) {
 				if (node_distance(j, k) > sched_domains_numa_distance[i])
 					continue;
 
kernel/time/hrtimer.c +37 -18

104 lines not on this page · raw message

kernel/time/timer_list.c +1 -1
index f75e35b60149..ba7d8b288bb3 100644
@@ -69,7 +69,7 @@ print_timer(struct seq_file *m, struct hrtimer *taddr, struct hrtimer *timer,
 	print_name_offset(m, taddr);
 	SEQ_printf(m, ", ");
 	print_name_offset(m, timer->function);
-	SEQ_printf(m, ", S:%02lx", timer->state);
+	SEQ_printf(m, ", S:%02x", timer->state);
 #ifdef CONFIG_TIMER_STATS
 	SEQ_printf(m, ", ");
 	print_name_offset(m, timer->start_site);
kernel/trace/trace.c +1 -1
index 87fb9801bd9e..d9293402ee68 100644
@@ -1751,7 +1751,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr,
 {
 	__buffer_unlock_commit(buffer, event);
 
-	ftrace_trace_stack(tr, buffer, flags, 6, pc, regs);
+	ftrace_trace_stack(tr, buffer, flags, 0, pc, regs);
 	ftrace_trace_userstack(buffer, flags, pc);
 }
 EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit_regs);
kernel/trace/trace_stack.c +7 -0
index dda9e6742950..202df6cffcca 100644
@@ -126,6 +126,13 @@ check_stack(unsigned long ip, unsigned long *stack)
 	}
 
 	/*
+	 * Some archs may not have the passed in ip in the dump.
+	 * If that happens, we need to show everything.
+	 */
+	if (i == stack_trace_max.nr_entries)
+		i = 0;
+
+	/*
 	 * Now find where in the stack these are.
 	 */
 	x = 0;
lib/libcrc32c.c +1 -0
index 6a08ce7d6adc..acf9da449f81 100644
@@ -74,3 +74,4 @@ module_exit(libcrc32c_mod_fini);
 MODULE_AUTHOR("Clay Haapala <[email protected]>");
 MODULE_DESCRIPTION("CRC32c (Castagnoli) calculations");
 MODULE_LICENSE("GPL");
+MODULE_SOFTDEP("pre: crc32c");
mm/backing-dev.c +1 -1
index 7340353f8aea..cbe6f0b96f29 100644
@@ -989,7 +989,7 @@ long wait_iff_congested(struct zone *zone, int sync, long timeout)
 		 * here rather than calling cond_resched().
 		 */
 		if (current->flags & PF_WQ_WORKER)
-			schedule_timeout(1);
+			schedule_timeout_uninterruptible(1);
 		else
 			cond_resched();
 
mm/zsmalloc.c +13 -1
index 9f15bdd9163c..fc083996e40a 100644
@@ -309,7 +309,12 @@ static void free_handle(struct zs_pool *pool, unsigned long handle)
 
 static void record_obj(unsigned long handle, unsigned long obj)
 {
-	*(unsigned long *)handle = obj;
+	/*
+	 * lsb of @obj represents handle lock while other bits
+	 * represent object value the handle is pointing so
+	 * updating shouldn't do store tearing.
+	 */
+	WRITE_ONCE(*(unsigned long *)handle, obj);
 }
 
 /* zpool driver */
@@ -1635,6 +1640,13 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
 		free_obj = obj_malloc(d_page, class, handle);
 		zs_object_copy(free_obj, used_obj, class);
 		index++;
+		/*
+		 * record_obj updates handle's value to free_obj and it will
+		 * invalidate lock bit(ie, HANDLE_PIN_BIT) of handle, which
+		 * breaks synchronization using pin_tag(e,g, zs_free) so
+		 * let's keep the lock bit.
+		 */
+		free_obj |= BIT(HANDLE_PIN_BIT);
 		record_obj(handle, free_obj);
 		unpin_tag(handle);
 		obj_free(pool, class, used_obj);
security/integrity/evm/evm_main.c +2 -1
index 1334e02ae8f4..3d145a3ffccf 100644
@@ -23,6 +23,7 @@
 #include <linux/integrity.h>
 #include <linux/evm.h>
 #include <crypto/hash.h>
+#include <crypto/algapi.h>
 #include "evm.h"
 
 int evm_initialized;
@@ -148,7 +149,7 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
 				   xattr_value_len, calc.digest);
 		if (rc)
 			break;
-		rc = memcmp(xattr_data->digest, calc.digest,
+		rc = crypto_memneq(xattr_data->digest, calc.digest,
 			    sizeof(calc.digest));
 		if (rc)
 			rc = -EINVAL;
sound/core/compress_offload.c +11 -0
index b123c42e7dc8..b554d7f9e3be 100644
@@ -44,6 +44,13 @@
 #include <sound/compress_offload.h>
 #include <sound/compress_driver.h>
 
+/* struct snd_compr_codec_caps overflows the ioctl bit size for some
+ * architectures, so we need to disable the relevant ioctls.
+ */
+#if _IOC_SIZEBITS < 14
+#define COMPR_CODEC_CAPS_OVERFLOW
+#endif
+
 /* TODO:
  * - add substream support for multiple devices in case of
  *	SND_DYNAMIC_MINORS is not used
@@ -438,6 +445,7 @@ out:
 	return retval;
 }
 
+#ifndef COMPR_CODEC_CAPS_OVERFLOW
 static int
 snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg)
 {
@@ -461,6 +469,7 @@ out:
 	kfree(caps);
 	return retval;
 }
+#endif /* !COMPR_CODEC_CAPS_OVERFLOW */
 
 /* revisit this with snd_pcm_preallocate_xxx */
 static int snd_compr_allocate_buffer(struct snd_compr_stream *stream,
@@ -799,9 +808,11 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
 	case _IOC_NR(SNDRV_COMPRESS_GET_CAPS):
 		retval = snd_compr_get_caps(stream, arg);
 		break;
+#ifndef COMPR_CODEC_CAPS_OVERFLOW
 	case _IOC_NR(SNDRV_COMPRESS_GET_CODEC_CAPS):
 		retval = snd_compr_get_codec_caps(stream, arg);
 		break;
+#endif
 	case _IOC_NR(SNDRV_COMPRESS_SET_PARAMS):
 		retval = snd_compr_set_params(stream, arg);
 		break;
sound/core/oss/pcm_oss.c +15 -6
index 58550cc93f28..33e72c809e50 100644
@@ -834,7 +834,8 @@ static int choose_rate(struct snd_pcm_substream *substream,
 	return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL);
 }
 
-static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
+static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream,
+				     bool trylock)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct snd_pcm_hw_params *params, *sparams;
@@ -848,7 +849,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
 	struct snd_mask sformat_mask;
 	struct snd_mask mask;
 
-	if (mutex_lock_interruptible(&runtime->oss.params_lock))
+	if (trylock) {
+		if (!(mutex_trylock(&runtime->oss.params_lock)))
+			return -EAGAIN;
+	} else if (mutex_lock_interruptible(&runtime->oss.params_lock))
 		return -EINTR;
 	sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL);
 	params = kmalloc(sizeof(*params), GFP_KERNEL);
@@ -1092,7 +1096,7 @@ static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_fil
 		if (asubstream == NULL)
 			asubstream = substream;
 		if (substream->runtime->oss.params) {
-			err = snd_pcm_oss_change_params(substream);
+			err = snd_pcm_oss_change_params(substream, false);
 			if (err < 0)
 				return err;
 		}
@@ -1132,7 +1136,7 @@ static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream)
 		return 0;
 	runtime = substream->runtime;
 	if (runtime->oss.params) {
-		err = snd_pcm_oss_change_params(substream);
+		err = snd_pcm_oss_change_params(substream, false);
 		if (err < 0)
 			return err;
 	}
@@ -2163,7 +2167,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
 	runtime = substream->runtime;
 
 	if (runtime->oss.params &&
-	    (err = snd_pcm_oss_change_params(substream)) < 0)
+	    (err = snd_pcm_oss_change_params(substream, false)) < 0)
 		return err;
 
 	info.fragsize = runtime->oss.period_bytes;
@@ -2800,7 +2804,12 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
 		return -EIO;
 	
 	if (runtime->oss.params) {
-		if ((err = snd_pcm_oss_change_params(substream)) < 0)
+		/* use mutex_trylock() for params_lock for avoiding a deadlock
+		 * between mmap_sem and params_lock taken by
+		 * copy_from/to_user() in snd_pcm_oss_write/read()
+		 */
+		err = snd_pcm_oss_change_params(substream, true);
+		if (err < 0)
 			return err;
 	}
 #ifdef CONFIG_SND_PCM_OSS_PLUGINS
sound/core/rawmidi.c +95 -39

238 lines not on this page · raw message

sound/core/seq/oss/seq_oss_init.c +1 -1
index b1221b29728e..6779e82b46dd 100644
@@ -202,7 +202,7 @@ snd_seq_oss_open(struct file *file, int level)
 
 	dp->index = i;
 	if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) {
-		pr_err("ALSA: seq_oss: too many applications\n");
+		pr_debug("ALSA: seq_oss: too many applications\n");
 		rc = -ENOMEM;
 		goto _error;
 	}
sound/core/seq/oss/seq_oss_synth.c +1 -1
index 0f3b38184fe5..b16dbef04174 100644
@@ -308,7 +308,7 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp)
 	struct seq_oss_synth *rec;
 	struct seq_oss_synthinfo *info;
 
-	if (snd_BUG_ON(dp->max_synthdev >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS))
+	if (snd_BUG_ON(dp->max_synthdev > SNDRV_SEQ_OSS_MAX_SYNTH_DEVS))
 		return;
 	for (i = 0; i < dp->max_synthdev; i++) {
 		info = &dp->synths[i];
sound/core/seq/seq_clientmgr.c +3 -0
index 13cfa815732d..58e79e02f217 100644
@@ -678,6 +678,9 @@ static int deliver_to_subscribers(struct snd_seq_client *client,
 	else
 		down_read(&grp->list_mutex);
 	list_for_each_entry(subs, &grp->list_head, src_list) {
+		/* both ports ready? */
+		if (atomic_read(&subs->ref_count) != 2)
+			continue;
 		event->dest = subs->info.dest;
 		if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP)
 			/* convert time according to flag with subscription */
sound/core/seq/seq_ports.c +130 -103

30 lines not on this page · raw message

sound/core/seq/seq_timer.c +67 -20

87 lines not on this page · raw message

sound/core/seq/seq_virmidi.c +17 -6
index 56e0f4cd3f82..81134e067184 100644

Lines of this file are not shown. View the raw message.

sound/core/timer.c +59 -39

98 lines not on this page · raw message

sound/drivers/dummy.c +18 -17
index 016e451ed506..a9f7a75702d2 100644

Lines of this file are not shown. View the raw message.

sound/firewire/bebob/bebob_stream.c +9 -5
index 926e5dcbb66a..5022c9b97ddf 100644

Lines of this file are not shown. View the raw message.

sound/isa/Kconfig +4 -0
index 0216475fc759..37adcc6cbe6b 100644

Lines of this file are not shown. View the raw message.

sound/pci/Kconfig +3 -0
index 656ce39bddbc..8f6594a7d37f 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/hda_generic.c +70 -21

91 lines not on this page · raw message

sound/pci/hda/hda_intel.c +13 -0
index 614baff1f5d7..02a86ba5ba22 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/hda_jack.c +1 -1
index c945e257d368..a33234e04d4f 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/hda_jack.h +1 -1
index 858708a044f5..e9814c0168ea 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/patch_ca0132.c +4 -1
index 4ef2259f88ca..9ceb2bc36e68 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/patch_cirrus.c +27 -0
index a12ae8ac0914..c1c855a6c0af 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/patch_hdmi.c +3 -2
index 4b6fb668c91c..70c945603379 100644

Lines of this file are not shown. View the raw message.

sound/pci/hda/patch_realtek.c +76 -9

85 lines not on this page · raw message

sound/pci/hda/patch_sigmatel.c +3 -3
index 2c7c5eb8b1e9..37b70f8e878f 100644

Lines of this file are not shown. View the raw message.

sound/soc/codecs/rt5645.c +1 -1
index 3e3c7f6be29d..b74840b5becf 100644

Lines of this file are not shown. View the raw message.

sound/soc/soc-pcm.c +2 -1
index c86dc96e8986..65b936e251ea 100644

Lines of this file are not shown. View the raw message.

sound/sparc/Kconfig +1 -0
index d75deba5617d..dfcd38647606 100644

Lines of this file are not shown. View the raw message.

sound/usb/midi.c +0 -1
index 5b4c58c3e2c5..b21b76690b31 100644

Lines of this file are not shown. View the raw message.

sound/usb/quirks.c +16 -2
index 23ea6d800c4c..4f6ce1cac8e2 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#2 lore raw

BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Greg KH
Quoted 1 line · Greg KH

I'm announcing the release of the 4.4.2 kernel.

...

Quoted 5 lines

Peter Hurley (4):
n_tty: Fix unsafe reference to "other" ldisc
tty: Wait interruptibly for tty lock on reopen
tty: Retry failed reopen if tty teardown in-progress
tty: Fix unsafe ldisc reference via ioctl(TIOCGETD)

It seems like 4.4.2 schedules a tty flush work but the work is deleted meanwhile. This was trigerred by a gdb build on our servers [1]. Going to investigate further, if this doesn't ring a bell?

[1]
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:I/gdb/standard/x86_64

kernel tried to execute NX-protected page - exploit attempt? (uid: 399)

BUG: unable to handle kernel paging request at ffff88023fd40000
IP: [<ffff88023fd40000>] 0xffff88023fd40000
PGD 2240067 PUD 23fced063 PMD 23fcee063 PTE 800000023fd40163
Oops: 0011 [#1] PREEMPT SMP
Modules linked in: ata_generic ata_piix nls_iso8859_1 nls_cp437 vfat fat

virtio_rng virtio_blk virtio_pci virtio
k_ipv6 nf_defrag_ipv6 nf_conntrack btrfs xor raid6_pq reiserfs squashfs fuse dm_snapshot dm_bufio dm_mod binfmt_
misc loop sg

CPU: 7 PID: 3127 Comm: gdb Not tainted 4.4.2-3-default #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.1-0-g4adadbd-20151112_172657-sheep25 04/01/2
014
task: ffff8801e43a4240 ti: ffff8800bb2a4000 task.ti: ffff8800bb2a4000
RIP: 0010:[<ffff88023fd40000>]  [<ffff88023fd40000>] 0xffff88023fd40000
RSP: 0018:ffff8800bb2a7c50  EFLAGS: 00056686
RAX: 00000000bb37e180 RBX: 0000000000000001 RCX: 00000000ffffffff
RDX: 0000000000000000 RSI: ffff88023fdd6e80 RDI: ffff88023fdd6e80
RBP: ffffffff810a535a R08: 0000000000000000 R09: 0000000000000020
R10: 0000000001b52cb0 R11: 0000000000000293 R12: 0000000000000046
R13: ffff8800bb37e180 R14: 0000000000016e80 R15: ffff8800bb2a7c80
FS:  00007fe3e4aba740(0000) GS:ffff88023fdc0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88023fd40000 CR3: 00000002353cd000 CR4: 00000000000406e0
Stack:
 000000008146e197 ffff88017ee19f00 ffff880234e26a08 ffff88017ed2a830
 0000000000000005 0000000000010e30 ffff8800bb2a7c90 ffffffff810a5585
 ffff8800bb2a7cc8 ffffffff81092fe1 0000000000000000 ffff88017ee19f00
Call Trace:

Inexact backtrace:

[<ffffffff810a5585>] ? wake_up_process+0x15/0x20 [<ffffffff81092fe1>] ? insert_work+0x81/0xc0 [<ffffffff8109326c>] ? __queue_work+0x24c/0x390 [<ffffffff81093947>] ? queue_work_on+0x27/0x40 [<ffffffff814732db>] ? tty_flip_buffer_push+0x2b/0x30 [<ffffffff81474f1a>] ? pty_write+0x4a/0x60 [<ffffffff8146e5c6>] ? n_tty_write+0x1b6/0x4d0 [<ffffffff810bd330>] ? __wake_up_sync+0x20/0x20 [<ffffffff8146a96b>] ? tty_write+0x1cb/0x2b0 [<ffffffff8146e410>] ? n_tty_open+0xe0/0xe0 [<ffffffff811fa858>] ? __vfs_write+0x28/0xf0 [<ffffffff81334a48>] ? apparmor_file_permission+0x18/0x20 [<ffffffff812ff05d>] ? security_file_permission+0x3d/0xc0 [<ffffffff811facbf>] ? rw_verify_area+0x4f/0xe0 [<ffffffff811faf29>] ? vfs_write+0xa9/0x1a0 [<ffffffff811fbb26>] ? SyS_write+0x46/0xa0 [<ffffffff816a96f6>] ? entry_SYSCALL_64_fastpath+0x16/0x75

Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 0
00> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 RIP [<ffff88023fd40000>] 0xffff88023fd40000
RSP <ffff8800bb2a7c50>
CR2: ffff88023fd40000

---[ end trace 14d86b882766d1bf ]---

thanks,

Signature · 2 lines
js
suse labs
#3 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 11 lines · Jiri Slaby
Quoted 1 line · Greg KH

I'm announcing the release of the 4.4.2 kernel.

...

Quoted 5 lines

Peter Hurley (4):
n_tty: Fix unsafe reference to "other" ldisc
tty: Wait interruptibly for tty lock on reopen
tty: Retry failed reopen if tty teardown in-progress
tty: Fix unsafe ldisc reference via ioctl(TIOCGETD)

It seems like 4.4.2 schedules a tty flush work but the work is deleted meanwhile.

Assuming the stack backtrace is accurate, this doesn't look like a freed work crash.

The process being woken here is a workqueue kworker for the system_unbound_wq, not the work function being queued.

The crash itself is in try_to_wake_up() (again, assuming the stacktrace is valid).

Looking at the gs base @ ffff88023fdc0000 which is for CPU7, rip @ ffff88023fd40000 appears to be in the PERCPU area. You can confirm this in the kernel log (grep PERCPU) which prints the pcpu base ptr.

Quoted 1 line

This was trigerred by a gdb build on our servers [1].

I noted that the crash is not strictly for building gdb but appears to be with gdb running? Perhaps some test that has failed? Maybe some ABI violation with gdb + kvm?

Is this reproducible?

Regards,
Peter Hurley

Quoted 64 lines

Going to investigate further, if this doesn't ring a bell?

[1]
https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:I/gdb/standard/x86_64

kernel tried to execute NX-protected page - exploit attempt? (uid: 399)

BUG: unable to handle kernel paging request at ffff88023fd40000
IP: [<ffff88023fd40000>] 0xffff88023fd40000
PGD 2240067 PUD 23fced063 PMD 23fcee063 PTE 800000023fd40163
Oops: 0011 [#1] PREEMPT SMP
Modules linked in: ata_generic ata_piix nls_iso8859_1 nls_cp437 vfat fat

virtio_rng virtio_blk virtio_pci virtio
k_ipv6 nf_defrag_ipv6 nf_conntrack btrfs xor raid6_pq reiserfs squashfs fuse dm_snapshot dm_bufio dm_mod binfmt_
misc loop sg

CPU: 7 PID: 3127 Comm: gdb Not tainted 4.4.2-3-default #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.8.1-0-g4adadbd-20151112_172657-sheep25 04/01/2
014
task: ffff8801e43a4240 ti: ffff8800bb2a4000 task.ti: ffff8800bb2a4000
RIP: 0010:[<ffff88023fd40000>]  [<ffff88023fd40000>] 0xffff88023fd40000
RSP: 0018:ffff8800bb2a7c50  EFLAGS: 00056686
RAX: 00000000bb37e180 RBX: 0000000000000001 RCX: 00000000ffffffff
RDX: 0000000000000000 RSI: ffff88023fdd6e80 RDI: ffff88023fdd6e80
RBP: ffffffff810a535a R08: 0000000000000000 R09: 0000000000000020
R10: 0000000001b52cb0 R11: 0000000000000293 R12: 0000000000000046
R13: ffff8800bb37e180 R14: 0000000000016e80 R15: ffff8800bb2a7c80
FS:  00007fe3e4aba740(0000) GS:ffff88023fdc0000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff88023fd40000 CR3: 00000002353cd000 CR4: 00000000000406e0
Stack:
 000000008146e197 ffff88017ee19f00 ffff880234e26a08 ffff88017ed2a830
 0000000000000005 0000000000010e30 ffff8800bb2a7c90 ffffffff810a5585
 ffff8800bb2a7cc8 ffffffff81092fe1 0000000000000000 ffff88017ee19f00
Call Trace:

Inexact backtrace:

[<ffffffff810a5585>] ? wake_up_process+0x15/0x20 [<ffffffff81092fe1>] ? insert_work+0x81/0xc0 [<ffffffff8109326c>] ? __queue_work+0x24c/0x390 [<ffffffff81093947>] ? queue_work_on+0x27/0x40 [<ffffffff814732db>] ? tty_flip_buffer_push+0x2b/0x30 [<ffffffff81474f1a>] ? pty_write+0x4a/0x60 [<ffffffff8146e5c6>] ? n_tty_write+0x1b6/0x4d0 [<ffffffff810bd330>] ? __wake_up_sync+0x20/0x20 [<ffffffff8146a96b>] ? tty_write+0x1cb/0x2b0 [<ffffffff8146e410>] ? n_tty_open+0xe0/0xe0 [<ffffffff811fa858>] ? __vfs_write+0x28/0xf0 [<ffffffff81334a48>] ? apparmor_file_permission+0x18/0x20 [<ffffffff812ff05d>] ? security_file_permission+0x3d/0xc0 [<ffffffff811facbf>] ? rw_verify_area+0x4f/0xe0 [<ffffffff811faf29>] ? vfs_write+0xa9/0x1a0 [<ffffffff811fbb26>] ? SyS_write+0x46/0xa0 [<ffffffff816a96f6>] ? entry_SYSCALL_64_fastpath+0x16/0x75

Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

00 00 00 00 00 00 00 00 00 00 00 00 00 0
00> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 RIP [<ffff88023fd40000>] 0xffff88023fd40000
RSP <ffff8800bb2a7c50>
CR2: ffff88023fd40000

---[ end trace 14d86b882766d1bf ]---

thanks,

#4 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 3 lines · Peter Hurley

The crash itself is in try_to_wake_up() (again, assuming the stacktrace is valid).

No, the crash seems to be off in la-la-land, judging by the oops:

IP: [<ffff88023fd40000>] 0xffff88023fd40000

which isn't kernel code at all. It is close to, but not at, the percpu area you point out.

But yes, the call trace looks accurate and makes sense, we haveL

tty_flip_buffer_push ->

    (queue_work is inline) ->
    queue_work_on ->
      __queue_work ->
        insert_work ->
          (wake_up_worker is inlined)
          wake_up_process ->
            *insane non-code address*

but I cannot for the life of me see how we get to an insane address. It smells like stack corruption when returning from try_to_wake_up() or something like that.

Hmm. Actually, try_to_wake_up() will do several indirect calls (task_waking and select_task_rq, and it_func_ptr->fn for tracing), but then I'd expect to see try_to_wake_up itself in the stack trace.

Of course, when you jump to la-la-land, crazy things can happen. And that offending IP is at a page boundary, so it migth have run some random code on the previous page.

Quite frankly, neither ->task_waking() nor ->select_task_rq() look very likely. But the tracepoint stuff is actually fairly dynamic, and does things like

    it_func_ptr = rcu_dereference_sched((tp)->funcs);

to get the function pointer information, so if there is some race in there, anything can happen.

Jiri, were you messing around with tracing when this happened? Or maybe shutting down CPU's? There was a RCU locking problem with CPU shutdown, maybe this is one of the symptoms. The fix for that is recent, and not in 4.4.2.

Adding Steven Rostedt to the cc. Steven, does that look like a possible case?

Linus

#5 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 6 lines · On Thu, 25 Feb 2016 11:09:35 -0800 Linus Torvalds…

Jiri, were you messing around with tracing when this happened? Or maybe shutting down CPU's? There was a RCU locking problem with CPU shutdown, maybe this is one of the symptoms. The fix for that is recent, and not in 4.4.2.

Adding Steven Rostedt to the cc. Steven, does that look like a possible case?

Possible: yes. Likely: no

The recent fix would require shutting down a CPU at the same time as a tracepoint is enabled or disabled. Rather difficult to hit, but easier on a virtual machine. If Jiri was not enabling/disabling tracepoints or shutting down CPUs, then it would not be the bug.

But as the comm of the bug is gdb and this running on a virtual machine, I think the bug may be elsewhere. Corrupt stack possibly?

-- Steve

#7 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Linus Torvalds
Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Peter Hurley

The crash itself is in try_to_wake_up() (again, assuming the stacktrace is valid).

No, the crash seems to be off in la-la-land

I meant the last-known-good address is try_to_wake_up(); in the same way that RIP @ 0 crashes, but no one says the crash is @ NULL.

Quoted 6 lines

, judging by the oops:

   IP: [<ffff88023fd40000>] 0xffff88023fd40000

which isn't kernel code at all. It is close to, but not at, the percpu area you point out.

Assuming ffff88023fdc0000 is percpu start for cpu 7 then I'm pretty sure

         ffff88023fd40000 is percpu start for cpu 6.

Either way, RIP is almost certainly in the percpu block.

Quoted 9 lines

But yes, the call trace looks accurate and makes sense, we haveL

tty_flip_buffer_push ->

    (queue_work is inline) ->
    queue_work_on ->
      __queue_work ->
        insert_work ->
          (wake_up_worker is inlined)
          wake_up_process ->
              try_to_wake_up ->
Quoted 11 lines

*insane non-code address*

but I cannot for the life of me see how we get to an insane address. It smells like stack corruption when returning from try_to_wake_up() or something like that.

Hmm. Actually, try_to_wake_up() will do several indirect calls (task_waking and select_task_rq, and it_func_ptr->fn for tracing), but then I'd expect to see try_to_wake_up itself in the stack trace.

Quoted 6 lines

Of course, when you jump to la-la-land, crazy things can happen. And that offending IP is at a page boundary, so it migth have run some random code on the previous page.

Quite frankly, neither ->task_waking() nor ->select_task_rq() look very likely.

Agreed, the sched_class indirections do not seem likely.

Quoted 17 lines

But the tracepoint stuff is actually fairly dynamic, and does things like

    it_func_ptr = rcu_dereference_sched((tp)->funcs);

to get the function pointer information, so if there is some race in there, anything can happen.

Jiri, were you messing around with tracing when this happened? Or maybe shutting down CPU's? There was a RCU locking problem with CPU shutdown, maybe this is one of the symptoms. The fix for that is recent, and not in 4.4.2.

Adding Steven Rostedt to the cc. Steven, does that look like a possible case?

Linus

#8 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 10 lines · Peter Hurley
Quoted 9 lines

But yes, the call trace looks accurate and makes sense, we haveL

tty_flip_buffer_push ->

    (queue_work is inline) ->
    queue_work_on ->
      __queue_work ->
        insert_work ->
          (wake_up_worker is inlined)
          wake_up_process ->
Quoted 3 lines
              try_to_wake_up ->
Quoted 1 line

*insane non-code address*

The thing is, we don't actually have that try_to_wake_up() on the stack in the oops report. There are other thigns on the stack, but the first stack entry that is dumped that is a text address is that "ffffffff810a5585" which is wake_up_process.

That's why I said it might be stack corruption: we might be returning from try_to_wake_up(), but with a corrupt stack entry, and returning to garbage.

If it was one of the calls _in_ try_to_wake_up() that called to insane code, I would have expected to see try_to_wake_up on the stack.

That's particularly true on modern machines, where things like the percpu area is nopefully marked NX, so that we shouldn't be executing random instructions. Which is the fault that actually triggers ("kernel tried to execute NX-protected page"), so the "we corrupted the stack by running random code at the original target of the jump" scenario sounds much less likely.

So the whole oops looks odd. If it really was one of the calls from try_to_wake_up(), why isn't that return address on the stack?

Since this is under qemu, I'm wondering if this is a qemu bug, where the NX fault processing of a call instruction happens before the stack is pushed, but when the instruction pointer already points to the new address.

Another alternative *might* be that gcc has turned an indirect tail-call call into a "jmp *", but I certainly don't see that when I compile the file myself. I've seen it in the past in some (very unusual) cases, so it's possible - gcc definitely knows about tail-call jmp conversion (even if it makes debugging sometimes a pain).

Jiri, can you check your try_to_wake_up() disassembly for some indirect "jmp" instructions?

Linus

#9 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 2 lines · Linus Torvalds

Jiri, can you check your try_to_wake_up() disassembly for some indirect "jmp" instructions?

Nope, there is none.

I will reply to all your questions tomorrow.

Just quickly, as I have to go (and don't want you to duplicate efforts) the kernel which was used can be obtained here:
https://build.opensuse.org/package/binaries/openSUSE:Factory:Staging:I/kernel-default?repository=standard

The issue is very weird, indeed, this is what I noted to our bugzilla:
The stack trace ends in call of try_to_wake_up. Then, there it has to be some of the indirect calls:

callq *0x40(%rax)
p->sched_class->select_task_rq from select_task_rq

RAX is 0x00000000bb37e180, barely can be read with offset 0x40

callq *0xd85656(%rip) # ffffffff81e2aba0 <smp_ops+0x20>
smp_ops.smp_send_reschedule from ttwu_queue_remote

Which hardly can be it, given smp_ops is static.

So it has to be some other "call *" from a nested function :(.

Interestingly, RBP contains address inside try_to_wake_up -- ffffffff810a535a (dunno why) which is:
ffffffff810a5355: e8 66 a0 ff ff callq ffffffff8109f3c0
<ttwu_stat>
ffffffff810a535a: e9 9d fe ff ff jmpq ffffffff810a51fc
<try_to_wake_up+0x3c>

ttwu_stat does in the begginning:
mov $0x16e80,%r14

which is what we actually still have in r14 when it crashes. The first ttwu_stat's "if" has to go through the true branch (otherwise r14 would be overwritten).

Another note: we die when jmp/calling to 0xffff88023fd40000. RSI=RDI=0xffff88023fdd6e80. RSI-RIP is 0x96e80, which is R14 + 0x80000. Coincidence?

thanks,

Signature · 2 lines
js
suse labs
#21 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Linus Torvalds
Quoted 11 lines · Linus Torvalds
Quoted 10 lines · Peter Hurley
Quoted 9 lines

But yes, the call trace looks accurate and makes sense, we haveL

tty_flip_buffer_push ->

    (queue_work is inline) ->
    queue_work_on ->
      __queue_work ->
        insert_work ->
          (wake_up_worker is inlined)
          wake_up_process ->
Quoted 6 lines
Quoted 3 lines
              try_to_wake_up ->
Quoted 1 line

*insane non-code address*

The thing is, we don't actually have that try_to_wake_up() on the stack in the oops report.

I know, but last execution prior to things going sideways was definitely in try_to_wake_up().

Quoted 10 lines

There are other thigns on the stack, but the
first stack entry that is dumped that is a text address is that "ffffffff810a5585" which is wake_up_process.

That's why I said it might be stack corruption: we might be returning from try_to_wake_up(), but with a corrupt stack entry, and returning to garbage.

If it was one of the calls _in_ try_to_wake_up() that called to insane code, I would have expected to see try_to_wake_up on the stack.

Agreed, how execution got from try_to_wake_up() to mysterious percpu address without call is the question.

Quoted 9 lines

That's particularly true on modern machines, where things like the percpu area is nopefully marked NX, so that we shouldn't be executing random instructions. Which is the fault that actually triggers ("kernel tried to execute NX-protected page"), so the "we corrupted the stack by running random code at the original target of the jump" scenario sounds much less likely.

So the whole oops looks odd. If it really was one of the calls from try_to_wake_up(), why isn't that return address on the stack?

I don't think it's anything from code flow.

Quoted 4 lines

Since this is under qemu, I'm wondering if this is a qemu bug, where the NX fault processing of a call instruction happens before the stack is pushed, but when the instruction pointer already points to the new address.

Or any fault processing really; an iret to the bogus address would then trigger NX fault without leaving a trace of the broken exception handling.

Quoted 12 lines

Another alternative *might* be that gcc has turned an indirect tail-call call into a "jmp *", but I certainly don't see that when I compile the file myself. I've seen it in the past in some (very unusual) cases, so it's possible - gcc definitely knows about tail-call jmp conversion (even if it makes debugging sometimes a pain).

Jiri, can you check your try_to_wake_up() disassembly for some indirect "jmp" instructions?

Linus

#22 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Linus Torvalds
Quoted 17 lines · Linus Torvalds
Quoted 11 lines
Quoted 7 lines

tty_flip_buffer_push ->

    (queue_work is inline) ->
    queue_work_on ->
      __queue_work ->
        insert_work ->
          (wake_up_worker is inlined)
          wake_up_process ->
              try_to_wake_up ->
Quoted 1 line

*insane non-code address*

The thing is, we don't actually have that try_to_wake_up() on the stack in the oops report. There are other thigns on the stack, but the first stack entry that is dumped that is a text address is that "ffffffff810a5585" which is wake_up_process.

Quoted 6 lines

That's why I said it might be stack corruption: we might be returning from try_to_wake_up(), but with a corrupt stack entry, and returning to garbage.

If it was one of the calls _in_ try_to_wake_up() that called to insane code, I would have expected to see try_to_wake_up on the stack.

try_to_wake_up() is very likely to be inlined into wake_up_process(), and therefore in such cases will never be on the stack as a return address; it'll always be wake_up_process().

Signature · 2 lines
Jiri Kosina
SUSE Labs
#10 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Jiri Slaby
Quoted 31 lines · Jiri Slaby
Quoted 2 lines · Linus Torvalds

Jiri, can you check your try_to_wake_up() disassembly for some indirect "jmp" instructions?

Nope, there is none.

I will reply to all your questions tomorrow.

Just quickly, as I have to go (and don't want you to duplicate efforts) the kernel which was used can be obtained here:
https://build.opensuse.org/package/binaries/openSUSE:Factory:Staging:I/kernel-default?repository=standard

The issue is very weird, indeed, this is what I noted to our bugzilla:
The stack trace ends in call of try_to_wake_up. Then, there it has to be some of the indirect calls:

callq *0x40(%rax)
p->sched_class->select_task_rq from select_task_rq

RAX is 0x00000000bb37e180, barely can be read with offset 0x40

callq *0xd85656(%rip) # ffffffff81e2aba0 <smp_ops+0x20>
smp_ops.smp_send_reschedule from ttwu_queue_remote

Which hardly can be it, given smp_ops is static.

So it has to be some other "call *" from a nested function :(.

Quoted 6 lines

Interestingly, RBP contains address inside try_to_wake_up -- ffffffff810a535a (dunno why) which is:
ffffffff810a5355: e8 66 a0 ff ff callq ffffffff8109f3c0
<ttwu_stat>
ffffffff810a535a: e9 9d fe ff ff jmpq ffffffff810a51fc
<try_to_wake_up+0x3c>

That would imply that RSP was off by +8 when the ttwu_stat() epilog was executed so that RBP <= ret addr and RIP <= some local var in try_to_wake_up() stack frame.

Looks like R15 in the crash report could be what RBP should have been.

Now to find out why RSP is +8

Quoted 17 lines

ttwu_stat does in the begginning:
mov $0x16e80,%r14

which is what we actually still have in r14 when it crashes. The first ttwu_stat's "if" has to go through the true branch (otherwise r14 would be overwritten).

Another note: we die when jmp/calling to 0xffff88023fd40000. RSI=RDI=0xffff88023fdd6e80. RSI-RIP is 0x96e80, which is R14 + 0x80000. Coincidence?

thanks,

#13 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Jiri Slaby
Quoted 8 lines · Jiri Slaby

Interestingly, RBP contains address inside try_to_wake_up -- ffffffff810a535a (dunno why) which is:
ffffffff810a5355: e8 66 a0 ff ff callq ffffffff8109f3c0
<ttwu_stat>
ffffffff810a535a: e9 9d fe ff ff jmpq ffffffff810a51fc
<try_to_wake_up+0x3c>

Quoted 6 lines

ttwu_stat does in the begginning:
mov $0x16e80,%r14

which is what we actually still have in r14 when it crashes. The first ttwu_stat's "if" has to go through the true branch (otherwise r14 would be overwritten).

Hmm. That does sound very much like it might be ttwu_stat() that has gotten the stack frame wrong, and when finishes exits, it does

popq %rbp
ret

but in fact it popped the return address, and then returned to a crazy address.

Which sounds like a corrupted stack pointer (not a corrupted stack).

Can you make just the "vmlinux" file available somewhere?

In my own private configuration, ttwu_stat() doesn't actually touch the stack at all - no stack pointer action anywhere except for the

ttwu_stat:
1: call __fentry__
pushq %rbp
..
movq %rsp, %rbp #,

.....

popq %rbp
ret

but yeah, as Peter says, maybe an exception screwed up %rsp somehow..

I really don't see how it would happen here - that code doesn't look particularly odd.

And the fentry code used by the function tracer can certainly screw things up, but even that would be hard-pressed to screw up %rbp, since the saving of rbp comes *after* fentry. Old pre-__fentry__ gcc versions had a much higher likelihood (the whole mcount thing is a disaster, but I'm assuming you have a compiler that does __fentry__ and have CC_USING_FENTRY set?)

Linus

#11 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Peter Hurley
Quoted 39 lines · Peter Hurley
Quoted 31 lines · Jiri Slaby
Quoted 2 lines · Linus Torvalds

Jiri, can you check your try_to_wake_up() disassembly for some indirect "jmp" instructions?

Nope, there is none.

I will reply to all your questions tomorrow.

Just quickly, as I have to go (and don't want you to duplicate efforts) the kernel which was used can be obtained here:
https://build.opensuse.org/package/binaries/openSUSE:Factory:Staging:I/kernel-default?repository=standard

The issue is very weird, indeed, this is what I noted to our bugzilla:
The stack trace ends in call of try_to_wake_up. Then, there it has to be some of the indirect calls:

callq *0x40(%rax)
p->sched_class->select_task_rq from select_task_rq

RAX is 0x00000000bb37e180, barely can be read with offset 0x40

callq *0xd85656(%rip) # ffffffff81e2aba0 <smp_ops+0x20>
smp_ops.smp_send_reschedule from ttwu_queue_remote

Which hardly can be it, given smp_ops is static.

So it has to be some other "call *" from a nested function :(.

Quoted 6 lines

Interestingly, RBP contains address inside try_to_wake_up -- ffffffff810a535a (dunno why) which is:
ffffffff810a5355: e8 66 a0 ff ff callq ffffffff8109f3c0
<ttwu_stat>
ffffffff810a535a: e9 9d fe ff ff jmpq ffffffff810a51fc
<try_to_wake_up+0x3c>

Quoted 7 lines

That would imply that RSP was off by +8 when the ttwu_stat() epilog was executed so that RBP <= ret addr and RIP <= some local var in try_to_wake_up() stack frame.

Looks like R15 in the crash report could be what RBP should have been.

Now to find out why RSP is +8

Which I would investigate if I could download that kernel. Unfortunately, OBS doesn't like me so if you could make that kernel available some other way or send me a mixed listing of kernel/sched/core.c

Quoted 16 lines
Quoted 15 lines

ttwu_stat does in the begginning:
mov $0x16e80,%r14

which is what we actually still have in r14 when it crashes. The first ttwu_stat's "if" has to go through the true branch (otherwise r14 would be overwritten).

Another note: we die when jmp/calling to 0xffff88023fd40000. RSI=RDI=0xffff88023fdd6e80. RSI-RIP is 0x96e80, which is R14 + 0x80000. Coincidence?

thanks,

#24 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Peter Hurley
Quoted 4 lines · Peter Hurley
Quoted 1 line

This was trigerred by a gdb build on our servers [1].

I noted that the crash is not strictly for building gdb but appears to be with gdb running?

Yes, when gdb is built, gdb tests are run. From the build log gdb_log [1], checks were run on the top of built gdb:
./orphanripper make -j8 -k check//unix/-m64 check//unix/-m64/-fPIC/-pie check//unix/-m32 check//unix/-m32/-fPIC/-pie

[1] http://labs.suse.cz/jslaby/bug-968218/

Quoted 2 lines

Perhaps some test that has failed?
Maybe some ABI violation with gdb + kvm?

[  425s]                === gdb tests ===
[  425s]
[  425s] Schedule of variations:
[  425s]     unix/-m32
[  425s]
[  425s] Running target unix/-m32
[  425s] Using /usr/share/dejagnu/baseboards/unix.exp as board

description file for target.
[ 425s] Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
[ 425s] Using /home/abuild/rpmbuild/BUILD/gdb-7.10.1/gdb/testsuite/config/unix.exp as tool-and-target-specific interface file.
[ 425s] Running /home/abuild/rpmbuild/BUILD/gdb-7.10.1/gdb/testsuite/gdb.base/break-interp.exp
...
[ 425s] [ 413.383880] kernel tried to execute NX-protected page - exploit attempt? (uid: 399)

It's plenty of code run in there:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/testsuite/gdb.base/break-interp.exp;h=713e1008fb3739f7fdcdb6c0a484a46b279ef1b6;hb=HEAD

Quoted 1 line

Is this reproducible?

I tried whole day yesterday without luck :(.

thanks,

Signature · 2 lines
js
suse labs
#6 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Steven Rostedt
Quoted 9 lines · Steven Rostedt
Quoted 5 lines · On Thu, 25 Feb 2016 11:09:35 -0800 Linus Torvalds…

Jiri, were you messing around with tracing when this happened? Or maybe shutting down CPU's? There was a RCU locking problem with CPU shutdown, maybe this is one of the symptoms. The fix for that is recent, and not in 4.4.2.

Quoted 8 lines
Quoted 1 line

Adding Steven Rostedt to the cc. Steven, does that look like a possible case?

Possible: yes. Likely: no

The recent fix would require shutting down a CPU at the same time as a tracepoint is enabled or disabled. Rather difficult to hit, but easier on a virtual machine. If Jiri was not enabling/disabling tracepoints or shutting down CPUs, then it would not be the bug.

As this is an automatic build, I very doubt a CPU was offlined or tracepoints enabled. So I see it even less unlikely this to happen concurrently.

Quoted 2 lines

But as the comm of the bug is gdb and this running on a virtual machine, I think the bug may be elsewhere. Corrupt stack possibly?

Seems so (broken stack frame pointer link), as is indicated in other e-mail.

thanks,

Signature · 2 lines
js
suse labs
#23 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Jiri Kosina
Quoted 6 lines · Jiri Kosina
Quoted 2 lines

If it was one of the calls _in_ try_to_wake_up() that called to insane code, I would have expected to see try_to_wake_up on the stack.

try_to_wake_up() is very likely to be inlined into wake_up_process(), and therefore in such cases will never be on the stack as a return address; it'll always be wake_up_process().

Actually it is not inlined, see core.s at:
http://labs.suse.cz/jslaby/bug-968218/

thanks,

Signature · 2 lines
js
suse labs
#12 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Peter Hurley
Quoted 4 lines · Peter Hurley
Quoted 4 lines

That would imply that RSP was off by +8 when the ttwu_stat() epilog was executed so that RBP <= ret addr and RIP <= some local var in try_to_wake_up() stack frame.

Quoted 8 lines
Quoted 3 lines

Looks like R15 in the crash report could be what RBP should have been.

Now to find out why RSP is +8

Which I would investigate if I could download that kernel. Unfortunately, OBS doesn't like me so if you could make that kernel available some other way or send me a mixed listing of kernel/sched/core.c

Actually I cannot do mixed listing using objdump, as my objdump complains in the middle of vmlinux:
objdump: Dwarf Error: mangled line number section.

and dumps no more code afterwards. (And core.c is after the error happens.)

Nevertheless, I did:
gdb vmlinux-4.4.2-3-default -ex 'disass /m try_to_wake_up' --batch > try_to_wake_up.mixed
gdb vmlinux-4.4.2-3-default -ex 'disass /m ttwu_stat' --batch

Quoted 1 line

ttwu_stat.mixed

And both will appear at:
http://labs.suse.cz/jslaby/bug-968218/

thanks,

Signature · 2 lines
js
suse labs
#14 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Linus Torvalds
Quoted 19 lines · Linus Torvalds
Quoted 8 lines · Jiri Slaby

Interestingly, RBP contains address inside try_to_wake_up -- ffffffff810a535a (dunno why) which is:
ffffffff810a5355: e8 66 a0 ff ff callq ffffffff8109f3c0
<ttwu_stat>
ffffffff810a535a: e9 9d fe ff ff jmpq ffffffff810a51fc
<try_to_wake_up+0x3c>

Quoted 6 lines

ttwu_stat does in the begginning:
mov $0x16e80,%r14

which is what we actually still have in r14 when it crashes. The first ttwu_stat's "if" has to go through the true branch (otherwise r14 would be overwritten).

Hmm. That does sound very much like it might be ttwu_stat() that has gotten the stack frame wrong, and when finishes exits, it does

Quoted 8 lines

popq %rbp
ret

but in fact it popped the return address, and then returned to a crazy address.

Which sounds like a corrupted stack pointer (not a corrupted stack).

Can you make just the "vmlinux" file available somewhere?

Sure, both vmlinux w/ its separated .debuginfo sections vmlinux.debug are at:
http://labs.suse.cz/jslaby/bug-968218/

There is also core.s which is a result of:
objdump -d vmlinux-4.4.2-3-default | grep -A 10000 '<update_rq_clock>:'

Quoted 11 lines

core.s

In my own private configuration, ttwu_stat() doesn't actually touch the stack at all - no stack pointer action anywhere except for the

ttwu_stat:
1: call __fentry__
pushq %rbp
..
movq %rsp, %rbp #,

Quoted 6 lines

.....

popq %rbp
ret

but yeah, as Peter says, maybe an exception screwed up %rsp somehow..

Lucky you. My ttwu_stat does a bit more stack save-restoring. But all seem to be paired:

ffffffff8109f3c0 <ttwu_stat>:
ffffffff8109f3c0: e8 fb ca 60 00 callq ffffffff816abec0
<__fentry__>

ffffffff8109f3c5:       55                      push   %rbp
ffffffff8109f3c6:       48 89 e5                mov    %rsp,%rbp
ffffffff8109f3c9:       41 57                   push   %r15
ffffffff8109f3cb:       41 56                   push   %r14
ffffffff8109f3cd:       41 55                   push   %r13
ffffffff8109f3cf:       41 54                   push   %r12
ffffffff8109f3d1:       49 c7 c6 80 6e 01 00    mov    $0x16e80,%r14
ffffffff8109f3d8:       53                      push   %rbx
...
ffffffff8109f48c:       5b                      pop    %rbx
ffffffff8109f48d:       41 5c                   pop    %r12
ffffffff8109f48f:       41 5d                   pop    %r13
ffffffff8109f491:       41 5e                   pop    %r14
ffffffff8109f493:       41 5f                   pop    %r15
ffffffff8109f495:       5d                      pop    %rbp
ffffffff8109f496:       c3                      retq
Quoted 9 lines

I really don't see how it would happen here - that code doesn't look particularly odd.

And the fentry code used by the function tracer can certainly screw things up, but even that would be hard-pressed to screw up %rbp, since the saving of rbp comes *after* fentry. Old pre-__fentry__ gcc versions had a much higher likelihood (the whole mcount thing is a disaster, but I'm assuming you have a compiler that does __fentry__ and have CC_USING_FENTRY set?)

Yep, -mfentry in use obviously from the dump above, it is compiled by gcc 5.3.1 rev231346.

thanks,

Signature · 2 lines
js
suse labs
#15 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 2 lines · Jiri Slaby
Quoted 2 lines

I really don't see how it would happen here - that code doesn't look particularly odd.

Funnily enough, this is what I got today, when booting 4.4.2 in qemu VM on my host.

RIP crashing (ffffffff810f28d5) is action->dev_id dereference in handle_irq_event_percpu. Look:

   0xffffffff810f28d5 <+101>:   mov    0x8(%rbx),%rsi
   0xffffffff810f28d9 <+105>:   mov    %r12d,%edi
   0xffffffff810f28dc <+108>:   callq  *(%rbx)
which is
       trace_irq_handler_entry(irq, action);
       res = action->handler(irq, action->dev_id);
       trace_irq_handler_exit(irq, action, res);

Now, I feel a bit worried: crash involving percpu and trace together? I have seen this pattern inlined in try_to_wake_up already (see ffffffff810a54af in core.s [1]).

try_to_wake_up
-> ttwu_queue

    -> ttwu_queue_remote
      -> trace_sched_wake_idle_without_ipi

-> ttwu_stat ** CRASH somewhere here

So is this the same bug or not?

[1] http://labs.suse.cz/jslaby/bug-968218/

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffff810f28d5>] handle_irq_event_percpu+0x65/0x340
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ...
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.2-13.g19ca782-default #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by
qemu-project.org 04/01/2014
task: ffffffff81e12540 ti: ffffffff81e00000 task.ti: ffffffff81e00000
RIP: 0010:[<ffffffff810f28d5>]  [<ffffffff810f28d5>]
handle_irq_event_percpu+0x65/0x340
RSP: 0018:ffff880093e03d88  EFLAGS: 00010002
RAX: 0000000000000001 RBX: 0000000000000000 RCX: 000000000000000f
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000046
RBP: ffff880093e03dc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000004
R13: ffff880087c3b058 R14: 0000000000000000 R15: ffffffff81e03df8
FS:  0000000000000000(0000) GS:ffff880093e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 000000008a790000 CR4: 00000000000006f0
Stack:
 ffff880087c3b000 0000000087c3b0d8 ffff880087c3b058 ffff880087c3b000
 ffff880087c3b0d8 ffff880087c3b058 0000000000000034 ffffffff81e03df8
 ffff880093e03df0 ffffffff810f2bec ffff880087c3b000 ffff880087c3b0d8
Call Trace:
 [<ffffffff810f2bec>] handle_irq_event+0x3c/0x60
 [<ffffffff810f5f60>] handle_edge_irq+0x80/0x150
 [<ffffffff8101f49d>] handle_irq+0x1d/0x30
 [<ffffffff81751ac1>] do_IRQ+0x61/0x120
 [<ffffffff8174f80c>] common_interrupt+0x8c/0x8c

Full inexact backtrace again:

 <IRQ>
 [<ffffffff810f2bec>] handle_irq_event+0x3c/0x60
 [<ffffffff810f5f60>] handle_edge_irq+0x80/0x150
 [<ffffffff8101f49d>] handle_irq+0x1d/0x30
 [<ffffffff81751ac1>] do_IRQ+0x61/0x120
 [<ffffffff8174f80c>] common_interrupt+0x8c/0x8c
 [<ffffffff8108bae7>] ? __do_softirq+0xa7/0x470
 [<ffffffff8108bae0>] ? __do_softirq+0xa0/0x470
 [<ffffffff8108c053>] irq_exit+0xb3/0xc0
 [<ffffffff81751bc2>] smp_apic_timer_interrupt+0x42/0x50
 [<ffffffff8174fb9c>] apic_timer_interrupt+0x8c/0xa0
 <EOI>
 [<ffffffff81067c96>] ? native_safe_halt+0x6/0x10
 [<ffffffff810dcaed>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff81027753>] default_idle+0x23/0x170
 [<ffffffff8102808f>] arch_cpu_idle+0xf/0x20
 [<ffffffff810d270a>] default_idle_call+0x2a/0x40
 [<ffffffff810d2b07>] cpu_startup_entry+0x387/0x400
 [<ffffffff8173fef6>] rest_init+0x136/0x140
 [<ffffffff81f59fe3>] start_kernel+0x499/0x4a6
 [<ffffffff81f59120>] ? early_idt_handler_array+0x120/0x120
 [<ffffffff81f59339>] x86_64_start_reservations+0x2a/0x2c
 [<ffffffff81f59476>] x86_64_start_kernel+0x13b/0x14a
Code: 7e 48 8b 05 5e 58 e2 00 e8 79 8e 00 00 85 c0 74 0d 80 3d 54 3a e2

00 00 0f 84 db 01 00 00 65 ff 0d 01 96 f1 7e 0f 84 89 01 00 00 <48> 8b 73 08 44 89 e7 ff 13 41 89 c5 0f 1f 44 00 00 65 ff 05 e3 RIP [<ffffffff810f28d5>] handle_irq_event_percpu+0x65/0x340
RSP <ffff880093e03d88>
CR2: 0000000000000008

thanks,

Signature · 2 lines
js
suse labs
#16 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 17 lines · Jiri Slaby
Quoted 2 lines · Jiri Slaby
Quoted 2 lines

I really don't see how it would happen here - that code doesn't look particularly odd.

Funnily enough, this is what I got today, when booting 4.4.2 in qemu VM on my host.

RIP crashing (ffffffff810f28d5) is action->dev_id dereference in handle_irq_event_percpu. Look:

   0xffffffff810f28d5 <+101>:   mov    0x8(%rbx),%rsi
   0xffffffff810f28d9 <+105>:   mov    %r12d,%edi
   0xffffffff810f28dc <+108>:   callq  *(%rbx)
which is
       trace_irq_handler_entry(irq, action);
       res = action->handler(irq, action->dev_id);
       trace_irq_handler_exit(irq, action, res);

...

Quoted 1 line

So is this the same bug or not?

Seems not, actually. I think I need:
commit 570540d50710ed192e98e2f7f74578c9486b6b05

Author: Thomas Gleixner <[email protected]>
Date:   Wed Jan 13 14:07:25 2016 +0100

genirq: Validate action before dereferencing it in
handle_irq_event_percpu()

Quoted 66 lines

[1] http://labs.suse.cz/jslaby/bug-968218/

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffff810f28d5>] handle_irq_event_percpu+0x65/0x340
PGD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: ...
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.2-13.g19ca782-default #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS by
qemu-project.org 04/01/2014
task: ffffffff81e12540 ti: ffffffff81e00000 task.ti: ffffffff81e00000
RIP: 0010:[<ffffffff810f28d5>]  [<ffffffff810f28d5>]
handle_irq_event_percpu+0x65/0x340
RSP: 0018:ffff880093e03d88  EFLAGS: 00010002
RAX: 0000000000000001 RBX: 0000000000000000 RCX: 000000000000000f
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000046
RBP: ffff880093e03dc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000004
R13: ffff880087c3b058 R14: 0000000000000000 R15: ffffffff81e03df8
FS:  0000000000000000(0000) GS:ffff880093e00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 0000000000000008 CR3: 000000008a790000 CR4: 00000000000006f0
Stack:
 ffff880087c3b000 0000000087c3b0d8 ffff880087c3b058 ffff880087c3b000
 ffff880087c3b0d8 ffff880087c3b058 0000000000000034 ffffffff81e03df8
 ffff880093e03df0 ffffffff810f2bec ffff880087c3b000 ffff880087c3b0d8
Call Trace:
 [<ffffffff810f2bec>] handle_irq_event+0x3c/0x60
 [<ffffffff810f5f60>] handle_edge_irq+0x80/0x150
 [<ffffffff8101f49d>] handle_irq+0x1d/0x30
 [<ffffffff81751ac1>] do_IRQ+0x61/0x120
 [<ffffffff8174f80c>] common_interrupt+0x8c/0x8c

Full inexact backtrace again:

 <IRQ>
 [<ffffffff810f2bec>] handle_irq_event+0x3c/0x60
 [<ffffffff810f5f60>] handle_edge_irq+0x80/0x150
 [<ffffffff8101f49d>] handle_irq+0x1d/0x30
 [<ffffffff81751ac1>] do_IRQ+0x61/0x120
 [<ffffffff8174f80c>] common_interrupt+0x8c/0x8c
 [<ffffffff8108bae7>] ? __do_softirq+0xa7/0x470
 [<ffffffff8108bae0>] ? __do_softirq+0xa0/0x470
 [<ffffffff8108c053>] irq_exit+0xb3/0xc0
 [<ffffffff81751bc2>] smp_apic_timer_interrupt+0x42/0x50
 [<ffffffff8174fb9c>] apic_timer_interrupt+0x8c/0xa0
 <EOI>
 [<ffffffff81067c96>] ? native_safe_halt+0x6/0x10
 [<ffffffff810dcaed>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffff81027753>] default_idle+0x23/0x170
 [<ffffffff8102808f>] arch_cpu_idle+0xf/0x20
 [<ffffffff810d270a>] default_idle_call+0x2a/0x40
 [<ffffffff810d2b07>] cpu_startup_entry+0x387/0x400
 [<ffffffff8173fef6>] rest_init+0x136/0x140
 [<ffffffff81f59fe3>] start_kernel+0x499/0x4a6
 [<ffffffff81f59120>] ? early_idt_handler_array+0x120/0x120
 [<ffffffff81f59339>] x86_64_start_reservations+0x2a/0x2c
 [<ffffffff81f59476>] x86_64_start_kernel+0x13b/0x14a
Code: 7e 48 8b 05 5e 58 e2 00 e8 79 8e 00 00 85 c0 74 0d 80 3d 54 3a e2

00 00 0f 84 db 01 00 00 65 ff 0d 01 96 f1 7e 0f 84 89 01 00 00 <48> 8b 73 08 44 89 e7 ff 13 41 89 c5 0f 1f 44 00 00 65 ff 05 e3 RIP [<ffffffff810f28d5>] handle_irq_event_percpu+0x65/0x340
RSP <ffff880093e03d88>
CR2: 0000000000000008

thanks,

Signature · 2 lines
js
suse labs
author maintainer
#17 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

Quoted 21 lines · Jiri Slaby
Quoted 17 lines · Jiri Slaby
Quoted 2 lines · Jiri Slaby
Quoted 2 lines

I really don't see how it would happen here - that code doesn't look particularly odd.

Funnily enough, this is what I got today, when booting 4.4.2 in qemu VM on my host.

RIP crashing (ffffffff810f28d5) is action->dev_id dereference in handle_irq_event_percpu. Look:

   0xffffffff810f28d5 <+101>:   mov    0x8(%rbx),%rsi
   0xffffffff810f28d9 <+105>:   mov    %r12d,%edi
   0xffffffff810f28dc <+108>:   callq  *(%rbx)
which is
       trace_irq_handler_entry(irq, action);
       res = action->handler(irq, action->dev_id);
       trace_irq_handler_exit(irq, action, res);

...

Quoted 1 line

So is this the same bug or not?

Quoted 7 lines

Seems not, actually. I think I need:
commit 570540d50710ed192e98e2f7f74578c9486b6b05

Author: Thomas Gleixner <[email protected]>
Date:   Wed Jan 13 14:07:25 2016 +0100

genirq: Validate action before dereferencing it in
handle_irq_event_percpu()

That's in my queue to pick up later today, sorry about that.

greg k-h

#18 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Jiri Slaby
Quoted 4 lines · Jiri Slaby

Sure, both vmlinux w/ its separated .debuginfo sections vmlinux.debug are at:
http://labs.suse.cz/jslaby/bug-968218/

I'm not seeing anything odd there.

It does feel like CPU state corruption - either due to a qemu bug, or due to some odd trap/interrupt handling bug of ours.

Or possibly a CPU/microcode bug. You wouldn't happen to run this on an AMD Piledriver-based CPU with the 0x06000832 microcode?

Because we do have a pending qemu-related bug-report that turned out to be a AMD microcode problem with NMI delivery. Looking at that bug report, it actually looks rather similar - also due to a confused RIP.

Linus

#20 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Jiri Slaby
Quoted 20 lines · Jiri Slaby
Quoted 19 lines · Linus Torvalds
Quoted 8 lines · Jiri Slaby

Interestingly, RBP contains address inside try_to_wake_up -- ffffffff810a535a (dunno why) which is:
ffffffff810a5355: e8 66 a0 ff ff callq ffffffff8109f3c0
<ttwu_stat>
ffffffff810a535a: e9 9d fe ff ff jmpq ffffffff810a51fc
<try_to_wake_up+0x3c>

Quoted 6 lines

ttwu_stat does in the begginning:
mov $0x16e80,%r14

which is what we actually still have in r14 when it crashes. The first ttwu_stat's "if" has to go through the true branch (otherwise r14 would be overwritten).

Hmm. That does sound very much like it might be ttwu_stat() that has gotten the stack frame wrong, and when finishes exits, it does

Quoted 6 lines
Quoted 6 lines

popq %rbp
ret

but in fact it popped the return address, and then returned to a crazy address.

Which sounds like a corrupted stack pointer (not a corrupted stack).

So more analysis would seem to confirm that RSP has been bumped +8 while in ttwu_stat() so when the epilog executed, register restore was off by 1 qword. However, there's nothing in ttwu_stat() that results in stack pointer offset by +1 qword from prolog.

Below I highlighted key instructions from try_to_wake_up() => ttwu_stat() and what presumably was the resultant stack state at each instruction:

call try_to_wake_up   ffffffff810a5585  \
push rbp              ffff8800bb2a7c90   |
push r15              0000000000010e30   |
push r14              0000000000000005   |
push r13              ffff88017ed2a830   |- values from stack trace
push r12              ffff880234e26a08   |
push rbx              ffff88017ee19f00   |
sub  0x10, rsp        000000008146e197   /
                      ffff88023fd40000   => rip @ crash

call raw_spin_lock_irqsave
mov rax, r13
mov 0x16e80, r15

mov 1, r12d

call ttwu_stat        ffffffff810a535a   => rbp @ crash
push rbp              ffff8800bb2a7c80   => r15 @ crash
push r15              0000000000016e80   => r14 @ crash
push r14              ffff8800bb37e180   => r13 @ crash
push r13              0000000000000046   => r12 @ crash
push r12              0000000000000001   => rbx @ crash

push rbx ???
sub 8, rsp ???

So in addition to rbp <= ret addr and r15 <= saved rbp, note also

rbx <= saved r12 (== 1)
r12 <= saved r13 (rflags == 00046)
r14 <= saved r15 (== 0x16e80)

which neatly corresponds to the ttwu_stat() epilog if rsp has been offset by +1 qword.

Regards,
Peter Hurley

#19 lore raw

Re: BUG: unable to handle kernel paging request from pty_write [was: Linux 4.4.2]

In reply to Linus Torvalds
Quoted 9 lines · Linus Torvalds

It does feel like CPU state corruption - either due to a qemu bug, or due to some odd trap/interrupt handling bug of ours.

Or possibly a CPU/microcode bug. You wouldn't happen to run this on an AMD Piledriver-based CPU with the 0x06000832 microcode?

Because we do have a pending qemu-related bug-report that turned out to be a AMD microcode problem with NMI delivery. Looking at that bug report, it actually looks rather similar - also due to a confused RIP.

Just a couple notes about QEMU and KVM...

First, if you suspect a QEMU or KVM bug, feel free to Cc me.

Second, people generally say "QEMU" because that's what the SMBIOS info says, but it's helpful to distinguish the two. Nowadays it's almost always KVM, but at least Intel was running tests on QEMU's binary translator (no VT-x, no KVM) because it supported SMEP and SMAP long before hardware was common. Similarly, the next version of QEMU should support PKE so perhaps someone will be using it again to play with PKE.

Third, suspected QEMU bugs almost always end up being QEMU bugs, but KVM bugs rarely show up as random crashes in a Linux guest. KVM does _really_ little these days unless the host is swapping. (The puzzling aspect of the NMI microcode issue was that it was a plausible KVM bug, but such a KVM bug would have either showed up also on Intel, or if AMD-only also on other kinds of interrupts than NMIs). On the other hand, if your host is swapping and you hit a KVM bug, it's the host that would crash, not the guest.

Thanks,

Paolo