All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.4 000/135] 4.4.229-rc1 review
@ 2020-06-29 15:50 Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 001/135] s390: fix syscall_get_error for compat processes Sasha Levin
                   ` (138 more replies)
  0 siblings, 139 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, torvalds, akpm, linux, shuah, patches,
	ben.hutchings, lkft-triage


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

Responses should be made by Wed 01 Jul 2020 03:53:07 PM UTC.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.4.y&id2=v4.4.228

or in the git tree and branch at:
        git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.

--
Thanks,
Sasha

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

Pseudo-Shortlog of commits:

Adam Honse (1):
  i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets

Ahmed S. Darwish (2):
  block: nr_sects_write(): Disable preemption on seqcount write
  net: core: device_rename: Use rwsem instead of a seqcount

Al Cooper (1):
  xhci: Fix enumeration issue when setting max packet size for FS
    devices.

Al Viro (2):
  sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()
  fix a braino in "sparc32: fix register window handling in
    genregs32_[gs]et()"

Alex Williamson (1):
  vfio-pci: Mask cap zero

Alexander Tsoy (1):
  ALSA: usb-audio: Improve frames size computation

Arnd Bergmann (2):
  dlm: remove BUG() before panic()
  include/linux/bitops.h: avoid clang shift-count-overflow warnings

Bob Peterson (1):
  gfs2: Allow lock_nolock mount to specify jid=X

Bryan O'Donoghue (1):
  clk: qcom: msm8916: Fix the address location of pll->config_reg

Chen Yu (1):
  e1000e: Do not wake up the system via WOL if device wakeup is disabled

Christophe JAILLET (1):
  scsi: acornscsi: Fix an error handling path in acornscsi_probe()

Chuck Lever (1):
  SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()

Chuhong Yuan (1):
  USB: ohci-sm501: Add missed iounmap() in remove

Colin Ian King (1):
  usb: gadget: lpc32xx_udc: don't dereference ep pointer before null
    check

Dan Carpenter (2):
  ALSA: isa/wavefront: prevent out of bounds write in ioctl
  usb: gadget: udc: Potential Oops in error handling code

Daniel Mack (1):
  ALSA: usb-audio: allow clock source validity interrupts

David Christensen (1):
  tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes

Denis Efremov (1):
  drm/radeon: fix fb_div check in ni_init_smc_spll_table()

Dmitry Osipenko (1):
  power: supply: smb347-charger: IRQSTAT_D is volatile

Dmitry V. Levin (1):
  s390: fix syscall_get_error for compat processes

Dongdong Liu (2):
  PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports
  PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode

Emmanuel Nicolet (1):
  ps3disk: use the default segment boundary

Eric Biggers (1):
  crypto: algboss - don't wait during notifier callback

Eric Dumazet (1):
  tcp: grow window for OOO packets only for SACK flows

Fabrice Gasnier (1):
  usb: dwc2: gadget: move gadget resume after the core is in L0 state

Fan Guo (1):
  RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()

Fedor Tokarev (1):
  net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'

Gaurav Singh (1):
  perf report: Fix NULL pointer dereference in
    hists__fprintf_nr_sample_events()

Geoff Levand (1):
  powerpc/ps3: Fix kexec shutdown hang

Gregory CLEMENT (3):
  tty: n_gsm: Fix SOF skipping
  tty: n_gsm: Fix waking up upper tty layer when room available
  tty: n_gsm: Fix bogus i++ in gsm_data_kick

Huacai Chen (1):
  drm/qxl: Use correct notify port address when creating cursor ring

Jann Horn (1):
  lib/zlib: remove outdated and incorrect pre-increment optimization

Jason Yan (1):
  block: Fix use-after-free in blkdev_get()

Jeffle Xu (1):
  ext4: fix partial cluster initialization when splitting extent

Jeremy Kerr (1):
  net: usb: ax88179_178a: fix packet alignment padding

Jiping Ma (1):
  arm64: perf: Report the PC value in REGS_ABI_32 mode

Jiri Olsa (1):
  kretprobe: Prevent triggering kretprobe from within kprobe_flush_task

Joakim Tjernlund (1):
  cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip

John Stultz (1):
  serial: amba-pl011: Make sure we initialize the port.lock spinlock

Julian Scheel (1):
  ALSA: usb-audio: uac1: Invalidate ctl on interrupt

Julian Wiedmann (1):
  s390/qdio: put thinint indicator after early error

Junxiao Bi (3):
  ocfs2: load global_inode_alloc
  ocfs2: fix value of OCFS2_INVALID_SLOT
  ocfs2: fix panic on nfs server over ocfs2

Juri Lelli (1):
  sched/core: Fix PI boosting between RT and DEADLINE tasks

Kai-Heng Feng (3):
  PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
  libata: Use per port sync for detach
  xhci: Poll for U0 after disabling USB2 LPM

Kuppuswamy Sathyanarayanan (1):
  drivers: base: Fix NULL pointer exception in __platform_driver_probe()
    if a driver developer is foolish

Longfang Liu (1):
  USB: ehci: reopen solution for Synopsys HC bug

Luis Chamberlain (1):
  blktrace: break out of blktrace setup on concurrent calls

Lyude Paul (2):
  drm/dp_mst: Reformat drm_dp_check_act_status() a bit
  drm/dp_mst: Increase ACT retry timeout to 3s

Marcelo Ricardo Leitner (1):
  sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket

Marek Szyprowski (2):
  mfd: wm8994: Fix driver operation if loaded as modules
  clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1

Martin Wilck (1):
  scsi: scsi_devinfo: handle non-terminated strings

Masahiro Yamada (1):
  kbuild: improve cc-option to clean up all temporary files

Masami Hiramatsu (3):
  kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
  x86/kprobes: Avoid kretprobe recursion bug
  tracing: Fix event trigger to accept redundant spaces

Matej Dujava (1):
  staging: sm750fb: add missing case while setting FB_VISUAL

Mathias Nyman (1):
  xhci: Fix incorrect EP_STATE_MASK

Minas Harutyunyan (1):
  usb: dwc2: Postponed gadget registration to the udc class driver

Nathan Chancellor (2):
  USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in
    s3c2410_udc_nuke
  ACPI: sysfs: Fix pm_profile_attr type

Naveen N. Rao (1):
  powerpc/kprobes: Fixes for kprobe_lookup_name() on BE

Neal Cardwell (1):
  tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT

Nicholas Piggin (1):
  powerpc/pseries/ras: Fix FWNMI_VALID off by one

Nick Desaulniers (1):
  elfnote: mark all .note sections SHF_ALLOC

Olga Kornievskaia (1):
  NFSv4 fix CLOSE not waiting for direct IO compeletion

Oliver Neukum (1):
  usblp: poison URBs upon disconnect

Pingfan Liu (1):
  powerpc/crashkernel: Take "mem=" option into account

Qais Yousef (3):
  usb/ohci-platform: Fix a warning when hibernating
  usb/xhci-plat: Set PM runtime as active on resume
  usb/ehci-platform: Set PM runtime as active on resume

Qian Cai (1):
  vfio/pci: fix memory leaks in alloc_perm_bits()

Qiushi Wu (3):
  usb: gadget: fix potential double-free in m66592_probe.
  scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
  efi/esrt: Fix reference count leak in esre_create_sysfs_entry.

Raghavendra Rao Ananta (1):
  tty: hvc: Fix data abort due to race in hvc_open

Ridge Kennedy (1):
  l2tp: Allow duplicate session creation with UDP

Rikard Falkeborn (1):
  clk: sunxi: Fix incorrect usage of round_down()

Russell King (3):
  i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
  i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
  netfilter: ipset: fix unaligned atomic access

Sasha Levin (1):
  Linux 4.4.229-rc1

Simon Arlott (1):
  scsi: sr: Fix sr_probe() missing deallocate of device minor

Stafford Horne (1):
  openrisc: Fix issue with argument clobbering for clone/fork

Stefan Riedmueller (1):
  watchdog: da9062: No need to ping manually before setting timeout

Suganath Prabu S (1):
  scsi: mpt3sas: Fix double free warnings

Taehee Yoo (3):
  ip_tunnel: fix use-after-free in ip_tunnel_lookup()
  ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
  net: core: reduce recursion limit value

Takashi Iwai (3):
  ALSA: usb-audio: Clean up mixer element list traverse
  ALSA: usb-audio: Fix OOB access of mixer element list
  ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()

Tang Bin (2):
  USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe()
  usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()

Tariq Toukan (1):
  net: Do not clear the sock TX queue in sk_set_socket()

Tero Kristo (1):
  clk: ti: composite: fix memory leak

Thomas Gleixner (1):
  sched/rt, net: Use CONFIG_PREEMPTION.patch

Toke Høiland-Jørgensen (1):
  net: Revert "pkt_sched: fq: use proper locking in fq_dump_stats()"

Tom Rix (1):
  selinux: fix double free

Tomasz Meresiński (1):
  usb: add USB_QUIRK_DELAY_INIT for Logitech C922

Trond Myklebust (1):
  pNFS/flexfiles: Fix list corruption if the mirror count changes

Tyrel Datwyler (1):
  scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM

Valentin Longchamp (1):
  net: sched: export __netdev_watchdog_up()

Vasily Averin (1):
  sunrpc: fixed rollback in rpc_gssd_dummy_populate()

Viacheslav Dubeyko (1):
  scsi: qla2xxx: Fix issue with adapter's stopping state

Waiman Long (1):
  mm/slab: use memzero_explicit() in kzfree()

Wang Hai (2):
  yam: fix possible memory leak in yam_init_driver
  mld: fix memory leak in ipv6_mc_destroy_dev()

Wolfram Sang (1):
  drm: encoder_slave: fix refcouting error for modules

Xiaoyao Li (1):
  KVM: X86: Fix MSR range of APIC registers in X2APIC mode

Xiyu Yang (3):
  scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
  nfsd: Fix svc_xprt refcnt leak when setup callback client failed
  ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed

Yang Yingliang (1):
  net: fix memleak in register_netdevice()

Yick W. Tse (1):
  ALSA: usb-audio: add quirk for Denon DCD-1500RE

Zekun Shen (1):
  net: alx: fix race condition in alx_remove

Zhang Xiaoxu (2):
  cifs/smb3: Fix data inconsistent when punch hole
  cifs/smb3: Fix data inconsistent when zero file range

Zhiqiang Liu (1):
  bcache: fix potential deadlock problem in btree_gc_coalesce

ashimida (1):
  mksysmap: Fix the mismatch of '.L' symbols in System.map

guodeqing (1):
  net: Fix the arp error in some cases

tannerlove (1):
  selftests/net: in timestamping, strncpy needs to preserve null byte

yu kuai (1):
  ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()

 Makefile                                      |  4 +-
 arch/arm/mach-imx/pm-imx5.c                   |  6 +-
 arch/arm64/kernel/perf_regs.c                 | 25 ++++-
 arch/openrisc/kernel/entry.S                  |  4 +-
 arch/powerpc/include/asm/kprobes.h            |  3 +-
 arch/powerpc/kernel/machine_kexec.c           |  8 +-
 arch/powerpc/platforms/ps3/mm.c               | 22 +++--
 arch/powerpc/platforms/pseries/ras.c          |  5 +-
 arch/s390/include/asm/syscall.h               | 12 ++-
 arch/sparc/kernel/ptrace_32.c                 |  9 +-
 arch/sparc/kernel/ptrace_64.c                 | 13 +--
 arch/x86/kernel/kprobes/core.c                | 12 ++-
 arch/x86/kvm/x86.c                            |  4 +-
 crypto/algboss.c                              |  2 -
 drivers/acpi/sysfs.c                          |  4 +-
 drivers/ata/libata-core.c                     | 11 +--
 drivers/base/platform.c                       |  2 +
 drivers/block/ps3disk.c                       |  1 -
 drivers/clk/qcom/gcc-msm8916.c                |  8 +-
 drivers/clk/samsung/clk-exynos5433.c          |  3 +-
 drivers/clk/sunxi/clk-sunxi.c                 |  2 +-
 drivers/clk/ti/composite.c                    |  1 +
 drivers/firmware/efi/esrt.c                   |  2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c         | 58 +++++++-----
 drivers/gpu/drm/drm_encoder_slave.c           |  5 +-
 drivers/gpu/drm/qxl/qxl_kms.c                 |  2 +-
 drivers/gpu/drm/radeon/ni_dpm.c               |  2 +-
 drivers/i2c/busses/i2c-piix4.c                |  3 +-
 drivers/i2c/busses/i2c-pxa.c                  | 13 +--
 drivers/infiniband/core/mad.c                 |  1 +
 drivers/md/bcache/btree.c                     |  8 +-
 drivers/mfd/wm8994-core.c                     |  1 +
 drivers/net/ethernet/atheros/alx/main.c       |  9 +-
 drivers/net/ethernet/broadcom/tg3.c           |  4 +-
 drivers/net/ethernet/intel/e1000e/netdev.c    | 14 ++-
 drivers/net/hamradio/yam.c                    |  1 +
 drivers/net/usb/ax88179_178a.c                | 11 ++-
 drivers/pci/pcie/aspm.c                       | 10 --
 drivers/pci/quirks.c                          |  1 +
 drivers/power/smb347-charger.c                |  1 +
 drivers/s390/cio/qdio.h                       |  1 -
 drivers/s390/cio/qdio_setup.c                 |  1 -
 drivers/s390/cio/qdio_thinint.c               | 14 +--
 drivers/scsi/arm/acornscsi.c                  |  4 +-
 drivers/scsi/ibmvscsi/ibmvscsi.c              |  2 +
 drivers/scsi/iscsi_boot_sysfs.c               |  2 +-
 drivers/scsi/lpfc/lpfc_els.c                  |  2 +
 drivers/scsi/mpt3sas/mpt3sas_base.c           |  2 +
 drivers/scsi/qla2xxx/tcm_qla2xxx.c            |  2 +
 drivers/scsi/scsi_devinfo.c                   |  5 +-
 drivers/scsi/sr.c                             |  6 +-
 drivers/staging/sm750fb/sm750.c               |  1 +
 drivers/tty/hvc/hvc_console.c                 | 16 +++-
 drivers/tty/n_gsm.c                           | 26 +++---
 drivers/tty/serial/amba-pl011.c               |  1 +
 drivers/usb/class/cdc-acm.c                   |  2 +
 drivers/usb/class/usblp.c                     |  5 +-
 drivers/usb/core/quirks.c                     |  3 +-
 drivers/usb/dwc2/core_intr.c                  |  7 +-
 drivers/usb/dwc2/gadget.c                     |  6 --
 drivers/usb/dwc2/platform.c                   | 11 +++
 drivers/usb/gadget/udc/lpc32xx_udc.c          | 11 ++-
 drivers/usb/gadget/udc/m66592-udc.c           |  2 +-
 drivers/usb/gadget/udc/mv_udc_core.c          |  3 +-
 drivers/usb/gadget/udc/s3c2410_udc.c          |  4 -
 drivers/usb/host/ehci-exynos.c                |  5 +-
 drivers/usb/host/ehci-mxc.c                   |  2 +
 drivers/usb/host/ehci-pci.c                   |  7 ++
 drivers/usb/host/ehci-platform.c              |  5 +
 drivers/usb/host/ohci-platform.c              |  5 +
 drivers/usb/host/ohci-sm501.c                 |  1 +
 drivers/usb/host/xhci-plat.c                  | 11 ++-
 drivers/usb/host/xhci.c                       |  4 +
 drivers/usb/host/xhci.h                       |  2 +-
 drivers/vfio/pci/vfio_pci_config.c            | 14 ++-
 drivers/watchdog/da9062_wdt.c                 |  5 -
 fs/block_dev.c                                | 12 ++-
 fs/cifs/smb2ops.c                             | 12 +++
 fs/dlm/dlm_internal.h                         |  1 -
 fs/ext4/extents.c                             |  2 +-
 fs/gfs2/ops_fstype.c                          |  2 +-
 fs/nfs/direct.c                               | 13 ++-
 fs/nfs/file.c                                 |  1 +
 fs/nfs/flexfilelayout/flexfilelayout.c        | 11 ++-
 fs/nfsd/nfs4callback.c                        |  2 +
 fs/ocfs2/ocfs2_fs.h                           |  4 +-
 fs/ocfs2/suballoc.c                           |  9 +-
 include/linux/bitops.h                        |  2 +-
 include/linux/elfnote.h                       |  2 +-
 include/linux/genhd.h                         |  2 +
 include/linux/kprobes.h                       |  4 +
 include/linux/libata.h                        |  3 +
 include/linux/pci_ids.h                       |  2 +
 include/net/sctp/constants.h                  |  8 +-
 include/net/sock.h                            |  1 -
 kernel/kprobes.c                              | 27 +++++-
 kernel/sched/core.c                           |  3 +-
 kernel/trace/blktrace.c                       | 13 +++
 kernel/trace/trace_events_trigger.c           | 21 ++++-
 lib/zlib_inflate/inffast.c                    | 91 +++++++------------
 mm/slab_common.c                              |  2 +-
 net/core/dev.c                                | 49 +++++-----
 net/core/sock.c                               |  2 +
 net/ipv4/fib_semantics.c                      |  2 +-
 net/ipv4/ip_tunnel.c                          | 14 +--
 net/ipv4/tcp_cubic.c                          |  2 +
 net/ipv4/tcp_input.c                          | 12 ++-
 net/ipv6/ip6_gre.c                            |  9 +-
 net/ipv6/mcast.c                              |  1 +
 net/l2tp/l2tp_core.c                          |  7 +-
 net/netfilter/ipset/ip_set_core.c             |  2 +
 net/sched/sch_fq.c                            | 32 +++----
 net/sched/sch_generic.c                       |  1 +
 net/sctp/associola.c                          |  5 +-
 net/sctp/bind_addr.c                          |  1 +
 net/sctp/protocol.c                           |  1 +
 net/sunrpc/addr.c                             |  4 +-
 net/sunrpc/rpc_pipe.c                         |  1 +
 net/sunrpc/xdr.c                              |  4 +
 scripts/Kbuild.include                        | 11 ++-
 scripts/mksysmap                              |  2 +-
 security/selinux/ss/services.c                |  4 +
 sound/isa/wavefront/wavefront_synth.c         |  8 +-
 sound/soc/fsl/fsl_asrc_dma.c                  |  1 +
 sound/usb/card.h                              |  4 +
 sound/usb/endpoint.c                          | 43 ++++++++-
 sound/usb/endpoint.h                          |  1 +
 sound/usb/mixer.c                             | 41 ++++++---
 sound/usb/mixer.h                             | 15 ++-
 sound/usb/mixer_quirks.c                      | 11 ++-
 sound/usb/mixer_scarlett.c                    |  6 +-
 sound/usb/pcm.c                               |  2 +
 sound/usb/quirks.c                            |  1 +
 tools/perf/builtin-report.c                   |  3 +-
 .../networking/timestamping/timestamping.c    | 10 +-
 135 files changed, 699 insertions(+), 370 deletions(-)

-- 
2.25.1


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

* [PATCH 4.4 001/135] s390: fix syscall_get_error for compat processes
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
@ 2020-06-29 15:50 ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
                   ` (137 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dmitry V. Levin, Elvira Khabirova, Heiko Carstens, Vasily Gorbik,
	Greg Kroah-Hartman

From: "Dmitry V. Levin" <ldv@altlinux.org>

commit b3583fca5fb654af2cfc1c08259abb9728272538 upstream.

If both the tracer and the tracee are compat processes, and gprs[2]
is assigned a value by __poke_user_compat, then the higher 32 bits
of gprs[2] are cleared, IS_ERR_VALUE() always returns false, and
syscall_get_error() always returns 0.

Fix the implementation by sign-extending the value for compat processes
the same way as x86 implementation does.

The bug was exposed to user space by commit 201766a20e30f ("ptrace: add
PTRACE_GET_SYSCALL_INFO request") and detected by strace test suite.

This change fixes strace syscall tampering on s390.

Link: https://lkml.kernel.org/r/20200602180051.GA2427@altlinux.org
Fixes: 753c4dd6a2fa2 ("[S390] ptrace changes")
Cc: Elvira Khabirova <lineprinter@altlinux.org>
Cc: stable@vger.kernel.org # v2.6.28+
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/s390/include/asm/syscall.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h
index 6bc941be69217..166fbd74e316c 100644
--- a/arch/s390/include/asm/syscall.h
+++ b/arch/s390/include/asm/syscall.h
@@ -41,7 +41,17 @@ static inline void syscall_rollback(struct task_struct *task,
 static inline long syscall_get_error(struct task_struct *task,
 				     struct pt_regs *regs)
 {
-	return IS_ERR_VALUE(regs->gprs[2]) ? regs->gprs[2] : 0;
+	unsigned long error = regs->gprs[2];
+#ifdef CONFIG_COMPAT
+	if (test_tsk_thread_flag(task, TIF_31BIT)) {
+		/*
+		 * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
+		 * and will match correctly in comparisons.
+		 */
+		error = (long)(int)error;
+	}
+#endif
+	return IS_ERR_VALUE(error) ? error : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,
-- 
2.25.1


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

* [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 001/135] s390: fix syscall_get_error for compat processes Sasha Levin
@ 2020-06-29 15:50 ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 003/135] i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets Sasha Levin
                   ` (136 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Rikard Falkeborn, Maxime Ripard, Sasha Levin

From: Rikard Falkeborn <rikard.falkeborn@gmail.com>

[ Upstream commit ee25d9742dabed3fd18158b518f846abeb70f319 ]

round_down() can only round to powers of 2. If round_down() is asked
to round to something that is not a power of 2, incorrect results are
produced. The incorrect results can be both too large and too small.

Instead, use rounddown() which can round to any number.

Fixes: 6a721db180a2 ("clk: sunxi: Add A31 clocks support")
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/sunxi/clk-sunxi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 9c79af0c03b21..2cec9e83831fd 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -311,7 +311,7 @@ static void sun6i_a31_get_pll1_factors(u32 *freq, u32 parent_rate,
 	 * Round down the frequency to the closest multiple of either
 	 * 6 or 16
 	 */
-	u32 round_freq_6 = round_down(freq_mhz, 6);
+	u32 round_freq_6 = rounddown(freq_mhz, 6);
 	u32 round_freq_16 = round_down(freq_mhz, 16);
 
 	if (round_freq_6 > round_freq_16)
-- 
2.25.1


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

* [PATCH 4.4 003/135] i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 001/135] s390: fix syscall_get_error for compat processes Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
@ 2020-06-29 15:50 ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 004/135] clk: qcom: msm8916: Fix the address location of pll->config_reg Sasha Levin
                   ` (135 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Adam Honse, Jean Delvare, Sebastian Reichel, Wolfram Sang, Sasha Levin

From: Adam Honse <calcprogrammer1@gmail.com>

[ Upstream commit f27237c174fd9653033330e4e532cd9d153ce824 ]

The AMD X370 and other AM4 chipsets (A/B/X 3/4/5 parts) and Threadripper
equivalents have a secondary SMBus controller at I/O port address
0x0B20.  This bus is used by several manufacturers to control
motherboard RGB lighting via embedded controllers.  I have been using
this bus in my OpenRGB project to control the Aura RGB on many
motherboards and ASRock also uses this bus for their Polychrome RGB
controller.

I am not aware of any CZ-compatible platforms which do not have the
second SMBus channel.  All of AMD's AM4- and Threadripper- series
chipsets that OpenRGB users have tested appear to have this secondary
bus.  I also noticed this secondary bus is present on older AMD
platforms including my FM1 home server.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=202587
Signed-off-by: Adam Honse <calcprogrammer1@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-piix4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index b61db9db3ca5d..c85ac178c4838 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -647,7 +647,8 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	}
 
 	if (dev->vendor == PCI_VENDOR_ID_AMD &&
-	    dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) {
+	    (dev->device == PCI_DEVICE_ID_AMD_HUDSON2_SMBUS ||
+	     dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)) {
 		retval = piix4_setup_sb800(dev, id, 1);
 	}
 
-- 
2.25.1


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

* [PATCH 4.4 004/135] clk: qcom: msm8916: Fix the address location of pll->config_reg
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (2 preceding siblings ...)
  2020-06-29 15:50 ` [PATCH 4.4 003/135] i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets Sasha Levin
@ 2020-06-29 15:50 ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 005/135] ALSA: isa/wavefront: prevent out of bounds write in ioctl Sasha Levin
                   ` (134 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:50 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Bryan O'Donoghue, Georgi Djakov, Andy Gross, Bjorn Andersson,
	Michael Turquette, Stephen Boyd, Sasha Levin

From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

[ Upstream commit f47ab3c2f5338828a67e89d5f688d2cef9605245 ]

During the process of debugging a processor derived from the msm8916 which
we found the new processor was not starting one of its PLLs.

After tracing the addresses and writes that downstream was doing and
comparing to upstream it became obvious that we were writing to a different
register location than downstream when trying to configure the PLL.

This error is also present in upstream msm8916.

As an example clk-pll.c::clk_pll_recalc_rate wants to write to
pll->config_reg updating the bit-field POST_DIV_RATIO. That bit-field is
defined in PLL_USER_CTL not in PLL_CONFIG_CTL. Taking the BIMC PLL as an
example

lm80-p0436-13_c_qc_snapdragon_410_processor_hrd.pdf

0x01823010 GCC_BIMC_PLL_USER_CTL
0x01823014 GCC_BIMC_PLL_CONFIG_CTL

This pattern is repeated for gpll0, gpll1, gpll2 and bimc_pll.

This error is likely not apparent since the bootloader will already have
initialized these PLLs.

This patch corrects the location of config_reg from PLL_CONFIG_CTL to
PLL_USER_CTL for all relevant PLLs on msm8916.

Fixes commit 3966fab8b6ab ("clk: qcom: Add MSM8916 Global Clock Controller support")

Cc: Georgi Djakov <georgi.djakov@linaro.org>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Link: https://lkml.kernel.org/r/20200329124116.4185447-1-bryan.odonoghue@linaro.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/qcom/gcc-msm8916.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c
index 95a4dd290f35a..d7dd0417ef5e8 100644
--- a/drivers/clk/qcom/gcc-msm8916.c
+++ b/drivers/clk/qcom/gcc-msm8916.c
@@ -270,7 +270,7 @@ static struct clk_pll gpll0 = {
 	.l_reg = 0x21004,
 	.m_reg = 0x21008,
 	.n_reg = 0x2100c,
-	.config_reg = 0x21014,
+	.config_reg = 0x21010,
 	.mode_reg = 0x21000,
 	.status_reg = 0x2101c,
 	.status_bit = 17,
@@ -297,7 +297,7 @@ static struct clk_pll gpll1 = {
 	.l_reg = 0x20004,
 	.m_reg = 0x20008,
 	.n_reg = 0x2000c,
-	.config_reg = 0x20014,
+	.config_reg = 0x20010,
 	.mode_reg = 0x20000,
 	.status_reg = 0x2001c,
 	.status_bit = 17,
@@ -324,7 +324,7 @@ static struct clk_pll gpll2 = {
 	.l_reg = 0x4a004,
 	.m_reg = 0x4a008,
 	.n_reg = 0x4a00c,
-	.config_reg = 0x4a014,
+	.config_reg = 0x4a010,
 	.mode_reg = 0x4a000,
 	.status_reg = 0x4a01c,
 	.status_bit = 17,
@@ -351,7 +351,7 @@ static struct clk_pll bimc_pll = {
 	.l_reg = 0x23004,
 	.m_reg = 0x23008,
 	.n_reg = 0x2300c,
-	.config_reg = 0x23014,
+	.config_reg = 0x23010,
 	.mode_reg = 0x23000,
 	.status_reg = 0x2301c,
 	.status_bit = 17,
-- 
2.25.1


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

* [PATCH 4.4 005/135] ALSA: isa/wavefront: prevent out of bounds write in ioctl
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (3 preceding siblings ...)
  2020-06-29 15:50 ` [PATCH 4.4 004/135] clk: qcom: msm8916: Fix the address location of pll->config_reg Sasha Levin
@ 2020-06-29 15:50 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 006/135] scsi: qla2xxx: Fix issue with adapter's stopping state Sasha Levin
                   ` (133 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Dan Carpenter, Takashi Iwai, Sasha Levin

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

[ Upstream commit 7f0d5053c5a9d23fe5c2d337495a9d79038d267b ]

The "header->number" comes from the ioctl and it needs to be clamped to
prevent out of bounds writes.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200501094011.GA960082@mwanda
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/isa/wavefront/wavefront_synth.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index 718d5e3b7806f..6c06d06457796 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -1174,7 +1174,10 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)
 				      "alias for %d\n",
 				      header->number,
 				      header->hdr.a.OriginalSample);
-    
+
+	if (header->number >= WF_MAX_SAMPLE)
+		return -EINVAL;
+
 	munge_int32 (header->number, &alias_hdr[0], 2);
 	munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2);
 	munge_int32 (*((unsigned int *)&header->hdr.a.sampleStartOffset),
@@ -1205,6 +1208,9 @@ wavefront_send_multisample (snd_wavefront_t *dev, wavefront_patch_info *header)
 	int num_samples;
 	unsigned char *msample_hdr;
 
+	if (header->number >= WF_MAX_SAMPLE)
+		return -EINVAL;
+
 	msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL);
 	if (! msample_hdr)
 		return -ENOMEM;
-- 
2.25.1


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

* [PATCH 4.4 006/135] scsi: qla2xxx: Fix issue with adapter's stopping state
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (4 preceding siblings ...)
  2020-06-29 15:50 ` [PATCH 4.4 005/135] ALSA: isa/wavefront: prevent out of bounds write in ioctl Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 007/135] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Sasha Levin
                   ` (132 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Viacheslav Dubeyko, Roman Bolshakov, Himanshu Madhani,
	Martin K . Petersen, Sasha Levin

From: Viacheslav Dubeyko <v.dubeiko@yadro.com>

[ Upstream commit 803e45550b11c8e43d89812356fe6f105adebdf9 ]

The goal of the following command sequence is to restart the adapter.
However, the tgt_stop flag remains set, indicating that the adapter is
still in stopping state even after re-enabling it.

echo 0x7fffffff > /sys/module/qla2xxx/parameters/logging
modprobe target_core_mod
modprobe tcm_qla2xxx
mkdir /sys/kernel/config/target/qla2xxx
mkdir /sys/kernel/config/target/qla2xxx/<port-name>
mkdir /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1
echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
echo 0 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable
echo 1 > /sys/kernel/config/target/qla2xxx/<port-name>/tpgt_1/enable

kernel: PID 1396:qla_target.c:1555 qlt_stop_phase1(): tgt_stop 0x0, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-e803:1: PID 1396:qla_target.c:1567: Stopping target for host 1(c0000000033557e8)
kernel: PID 1396:qla_target.c:1579 qlt_stop_phase1(): tgt_stop 0x1, tgt_stopped 0x0
kernel: PID 1396:qla_target.c:1266 qlt_schedule_sess_for_deletion(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-e801:1: PID 1396:qla_target.c:1316: Scheduling sess c00000002d5cd800 for deletion 21:00:00:24:ff:7f:35:c7
<skipped>
kernel: qla2xxx [0001:00:02.0]-290a:1: PID 340:qla_target.c:1187: qlt_unreg_sess sess c00000002d5cd800 for deletion 21:00:00:24:ff:7f:35:c7
<skipped>
kernel: qla2xxx [0001:00:02.0]-f801:1: PID 340:qla_target.c:1145: Unregistration of sess c00000002d5cd800 21:00:00:24:ff:7f:35:c7 finished fcp_cnt 0
kernel: PID 340:qla_target.c:1155 qlt_free_session_done(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-4807:1: PID 346:qla_os.c:6329: ISP abort scheduled.
<skipped>
kernel: qla2xxx [0001:00:02.0]-28f1:1: PID 346:qla_os.c:3956: Mark all dev lost
kernel: PID 346:qla_target.c:1266 qlt_schedule_sess_for_deletion(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-4808:1: PID 346:qla_os.c:6338: ISP abort end.
<skipped>
kernel: PID 1396:qla_target.c:6812 qlt_enable_vha(): tgt_stop 0x1, tgt_stopped 0x0
<skipped>
kernel: qla2xxx [0001:00:02.0]-4807:1: PID 346:qla_os.c:6329: ISP abort scheduled.
<skipped>
kernel: qla2xxx [0001:00:02.0]-4808:1: PID 346:qla_os.c:6338: ISP abort end.

qlt_handle_cmd_for_atio() rejects the request to send commands because the
adapter is in the stopping state:

kernel: PID 0:qla_target.c:4442 qlt_handle_cmd_for_atio(): tgt_stop 0x1, tgt_stopped 0x0
kernel: qla2xxx [0001:00:02.0]-3861:1: PID 0:qla_target.c:4447: New command while device c000000005314600 is shutting down
kernel: qla2xxx [0001:00:02.0]-e85f:1: PID 0:qla_target.c:5728: qla_target: Unable to send command to target

This patch calls qla_stop_phase2() in addition to qlt_stop_phase1() in
tcm_qla2xxx_tpg_enable_store() and tcm_qla2xxx_npiv_tpg_enable_store(). The
qlt_stop_phase1() marks adapter as stopping (tgt_stop == 0x1, tgt_stopped
== 0x0) but qlt_stop_phase2() marks adapter as stopped (tgt_stop == 0x0,
tgt_stopped == 0x1).

Link: https://lore.kernel.org/r/52be1e8a3537f6c5407eae3edd4c8e08a9545ea5.camel@yadro.com
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Viacheslav Dubeyko <v.dubeiko@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index b1233ce6cb475..1cef25ea0da13 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -827,6 +827,7 @@ static ssize_t tcm_qla2xxx_tpg_enable_store(struct config_item *item,
 
 		atomic_set(&tpg->lport_tpg_enabled, 0);
 		qlt_stop_phase1(vha->vha_tgt.qla_tgt);
+		qlt_stop_phase2(vha->vha_tgt.qla_tgt);
 	}
 
 	return count;
@@ -990,6 +991,7 @@ static ssize_t tcm_qla2xxx_npiv_tpg_enable_store(struct config_item *item,
 
 		atomic_set(&tpg->lport_tpg_enabled, 0);
 		qlt_stop_phase1(vha->vha_tgt.qla_tgt);
+		qlt_stop_phase2(vha->vha_tgt.qla_tgt);
 	}
 
 	return count;
-- 
2.25.1


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

* [PATCH 4.4 007/135] i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (5 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 006/135] scsi: qla2xxx: Fix issue with adapter's stopping state Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 008/135] usblp: poison URBs upon disconnect Sasha Levin
                   ` (131 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Russell King, Wolfram Sang, Sasha Levin

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

[ Upstream commit e81c979f4e071d516aa27cf5a0c3939da00dc1ca ]

If we timeout during a message transfer, the control register may
contain bits that cause an action to be set. Read-modify-writing the
register leaving these bits set may trigger the hardware to attempt
one of these actions unintentionally.

Always clear these bits when cleaning up after a message or after
a timeout.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-pxa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 0d351954db02b..3264b50311ff0 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -691,11 +691,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
 {
 	u32 icr;
 
-	/*
-	 * Clear the STOP and ACK flags
-	 */
+	/* Clear the START, STOP, ACK, TB and MA flags */
 	icr = readl(_ICR(i2c));
-	icr &= ~(ICR_STOP | ICR_ACKNAK);
+	icr &= ~(ICR_START | ICR_STOP | ICR_ACKNAK | ICR_TB | ICR_MA);
 	writel(icr, _ICR(i2c));
 }
 
-- 
2.25.1


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

* [PATCH 4.4 008/135] usblp: poison URBs upon disconnect
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (6 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 007/135] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 009/135] ps3disk: use the default segment boundary Sasha Levin
                   ` (130 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Oliver Neukum, syzbot+be5b5f86a162a6c281e6, Greg Kroah-Hartman,
	Sasha Levin

From: Oliver Neukum <oneukum@suse.com>

[ Upstream commit 296a193b06120aa6ae7cf5c0d7b5e5b55968026e ]

syzkaller reported an URB that should have been killed to be active.
We do not understand it, but this should fix the issue if it is real.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reported-by: syzbot+be5b5f86a162a6c281e6@syzkaller.appspotmail.com
Link: https://lore.kernel.org/r/20200507085806.5793-1-oneukum@suse.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/class/usblp.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 07c3c3449147f..c578d64edc153 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -481,7 +481,8 @@ static int usblp_release(struct inode *inode, struct file *file)
 	usb_autopm_put_interface(usblp->intf);
 
 	if (!usblp->present)		/* finish cleanup from disconnect */
-		usblp_cleanup(usblp);
+		usblp_cleanup(usblp);	/* any URBs must be dead */
+
 	mutex_unlock(&usblp_mutex);
 	return 0;
 }
@@ -1397,9 +1398,11 @@ static void usblp_disconnect(struct usb_interface *intf)
 
 	usblp_unlink_urbs(usblp);
 	mutex_unlock(&usblp->mut);
+	usb_poison_anchored_urbs(&usblp->urbs);
 
 	if (!usblp->used)
 		usblp_cleanup(usblp);
+
 	mutex_unlock(&usblp_mutex);
 }
 
-- 
2.25.1


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

* [PATCH 4.4 009/135] ps3disk: use the default segment boundary
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (7 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 008/135] usblp: poison URBs upon disconnect Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 010/135] vfio/pci: fix memory leaks in alloc_perm_bits() Sasha Levin
                   ` (129 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Emmanuel Nicolet, Geoff Levand, Michael Ellerman, Sasha Levin

From: Emmanuel Nicolet <emmanuel.nicolet@gmail.com>

[ Upstream commit 720bc316690bd27dea9d71510b50f0cd698ffc32 ]

Since commit dcebd755926b ("block: use bio_for_each_bvec() to compute
multi-page bvec count"), the kernel will bug_on on the PS3 because
bio_split() is called with sectors == 0:

  kernel BUG at block/bio.c:1853!
  Oops: Exception in kernel mode, sig: 5 [#1]
  BE PAGE_SIZE=4K MMU=Hash PREEMPT SMP NR_CPUS=8 NUMA PS3
  Modules linked in: firewire_sbp2 rtc_ps3(+) soundcore ps3_gelic(+) \
  ps3rom(+) firewire_core ps3vram(+) usb_common crc_itu_t
  CPU: 0 PID: 97 Comm: blkid Not tainted 5.3.0-rc4 #1
  NIP:  c00000000027d0d0 LR: c00000000027d0b0 CTR: 0000000000000000
  REGS: c00000000135ae90 TRAP: 0700   Not tainted  (5.3.0-rc4)
  MSR:  8000000000028032 <SF,EE,IR,DR,RI>  CR: 44008240  XER: 20000000
  IRQMASK: 0
  GPR00: c000000000289368 c00000000135b120 c00000000084a500 c000000004ff8300
  GPR04: 0000000000000c00 c000000004c905e0 c000000004c905e0 000000000000ffff
  GPR08: 0000000000000000 0000000000000001 0000000000000000 000000000000ffff
  GPR12: 0000000000000000 c0000000008ef000 000000000000003e 0000000000080001
  GPR16: 0000000000000100 000000000000ffff 0000000000000000 0000000000000004
  GPR20: c00000000062fd7e 0000000000000001 000000000000ffff 0000000000000080
  GPR24: c000000000781788 c00000000135b350 0000000000000080 c000000004c905e0
  GPR28: c00000000135b348 c000000004ff8300 0000000000000000 c000000004c90000
  NIP [c00000000027d0d0] .bio_split+0x28/0xac
  LR [c00000000027d0b0] .bio_split+0x8/0xac
  Call Trace:
  [c00000000135b120] [c00000000027d130] .bio_split+0x88/0xac (unreliable)
  [c00000000135b1b0] [c000000000289368] .__blk_queue_split+0x11c/0x53c
  [c00000000135b2d0] [c00000000028f614] .blk_mq_make_request+0x80/0x7d4
  [c00000000135b3d0] [c000000000283a8c] .generic_make_request+0x118/0x294
  [c00000000135b4b0] [c000000000283d34] .submit_bio+0x12c/0x174
  [c00000000135b580] [c000000000205a44] .mpage_bio_submit+0x3c/0x4c
  [c00000000135b600] [c000000000206184] .mpage_readpages+0xa4/0x184
  [c00000000135b750] [c0000000001ff8fc] .blkdev_readpages+0x24/0x38
  [c00000000135b7c0] [c0000000001589f0] .read_pages+0x6c/0x1a8
  [c00000000135b8b0] [c000000000158c74] .__do_page_cache_readahead+0x118/0x184
  [c00000000135b9b0] [c0000000001591a8] .force_page_cache_readahead+0xe4/0xe8
  [c00000000135ba50] [c00000000014fc24] .generic_file_read_iter+0x1d8/0x830
  [c00000000135bb50] [c0000000001ffadc] .blkdev_read_iter+0x40/0x5c
  [c00000000135bbc0] [c0000000001b9e00] .new_sync_read+0x144/0x1a0
  [c00000000135bcd0] [c0000000001bc454] .vfs_read+0xa0/0x124
  [c00000000135bd70] [c0000000001bc7a4] .ksys_read+0x70/0xd8
  [c00000000135be20] [c00000000000a524] system_call+0x5c/0x70
  Instruction dump:
  7fe3fb78 482e30dc 7c0802a6 482e3085 7c9e2378 f821ff71 7ca42b78 7d3e00d0
  7c7d1b78 79290fe0 7cc53378 69290001 <0b090000> 81230028 7bca0020 7929ba62
  [ end trace 313fec760f30aa1f ]---

The problem originates from setting the segment boundary of the
request queue to -1UL. This makes get_max_segment_size() return zero
when offset is zero, whatever the max segment size. The test with
BLK_SEG_BOUNDARY_MASK fails and 'mask - (mask & offset) + 1' overflows
to zero in the return statement.

Not setting the segment boundary and using the default
value (BLK_SEG_BOUNDARY_MASK) fixes the problem.

Signed-off-by: Emmanuel Nicolet <emmanuel.nicolet@gmail.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/060a416c43138f45105c0540eff1a45539f7e2fc.1589049250.git.geoff@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/block/ps3disk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index c120d70d3fb3b..fc7a20286090d 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -464,7 +464,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev)
 	blk_queue_bounce_limit(queue, BLK_BOUNCE_HIGH);
 
 	blk_queue_max_hw_sectors(queue, dev->bounce_size >> 9);
-	blk_queue_segment_boundary(queue, -1UL);
 	blk_queue_dma_alignment(queue, dev->blk_size-1);
 	blk_queue_logical_block_size(queue, dev->blk_size);
 
-- 
2.25.1


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

* [PATCH 4.4 010/135] vfio/pci: fix memory leaks in alloc_perm_bits()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (8 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 009/135] ps3disk: use the default segment boundary Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 011/135] mfd: wm8994: Fix driver operation if loaded as modules Sasha Levin
                   ` (128 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Qian Cai, Alex Williamson, Sasha Levin

From: Qian Cai <cai@lca.pw>

[ Upstream commit 3e63b94b6274324ff2e7d8615df31586de827c4e ]

vfio_pci_disable() calls vfio_config_free() but forgets to call
free_perm_bits() resulting in memory leaks,

unreferenced object 0xc000000c4db2dee0 (size 16):
  comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
  hex dump (first 16 bytes):
    00 00 ff 00 ff ff ff ff ff ff ff ff ff ff 00 00  ................
  backtrace:
    [<00000000a6a4552d>] alloc_perm_bits+0x58/0xe0 [vfio_pci]
    [<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
    init_pci_cap_msi_perm at drivers/vfio/pci/vfio_pci_config.c:1125
    (inlined by) vfio_msi_cap_len at drivers/vfio/pci/vfio_pci_config.c:1180
    (inlined by) vfio_cap_len at drivers/vfio/pci/vfio_pci_config.c:1241
    (inlined by) vfio_cap_init at drivers/vfio/pci/vfio_pci_config.c:1468
    (inlined by) vfio_config_init at drivers/vfio/pci/vfio_pci_config.c:1707
    [<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
    [<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
    [<000000009e34c54f>] ksys_ioctl+0xd8/0x130
    [<000000006577923d>] sys_ioctl+0x28/0x40
    [<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
    [<0000000008ea7dd5>] system_call_common+0xf0/0x278
unreferenced object 0xc000000c4db2e330 (size 16):
  comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
  hex dump (first 16 bytes):
    00 ff ff 00 ff ff ff ff ff ff ff ff ff ff 00 00  ................
  backtrace:
    [<000000004c71914f>] alloc_perm_bits+0x44/0xe0 [vfio_pci]
    [<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
    [<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
    [<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
    [<000000009e34c54f>] ksys_ioctl+0xd8/0x130
    [<000000006577923d>] sys_ioctl+0x28/0x40
    [<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
    [<0000000008ea7dd5>] system_call_common+0xf0/0x278

Fixes: 89e1f7d4c66d ("vfio: Add PCI device driver")
Signed-off-by: Qian Cai <cai@lca.pw>
[aw: rolled in follow-up patch]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/vfio/pci/vfio_pci_config.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 98a12be76c9cf..bf65572f47a8f 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -1644,8 +1644,11 @@ void vfio_config_free(struct vfio_pci_device *vdev)
 	vdev->vconfig = NULL;
 	kfree(vdev->pci_config_map);
 	vdev->pci_config_map = NULL;
-	kfree(vdev->msi_perm);
-	vdev->msi_perm = NULL;
+	if (vdev->msi_perm) {
+		free_perm_bits(vdev->msi_perm);
+		kfree(vdev->msi_perm);
+		vdev->msi_perm = NULL;
+	}
 }
 
 /*
-- 
2.25.1


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

* [PATCH 4.4 011/135] mfd: wm8994: Fix driver operation if loaded as modules
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (9 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 010/135] vfio/pci: fix memory leaks in alloc_perm_bits() Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 012/135] scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event Sasha Levin
                   ` (127 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Marek Szyprowski, Charles Keepax, Lee Jones, Sasha Levin

From: Marek Szyprowski <m.szyprowski@samsung.com>

[ Upstream commit d4f9b5428b53dd67f49ee8deed8d4366ed6b1933 ]

WM8994 chip has built-in regulators, which might be used for chip
operation. They are controlled by a separate wm8994-regulator driver,
which should be loaded before this driver calls regulator_get(), because
that driver also provides consumer-supply mapping for the them. If that
driver is not yet loaded, regulator core substitute them with dummy
regulator, what breaks chip operation, because the built-in regulators are
never enabled. Fix this by annotating this driver with MODULE_SOFTDEP()
"pre" dependency to "wm8994_regulator" module.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/mfd/wm8994-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 7eec619a6023c..3d1457189fa21 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -690,3 +690,4 @@ module_i2c_driver(wm8994_i2c_driver);
 MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
+MODULE_SOFTDEP("pre: wm8994_regulator");
-- 
2.25.1


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

* [PATCH 4.4 012/135] scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (10 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 011/135] mfd: wm8994: Fix driver operation if loaded as modules Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 013/135] nfsd: Fix svc_xprt refcnt leak when setup callback client failed Sasha Levin
                   ` (126 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Xiyu Yang, Daniel Wagner, James Smart, Xin Tan,
	Martin K . Petersen, Sasha Levin

From: Xiyu Yang <xiyuyang19@fudan.edu.cn>

[ Upstream commit 7217e6e694da3aae6d17db8a7f7460c8d4817ebf ]

In order to create or activate a new node, lpfc_els_unsol_buffer() invokes
lpfc_nlp_init() or lpfc_enable_node() or lpfc_nlp_get(), all of them will
return a reference of the specified lpfc_nodelist object to "ndlp" with
increased refcnt.

When lpfc_els_unsol_buffer() returns, local variable "ndlp" becomes
invalid, so the refcount should be decreased to keep refcount balanced.

The reference counting issue happens in one exception handling path of
lpfc_els_unsol_buffer(). When "ndlp" in DEV_LOSS, the function forgets to
decrease the refcnt increased by lpfc_nlp_init() or lpfc_enable_node() or
lpfc_nlp_get(), causing a refcnt leak.

Fix this issue by calling lpfc_nlp_put() when "ndlp" in DEV_LOSS.

Link: https://lore.kernel.org/r/1590416184-52592-1-git-send-email-xiyuyang19@fudan.edu.cn
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/lpfc/lpfc_els.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 530b7df21322a..315dd25a0c44e 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -7315,6 +7315,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
 	spin_lock_irq(shost->host_lock);
 	if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) {
 		spin_unlock_irq(shost->host_lock);
+		if (newnode)
+			lpfc_nlp_put(ndlp);
 		goto dropit;
 	}
 	spin_unlock_irq(shost->host_lock);
-- 
2.25.1


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

* [PATCH 4.4 013/135] nfsd: Fix svc_xprt refcnt leak when setup callback client failed
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (11 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 012/135] scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 014/135] powerpc/crashkernel: Take "mem=" option into account Sasha Levin
                   ` (125 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Xiyu Yang, Xin Tan, J . Bruce Fields, Sasha Levin

From: Xiyu Yang <xiyuyang19@fudan.edu.cn>

[ Upstream commit a4abc6b12eb1f7a533c2e7484cfa555454ff0977 ]

nfsd4_process_cb_update() invokes svc_xprt_get(), which increases the
refcount of the "c->cn_xprt".

The reference counting issue happens in one exception handling path of
nfsd4_process_cb_update(). When setup callback client failed, the
function forgets to decrease the refcnt increased by svc_xprt_get(),
causing a refcnt leak.

Fix this issue by calling svc_xprt_put() when setup callback client
failed.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfsd/nfs4callback.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
index 4fa3f0ba9ab3c..0a0b41071ed77 100644
--- a/fs/nfsd/nfs4callback.c
+++ b/fs/nfsd/nfs4callback.c
@@ -1096,6 +1096,8 @@ static void nfsd4_process_cb_update(struct nfsd4_callback *cb)
 	err = setup_callback_client(clp, &conn, ses);
 	if (err) {
 		nfsd4_mark_cb_down(clp, err);
+		if (c)
+			svc_xprt_put(c->cn_xprt);
 		return;
 	}
 }
-- 
2.25.1


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

* [PATCH 4.4 014/135] powerpc/crashkernel: Take "mem=" option into account
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (12 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 013/135] nfsd: Fix svc_xprt refcnt leak when setup callback client failed Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 015/135] yam: fix possible memory leak in yam_init_driver Sasha Levin
                   ` (124 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Pingfan Liu, Hari Bathini, Michael Ellerman, Sasha Levin

From: Pingfan Liu <kernelfans@gmail.com>

[ Upstream commit be5470e0c285a68dc3afdea965032f5ddc8269d7 ]

'mem=" option is an easy way to put high pressure on memory during
some test. Hence after applying the memory limit, instead of total
mem, the actual usable memory should be considered when reserving mem
for crashkernel. Otherwise the boot up may experience OOM issue.

E.g. it would reserve 4G prior to the change and 512M afterward, if
passing
crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G",
and mem=5G on a 256G machine.

This issue is powerpc specific because it puts higher priority on
fadump and kdump reservation than on "mem=". Referring the following
code:
    if (fadump_reserve_mem() == 0)
            reserve_crashkernel();
    ...
    /* Ensure that total memory size is page-aligned. */
    limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
    memblock_enforce_memory_limit(limit);

While on other arches, the effect of "mem=" takes a higher priority
and pass through memblock_phys_mem_size() before calling
reserve_crashkernel().

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1585749644-4148-1-git-send-email-kernelfans@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/kernel/machine_kexec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 8dff2b3712190..a14d9b008f744 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -113,11 +113,12 @@ void machine_kexec(struct kimage *image)
 
 void __init reserve_crashkernel(void)
 {
-	unsigned long long crash_size, crash_base;
+	unsigned long long crash_size, crash_base, total_mem_sz;
 	int ret;
 
+	total_mem_sz = memory_limit ? memory_limit : memblock_phys_mem_size();
 	/* use common parsing */
-	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
+	ret = parse_crashkernel(boot_command_line, total_mem_sz,
 			&crash_size, &crash_base);
 	if (ret == 0 && crash_size > 0) {
 		crashk_res.start = crash_base;
@@ -176,6 +177,7 @@ void __init reserve_crashkernel(void)
 	/* Crash kernel trumps memory limit */
 	if (memory_limit && memory_limit <= crashk_res.end) {
 		memory_limit = crashk_res.end + 1;
+		total_mem_sz = memory_limit;
 		printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
 		       memory_limit);
 	}
@@ -184,7 +186,7 @@ void __init reserve_crashkernel(void)
 			"for crashkernel (System RAM: %ldMB)\n",
 			(unsigned long)(crash_size >> 20),
 			(unsigned long)(crashk_res.start >> 20),
-			(unsigned long)(memblock_phys_mem_size() >> 20));
+			(unsigned long)(total_mem_sz >> 20));
 
 	if (!memblock_is_region_memory(crashk_res.start, crash_size) ||
 	    memblock_reserve(crashk_res.start, crash_size)) {
-- 
2.25.1


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

* [PATCH 4.4 015/135] yam: fix possible memory leak in yam_init_driver
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (13 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 014/135] powerpc/crashkernel: Take "mem=" option into account Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 016/135] mksysmap: Fix the mismatch of '.L' symbols in System.map Sasha Levin
                   ` (123 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Wang Hai, Hulk Robot, David S . Miller, Sasha Levin

From: Wang Hai <wanghai38@huawei.com>

[ Upstream commit 98749b7188affbf2900c2aab704a8853901d1139 ]

If register_netdev(dev) fails, free_netdev(dev) needs
to be called, otherwise a memory leak will occur.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/hamradio/yam.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 1a4729c36aa49..623e4225e7c84 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -1160,6 +1160,7 @@ static int __init yam_init_driver(void)
 		err = register_netdev(dev);
 		if (err) {
 			printk(KERN_WARNING "yam: cannot register net device %s\n", dev->name);
+			free_netdev(dev);
 			goto error;
 		}
 		yam_devs[i] = dev;
-- 
2.25.1


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

* [PATCH 4.4 016/135] mksysmap: Fix the mismatch of '.L' symbols in System.map
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (14 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 015/135] yam: fix possible memory leak in yam_init_driver Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 017/135] scsi: sr: Fix sr_probe() missing deallocate of device minor Sasha Levin
                   ` (122 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: ashimida, Masahiro Yamada, Sasha Levin

From: ashimida <ashimida@linux.alibaba.com>

[ Upstream commit 72d24accf02add25e08733f0ecc93cf10fcbd88c ]

When System.map was generated, the kernel used mksysmap to
filter the kernel symbols, but all the symbols with the
second letter 'L' in the kernel were filtered out, not just
the symbols starting with 'dot + L'.

For example:
ashimida@ubuntu:~/linux$ cat System.map |grep ' .L'
ashimida@ubuntu:~/linux$ nm -n vmlinux |grep ' .L'
ffff0000088028e0 t bLength_show
......
ffff0000092e0408 b PLLP_OUTC_lock
ffff0000092e0410 b PLLP_OUTA_lock

The original intent should be to filter out all local symbols
starting with '.L', so the dot should be escaped.

Fixes: 00902e984732 ("mksysmap: Add h8300 local symbol pattern")
Signed-off-by: ashimida <ashimida@linux.alibaba.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/mksysmap | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/mksysmap b/scripts/mksysmap
index a35acc0d0b827..9aa23d15862a0 100755
--- a/scripts/mksysmap
+++ b/scripts/mksysmap
@@ -41,4 +41,4 @@
 # so we just ignore them to let readprofile continue to work.
 # (At least sparc64 has __crc_ in the middle).
 
-$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( .L\)' > $2
+$NM -n $1 | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)\|\( \.L\)' > $2
-- 
2.25.1


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

* [PATCH 4.4 017/135] scsi: sr: Fix sr_probe() missing deallocate of device minor
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (15 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 016/135] mksysmap: Fix the mismatch of '.L' symbols in System.map Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 018/135] scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM Sasha Levin
                   ` (121 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Simon Arlott, Martin K . Petersen, Sasha Levin

From: Simon Arlott <simon@octiron.net>

[ Upstream commit 6555781b3fdec5e94e6914511496144241df7dee ]

If the cdrom fails to be registered then the device minor should be
deallocated.

Link: https://lore.kernel.org/r/072dac4b-8402-4de8-36bd-47e7588969cd@0882a8b5-c6c3-11e9-b005-00805fc181fe
Signed-off-by: Simon Arlott <simon@octiron.net>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/sr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 5dc288fecace4..7dd4d9ded2491 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -746,7 +746,7 @@ static int sr_probe(struct device *dev)
 	cd->cdi.disk = disk;
 
 	if (register_cdrom(&cd->cdi))
-		goto fail_put;
+		goto fail_minor;
 
 	/*
 	 * Initialize block layer runtime PM stuffs before the
@@ -764,6 +764,10 @@ static int sr_probe(struct device *dev)
 
 	return 0;
 
+fail_minor:
+	spin_lock(&sr_index_lock);
+	clear_bit(minor, sr_index_bits);
+	spin_unlock(&sr_index_lock);
 fail_put:
 	put_disk(disk);
 fail_free:
-- 
2.25.1


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

* [PATCH 4.4 018/135] scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (16 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 017/135] scsi: sr: Fix sr_probe() missing deallocate of device minor Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 019/135] ALSA: usb-audio: Improve frames size computation Sasha Levin
                   ` (120 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tyrel Datwyler, Martin K . Petersen, Sasha Levin

From: Tyrel Datwyler <tyreld@linux.ibm.com>

[ Upstream commit 4919b33b63c8b69d8dcf2b867431d0e3b6dc6d28 ]

The adapter info MAD is used to send the client info and receive the host
info as a response. A persistent buffer is used and as such the client info
is overwritten after the response. During the course of a normal adapter
reset the client info is refreshed in the buffer in preparation for sending
the adapter info MAD.

However, in the special case of LPM where we reenable the CRQ instead of a
full CRQ teardown and reset we fail to refresh the client info in the
adapter info buffer. As a result, after Live Partition Migration (LPM) we
erroneously report the host's info as our own.

[mkp: typos]

Link: https://lore.kernel.org/r/20200603203632.18426-1-tyreld@linux.ibm.com
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index e26747a1b35a1..e7075aae15daa 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -427,6 +427,8 @@ static int ibmvscsi_reenable_crq_queue(struct crq_queue *queue,
 	int rc = 0;
 	struct vio_dev *vdev = to_vio_dev(hostdata->dev);
 
+	set_adapter_info(hostdata);
+
 	/* Re-enable the CRQ */
 	do {
 		if (rc)
-- 
2.25.1


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

* [PATCH 4.4 019/135] ALSA: usb-audio: Improve frames size computation
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (17 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 018/135] scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 020/135] s390/qdio: put thinint indicator after early error Sasha Levin
                   ` (119 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Alexander Tsoy, Takashi Iwai, Sasha Levin

From: Alexander Tsoy <alexander@tsoy.me>

[ Upstream commit f0bd62b64016508938df9babe47f65c2c727d25c ]

For computation of the the next frame size current value of fs/fps and
accumulated fractional parts of fs/fps are used, where values are stored
in Q16.16 format. This is quite natural for computing frame size for
asynchronous endpoints driven by explicit feedback, since in this case
fs/fps is a value provided by the feedback endpoint and it's already in
the Q format. If an error is accumulated over time, the device can
adjust fs/fps value to prevent buffer overruns/underruns.

But for synchronous endpoints the accuracy provided by these computations
is not enough. Due to accumulated error the driver periodically produces
frames with incorrect size (+/- 1 audio sample).

This patch fixes this issue by implementing a different algorithm for
frame size computation. It is based on accumulating of the remainders
from division fs/fps and it doesn't accumulate errors over time. This
new method is enabled for synchronous and adaptive playback endpoints.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200424022449.14972-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/usb/card.h     |  4 ++++
 sound/usb/endpoint.c | 43 ++++++++++++++++++++++++++++++++++++++-----
 sound/usb/endpoint.h |  1 +
 sound/usb/pcm.c      |  2 ++
 4 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/sound/usb/card.h b/sound/usb/card.h
index 71778ca4b26aa..844c688638105 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -80,6 +80,10 @@ struct snd_usb_endpoint {
 	dma_addr_t sync_dma;		/* DMA address of syncbuf */
 
 	unsigned int pipe;		/* the data i/o pipe */
+	unsigned int framesize[2];	/* small/large frame sizes in samples */
+	unsigned int sample_rem;	/* remainder from division fs/fps */
+	unsigned int sample_accum;	/* sample accumulator */
+	unsigned int fps;		/* frames per second */
 	unsigned int freqn;		/* nominal sampling rate in fs/fps in Q16.16 format */
 	unsigned int freqm;		/* momentary sampling rate in fs/fps in Q16.16 format */
 	int	   freqshift;		/* how much to shift the feedback value to get Q16.16 */
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 66648b4bdd289..666731317b332 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -137,12 +137,12 @@ int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep)
 
 /*
  * For streaming based on information derived from sync endpoints,
- * prepare_outbound_urb_sizes() will call next_packet_size() to
+ * prepare_outbound_urb_sizes() will call slave_next_packet_size() to
  * determine the number of samples to be sent in the next packet.
  *
- * For implicit feedback, next_packet_size() is unused.
+ * For implicit feedback, slave_next_packet_size() is unused.
  */
-int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
+int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep)
 {
 	unsigned long flags;
 	int ret;
@@ -159,6 +159,29 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
 	return ret;
 }
 
+/*
+ * For adaptive and synchronous endpoints, prepare_outbound_urb_sizes()
+ * will call next_packet_size() to determine the number of samples to be
+ * sent in the next packet.
+ */
+int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep)
+{
+	int ret;
+
+	if (ep->fill_max)
+		return ep->maxframesize;
+
+	ep->sample_accum += ep->sample_rem;
+	if (ep->sample_accum >= ep->fps) {
+		ep->sample_accum -= ep->fps;
+		ret = ep->framesize[1];
+	} else {
+		ret = ep->framesize[0];
+	}
+
+	return ret;
+}
+
 static void retire_outbound_urb(struct snd_usb_endpoint *ep,
 				struct snd_urb_ctx *urb_ctx)
 {
@@ -203,6 +226,8 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep,
 
 		if (ctx->packet_size[i])
 			counts = ctx->packet_size[i];
+		else if (ep->sync_master)
+			counts = snd_usb_endpoint_slave_next_packet_size(ep);
 		else
 			counts = snd_usb_endpoint_next_packet_size(ep);
 
@@ -879,10 +904,17 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
 	ep->maxpacksize = fmt->maxpacksize;
 	ep->fill_max = !!(fmt->attributes & UAC_EP_CS_ATTR_FILL_MAX);
 
-	if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL)
+	if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_FULL) {
 		ep->freqn = get_usb_full_speed_rate(rate);
-	else
+		ep->fps = 1000;
+	} else {
 		ep->freqn = get_usb_high_speed_rate(rate);
+		ep->fps = 8000;
+	}
+
+	ep->sample_rem = rate % ep->fps;
+	ep->framesize[0] = rate / ep->fps;
+	ep->framesize[1] = (rate + (ep->fps - 1)) / ep->fps;
 
 	/* calculate the frequency in 16.16 format */
 	ep->freqm = ep->freqn;
@@ -941,6 +973,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
 	ep->active_mask = 0;
 	ep->unlink_mask = 0;
 	ep->phase = 0;
+	ep->sample_accum = 0;
 
 	snd_usb_endpoint_start_quirk(ep);
 
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
index 584f295d7c773..4aad49cbeb5f1 100644
--- a/sound/usb/endpoint.h
+++ b/sound/usb/endpoint.h
@@ -27,6 +27,7 @@ void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
 void snd_usb_endpoint_free(struct snd_usb_endpoint *ep);
 
 int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);
+int snd_usb_endpoint_slave_next_packet_size(struct snd_usb_endpoint *ep);
 int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep);
 
 void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index f84c55ecd0fb4..53d91cae86f96 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1473,6 +1473,8 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
 	for (i = 0; i < ctx->packets; i++) {
 		if (ctx->packet_size[i])
 			counts = ctx->packet_size[i];
+		else if (ep->sync_master)
+			counts = snd_usb_endpoint_slave_next_packet_size(ep);
 		else
 			counts = snd_usb_endpoint_next_packet_size(ep);
 
-- 
2.25.1


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

* [PATCH 4.4 020/135] s390/qdio: put thinint indicator after early error
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (18 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 019/135] ALSA: usb-audio: Improve frames size computation Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 021/135] tty: hvc: Fix data abort due to race in hvc_open Sasha Levin
                   ` (118 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Julian Wiedmann, Benjamin Block, Vasily Gorbik, Sasha Levin

From: Julian Wiedmann <jwi@linux.ibm.com>

[ Upstream commit 75e82bec6b2622c6f455b7a543fb5476a5d0eed7 ]

qdio_establish() calls qdio_setup_thinint() via qdio_setup_irq().
If the subsequent qdio_establish_thinint() fails, we miss to put the
DSCI again. Thus the DSCI isn't available for re-use. Given enough of
such errors, we could end up with having only the shared DSCI available.

Merge qdio_setup_thinint() into qdio_establish_thinint(), and deal with
such an error internally.

Fixes: 779e6e1c724d ("[S390] qdio: new qdio driver.")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/s390/cio/qdio.h         |  1 -
 drivers/s390/cio/qdio_setup.c   |  1 -
 drivers/s390/cio/qdio_thinint.c | 14 ++++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h
index 7e70f9298cc13..11f6ebd045456 100644
--- a/drivers/s390/cio/qdio.h
+++ b/drivers/s390/cio/qdio.h
@@ -376,7 +376,6 @@ static inline int multicast_outbound(struct qdio_q *q)
 extern u64 last_ai_time;
 
 /* prototypes for thin interrupt */
-void qdio_setup_thinint(struct qdio_irq *irq_ptr);
 int qdio_establish_thinint(struct qdio_irq *irq_ptr);
 void qdio_shutdown_thinint(struct qdio_irq *irq_ptr);
 void tiqdio_add_input_queues(struct qdio_irq *irq_ptr);
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index d0090c5c88e74..a64615a10352b 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -479,7 +479,6 @@ int qdio_setup_irq(struct qdio_initialize *init_data)
 	setup_queues(irq_ptr, init_data);
 
 	setup_qib(irq_ptr, init_data);
-	qdio_setup_thinint(irq_ptr);
 	set_impl_params(irq_ptr, init_data->qib_param_field_format,
 			init_data->qib_param_field,
 			init_data->input_slib_elements,
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c
index debe69adfc705..aecb6445a5671 100644
--- a/drivers/s390/cio/qdio_thinint.c
+++ b/drivers/s390/cio/qdio_thinint.c
@@ -268,17 +268,19 @@ int __init tiqdio_register_thinints(void)
 
 int qdio_establish_thinint(struct qdio_irq *irq_ptr)
 {
+	int rc;
+
 	if (!is_thinint_irq(irq_ptr))
 		return 0;
-	return set_subchannel_ind(irq_ptr, 0);
-}
 
-void qdio_setup_thinint(struct qdio_irq *irq_ptr)
-{
-	if (!is_thinint_irq(irq_ptr))
-		return;
 	irq_ptr->dsci = get_indicator();
 	DBF_HEX(&irq_ptr->dsci, sizeof(void *));
+
+	rc = set_subchannel_ind(irq_ptr, 0);
+	if (rc)
+		put_indicator(irq_ptr->dsci);
+
+	return rc;
 }
 
 void qdio_shutdown_thinint(struct qdio_irq *irq_ptr)
-- 
2.25.1


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

* [PATCH 4.4 021/135] tty: hvc: Fix data abort due to race in hvc_open
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (19 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 020/135] s390/qdio: put thinint indicator after early error Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 022/135] staging: sm750fb: add missing case while setting FB_VISUAL Sasha Levin
                   ` (117 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Raghavendra Rao Ananta, Greg Kroah-Hartman, Sasha Levin

From: Raghavendra Rao Ananta <rananta@codeaurora.org>

[ Upstream commit e2bd1dcbe1aa34ff5570b3427c530e4332ecf0fe ]

Potentially, hvc_open() can be called in parallel when two tasks calls
open() on /dev/hvcX. In such a scenario, if the hp->ops->notifier_add()
callback in the function fails, where it sets the tty->driver_data to
NULL, the parallel hvc_open() can see this NULL and cause a memory abort.
Hence, serialize hvc_open and check if tty->private_data is NULL before
proceeding ahead.

The issue can be easily reproduced by launching two tasks simultaneously
that does nothing but open() and close() on /dev/hvcX.
For example:
$ ./simple_open_close /dev/hvc0 & ./simple_open_close /dev/hvc0 &

Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
Link: https://lore.kernel.org/r/20200428032601.22127-1-rananta@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/hvc/hvc_console.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index acf6d143c7531..81f23af8beca9 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -89,6 +89,8 @@ static LIST_HEAD(hvc_structs);
  */
 static DEFINE_SPINLOCK(hvc_structs_lock);
 
+/* Mutex to serialize hvc_open */
+static DEFINE_MUTEX(hvc_open_mutex);
 /*
  * This value is used to assign a tty->index value to a hvc_struct based
  * upon order of exposure via hvc_probe(), when we can not match it to
@@ -333,16 +335,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)
  */
 static int hvc_open(struct tty_struct *tty, struct file * filp)
 {
-	struct hvc_struct *hp = tty->driver_data;
+	struct hvc_struct *hp;
 	unsigned long flags;
 	int rc = 0;
 
+	mutex_lock(&hvc_open_mutex);
+
+	hp = tty->driver_data;
+	if (!hp) {
+		rc = -EIO;
+		goto out;
+	}
+
 	spin_lock_irqsave(&hp->port.lock, flags);
 	/* Check and then increment for fast path open. */
 	if (hp->port.count++ > 0) {
 		spin_unlock_irqrestore(&hp->port.lock, flags);
 		hvc_kick();
-		return 0;
+		goto out;
 	} /* else count == 0 */
 	spin_unlock_irqrestore(&hp->port.lock, flags);
 
@@ -371,6 +381,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
 	/* Force wakeup of the polling thread */
 	hvc_kick();
 
+out:
+	mutex_unlock(&hvc_open_mutex);
 	return rc;
 }
 
-- 
2.25.1


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

* [PATCH 4.4 022/135] staging: sm750fb: add missing case while setting FB_VISUAL
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (20 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 021/135] tty: hvc: Fix data abort due to race in hvc_open Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 023/135] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output Sasha Levin
                   ` (116 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Matej Dujava, Greg Kroah-Hartman, Sasha Levin

From: Matej Dujava <mdujava@kocurkovo.cz>

[ Upstream commit fa90133377f4a7f15a937df6ad55133bb57c5665 ]

Switch statement does not contain all cases: 8, 16, 24, 32.
This patch will add missing one (24)

Fixes: 81dee67e215b ("staging: sm750fb: add sm750 to staging")
Signed-off-by: Matej Dujava <mdujava@kocurkovo.cz>
Link: https://lore.kernel.org/r/1588277366-19354-2-git-send-email-mdujava@kocurkovo.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/staging/sm750fb/sm750.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 860e1c288ad5e..75b47d61318a1 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -894,6 +894,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
 		fix->visual = FB_VISUAL_PSEUDOCOLOR;
 		break;
 	case 16:
+	case 24:
 	case 32:
 		fix->visual = FB_VISUAL_TRUECOLOR;
 		break;
-- 
2.25.1


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

* [PATCH 4.4 023/135] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (21 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 022/135] staging: sm750fb: add missing case while setting FB_VISUAL Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 024/135] serial: amba-pl011: Make sure we initialize the port.lock spinlock Sasha Levin
                   ` (115 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Russell King, Wolfram Sang, Sasha Levin

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

[ Upstream commit 88b73ee7ca4c90baf136ed5a8377fc5a9b73ac08 ]

The IRQ log output is supposed to appear on a single line.  However,
commit 3a2dc1677b60 ("i2c: pxa: Update debug function to dump more info
on error") resulted in it being printed one-entry-per-line, which is
excessively long.

Fixing this is not a trivial matter; using pr_cont() doesn't work as
the previous dev_dbg() may not have been compiled in, or may be
dynamic.

Since the rest of this function output is at error level, and is also
debug output, promote this to error level as well to avoid this
problem.

Reduce the number of always zero prefix digits to save screen real-
estate.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-pxa.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 3264b50311ff0..8fca6e3dd7504 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -297,11 +297,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
 	dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n",
 		readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)),
 		readl(_ISR(i2c)));
-	dev_dbg(dev, "log: ");
+	dev_err(dev, "log:");
 	for (i = 0; i < i2c->irqlogidx; i++)
-		pr_debug("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
-
-	pr_debug("\n");
+		pr_cont(" [%03x:%05x]", i2c->isrlog[i], i2c->icrlog[i]);
+	pr_cont("\n");
 }
 
 #else /* ifdef DEBUG */
-- 
2.25.1


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

* [PATCH 4.4 024/135] serial: amba-pl011: Make sure we initialize the port.lock spinlock
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (22 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 023/135] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 025/135] drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish Sasha Levin
                   ` (114 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: John Stultz, Andy Shevchenko, Russell King, Jiri Slaby,
	linux-serial, Valentin Schneider, Greg Kroah-Hartman,
	Sasha Levin

From: John Stultz <john.stultz@linaro.org>

[ Upstream commit 8508f4cba308f785b2fd4b8c38849c117b407297 ]

Valentine reported seeing:

[    3.626638] INFO: trying to register non-static key.
[    3.626639] the code is fine but needs lockdep annotation.
[    3.626640] turning off the locking correctness validator.
[    3.626644] CPU: 7 PID: 51 Comm: kworker/7:1 Not tainted 5.7.0-rc2-00115-g8c2e9790f196 #116
[    3.626646] Hardware name: HiKey960 (DT)
[    3.626656] Workqueue: events deferred_probe_work_func
[    3.632476] sd 0:0:0:0: [sda] Optimal transfer size 8192 bytes not a multiple of physical block size (16384 bytes)
[    3.640220] Call trace:
[    3.640225]  dump_backtrace+0x0/0x1b8
[    3.640227]  show_stack+0x20/0x30
[    3.640230]  dump_stack+0xec/0x158
[    3.640234]  register_lock_class+0x598/0x5c0
[    3.640235]  __lock_acquire+0x80/0x16c0
[    3.640236]  lock_acquire+0xf4/0x4a0
[    3.640241]  _raw_spin_lock_irqsave+0x70/0xa8
[    3.640245]  uart_add_one_port+0x388/0x4b8
[    3.640248]  pl011_register_port+0x70/0xf0
[    3.640250]  pl011_probe+0x184/0x1b8
[    3.640254]  amba_probe+0xdc/0x180
[    3.640256]  really_probe+0xe0/0x338
[    3.640257]  driver_probe_device+0x60/0xf8
[    3.640259]  __device_attach_driver+0x8c/0xd0
[    3.640260]  bus_for_each_drv+0x84/0xd8
[    3.640261]  __device_attach+0xe4/0x140
[    3.640263]  device_initial_probe+0x1c/0x28
[    3.640265]  bus_probe_device+0xa4/0xb0
[    3.640266]  deferred_probe_work_func+0x7c/0xb8
[    3.640269]  process_one_work+0x2c0/0x768
[    3.640271]  worker_thread+0x4c/0x498
[    3.640272]  kthread+0x14c/0x158
[    3.640275]  ret_from_fork+0x10/0x1c

Which seems to be due to the fact that after allocating the uap
structure, nothing initializes the spinlock.

Its a little confusing, as uart_port_spin_lock_init() is one
place where the lock is supposed to be initialized, but it has
an exception for the case where the port is a console.

This makes it seem like a deeper fix is needed to properly
register the console, but I'm not sure what that entails, and
Andy suggested that this approach is less invasive.

Thus, this patch resolves the issue by initializing the spinlock
in the driver, and resolves the resulting warning.

Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Reported-by: Valentin Schneider <valentin.schneider@arm.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-and-tested-by: Valentin Schneider <valentin.schneider@arm.com>
Link: https://lore.kernel.org/r/20200428184050.6501-1-john.stultz@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/serial/amba-pl011.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 899a77187bdea..c5da46f7b9093 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2323,6 +2323,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
 	uap->port.fifosize = uap->fifosize;
 	uap->port.flags = UPF_BOOT_AUTOCONF;
 	uap->port.line = index;
+	spin_lock_init(&uap->port.lock);
 
 	amba_ports[index] = uap;
 
-- 
2.25.1


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

* [PATCH 4.4 025/135] drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (23 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 024/135] serial: amba-pl011: Make sure we initialize the port.lock spinlock Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 026/135] PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges Sasha Levin
                   ` (113 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kuppuswamy Sathyanarayanan, Greg Kroah-Hartman, Sasha Levin

From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

[ Upstream commit 388bcc6ecc609fca1b4920de7dc3806c98ec535e ]

If platform bus driver registration is failed then, accessing
platform bus spin lock (&drv->driver.bus->p->klist_drivers.k_lock)
in __platform_driver_probe() without verifying the return value
__platform_driver_register() can lead to NULL pointer exception.

So check the return value before attempting the spin lock.

One such example is below:

For a custom usecase, I have intentionally failed the platform bus
registration and I expected all the platform device/driver
registrations to fail gracefully. But I came across this panic
issue.

[    1.331067] BUG: kernel NULL pointer dereference, address: 00000000000000c8
[    1.331118] #PF: supervisor write access in kernel mode
[    1.331163] #PF: error_code(0x0002) - not-present page
[    1.331208] PGD 0 P4D 0
[    1.331233] Oops: 0002 [#1] PREEMPT SMP
[    1.331268] CPU: 3 PID: 1 Comm: swapper/0 Tainted: G        W         5.6.0-00049-g670d35fb0144 #165
[    1.331341] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
[    1.331406] RIP: 0010:_raw_spin_lock+0x15/0x30
[    1.331588] RSP: 0000:ffffc9000001be70 EFLAGS: 00010246
[    1.331632] RAX: 0000000000000000 RBX: 00000000000000c8 RCX: 0000000000000001
[    1.331696] RDX: 0000000000000001 RSI: 0000000000000092 RDI: 0000000000000000
[    1.331754] RBP: 00000000ffffffed R08: 0000000000000501 R09: 0000000000000001
[    1.331817] R10: ffff88817abcc520 R11: 0000000000000670 R12: 00000000ffffffed
[    1.331881] R13: ffffffff82dbc268 R14: ffffffff832f070a R15: 0000000000000000
[    1.331945] FS:  0000000000000000(0000) GS:ffff88817bd80000(0000) knlGS:0000000000000000
[    1.332008] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    1.332062] CR2: 00000000000000c8 CR3: 000000000681e001 CR4: 00000000003606e0
[    1.332126] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    1.332189] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[    1.332252] Call Trace:
[    1.332281]  __platform_driver_probe+0x92/0xee
[    1.332323]  ? rtc_dev_init+0x2b/0x2b
[    1.332358]  cmos_init+0x37/0x67
[    1.332396]  do_one_initcall+0x7d/0x168
[    1.332428]  kernel_init_freeable+0x16c/0x1c9
[    1.332473]  ? rest_init+0xc0/0xc0
[    1.332508]  kernel_init+0x5/0x100
[    1.332543]  ret_from_fork+0x1f/0x30
[    1.332579] CR2: 00000000000000c8
[    1.332616] ---[ end trace 3bd87f12e9010b87 ]---
[    1.333549] note: swapper/0[1] exited with preempt_count 1
[    1.333592] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[    1.333736] Kernel Offset: disabled

Note, this can only be triggered if a driver errors out from this call,
which should never happen.  If it does, the driver needs to be fixed.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: https://lore.kernel.org/r/20200408214003.3356-1-sathyanarayanan.kuppuswamy@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/platform.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 065fcc4be263a..f89cb143f1cdf 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -638,6 +638,8 @@ int __init_or_module __platform_driver_probe(struct platform_driver *drv,
 	/* temporary section violation during probe() */
 	drv->probe = probe;
 	retval = code = __platform_driver_register(drv, module);
+	if (retval)
+		return retval;
 
 	/*
 	 * Fixup that section violation, being paranoid about code scanning
-- 
2.25.1


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

* [PATCH 4.4 026/135] PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (24 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 025/135] drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 027/135] power: supply: smb347-charger: IRQSTAT_D is volatile Sasha Levin
                   ` (112 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kai-Heng Feng, Bjorn Helgaas, Mika Westerberg, Sasha Levin

From: Kai-Heng Feng <kai.heng.feng@canonical.com>

[ Upstream commit 66ff14e59e8a30690755b08bc3042359703fb07a ]

7d715a6c1ae5 ("PCI: add PCI Express ASPM support") added the ability for
Linux to enable ASPM, but for some undocumented reason, it didn't enable
ASPM on links where the downstream component is a PCIe-to-PCI/PCI-X Bridge.

Remove this exclusion so we can enable ASPM on these links.

The Dell OptiPlex 7080 mentioned in the bugzilla has a TI XIO2001
PCIe-to-PCI Bridge.  Enabling ASPM on the link leading to it allows the
Intel SoC to enter deeper Package C-states, which is a significant power
savings.

[bhelgaas: commit log]
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207571
Link: https://lore.kernel.org/r/20200505173423.26968-1-kai.heng.feng@canonical.com
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/pci/pcie/aspm.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index c6a012b5ba390..966b6947e5656 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -388,16 +388,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
 
 	/* Setup initial capable state. Will be updated later */
 	link->aspm_capable = link->aspm_support;
-	/*
-	 * If the downstream component has pci bridge function, don't
-	 * do ASPM for now.
-	 */
-	list_for_each_entry(child, &linkbus->devices, bus_list) {
-		if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) {
-			link->aspm_disable = ASPM_STATE_ALL;
-			break;
-		}
-	}
 
 	/* Get and check endpoint acceptable latencies */
 	list_for_each_entry(child, &linkbus->devices, bus_list) {
-- 
2.25.1


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

* [PATCH 4.4 027/135] power: supply: smb347-charger: IRQSTAT_D is volatile
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (25 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 026/135] PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 028/135] scsi: mpt3sas: Fix double free warnings Sasha Levin
                   ` (111 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dmitry Osipenko, David Heidelberg, Sebastian Reichel, Sasha Levin

From: Dmitry Osipenko <digetx@gmail.com>

[ Upstream commit c32ea07a30630ace950e07ffe7a18bdcc25898e1 ]

Fix failure when USB cable is connected:
smb347 2-006a: reading IRQSTAT_D failed

Fixes: 1502cfe19bac ("smb347-charger: Fix battery status reporting logic for charger faults")

Tested-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/power/smb347-charger.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/power/smb347-charger.c b/drivers/power/smb347-charger.c
index 072c5189bd6d1..0655dbdc7000d 100644
--- a/drivers/power/smb347-charger.c
+++ b/drivers/power/smb347-charger.c
@@ -1141,6 +1141,7 @@ static bool smb347_volatile_reg(struct device *dev, unsigned int reg)
 	switch (reg) {
 	case IRQSTAT_A:
 	case IRQSTAT_C:
+	case IRQSTAT_D:
 	case IRQSTAT_E:
 	case IRQSTAT_F:
 	case STAT_A:
-- 
2.25.1


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

* [PATCH 4.4 028/135] scsi: mpt3sas: Fix double free warnings
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (26 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 027/135] power: supply: smb347-charger: IRQSTAT_D is volatile Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 029/135] dlm: remove BUG() before panic() Sasha Levin
                   ` (110 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Suganath Prabu S, Dan Carpenter, Martin K . Petersen, Sasha Levin

From: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>

[ Upstream commit cbbfdb2a2416c9f0cde913cf09670097ac281282 ]

Fix following warning from Smatch static analyser:

drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->hpr_lookup' double freed

drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->internal_lookup' double freed

Link: https://lore.kernel.org/r/20200508110738.30732-1-suganath-prabu.subramani@broadcom.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 7af7a08594785..8d52afd1f71db 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -3136,7 +3136,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)
 		ioc->scsi_lookup = NULL;
 	}
 	kfree(ioc->hpr_lookup);
+	ioc->hpr_lookup = NULL;
 	kfree(ioc->internal_lookup);
+	ioc->internal_lookup = NULL;
 	if (ioc->chain_lookup) {
 		for (i = 0; i < ioc->chain_depth; i++) {
 			if (ioc->chain_lookup[i].chain_buffer)
-- 
2.25.1


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

* [PATCH 4.4 029/135] dlm: remove BUG() before panic()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (27 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 028/135] scsi: mpt3sas: Fix double free warnings Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 030/135] clk: ti: composite: fix memory leak Sasha Levin
                   ` (109 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, Josh Poimboeuf, clang-built-linux, David Teigland,
	Sasha Levin

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit fe204591cc9480347af7d2d6029b24a62e449486 ]

Building a kernel with clang sometimes fails with an objtool error in dlm:

fs/dlm/lock.o: warning: objtool: revert_lock_pc()+0xbd: can't find jump dest instruction at .text+0xd7fc

The problem is that BUG() never returns and the compiler knows
that anything after it is unreachable, however the panic still
emits some code that does not get fully eliminated.

Having both BUG() and panic() is really pointless as the BUG()
kills the current process and the subsequent panic() never hits.
In most cases, we probably don't really want either and should
replace the DLM_ASSERT() statements with WARN_ON(), as has
been done for some of them.

Remove the BUG() here so the user at least sees the panic message
and we can reliably build randconfig kernels.

Fixes: e7fd41792fc0 ("[DLM] The core of the DLM for GFS2/CLVM")
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: clang-built-linux@googlegroups.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/dlm/dlm_internal.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 5eff6ea3e27f1..63e856d90ed05 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -92,7 +92,6 @@ do { \
                __LINE__, __FILE__, #x, jiffies); \
     {do} \
     printk("\n"); \
-    BUG(); \
     panic("DLM:  Record message above and reboot.\n"); \
   } \
 }
-- 
2.25.1


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

* [PATCH 4.4 030/135] clk: ti: composite: fix memory leak
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (28 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 029/135] dlm: remove BUG() before panic() Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 031/135] tty: n_gsm: Fix SOF skipping Sasha Levin
                   ` (108 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tero Kristo, Tomi Valkeinen, Tony Lindgren, Stephen Boyd, Sasha Levin

From: Tero Kristo <t-kristo@ti.com>

[ Upstream commit c7c1cbbc9217ebb5601b88d138d4a5358548de9d ]

The parent_names is never released for a component clock definition,
causing some memory leak. Fix by releasing it once it is no longer
needed.

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Link: https://lkml.kernel.org/r/20200429131341.4697-2-t-kristo@ti.com
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/ti/composite.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c
index dbef218fe5ecd..14201c52b44bc 100644
--- a/drivers/clk/ti/composite.c
+++ b/drivers/clk/ti/composite.c
@@ -228,6 +228,7 @@ static void __init _register_composite(struct clk_hw *hw,
 		if (!cclk->comp_clks[i])
 			continue;
 		list_del(&cclk->comp_clks[i]->link);
+		kfree(cclk->comp_clks[i]->parent_names);
 		kfree(cclk->comp_clks[i]);
 	}
 
-- 
2.25.1


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

* [PATCH 4.4 031/135] tty: n_gsm: Fix SOF skipping
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (29 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 030/135] clk: ti: composite: fix memory leak Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 032/135] tty: n_gsm: Fix waking up upper tty layer when room available Sasha Levin
                   ` (107 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Gregory CLEMENT, Greg Kroah-Hartman, Sasha Levin

From: Gregory CLEMENT <gregory.clement@bootlin.com>

[ Upstream commit 84d6f81c1fb58b56eba81ff0a36cf31946064b40 ]

For at least some modems like the TELIT LE910, skipping SOF makes
transfers blocking indefinitely after a short amount of data
transferred.

Given the small improvement provided by skipping the SOF (just one
byte on about 100 bytes), it seems better to completely remove this
"feature" than make it optional.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20200512115323.1447922-3-gregory.clement@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/n_gsm.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 6060c3e8925ef..08aaf993221e7 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -685,7 +685,6 @@ static void gsm_data_kick(struct gsm_mux *gsm)
 {
 	struct gsm_msg *msg, *nmsg;
 	int len;
-	int skip_sof = 0;
 
 	list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) {
 		if (gsm->constipated && msg->addr)
@@ -707,15 +706,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)
 			print_hex_dump_bytes("gsm_data_kick: ",
 					     DUMP_PREFIX_OFFSET,
 					     gsm->txframe, len);
-
-		if (gsm->output(gsm, gsm->txframe + skip_sof,
-						len - skip_sof) < 0)
+		if (gsm->output(gsm, gsm->txframe, len) < 0)
 			break;
 		/* FIXME: Can eliminate one SOF in many more cases */
 		gsm->tx_bytes -= msg->len;
-		/* For a burst of frames skip the extra SOF within the
-		   burst */
-		skip_sof = 1;
 
 		list_del(&msg->list);
 		kfree(msg);
-- 
2.25.1


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

* [PATCH 4.4 032/135] tty: n_gsm: Fix waking up upper tty layer when room available
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (30 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 031/135] tty: n_gsm: Fix SOF skipping Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 033/135] powerpc/pseries/ras: Fix FWNMI_VALID off by one Sasha Levin
                   ` (106 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Gregory CLEMENT, Greg Kroah-Hartman, Sasha Levin

From: Gregory CLEMENT <gregory.clement@bootlin.com>

[ Upstream commit 01dbb362f0a114fbce19c8abe4cd6f4710e934d5 ]

Warn the upper layer when n_gms is ready to receive data
again. Without this the associated virtual tty remains blocked
indefinitely.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20200512115323.1447922-4-gregory.clement@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/n_gsm.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 08aaf993221e7..0020de4fe66f5 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -681,7 +681,7 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len,
  *	FIXME: lock against link layer control transmissions
  */
 
-static void gsm_data_kick(struct gsm_mux *gsm)
+static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
 {
 	struct gsm_msg *msg, *nmsg;
 	int len;
@@ -713,6 +713,24 @@ static void gsm_data_kick(struct gsm_mux *gsm)
 
 		list_del(&msg->list);
 		kfree(msg);
+
+		if (dlci) {
+			tty_port_tty_wakeup(&dlci->port);
+		} else {
+			int i = 0;
+
+			for (i = 0; i < NUM_DLCI; i++) {
+				struct gsm_dlci *dlci;
+
+				dlci = gsm->dlci[i];
+				if (dlci == NULL) {
+					i++;
+					continue;
+				}
+
+				tty_port_tty_wakeup(&dlci->port);
+			}
+		}
 	}
 }
 
@@ -764,7 +782,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, struct gsm_msg *msg)
 	/* Add to the actual output queue */
 	list_add_tail(&msg->list, &gsm->tx_list);
 	gsm->tx_bytes += msg->len;
-	gsm_data_kick(gsm);
+	gsm_data_kick(gsm, dlci);
 }
 
 /**
@@ -1225,7 +1243,7 @@ static void gsm_control_message(struct gsm_mux *gsm, unsigned int command,
 		gsm_control_reply(gsm, CMD_FCON, NULL, 0);
 		/* Kick the link in case it is idling */
 		spin_lock_irqsave(&gsm->tx_lock, flags);
-		gsm_data_kick(gsm);
+		gsm_data_kick(gsm, NULL);
 		spin_unlock_irqrestore(&gsm->tx_lock, flags);
 		break;
 	case CMD_FCOFF:
@@ -2423,7 +2441,7 @@ static void gsmld_write_wakeup(struct tty_struct *tty)
 	/* Queue poll */
 	clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
 	spin_lock_irqsave(&gsm->tx_lock, flags);
-	gsm_data_kick(gsm);
+	gsm_data_kick(gsm, NULL);
 	if (gsm->tx_bytes < TX_THRESH_LO) {
 		gsm_dlci_data_sweep(gsm);
 	}
-- 
2.25.1


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

* [PATCH 4.4 033/135] powerpc/pseries/ras: Fix FWNMI_VALID off by one
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (31 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 032/135] tty: n_gsm: Fix waking up upper tty layer when room available Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 034/135] powerpc/ps3: Fix kexec shutdown hang Sasha Levin
                   ` (105 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Nicholas Piggin, Michael Ellerman, Mahesh Salgaonkar, Sasha Levin

From: Nicholas Piggin <npiggin@gmail.com>

[ Upstream commit deb70f7a35a22dffa55b2c3aac71bc6fb0f486ce ]

This was discovered developing qemu fwnmi sreset support. This
off-by-one bug means the last 16 bytes of the rtas area can not
be used for a 16 byte save area.

It's not a serious bug, and QEMU implementation has to retain a
workaround for old kernels, but it's good to tighten it.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Link: https://lore.kernel.org/r/20200508043408.886394-7-npiggin@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/pseries/ras.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 9795e52bab3d3..9e817c1b78087 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -265,10 +265,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
 /*
  * Some versions of FWNMI place the buffer inside the 4kB page starting at
  * 0x7000. Other versions place it inside the rtas buffer. We check both.
+ * Minimum size of the buffer is 16 bytes.
  */
 #define VALID_FWNMI_BUFFER(A) \
-	((((A) >= 0x7000) && ((A) < 0x7ff0)) || \
-	(((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16))))
+	((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \
+	(((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16))))
 
 /*
  * Get the error information for errors coming through the
-- 
2.25.1


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

* [PATCH 4.4 034/135] powerpc/ps3: Fix kexec shutdown hang
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (32 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 033/135] powerpc/pseries/ras: Fix FWNMI_VALID off by one Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 035/135] vfio-pci: Mask cap zero Sasha Levin
                   ` (104 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Geoff Levand, Michael Ellerman, Sasha Levin

From: Geoff Levand <geoff@infradead.org>

[ Upstream commit 126554465d93b10662742128918a5fc338cda4aa ]

The ps3_mm_region_destroy() and ps3_mm_vas_destroy() routines
are called very late in the shutdown via kexec's mmu_cleanup_all
routine.  By the time mmu_cleanup_all runs it is too late to use
udbg_printf, and calling it will cause PS3 systems to hang.

Remove all debugging statements from ps3_mm_region_destroy() and
ps3_mm_vas_destroy() and replace any error reporting with calls
to lv1_panic.

With this change builds with 'DEBUG' defined will not cause kexec
reboots to hang, and builds with 'DEBUG' defined or not will end
in lv1_panic if an error is encountered.

Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7325c4af2b4c989c19d6a26b90b1fec9c0615ddf.1589049250.git.geoff@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/platforms/ps3/mm.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index b0f34663b1aec..19bae78b1f25b 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -212,13 +212,14 @@ void ps3_mm_vas_destroy(void)
 {
 	int result;
 
-	DBG("%s:%d: map.vas_id    = %llu\n", __func__, __LINE__, map.vas_id);
-
 	if (map.vas_id) {
 		result = lv1_select_virtual_address_space(0);
-		BUG_ON(result);
-		result = lv1_destruct_virtual_address_space(map.vas_id);
-		BUG_ON(result);
+		result += lv1_destruct_virtual_address_space(map.vas_id);
+
+		if (result) {
+			lv1_panic(0);
+		}
+
 		map.vas_id = 0;
 	}
 }
@@ -316,19 +317,20 @@ static void ps3_mm_region_destroy(struct mem_region *r)
 	int result;
 
 	if (!r->destroy) {
-		pr_info("%s:%d: Not destroying high region: %llxh %llxh\n",
-			__func__, __LINE__, r->base, r->size);
 		return;
 	}
 
-	DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base);
-
 	if (r->base) {
 		result = lv1_release_memory(r->base);
-		BUG_ON(result);
+
+		if (result) {
+			lv1_panic(0);
+		}
+
 		r->size = r->base = r->offset = 0;
 		map.total = map.rm.size;
 	}
+
 	ps3_mm_set_repository_highmem(NULL);
 }
 
-- 
2.25.1


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

* [PATCH 4.4 035/135] vfio-pci: Mask cap zero
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (33 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 034/135] powerpc/ps3: Fix kexec shutdown hang Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51   ` Sasha Levin
                   ` (103 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Alex Williamson, Cornelia Huck, Sasha Levin

From: Alex Williamson <alex.williamson@redhat.com>

[ Upstream commit bc138db1b96264b9c1779cf18d5a3b186aa90066 ]

The PCI Code and ID Assignment Specification changed capability ID 0
from reserved to a NULL capability in the v1.1 revision.  The NULL
capability is defined to include only the 16-bit capability header,
ie. only the ID and next pointer.  Unfortunately vfio-pci creates a
map of config space, where ID 0 is used to reserve the standard type
0 header.  Finding an actual capability with this ID therefore results
in a bogus range marked in that map and conflicts with subsequent
capabilities.  As this seems to be a dummy capability anyway and we
already support dropping capabilities, let's hide this one rather than
delving into the potentially subtle dependencies within our map.

Seen on an NVIDIA Tesla T4.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/vfio/pci/vfio_pci_config.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index bf65572f47a8f..666b234acca0a 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -1405,7 +1405,12 @@ static int vfio_cap_init(struct vfio_pci_device *vdev)
 		if (ret)
 			return ret;
 
-		if (cap <= PCI_CAP_ID_MAX) {
+		/*
+		 * ID 0 is a NULL capability, conflicting with our fake
+		 * PCI_CAP_ID_BASIC.  As it has no content, consider it
+		 * hidden for now.
+		 */
+		if (cap && cap <= PCI_CAP_ID_MAX) {
 			len = pci_cap_length[cap];
 			if (len == 0xFF) { /* Variable length */
 				len = vfio_cap_len(vdev, cap, pos);
-- 
2.25.1


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

* [PATCH 4.4 036/135] usb/ohci-platform: Fix a warning when hibernating
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
@ 2020-06-29 15:51   ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
                     ` (137 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Qais Yousef, Alan Stern, Tony Prisk, Greg Kroah-Hartman,
	Mathias Nyman, Oliver Neukum, linux-arm-kernel, linux-usb,
	Sasha Levin

From: Qais Yousef <qais.yousef@arm.com>

[ Upstream commit 1cb3b0095c3d0bb96912bfbbce4fc006d41f367c ]

The following warning was observed when attempting to suspend to disk
using a USB flash as a swap device.

[  111.779649] ------------[ cut here ]------------
[  111.788382] URB (____ptrval____) submitted while active
[  111.796646] WARNING: CPU: 3 PID: 365 at drivers/usb/core/urb.c:363 usb_submit_urb+0x3d8/0x590
[  111.805417] Modules linked in:
[  111.808584] CPU: 3 PID: 365 Comm: kworker/3:2 Not tainted 5.6.0-rc6-00002-gdfd1731f9a3e-dirty #545
[  111.817796] Hardware name: ARM Juno development board (r2) (DT)
[  111.823896] Workqueue: usb_hub_wq hub_event
[  111.828217] pstate: 60000005 (nZCv daif -PAN -UAO)
[  111.833156] pc : usb_submit_urb+0x3d8/0x590
[  111.837471] lr : usb_submit_urb+0x3d8/0x590
[  111.841783] sp : ffff800018de38b0
[  111.845205] x29: ffff800018de38b0 x28: 0000000000000003
[  111.850682] x27: ffff000970530b20 x26: ffff8000133fd000
[  111.856159] x25: ffff8000133fd000 x24: ffff800018de3b38
[  111.861635] x23: 0000000000000004 x22: 0000000000000c00
[  111.867112] x21: 0000000000000000 x20: 00000000fffffff0
[  111.872589] x19: ffff0009704e7a00 x18: ffffffffffffffff
[  111.878065] x17: 00000000a7c8f4bc x16: 000000002af33de8
[  111.883542] x15: ffff8000133fda88 x14: 0720072007200720
[  111.889019] x13: 0720072007200720 x12: 0720072007200720
[  111.894496] x11: 0000000000000000 x10: 00000000a5286134
[  111.899973] x9 : 0000000000000002 x8 : ffff000970c837a0
[  111.905449] x7 : 0000000000000000 x6 : ffff800018de3570
[  111.910926] x5 : 0000000000000001 x4 : 0000000000000003
[  111.916401] x3 : 0000000000000000 x2 : ffff800013427118
[  111.921879] x1 : 9d4e965b4b7d7c00 x0 : 0000000000000000
[  111.927356] Call trace:
[  111.929892]  usb_submit_urb+0x3d8/0x590
[  111.933852]  hub_activate+0x108/0x7f0
[  111.937633]  hub_resume+0xac/0x148
[  111.941149]  usb_resume_interface.isra.10+0x60/0x138
[  111.946265]  usb_resume_both+0xe4/0x140
[  111.950225]  usb_runtime_resume+0x24/0x30
[  111.954365]  __rpm_callback+0xdc/0x138
[  111.958236]  rpm_callback+0x34/0x98
[  111.961841]  rpm_resume+0x4a8/0x720
[  111.965445]  rpm_resume+0x50c/0x720
[  111.969049]  __pm_runtime_resume+0x4c/0xb8
[  111.973276]  usb_autopm_get_interface+0x28/0x60
[  111.977948]  hub_event+0x80/0x16d8
[  111.981466]  process_one_work+0x2a4/0x748
[  111.985604]  worker_thread+0x48/0x498
[  111.989387]  kthread+0x13c/0x140
[  111.992725]  ret_from_fork+0x10/0x18
[  111.996415] irq event stamp: 354
[  111.999756] hardirqs last  enabled at (353): [<ffff80001019ea1c>] console_unlock+0x504/0x5b8
[  112.008441] hardirqs last disabled at (354): [<ffff8000100a95d0>] do_debug_exception+0x1a8/0x258
[  112.017479] softirqs last  enabled at (350): [<ffff8000100818a4>] __do_softirq+0x4bc/0x568
[  112.025984] softirqs last disabled at (343): [<ffff8000101145a4>] irq_exit+0x144/0x150
[  112.034129] ---[ end trace dc96030b9cf6c8a3 ]---

The problem was tracked down to a missing call to
pm_runtime_set_active() on resume in ohci-platform.

Link: https://lore.kernel.org/lkml/20200323143857.db5zphxhq4hz3hmd@e107158-lin.cambridge.arm.com/
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Tony Prisk <linux@prisktech.co.nz>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Mathias Nyman <mathias.nyman@intel.com>
CC: Oliver Neukum <oneukum@suse.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-usb@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20200518154931.6144-1-qais.yousef@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/ohci-platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index c2669f185f658..0e5580e6f35cb 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -339,6 +339,11 @@ static int ohci_platform_resume(struct device *dev)
 	}
 
 	ohci_resume(hcd, false);
+
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
-- 
2.25.1


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

* [PATCH 4.4 036/135] usb/ohci-platform: Fix a warning when hibernating
@ 2020-06-29 15:51   ` Sasha Levin
  0 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Oliver Neukum, Mathias Nyman, Greg Kroah-Hartman,
	linux-usb, Tony Prisk, Alan Stern, Qais Yousef, linux-arm-kernel

From: Qais Yousef <qais.yousef@arm.com>

[ Upstream commit 1cb3b0095c3d0bb96912bfbbce4fc006d41f367c ]

The following warning was observed when attempting to suspend to disk
using a USB flash as a swap device.

[  111.779649] ------------[ cut here ]------------
[  111.788382] URB (____ptrval____) submitted while active
[  111.796646] WARNING: CPU: 3 PID: 365 at drivers/usb/core/urb.c:363 usb_submit_urb+0x3d8/0x590
[  111.805417] Modules linked in:
[  111.808584] CPU: 3 PID: 365 Comm: kworker/3:2 Not tainted 5.6.0-rc6-00002-gdfd1731f9a3e-dirty #545
[  111.817796] Hardware name: ARM Juno development board (r2) (DT)
[  111.823896] Workqueue: usb_hub_wq hub_event
[  111.828217] pstate: 60000005 (nZCv daif -PAN -UAO)
[  111.833156] pc : usb_submit_urb+0x3d8/0x590
[  111.837471] lr : usb_submit_urb+0x3d8/0x590
[  111.841783] sp : ffff800018de38b0
[  111.845205] x29: ffff800018de38b0 x28: 0000000000000003
[  111.850682] x27: ffff000970530b20 x26: ffff8000133fd000
[  111.856159] x25: ffff8000133fd000 x24: ffff800018de3b38
[  111.861635] x23: 0000000000000004 x22: 0000000000000c00
[  111.867112] x21: 0000000000000000 x20: 00000000fffffff0
[  111.872589] x19: ffff0009704e7a00 x18: ffffffffffffffff
[  111.878065] x17: 00000000a7c8f4bc x16: 000000002af33de8
[  111.883542] x15: ffff8000133fda88 x14: 0720072007200720
[  111.889019] x13: 0720072007200720 x12: 0720072007200720
[  111.894496] x11: 0000000000000000 x10: 00000000a5286134
[  111.899973] x9 : 0000000000000002 x8 : ffff000970c837a0
[  111.905449] x7 : 0000000000000000 x6 : ffff800018de3570
[  111.910926] x5 : 0000000000000001 x4 : 0000000000000003
[  111.916401] x3 : 0000000000000000 x2 : ffff800013427118
[  111.921879] x1 : 9d4e965b4b7d7c00 x0 : 0000000000000000
[  111.927356] Call trace:
[  111.929892]  usb_submit_urb+0x3d8/0x590
[  111.933852]  hub_activate+0x108/0x7f0
[  111.937633]  hub_resume+0xac/0x148
[  111.941149]  usb_resume_interface.isra.10+0x60/0x138
[  111.946265]  usb_resume_both+0xe4/0x140
[  111.950225]  usb_runtime_resume+0x24/0x30
[  111.954365]  __rpm_callback+0xdc/0x138
[  111.958236]  rpm_callback+0x34/0x98
[  111.961841]  rpm_resume+0x4a8/0x720
[  111.965445]  rpm_resume+0x50c/0x720
[  111.969049]  __pm_runtime_resume+0x4c/0xb8
[  111.973276]  usb_autopm_get_interface+0x28/0x60
[  111.977948]  hub_event+0x80/0x16d8
[  111.981466]  process_one_work+0x2a4/0x748
[  111.985604]  worker_thread+0x48/0x498
[  111.989387]  kthread+0x13c/0x140
[  111.992725]  ret_from_fork+0x10/0x18
[  111.996415] irq event stamp: 354
[  111.999756] hardirqs last  enabled at (353): [<ffff80001019ea1c>] console_unlock+0x504/0x5b8
[  112.008441] hardirqs last disabled at (354): [<ffff8000100a95d0>] do_debug_exception+0x1a8/0x258
[  112.017479] softirqs last  enabled at (350): [<ffff8000100818a4>] __do_softirq+0x4bc/0x568
[  112.025984] softirqs last disabled at (343): [<ffff8000101145a4>] irq_exit+0x144/0x150
[  112.034129] ---[ end trace dc96030b9cf6c8a3 ]---

The problem was tracked down to a missing call to
pm_runtime_set_active() on resume in ohci-platform.

Link: https://lore.kernel.org/lkml/20200323143857.db5zphxhq4hz3hmd@e107158-lin.cambridge.arm.com/
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Tony Prisk <linux@prisktech.co.nz>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Mathias Nyman <mathias.nyman@intel.com>
CC: Oliver Neukum <oneukum@suse.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-usb@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20200518154931.6144-1-qais.yousef@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/ohci-platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index c2669f185f658..0e5580e6f35cb 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -339,6 +339,11 @@ static int ohci_platform_resume(struct device *dev)
 	}
 
 	ohci_resume(hcd, false);
+
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 4.4 037/135] USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (35 preceding siblings ...)
  2020-06-29 15:51   ` Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 038/135] tty: n_gsm: Fix bogus i++ in gsm_data_kick Sasha Levin
                   ` (101 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tang Bin, Zhang Shengju, Peter Chen, Greg Kroah-Hartman, Sasha Levin

From: Tang Bin <tangbin@cmss.chinamobile.com>

[ Upstream commit d49292025f79693d3348f8e2029a8b4703be0f0a ]

The function ehci_mxc_drv_probe() does not perform sufficient error
checking after executing platform_get_irq(), thus fix it.

Fixes: 7e8d5cd93fac ("USB: Add EHCI support for MX27 and MX31 based boards")
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20200513132647.5456-1-tangbin@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/ehci-mxc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index c7a9b31eeaeff..637079a350032 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -63,6 +63,8 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
 	}
 
 	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
 
 	hcd = usb_create_hcd(&ehci_mxc_hc_driver, dev, dev_name(dev));
 	if (!hcd)
-- 
2.25.1


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

* [PATCH 4.4 038/135] tty: n_gsm: Fix bogus i++ in gsm_data_kick
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (36 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 037/135] USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe() Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 039/135] clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1 Sasha Levin
                   ` (100 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Gregory CLEMENT, Greg Kroah-Hartman, Sasha Levin

From: Gregory CLEMENT <gregory.clement@bootlin.com>

[ Upstream commit 4dd31f1ffec6c370c3c2e0c605628bf5e16d5c46 ]

When submitting the previous fix "tty: n_gsm: Fix waking up upper tty
layer when room available". It was suggested to switch from a while to
a for loop, but when doing it, there was a remaining bogus i++.

This patch removes this i++ and also reorganizes the code making it more
compact.

Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20200518084517.2173242-3-gregory.clement@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/tty/n_gsm.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index 0020de4fe66f5..9b2beada2ff3b 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -719,17 +719,9 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct gsm_dlci *dlci)
 		} else {
 			int i = 0;
 
-			for (i = 0; i < NUM_DLCI; i++) {
-				struct gsm_dlci *dlci;
-
-				dlci = gsm->dlci[i];
-				if (dlci == NULL) {
-					i++;
-					continue;
-				}
-
-				tty_port_tty_wakeup(&dlci->port);
-			}
+			for (i = 0; i < NUM_DLCI; i++)
+				if (gsm->dlci[i])
+					tty_port_tty_wakeup(&gsm->dlci[i]->port);
 		}
 	}
 }
-- 
2.25.1


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

* [PATCH 4.4 039/135] clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (37 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 038/135] tty: n_gsm: Fix bogus i++ in gsm_data_kick Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 040/135] watchdog: da9062: No need to ping manually before setting timeout Sasha Levin
                   ` (99 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Marek Szyprowski, Sylwester Nawrocki, Sasha Levin

From: Marek Szyprowski <m.szyprowski@samsung.com>

[ Upstream commit 25bdae0f1c6609ceaf55fe6700654f0be2253d8e ]

Mark the SCLK clock for Exynos5433 I2S1 device with IGNORE_UNUSED flag to
match its behaviour with SCLK clock for AUD_I2S (I2S0) device until
a proper fix for Exynos I2S driver is ready.

This fixes the following synchronous abort issue revealed by the probe
order change caused by the commit 93d2e4322aa7 ("of: platform: Batch
fwnode parsing when adding all top level devices")

Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 50 Comm: kworker/0:1 Not tainted 5.7.0-rc5+ #701
Hardware name: Samsung TM2E board (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO)
pc : samsung_i2s_probe+0x768/0x8f0
lr : samsung_i2s_probe+0x688/0x8f0
...
Call trace:
 samsung_i2s_probe+0x768/0x8f0
 platform_drv_probe+0x50/0xa8
 really_probe+0x108/0x370
 driver_probe_device+0x54/0xb8
 __device_attach_driver+0x90/0xc0
 bus_for_each_drv+0x70/0xc8
 __device_attach+0xdc/0x140
 device_initial_probe+0x10/0x18
 bus_probe_device+0x94/0xa0
 deferred_probe_work_func+0x70/0xa8
 process_one_work+0x2a8/0x718
 worker_thread+0x48/0x470
 kthread+0x134/0x160
 ret_from_fork+0x10/0x1c
Code: 17ffffaf d503201f f94086c0 91003000 (88dffc00)
---[ end trace ccf721c9400ddbd6 ]---

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/samsung/clk-exynos5433.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
index 91c89ac193b9a..77ae2d21c4882 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -1708,7 +1708,8 @@ static struct samsung_gate_clock peric_gate_clks[] __initdata = {
 	GATE(CLK_SCLK_PCM1, "sclk_pcm1", "sclk_pcm1_peric",
 			ENABLE_SCLK_PERIC, 7, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_I2S1, "sclk_i2s1", "sclk_i2s1_peric",
-			ENABLE_SCLK_PERIC, 6, CLK_SET_RATE_PARENT, 0),
+			ENABLE_SCLK_PERIC, 6,
+			CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED, 0),
 	GATE(CLK_SCLK_SPI2, "sclk_spi2", "sclk_spi2_peric", ENABLE_SCLK_PERIC,
 			5, CLK_SET_RATE_PARENT, 0),
 	GATE(CLK_SCLK_SPI1, "sclk_spi1", "sclk_spi1_peric", ENABLE_SCLK_PERIC,
-- 
2.25.1


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

* [PATCH 4.4 040/135] watchdog: da9062: No need to ping manually before setting timeout
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (38 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 039/135] clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1 Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 041/135] usb: dwc2: gadget: move gadget resume after the core is in L0 state Sasha Levin
                   ` (98 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Stefan Riedmueller, Guenter Roeck, Adam Thomson,
	Wim Van Sebroeck, Sasha Levin

From: Stefan Riedmueller <s.riedmueller@phytec.de>

[ Upstream commit a0948ddba65f4f6d3cfb5e2b84685485d0452966 ]

There is actually no need to ping the watchdog before disabling it
during timeout change. Disabling the watchdog already takes care of
resetting the counter.

This fixes an issue during boot when the userspace watchdog handler takes
over and the watchdog is already running. Opening the watchdog in this case
leads to the first ping and directly after that without the required
heartbeat delay a second ping issued by the set_timeout call. Due to the
missing delay this resulted in a reset.

Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20200403130728.39260-3-s.riedmueller@phytec.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/watchdog/da9062_wdt.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index daeb645fcea8a..519419136ce8f 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -94,11 +94,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt,
 					      unsigned int regval)
 {
 	struct da9062 *chip = wdt->hw;
-	int ret;
-
-	ret = da9062_reset_watchdog_timer(wdt);
-	if (ret)
-		return ret;
 
 	return regmap_update_bits(chip->regmap,
 				  DA9062AA_CONTROL_D,
-- 
2.25.1


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

* [PATCH 4.4 041/135] usb: dwc2: gadget: move gadget resume after the core is in L0 state
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (39 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 040/135] watchdog: da9062: No need to ping manually before setting timeout Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 042/135] USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke Sasha Levin
                   ` (97 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Fabrice Gasnier, Minas Harutyunyan, Felipe Balbi, Sasha Levin

From: Fabrice Gasnier <fabrice.gasnier@st.com>

[ Upstream commit 8c935deacebb8fac8f41378701eb79d12f3c2e2d ]

When the remote wakeup interrupt is triggered, lx_state is resumed from L2
to L0 state. But when the gadget resume is called, lx_state is still L2.
This prevents the resume callback to queue any request. Any attempt
to queue a request from resume callback will result in:
- "submit request only in active state" debug message to be issued
- dwc2_hsotg_ep_queue() returns -EAGAIN

Call the gadget resume routine after the core is in L0 state.

Fixes: f81f46e1f530 ("usb: dwc2: implement hibernation during bus suspend/resume")

Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/dwc2/core_intr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index 27daa42788b1a..796d60d49ac5f 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -363,10 +363,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)
 			if (ret && (ret != -ENOTSUPP))
 				dev_err(hsotg->dev, "exit hibernation failed\n");
 
+			/* Change to L0 state */
+			hsotg->lx_state = DWC2_L0;
 			call_gadget(hsotg, resume);
+		} else {
+			/* Change to L0 state */
+			hsotg->lx_state = DWC2_L0;
 		}
-		/* Change to L0 state */
-		hsotg->lx_state = DWC2_L0;
 	} else {
 		if (hsotg->core_params->hibernation) {
 			dwc2_writel(GINTSTS_WKUPINT, hsotg->regs + GINTSTS);
-- 
2.25.1


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

* [PATCH 4.4 042/135] USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (40 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 041/135] usb: dwc2: gadget: move gadget resume after the core is in L0 state Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 043/135] usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check Sasha Levin
                   ` (96 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Nathan Chancellor, Nick Desaulniers, kbuild test robot,
	Felipe Balbi, Sasha Levin

From: Nathan Chancellor <natechancellor@gmail.com>

[ Upstream commit 7a0fbcf7c308920bc6116b3a5fb21c8cc5fec128 ]

Clang warns:

drivers/usb/gadget/udc/s3c2410_udc.c:255:11: warning: comparison of
address of 'ep->queue' equal to a null pointer is always false
[-Wtautological-pointer-compare]
        if (&ep->queue == NULL)
             ~~~~^~~~~    ~~~~
1 warning generated.

It is not wrong, queue is not a pointer so if ep is not NULL, the
address of queue cannot be NULL. No other driver does a check like this
and this check has been around since the driver was first introduced,
presumably with no issues so it does not seem like this check should be
something else. Just remove it.

Commit afe956c577b2d ("kbuild: Enable -Wtautological-compare") exposed
this but it is not the root cause of the warning.

Fixes: 3fc154b6b8134 ("USB Gadget driver for Samsung s3c2410 ARM SoC")
Link: https://github.com/ClangBuiltLinux/linux/issues/1004
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/gadget/udc/s3c2410_udc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c
index eb3571ee59e3c..08153a48704bb 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.c
+++ b/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -269,10 +269,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep,
 static void s3c2410_udc_nuke(struct s3c2410_udc *udc,
 		struct s3c2410_ep *ep, int status)
 {
-	/* Sanity check */
-	if (&ep->queue == NULL)
-		return;
-
 	while (!list_empty(&ep->queue)) {
 		struct s3c2410_request *req;
 		req = list_entry(ep->queue.next, struct s3c2410_request,
-- 
2.25.1


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

* [PATCH 4.4 043/135] usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (41 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 042/135] USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 044/135] usb: gadget: fix potential double-free in m66592_probe Sasha Levin
                   ` (95 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Colin Ian King, Felipe Balbi, Sasha Levin

From: Colin Ian King <colin.king@canonical.com>

[ Upstream commit eafa80041645cd7604c4357b1a0cd4a3c81f2227 ]

Currently pointer ep is being dereferenced before it is null checked
leading to a null pointer dereference issue.  Fix this by only assigning
pointer udc once ep is known to be not null.  Also remove a debug
message that requires a valid udc which may not be possible at that
point.

Addresses-Coverity: ("Dereference before null check")
Fixes: 24a28e428351 ("USB: gadget driver for LPC32xx")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/gadget/udc/lpc32xx_udc.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c
index ea43cb74a6f27..c9590949e4f0a 100644
--- a/drivers/usb/gadget/udc/lpc32xx_udc.c
+++ b/drivers/usb/gadget/udc/lpc32xx_udc.c
@@ -1662,17 +1662,17 @@ static int lpc32xx_ep_enable(struct usb_ep *_ep,
 			     const struct usb_endpoint_descriptor *desc)
 {
 	struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep);
-	struct lpc32xx_udc *udc = ep->udc;
+	struct lpc32xx_udc *udc;
 	u16 maxpacket;
 	u32 tmp;
 	unsigned long flags;
 
 	/* Verify EP data */
 	if ((!_ep) || (!ep) || (!desc) ||
-	    (desc->bDescriptorType != USB_DT_ENDPOINT)) {
-		dev_dbg(udc->dev, "bad ep or descriptor\n");
+	    (desc->bDescriptorType != USB_DT_ENDPOINT))
 		return -EINVAL;
-	}
+
+	udc = ep->udc;
 	maxpacket = usb_endpoint_maxp(desc);
 	if ((maxpacket == 0) || (maxpacket > ep->maxpacket)) {
 		dev_dbg(udc->dev, "bad ep descriptor's packet size\n");
@@ -1920,7 +1920,7 @@ static int lpc32xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value)
 {
 	struct lpc32xx_ep *ep = container_of(_ep, struct lpc32xx_ep, ep);
-	struct lpc32xx_udc *udc = ep->udc;
+	struct lpc32xx_udc *udc;
 	unsigned long flags;
 
 	if ((!ep) || (ep->hwep_num <= 1))
@@ -1930,6 +1930,7 @@ static int lpc32xx_ep_set_halt(struct usb_ep *_ep, int value)
 	if (ep->is_in)
 		return -EAGAIN;
 
+	udc = ep->udc;
 	spin_lock_irqsave(&udc->lock, flags);
 
 	if (value == 1) {
-- 
2.25.1


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

* [PATCH 4.4 044/135] usb: gadget: fix potential double-free in m66592_probe.
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (42 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 043/135] usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 045/135] net: sunrpc: Fix off-by-one issues in 'rpc_ntop6' Sasha Levin
                   ` (94 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Qiushi Wu, Felipe Balbi, Sasha Levin

From: Qiushi Wu <wu000273@umn.edu>

[ Upstream commit 44734a594196bf1d474212f38fe3a0d37a73278b ]

m66592_free_request() is called under label "err_add_udc"
and "clean_up", and m66592->ep0_req is not set to NULL after
first free, leading to a double-free. Fix this issue by
setting m66592->ep0_req to NULL after the first free.

Fixes: 0f91349b89f3 ("usb: gadget: convert all users to the new udc infrastructure")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/gadget/udc/m66592-udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c
index b1cfa96cc88f8..db95eab8b4328 100644
--- a/drivers/usb/gadget/udc/m66592-udc.c
+++ b/drivers/usb/gadget/udc/m66592-udc.c
@@ -1684,7 +1684,7 @@ static int m66592_probe(struct platform_device *pdev)
 
 err_add_udc:
 	m66592_free_request(&m66592->ep[0].ep, m66592->ep0_req);
-
+	m66592->ep0_req = NULL;
 clean_up3:
 	if (m66592->pdata->on_chip) {
 		clk_disable(m66592->clk);
-- 
2.25.1


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

* [PATCH 4.4 045/135] net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (43 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 044/135] usb: gadget: fix potential double-free in m66592_probe Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 046/135] ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed Sasha Levin
                   ` (93 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Fedor Tokarev, Anna Schumaker, Sasha Levin

From: Fedor Tokarev <ftokarev@gmail.com>

[ Upstream commit 118917d696dc59fd3e1741012c2f9db2294bed6f ]

Fix off-by-one issues in 'rpc_ntop6':
 - 'snprintf' returns the number of characters which would have been
   written if enough space had been available, excluding the terminating
   null byte. Thus, a return value of 'sizeof(scopebuf)' means that the
   last character was dropped.
 - 'strcat' adds a terminating null byte to the string, thus if len ==
   buflen, the null byte is written past the end of the buffer.

Signed-off-by: Fedor Tokarev <ftokarev@gmail.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/sunrpc/addr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/addr.c b/net/sunrpc/addr.c
index 2e0a6f92e563d..8391c27855501 100644
--- a/net/sunrpc/addr.c
+++ b/net/sunrpc/addr.c
@@ -81,11 +81,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap,
 
 	rc = snprintf(scopebuf, sizeof(scopebuf), "%c%u",
 			IPV6_SCOPE_DELIMITER, sin6->sin6_scope_id);
-	if (unlikely((size_t)rc > sizeof(scopebuf)))
+	if (unlikely((size_t)rc >= sizeof(scopebuf)))
 		return 0;
 
 	len += rc;
-	if (unlikely(len > buflen))
+	if (unlikely(len >= buflen))
 		return 0;
 
 	strcat(buf, scopebuf);
-- 
2.25.1


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

* [PATCH 4.4 046/135] ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (44 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 045/135] net: sunrpc: Fix off-by-one issues in 'rpc_ntop6' Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 047/135] openrisc: Fix issue with argument clobbering for clone/fork Sasha Levin
                   ` (92 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Xiyu Yang, Xin Tan, Mark Brown, Sasha Levin

From: Xiyu Yang <xiyuyang19@fudan.edu.cn>

[ Upstream commit 36124fb19f1ae68a500cd76a76d40c6e81bee346 ]

fsl_asrc_dma_hw_params() invokes dma_request_channel() or
fsl_asrc_get_dma_channel(), which returns a reference of the specified
dma_chan object to "pair->dma_chan[dir]" with increased refcnt.

The reference counting issue happens in one exception handling path of
fsl_asrc_dma_hw_params(). When config DMA channel failed for Back-End,
the function forgets to decrease the refcnt increased by
dma_request_channel() or fsl_asrc_get_dma_channel(), causing a refcnt
leak.

Fix this issue by calling dma_release_channel() when config DMA channel
failed.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Link: https://lore.kernel.org/r/1590415966-52416-1-git-send-email-xiyuyang19@fudan.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/fsl/fsl_asrc_dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index ffc000bc1f15b..56a873ba08e47 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -243,6 +243,7 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream,
 	ret = dmaengine_slave_config(pair->dma_chan[dir], &config_be);
 	if (ret) {
 		dev_err(dev, "failed to config DMA channel for Back-End\n");
+		dma_release_channel(pair->dma_chan[dir]);
 		return ret;
 	}
 
-- 
2.25.1


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

* [PATCH 4.4 047/135] openrisc: Fix issue with argument clobbering for clone/fork
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (45 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 046/135] ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 048/135] gfs2: Allow lock_nolock mount to specify jid=X Sasha Levin
                   ` (91 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Stafford Horne, Sasha Levin

From: Stafford Horne <shorne@gmail.com>

[ Upstream commit 6bd140e14d9aaa734ec37985b8b20a96c0ece948 ]

Working on the OpenRISC glibc port I found that sometimes clone was
working strange.  That the tls data argument sent in r7 was always
wrong.  Further investigation revealed that the arguments were getting
clobbered in the entry code.  This patch removes the code that writes to
the argument registers.  This was likely due to some old code hanging
around.

This patch fixes this up for clone and fork.  This fork clobber is
harmless but also useless so remove.

Signed-off-by: Stafford Horne <shorne@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/openrisc/kernel/entry.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
index c17e8451d9978..3fbe420f49c43 100644
--- a/arch/openrisc/kernel/entry.S
+++ b/arch/openrisc/kernel/entry.S
@@ -1092,13 +1092,13 @@ ENTRY(__sys_clone)
 	l.movhi	r29,hi(sys_clone)
 	l.ori	r29,r29,lo(sys_clone)
 	l.j	_fork_save_extra_regs_and_call
-	 l.addi	r7,r1,0
+	 l.nop
 
 ENTRY(__sys_fork)
 	l.movhi	r29,hi(sys_fork)
 	l.ori	r29,r29,lo(sys_fork)
 	l.j	_fork_save_extra_regs_and_call
-	 l.addi	r3,r1,0
+	 l.nop
 
 ENTRY(sys_rt_sigreturn)
 	l.j	_sys_rt_sigreturn
-- 
2.25.1


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

* [PATCH 4.4 048/135] gfs2: Allow lock_nolock mount to specify jid=X
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (46 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 047/135] openrisc: Fix issue with argument clobbering for clone/fork Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 049/135] scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj Sasha Levin
                   ` (90 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Bob Peterson, Andreas Gruenbacher, Sasha Levin

From: Bob Peterson <rpeterso@redhat.com>

[ Upstream commit ea22eee4e6027d8927099de344f7fff43c507ef9 ]

Before this patch, a simple typo accidentally added \n to the jid=
string for lock_nolock mounts. This made it impossible to mount a
gfs2 file system with a journal other than journal0. Thus:

mount -tgfs2 -o hostdata="jid=1" <device> <mount pt>

Resulted in:
mount: wrong fs type, bad option, bad superblock on <device>

In most cases this is not a problem. However, for debugging and
testing purposes we sometimes want to test the integrity of other
journals. This patch removes the unnecessary \n and thus allows
lock_nolock users to specify an alternate journal.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/gfs2/ops_fstype.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index de7143e2b361a..b7b43d00cc6d7 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -916,7 +916,7 @@ static int init_per_node(struct gfs2_sbd *sdp, int undo)
 }
 
 static const match_table_t nolock_tokens = {
-	{ Opt_jid, "jid=%d\n", },
+	{ Opt_jid, "jid=%d", },
 	{ Opt_err, NULL },
 };
 
-- 
2.25.1


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

* [PATCH 4.4 049/135] scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (47 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 048/135] gfs2: Allow lock_nolock mount to specify jid=X Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 050/135] lib/zlib: remove outdated and incorrect pre-increment optimization Sasha Levin
                   ` (89 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Qiushi Wu, Lee Duncan, Martin K . Petersen, Sasha Levin

From: Qiushi Wu <wu000273@umn.edu>

[ Upstream commit 0267ffce562c8bbf9b57ebe0e38445ad04972890 ]

kobject_init_and_add() takes reference even when it fails. If this
function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.

Link: https://lore.kernel.org/r/20200528201353.14849-1-wu000273@umn.edu
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/iscsi_boot_sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
index 680bf6f0ce767..476f46aad54cb 100644
--- a/drivers/scsi/iscsi_boot_sysfs.c
+++ b/drivers/scsi/iscsi_boot_sysfs.c
@@ -319,7 +319,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset,
 	boot_kobj->kobj.kset = boot_kset->kset;
 	if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype,
 				 NULL, name, index)) {
-		kfree(boot_kobj);
+		kobject_put(&boot_kobj->kobj);
 		return NULL;
 	}
 	boot_kobj->data = data;
-- 
2.25.1


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

* [PATCH 4.4 050/135] lib/zlib: remove outdated and incorrect pre-increment optimization
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (48 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 049/135] scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 051/135] include/linux/bitops.h: avoid clang shift-count-overflow warnings Sasha Levin
                   ` (88 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jann Horn, Andrew Morton, Mikhail Zaslonko, Linus Torvalds, Sasha Levin

From: Jann Horn <jannh@google.com>

[ Upstream commit acaab7335bd6f0c0b54ce3a00bd7f18222ce0f5f ]

The zlib inflate code has an old micro-optimization based on the
assumption that for pre-increment memory accesses, the compiler will
generate code that fits better into the processor's pipeline than what
would be generated for post-increment memory accesses.

This optimization was already removed in upstream zlib in 2016:
https://github.com/madler/zlib/commit/9aaec95e8211

This optimization causes UB according to C99, which says in section 6.5.6
"Additive operators": "If both the pointer operand and the result point to
elements of the same array object, or one past the last element of the
array object, the evaluation shall not produce an overflow; otherwise, the
behavior is undefined".

This UB is not only a theoretical concern, but can also cause trouble for
future work on compiler-based sanitizers.

According to the zlib commit, this optimization also is not optimal
anymore with modern compilers.

Replace uses of OFF, PUP and UP_UNALIGNED with their definitions in the
POSTINC case, and remove the macro definitions, just like in the upstream
patch.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Link: http://lkml.kernel.org/r/20200507123112.252723-1-jannh@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 lib/zlib_inflate/inffast.c | 91 +++++++++++++++-----------------------
 1 file changed, 35 insertions(+), 56 deletions(-)

diff --git a/lib/zlib_inflate/inffast.c b/lib/zlib_inflate/inffast.c
index 2c13ecc5bb2c7..ed1f3df272602 100644
--- a/lib/zlib_inflate/inffast.c
+++ b/lib/zlib_inflate/inffast.c
@@ -10,17 +10,6 @@
 
 #ifndef ASMINF
 
-/* Allow machine dependent optimization for post-increment or pre-increment.
-   Based on testing to date,
-   Pre-increment preferred for:
-   - PowerPC G3 (Adler)
-   - MIPS R5000 (Randers-Pehrson)
-   Post-increment preferred for:
-   - none
-   No measurable difference:
-   - Pentium III (Anderson)
-   - M68060 (Nikl)
- */
 union uu {
 	unsigned short us;
 	unsigned char b[2];
@@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p)
 	return mm.us;
 }
 
-#ifdef POSTINC
-#  define OFF 0
-#  define PUP(a) *(a)++
-#  define UP_UNALIGNED(a) get_unaligned16((a)++)
-#else
-#  define OFF 1
-#  define PUP(a) *++(a)
-#  define UP_UNALIGNED(a) get_unaligned16(++(a))
-#endif
-
 /*
    Decode literal, length, and distance codes and write out the resulting
    literal and match bytes until either not enough input or output is
@@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start)
 
     /* copy state to local variables */
     state = (struct inflate_state *)strm->state;
-    in = strm->next_in - OFF;
+    in = strm->next_in;
     last = in + (strm->avail_in - 5);
-    out = strm->next_out - OFF;
+    out = strm->next_out;
     beg = out - (start - strm->avail_out);
     end = out + (strm->avail_out - 257);
 #ifdef INFLATE_STRICT
@@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start)
        input data or output space */
     do {
         if (bits < 15) {
-            hold += (unsigned long)(PUP(in)) << bits;
+            hold += (unsigned long)(*in++) << bits;
             bits += 8;
-            hold += (unsigned long)(PUP(in)) << bits;
+            hold += (unsigned long)(*in++) << bits;
             bits += 8;
         }
         this = lcode[hold & lmask];
@@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start)
         bits -= op;
         op = (unsigned)(this.op);
         if (op == 0) {                          /* literal */
-            PUP(out) = (unsigned char)(this.val);
+            *out++ = (unsigned char)(this.val);
         }
         else if (op & 16) {                     /* length base */
             len = (unsigned)(this.val);
             op &= 15;                           /* number of extra bits */
             if (op) {
                 if (bits < op) {
-                    hold += (unsigned long)(PUP(in)) << bits;
+                    hold += (unsigned long)(*in++) << bits;
                     bits += 8;
                 }
                 len += (unsigned)hold & ((1U << op) - 1);
@@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start)
                 bits -= op;
             }
             if (bits < 15) {
-                hold += (unsigned long)(PUP(in)) << bits;
+                hold += (unsigned long)(*in++) << bits;
                 bits += 8;
-                hold += (unsigned long)(PUP(in)) << bits;
+                hold += (unsigned long)(*in++) << bits;
                 bits += 8;
             }
             this = dcode[hold & dmask];
@@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start)
                 dist = (unsigned)(this.val);
                 op &= 15;                       /* number of extra bits */
                 if (bits < op) {
-                    hold += (unsigned long)(PUP(in)) << bits;
+                    hold += (unsigned long)(*in++) << bits;
                     bits += 8;
                     if (bits < op) {
-                        hold += (unsigned long)(PUP(in)) << bits;
+                        hold += (unsigned long)(*in++) << bits;
                         bits += 8;
                     }
                 }
@@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start)
                         state->mode = BAD;
                         break;
                     }
-                    from = window - OFF;
+                    from = window;
                     if (write == 0) {           /* very common case */
                         from += wsize - op;
                         if (op < len) {         /* some from window */
                             len -= op;
                             do {
-                                PUP(out) = PUP(from);
+                                *out++ = *from++;
                             } while (--op);
                             from = out - dist;  /* rest from output */
                         }
@@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start)
                         if (op < len) {         /* some from end of window */
                             len -= op;
                             do {
-                                PUP(out) = PUP(from);
+                                *out++ = *from++;
                             } while (--op);
-                            from = window - OFF;
+                            from = window;
                             if (write < len) {  /* some from start of window */
                                 op = write;
                                 len -= op;
                                 do {
-                                    PUP(out) = PUP(from);
+                                    *out++ = *from++;
                                 } while (--op);
                                 from = out - dist;      /* rest from output */
                             }
@@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start)
                         if (op < len) {         /* some from window */
                             len -= op;
                             do {
-                                PUP(out) = PUP(from);
+                                *out++ = *from++;
                             } while (--op);
                             from = out - dist;  /* rest from output */
                         }
                     }
                     while (len > 2) {
-                        PUP(out) = PUP(from);
-                        PUP(out) = PUP(from);
-                        PUP(out) = PUP(from);
+                        *out++ = *from++;
+                        *out++ = *from++;
+                        *out++ = *from++;
                         len -= 3;
                     }
                     if (len) {
-                        PUP(out) = PUP(from);
+                        *out++ = *from++;
                         if (len > 1)
-                            PUP(out) = PUP(from);
+                            *out++ = *from++;
                     }
                 }
                 else {
@@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start)
                     from = out - dist;          /* copy direct from output */
 		    /* minimum length is three */
 		    /* Align out addr */
-		    if (!((long)(out - 1 + OFF) & 1)) {
-			PUP(out) = PUP(from);
+		    if (!((long)(out - 1) & 1)) {
+			*out++ = *from++;
 			len--;
 		    }
-		    sout = (unsigned short *)(out - OFF);
+		    sout = (unsigned short *)(out);
 		    if (dist > 2) {
 			unsigned short *sfrom;
 
-			sfrom = (unsigned short *)(from - OFF);
+			sfrom = (unsigned short *)(from);
 			loops = len >> 1;
 			do
 #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
-			    PUP(sout) = PUP(sfrom);
+			    *sout++ = *sfrom++;
 #else
-			    PUP(sout) = UP_UNALIGNED(sfrom);
+			    *sout++ = get_unaligned16(sfrom++);
 #endif
 			while (--loops);
-			out = (unsigned char *)sout + OFF;
-			from = (unsigned char *)sfrom + OFF;
+			out = (unsigned char *)sout;
+			from = (unsigned char *)sfrom;
 		    } else { /* dist == 1 or dist == 2 */
 			unsigned short pat16;
 
-			pat16 = *(sout-1+OFF);
+			pat16 = *(sout-1);
 			if (dist == 1) {
 				union uu mm;
 				/* copy one char pattern to both bytes */
@@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start)
 			}
 			loops = len >> 1;
 			do
-			    PUP(sout) = pat16;
+			    *sout++ = pat16;
 			while (--loops);
-			out = (unsigned char *)sout + OFF;
+			out = (unsigned char *)sout;
 		    }
 		    if (len & 1)
-			PUP(out) = PUP(from);
+			*out++ = *from++;
                 }
             }
             else if ((op & 64) == 0) {          /* 2nd level distance code */
@@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start)
     hold &= (1U << bits) - 1;
 
     /* update state and return */
-    strm->next_in = in + OFF;
-    strm->next_out = out + OFF;
+    strm->next_in = in;
+    strm->next_out = out;
     strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
     strm->avail_out = (unsigned)(out < end ?
                                  257 + (end - out) : 257 - (out - end));
-- 
2.25.1


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

* [PATCH 4.4 051/135] include/linux/bitops.h: avoid clang shift-count-overflow warnings
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (49 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 050/135] lib/zlib: remove outdated and incorrect pre-increment optimization Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 052/135] elfnote: mark all .note sections SHF_ALLOC Sasha Levin
                   ` (87 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Arnd Bergmann, Andrew Morton, Christian Brauner, Andy Shevchenko,
	Rasmus Villemoes, Josh Poimboeuf, Nick Desaulniers,
	Linus Torvalds, Sasha Levin

From: Arnd Bergmann <arnd@arndb.de>

[ Upstream commit bd93f003b7462ae39a43c531abca37fe7073b866 ]

Clang normally does not warn about certain issues in inline functions when
it only happens in an eliminated code path. However if something else
goes wrong, it does tend to complain about the definition of hweight_long()
on 32-bit targets:

  include/linux/bitops.h:75:41: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
          return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
                                                 ^~~~~~~~~~~~
  include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
   define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
                                                  ^~~~~~~~~~~~~~~~~~~~
  include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
   define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
                                                                             ^  ~~
  include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
   define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
                                                  ^
  include/asm-generic/bitops/const_hweight.h:19:72: note: expanded from macro '__const_hweight16'
   define __const_hweight16(w) (__const_hweight8(w)  + __const_hweight8((w)  >> 8 ))
                                                                         ^
  include/asm-generic/bitops/const_hweight.h:12:9: note: expanded from macro '__const_hweight8'
            (!!((w) & (1ULL << 2))) +     \

Adding an explicit cast to __u64 avoids that warning and makes it easier
to read other output.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Link: http://lkml.kernel.org/r/20200505135513.65265-1-arnd@arndb.de
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/bitops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index ce2bb045b3fdd..9b9711ea267a4 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -59,7 +59,7 @@ static inline int get_count_order(unsigned int count)
 
 static __always_inline unsigned long hweight_long(unsigned long w)
 {
-	return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
+	return sizeof(w) == 4 ? hweight32(w) : hweight64((__u64)w);
 }
 
 /**
-- 
2.25.1


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

* [PATCH 4.4 052/135] elfnote: mark all .note sections SHF_ALLOC
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (50 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 051/135] include/linux/bitops.h: avoid clang shift-count-overflow warnings Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 053/135] selftests/net: in timestamping, strncpy needs to preserve null byte Sasha Levin
                   ` (86 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Nick Desaulniers, Andrew Morton, Nathan Chancellor, Fangrui Song,
	Jeremy Fitzhardinge, Thomas Gleixner, Vincenzo Frascino,
	Ilie Halip, Linus Torvalds, Sasha Levin

From: Nick Desaulniers <ndesaulniers@google.com>

[ Upstream commit 51da9dfb7f20911ae4e79e9b412a9c2d4c373d4b ]

ELFNOTE_START allows callers to specify flags for .pushsection assembler
directives.  All callsites but ELF_NOTE use "a" for SHF_ALLOC.  For vdso's
that explicitly use ELF_NOTE_START and BUILD_SALT, the same section is
specified twice after preprocessing, once with "a" flag, once without.
Example:

.pushsection .note.Linux, "a", @note ;
.pushsection .note.Linux, "", @note ;

While GNU as allows this ordering, it warns for the opposite ordering,
making these directives position dependent.  We'd prefer not to precisely
match this behavior in Clang's integrated assembler.  Instead, the non
__ASSEMBLY__ definition of ELF_NOTE uses
__attribute__((section(".note.Linux"))) which is created with SHF_ALLOC,
so let's make the __ASSEMBLY__ definition of ELF_NOTE consistent with C
and just always use "a" flag.

This allows Clang to assemble a working mainline (5.6) kernel via:
$ make CC=clang AS=clang

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Fangrui Song <maskray@google.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://github.com/ClangBuiltLinux/linux/issues/913
Link: http://lkml.kernel.org/r/20200325231250.99205-1-ndesaulniers@google.com
Debugged-by: Ilie Halip <ilie.halip@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/elfnote.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index 278e3ef053369..56c6d9031663d 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -53,7 +53,7 @@
 .popsection				;
 
 #define ELFNOTE(name, type, desc)		\
-	ELFNOTE_START(name, type, "")		\
+	ELFNOTE_START(name, type, "a")		\
 		desc			;	\
 	ELFNOTE_END
 
-- 
2.25.1


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

* [PATCH 4.4 053/135] selftests/net: in timestamping, strncpy needs to preserve null byte
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (51 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 052/135] elfnote: mark all .note sections SHF_ALLOC Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 054/135] scsi: acornscsi: Fix an error handling path in acornscsi_probe() Sasha Levin
                   ` (85 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: tannerlove, Willem de Bruijn, David S . Miller, Sasha Levin

From: tannerlove <tannerlove@google.com>

[ Upstream commit 8027bc0307ce59759b90679fa5d8b22949586d20 ]

If user passed an interface option longer than 15 characters, then
device.ifr_name and hwtstamp.ifr_name became non-null-terminated
strings. The compiler warned about this:

timestamping.c:353:2: warning: ‘strncpy’ specified bound 16 equals \
destination size [-Wstringop-truncation]
  353 |  strncpy(device.ifr_name, interface, sizeof(device.ifr_name));

Fixes: cb9eff097831 ("net: new user space API for time stamping of incoming and outgoing packets")
Signed-off-by: Tanner Love <tannerlove@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 .../selftests/networking/timestamping/timestamping.c   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/networking/timestamping/timestamping.c b/tools/testing/selftests/networking/timestamping/timestamping.c
index 5cdfd743447b7..900ed4b478996 100644
--- a/tools/testing/selftests/networking/timestamping/timestamping.c
+++ b/tools/testing/selftests/networking/timestamping/timestamping.c
@@ -332,10 +332,16 @@ int main(int argc, char **argv)
 	int val;
 	socklen_t len;
 	struct timeval next;
+	size_t if_len;
 
 	if (argc < 2)
 		usage(0);
 	interface = argv[1];
+	if_len = strlen(interface);
+	if (if_len >= IFNAMSIZ) {
+		printf("interface name exceeds IFNAMSIZ\n");
+		exit(1);
+	}
 
 	for (i = 2; i < argc; i++) {
 		if (!strcasecmp(argv[i], "SO_TIMESTAMP"))
@@ -369,12 +375,12 @@ int main(int argc, char **argv)
 		bail("socket");
 
 	memset(&device, 0, sizeof(device));
-	strncpy(device.ifr_name, interface, sizeof(device.ifr_name));
+	memcpy(device.ifr_name, interface, if_len + 1);
 	if (ioctl(sock, SIOCGIFADDR, &device) < 0)
 		bail("getting interface IP address");
 
 	memset(&hwtstamp, 0, sizeof(hwtstamp));
-	strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name));
+	memcpy(hwtstamp.ifr_name, interface, if_len + 1);
 	hwtstamp.ifr_data = (void *)&hwconfig;
 	memset(&hwconfig, 0, sizeof(hwconfig));
 	hwconfig.tx_type =
-- 
2.25.1


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

* [PATCH 4.4 054/135] scsi: acornscsi: Fix an error handling path in acornscsi_probe()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (52 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 053/135] selftests/net: in timestamping, strncpy needs to preserve null byte Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51   ` Sasha Levin
                   ` (84 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Christophe JAILLET, Martin K . Petersen, Sasha Levin

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

[ Upstream commit 42c76c9848e13dbe0538d7ae0147a269dfa859cb ]

'ret' is known to be 0 at this point.  Explicitly return -ENOMEM if one of
the 'ecardm_iomap()' calls fail.

Link: https://lore.kernel.org/r/20200530081622.577888-1-christophe.jaillet@wanadoo.fr
Fixes: e95a1b656a98 ("[ARM] rpc: acornscsi: update to new style ecard driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/arm/acornscsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index deaaf84989cd1..be595add8026b 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -2912,8 +2912,10 @@ static int acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
 
 	ashost->base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0);
 	ashost->fast = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0);
-	if (!ashost->base || !ashost->fast)
+	if (!ashost->base || !ashost->fast) {
+		ret = -ENOMEM;
 		goto out_put;
+	}
 
 	host->irq = ec->irq;
 	ashost->host = host;
-- 
2.25.1


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

* [PATCH 4.4 055/135] usb/xhci-plat: Set PM runtime as active on resume
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
@ 2020-06-29 15:51   ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
                     ` (137 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Qais Yousef, Tony Prisk, Greg Kroah-Hartman, Mathias Nyman,
	Oliver Neukum, linux-arm-kernel, linux-usb, Sasha Levin

From: Qais Yousef <qais.yousef@arm.com>

[ Upstream commit 79112cc3c29f4a8c73a21428fbcbcb0afb005e3e ]

Follow suit of ohci-platform.c and perform pm_runtime_set_active() on
resume.

ohci-platform.c had a warning reported due to the missing
pm_runtime_set_active() [1].

[1] https://lore.kernel.org/lkml/20200323143857.db5zphxhq4hz3hmd@e107158-lin.cambridge.arm.com/

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Tony Prisk <linux@prisktech.co.nz>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Mathias Nyman <mathias.nyman@intel.com>
CC: Oliver Neukum <oneukum@suse.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-usb@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20200518154931.6144-2-qais.yousef@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/xhci-plat.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c4c40e9d42471..510fb7853f92a 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -249,8 +249,17 @@ static int xhci_plat_resume(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
+	int ret;
+
+	ret = xhci_resume(xhci, 0);
+	if (ret)
+		return ret;
 
-	return xhci_resume(xhci, 0);
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
+	return 0;
 }
 
 static const struct dev_pm_ops xhci_plat_pm_ops = {
-- 
2.25.1


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

* [PATCH 4.4 055/135] usb/xhci-plat: Set PM runtime as active on resume
@ 2020-06-29 15:51   ` Sasha Levin
  0 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Oliver Neukum, Mathias Nyman, Greg Kroah-Hartman,
	linux-usb, Tony Prisk, Qais Yousef, linux-arm-kernel

From: Qais Yousef <qais.yousef@arm.com>

[ Upstream commit 79112cc3c29f4a8c73a21428fbcbcb0afb005e3e ]

Follow suit of ohci-platform.c and perform pm_runtime_set_active() on
resume.

ohci-platform.c had a warning reported due to the missing
pm_runtime_set_active() [1].

[1] https://lore.kernel.org/lkml/20200323143857.db5zphxhq4hz3hmd@e107158-lin.cambridge.arm.com/

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Tony Prisk <linux@prisktech.co.nz>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Mathias Nyman <mathias.nyman@intel.com>
CC: Oliver Neukum <oneukum@suse.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-usb@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20200518154931.6144-2-qais.yousef@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/xhci-plat.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index c4c40e9d42471..510fb7853f92a 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -249,8 +249,17 @@ static int xhci_plat_resume(struct device *dev)
 {
 	struct usb_hcd	*hcd = dev_get_drvdata(dev);
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
+	int ret;
+
+	ret = xhci_resume(xhci, 0);
+	if (ret)
+		return ret;
 
-	return xhci_resume(xhci, 0);
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
+	return 0;
 }
 
 static const struct dev_pm_ops xhci_plat_pm_ops = {
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 4.4 056/135] usb/ehci-platform: Set PM runtime as active on resume
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
@ 2020-06-29 15:51   ` Sasha Levin
  2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
                     ` (137 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Qais Yousef, Alan Stern, Tony Prisk, Greg Kroah-Hartman,
	Mathias Nyman, Oliver Neukum, linux-arm-kernel, linux-usb,
	Sasha Levin

From: Qais Yousef <qais.yousef@arm.com>

[ Upstream commit 16bdc04cc98ab0c74392ceef2475ecc5e73fcf49 ]

Follow suit of ohci-platform.c and perform pm_runtime_set_active() on
resume.

ohci-platform.c had a warning reported due to the missing
pm_runtime_set_active() [1].

[1] https://lore.kernel.org/lkml/20200323143857.db5zphxhq4hz3hmd@e107158-lin.cambridge.arm.com/

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Tony Prisk <linux@prisktech.co.nz>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Mathias Nyman <mathias.nyman@intel.com>
CC: Oliver Neukum <oneukum@suse.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-usb@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20200518154931.6144-3-qais.yousef@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/ehci-platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index bd7082f297bbe..56200650b46b4 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -375,6 +375,11 @@ static int ehci_platform_resume(struct device *dev)
 	}
 
 	ehci_resume(hcd, priv->reset_on_resume);
+
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
-- 
2.25.1


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

* [PATCH 4.4 056/135] usb/ehci-platform: Set PM runtime as active on resume
@ 2020-06-29 15:51   ` Sasha Levin
  0 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Sasha Levin, Oliver Neukum, Mathias Nyman, Greg Kroah-Hartman,
	linux-usb, Tony Prisk, Alan Stern, Qais Yousef, linux-arm-kernel

From: Qais Yousef <qais.yousef@arm.com>

[ Upstream commit 16bdc04cc98ab0c74392ceef2475ecc5e73fcf49 ]

Follow suit of ohci-platform.c and perform pm_runtime_set_active() on
resume.

ohci-platform.c had a warning reported due to the missing
pm_runtime_set_active() [1].

[1] https://lore.kernel.org/lkml/20200323143857.db5zphxhq4hz3hmd@e107158-lin.cambridge.arm.com/

Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
CC: Tony Prisk <linux@prisktech.co.nz>
CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CC: Mathias Nyman <mathias.nyman@intel.com>
CC: Oliver Neukum <oneukum@suse.de>
CC: linux-arm-kernel@lists.infradead.org
CC: linux-usb@vger.kernel.org
CC: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20200518154931.6144-3-qais.yousef@arm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/ehci-platform.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index bd7082f297bbe..56200650b46b4 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -375,6 +375,11 @@ static int ehci_platform_resume(struct device *dev)
 	}
 
 	ehci_resume(hcd, priv->reset_on_resume);
+
+	pm_runtime_disable(dev);
+	pm_runtime_set_active(dev);
+	pm_runtime_enable(dev);
+
 	return 0;
 }
 #endif /* CONFIG_PM_SLEEP */
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 4.4 057/135] perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (55 preceding siblings ...)
  2020-06-29 15:51   ` Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 058/135] bcache: fix potential deadlock problem in btree_gc_coalesce Sasha Levin
                   ` (81 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Gaurav Singh, Adrian Hunter, Alexander Shishkin, Ingo Molnar,
	Jiri Olsa, Kan Liang, Mark Rutland, Namhyung Kim, Peter Zijlstra,
	Sasha Levin

From: Gaurav Singh <gaurav1086@gmail.com>

[ Upstream commit 11b6e5482e178055ec1f2444b55f2518713809d1 ]

The 'evname' variable can be NULL, as it is checked a few lines back,
check it before using.

Fixes: 9e207ddfa207 ("perf report: Show call graph from reference events")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/perf/builtin-report.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index f256fac1e7225..74dd196acdac3 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -334,8 +334,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
 	if (evname != NULL)
 		ret += fprintf(fp, " of event '%s'", evname);
 
-	if (symbol_conf.show_ref_callgraph &&
-	    strstr(evname, "call-graph=no")) {
+	if (symbol_conf.show_ref_callgraph && evname && strstr(evname, "call-graph=no")) {
 		ret += fprintf(fp, ", show reference callgraph");
 	}
 
-- 
2.25.1


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

* [PATCH 4.4 058/135] bcache: fix potential deadlock problem in btree_gc_coalesce
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (56 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 057/135] perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 059/135] block: Fix use-after-free in blkdev_get() Sasha Levin
                   ` (80 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Zhiqiang Liu, Coly Li, Jens Axboe, Sasha Levin

From: Zhiqiang Liu <liuzhiqiang26@huawei.com>

[ Upstream commit be23e837333a914df3f24bf0b32e87b0331ab8d1 ]

coccicheck reports:
  drivers/md//bcache/btree.c:1538:1-7: preceding lock on line 1417

In btree_gc_coalesce func, if the coalescing process fails, we will goto
to out_nocoalesce tag directly without releasing new_nodes[i]->write_lock.
Then, it will cause a deadlock when trying to acquire new_nodes[i]->
write_lock for freeing new_nodes[i] before return.

btree_gc_coalesce func details as follows:
	if alloc new_nodes[i] fails:
		goto out_nocoalesce;
	// obtain new_nodes[i]->write_lock
	mutex_lock(&new_nodes[i]->write_lock)
	// main coalescing process
	for (i = nodes - 1; i > 0; --i)
		[snipped]
		if coalescing process fails:
			// Here, directly goto out_nocoalesce
			 // tag will cause a deadlock
			goto out_nocoalesce;
		[snipped]
	// release new_nodes[i]->write_lock
	mutex_unlock(&new_nodes[i]->write_lock)
	// coalesing succ, return
	return;
out_nocoalesce:
	btree_node_free(new_nodes[i])	// free new_nodes[i]
	// obtain new_nodes[i]->write_lock
	mutex_lock(&new_nodes[i]->write_lock);
	// set flag for reuse
	clear_bit(BTREE_NODE_dirty, &ew_nodes[i]->flags);
	// release new_nodes[i]->write_lock
	mutex_unlock(&new_nodes[i]->write_lock);

To fix the problem, we add a new tag 'out_unlock_nocoalesce' for
releasing new_nodes[i]->write_lock before out_nocoalesce tag. If
coalescing process fails, we will go to out_unlock_nocoalesce tag
for releasing new_nodes[i]->write_lock before free new_nodes[i] in
out_nocoalesce tag.

(Coly Li helps to clean up commit log format.)

Fixes: 2a285686c109816 ("bcache: btree locking rework")
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/md/bcache/btree.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 5c93582c71cc6..634e9284b7bee 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -1375,7 +1375,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
 			if (__set_blocks(n1, n1->keys + n2->keys,
 					 block_bytes(b->c)) >
 			    btree_blocks(new_nodes[i]))
-				goto out_nocoalesce;
+				goto out_unlock_nocoalesce;
 
 			keys = n2->keys;
 			/* Take the key of the node we're getting rid of */
@@ -1404,7 +1404,7 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
 
 		if (__bch_keylist_realloc(&keylist,
 					  bkey_u64s(&new_nodes[i]->key)))
-			goto out_nocoalesce;
+			goto out_unlock_nocoalesce;
 
 		bch_btree_node_write(new_nodes[i], &cl);
 		bch_keylist_add(&keylist, &new_nodes[i]->key);
@@ -1450,6 +1450,10 @@ static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
 	/* Invalidated our iterator */
 	return -EINTR;
 
+out_unlock_nocoalesce:
+	for (i = 0; i < nodes; i++)
+		mutex_unlock(&new_nodes[i]->write_lock);
+
 out_nocoalesce:
 	closure_sync(&cl);
 	bch_keylist_free(&keylist);
-- 
2.25.1


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

* [PATCH 4.4 059/135] block: Fix use-after-free in blkdev_get()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (57 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 058/135] bcache: fix potential deadlock problem in btree_gc_coalesce Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 060/135] libata: Use per port sync for detach Sasha Levin
                   ` (79 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jason Yan, Hulk Robot, Sedat Dilek, Jan Kara, Christoph Hellwig,
	Dan Carpenter, Jens Axboe, Ming Lei, Sasha Levin

From: Jason Yan <yanaijie@huawei.com>

[ Upstream commit 2d3a8e2deddea6c89961c422ec0c5b851e648c14 ]

In blkdev_get() we call __blkdev_get() to do some internal jobs and if
there is some errors in __blkdev_get(), the bdput() is called which
means we have released the refcount of the bdev (actually the refcount of
the bdev inode). This means we cannot access bdev after that point. But
acctually bdev is still accessed in blkdev_get() after calling
__blkdev_get(). This results in use-after-free if the refcount is the
last one we released in __blkdev_get(). Let's take a look at the
following scenerio:

  CPU0            CPU1                    CPU2
blkdev_open     blkdev_open           Remove disk
                  bd_acquire
		  blkdev_get
		    __blkdev_get      del_gendisk
					bdev_unhash_inode
  bd_acquire          bdev_get_gendisk
    bd_forget           failed because of unhashed
	  bdput
	              bdput (the last one)
		        bdev_evict_inode

	  	    access bdev => use after free

[  459.350216] BUG: KASAN: use-after-free in __lock_acquire+0x24c1/0x31b0
[  459.351190] Read of size 8 at addr ffff88806c815a80 by task syz-executor.0/20132
[  459.352347]
[  459.352594] CPU: 0 PID: 20132 Comm: syz-executor.0 Not tainted 4.19.90 #2
[  459.353628] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[  459.354947] Call Trace:
[  459.355337]  dump_stack+0x111/0x19e
[  459.355879]  ? __lock_acquire+0x24c1/0x31b0
[  459.356523]  print_address_description+0x60/0x223
[  459.357248]  ? __lock_acquire+0x24c1/0x31b0
[  459.357887]  kasan_report.cold+0xae/0x2d8
[  459.358503]  __lock_acquire+0x24c1/0x31b0
[  459.359120]  ? _raw_spin_unlock_irq+0x24/0x40
[  459.359784]  ? lockdep_hardirqs_on+0x37b/0x580
[  459.360465]  ? _raw_spin_unlock_irq+0x24/0x40
[  459.361123]  ? finish_task_switch+0x125/0x600
[  459.361812]  ? finish_task_switch+0xee/0x600
[  459.362471]  ? mark_held_locks+0xf0/0xf0
[  459.363108]  ? __schedule+0x96f/0x21d0
[  459.363716]  lock_acquire+0x111/0x320
[  459.364285]  ? blkdev_get+0xce/0xbe0
[  459.364846]  ? blkdev_get+0xce/0xbe0
[  459.365390]  __mutex_lock+0xf9/0x12a0
[  459.365948]  ? blkdev_get+0xce/0xbe0
[  459.366493]  ? bdev_evict_inode+0x1f0/0x1f0
[  459.367130]  ? blkdev_get+0xce/0xbe0
[  459.367678]  ? destroy_inode+0xbc/0x110
[  459.368261]  ? mutex_trylock+0x1a0/0x1a0
[  459.368867]  ? __blkdev_get+0x3e6/0x1280
[  459.369463]  ? bdev_disk_changed+0x1d0/0x1d0
[  459.370114]  ? blkdev_get+0xce/0xbe0
[  459.370656]  blkdev_get+0xce/0xbe0
[  459.371178]  ? find_held_lock+0x2c/0x110
[  459.371774]  ? __blkdev_get+0x1280/0x1280
[  459.372383]  ? lock_downgrade+0x680/0x680
[  459.373002]  ? lock_acquire+0x111/0x320
[  459.373587]  ? bd_acquire+0x21/0x2c0
[  459.374134]  ? do_raw_spin_unlock+0x4f/0x250
[  459.374780]  blkdev_open+0x202/0x290
[  459.375325]  do_dentry_open+0x49e/0x1050
[  459.375924]  ? blkdev_get_by_dev+0x70/0x70
[  459.376543]  ? __x64_sys_fchdir+0x1f0/0x1f0
[  459.377192]  ? inode_permission+0xbe/0x3a0
[  459.377818]  path_openat+0x148c/0x3f50
[  459.378392]  ? kmem_cache_alloc+0xd5/0x280
[  459.379016]  ? entry_SYSCALL_64_after_hwframe+0x49/0xbe
[  459.379802]  ? path_lookupat.isra.0+0x900/0x900
[  459.380489]  ? __lock_is_held+0xad/0x140
[  459.381093]  do_filp_open+0x1a1/0x280
[  459.381654]  ? may_open_dev+0xf0/0xf0
[  459.382214]  ? find_held_lock+0x2c/0x110
[  459.382816]  ? lock_downgrade+0x680/0x680
[  459.383425]  ? __lock_is_held+0xad/0x140
[  459.384024]  ? do_raw_spin_unlock+0x4f/0x250
[  459.384668]  ? _raw_spin_unlock+0x1f/0x30
[  459.385280]  ? __alloc_fd+0x448/0x560
[  459.385841]  do_sys_open+0x3c3/0x500
[  459.386386]  ? filp_open+0x70/0x70
[  459.386911]  ? trace_hardirqs_on_thunk+0x1a/0x1c
[  459.387610]  ? trace_hardirqs_off_caller+0x55/0x1c0
[  459.388342]  ? do_syscall_64+0x1a/0x520
[  459.388930]  do_syscall_64+0xc3/0x520
[  459.389490]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[  459.390248] RIP: 0033:0x416211
[  459.390720] Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83
04 19 00 00 c3 48 83 ec 08 e8 0a fa ff ff 48 89 04 24 b8 02 00 00 00 0f
   05 <48> 8b 3c 24 48 89 c2 e8 53 fa ff ff 48 89 d0 48 83 c4 08 48 3d
      01
[  459.393483] RSP: 002b:00007fe45dfe9a60 EFLAGS: 00000293 ORIG_RAX: 0000000000000002
[  459.394610] RAX: ffffffffffffffda RBX: 00007fe45dfea6d4 RCX: 0000000000416211
[  459.395678] RDX: 00007fe45dfe9b0a RSI: 0000000000000002 RDI: 00007fe45dfe9b00
[  459.396758] RBP: 000000000076bf20 R08: 0000000000000000 R09: 000000000000000a
[  459.397930] R10: 0000000000000075 R11: 0000000000000293 R12: 00000000ffffffff
[  459.399022] R13: 0000000000000bd9 R14: 00000000004cdb80 R15: 000000000076bf2c
[  459.400168]
[  459.400430] Allocated by task 20132:
[  459.401038]  kasan_kmalloc+0xbf/0xe0
[  459.401652]  kmem_cache_alloc+0xd5/0x280
[  459.402330]  bdev_alloc_inode+0x18/0x40
[  459.402970]  alloc_inode+0x5f/0x180
[  459.403510]  iget5_locked+0x57/0xd0
[  459.404095]  bdget+0x94/0x4e0
[  459.404607]  bd_acquire+0xfa/0x2c0
[  459.405113]  blkdev_open+0x110/0x290
[  459.405702]  do_dentry_open+0x49e/0x1050
[  459.406340]  path_openat+0x148c/0x3f50
[  459.406926]  do_filp_open+0x1a1/0x280
[  459.407471]  do_sys_open+0x3c3/0x500
[  459.408010]  do_syscall_64+0xc3/0x520
[  459.408572]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[  459.409415]
[  459.409679] Freed by task 1262:
[  459.410212]  __kasan_slab_free+0x129/0x170
[  459.410919]  kmem_cache_free+0xb2/0x2a0
[  459.411564]  rcu_process_callbacks+0xbb2/0x2320
[  459.412318]  __do_softirq+0x225/0x8ac

Fix this by delaying bdput() to the end of blkdev_get() which means we
have finished accessing bdev.

Fixes: 77ea887e433a ("implement in-kernel gendisk events handling")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/block_dev.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 26bbaaefdff48..b2ebfd96785b7 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1181,10 +1181,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
 	 */
 	if (!for_part) {
 		ret = devcgroup_inode_permission(bdev->bd_inode, perm);
-		if (ret != 0) {
-			bdput(bdev);
+		if (ret != 0)
 			return ret;
-		}
 	}
 
  restart:
@@ -1253,8 +1251,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
 				goto out_clear;
 			BUG_ON(for_part);
 			ret = __blkdev_get(whole, mode, 1);
-			if (ret)
+			if (ret) {
+				bdput(whole);
 				goto out_clear;
+			}
 			bdev->bd_contains = whole;
 			bdev->bd_part = disk_get_part(disk, partno);
 			if (!(disk->flags & GENHD_FL_UP) ||
@@ -1311,7 +1311,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
 	put_disk(disk);
 	module_put(owner);
  out:
-	bdput(bdev);
 
 	return ret;
 }
@@ -1397,6 +1396,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
 		bdput(whole);
 	}
 
+	if (res)
+		bdput(bdev);
+
 	return res;
 }
 EXPORT_SYMBOL(blkdev_get);
-- 
2.25.1


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

* [PATCH 4.4 060/135] libata: Use per port sync for detach
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (58 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 059/135] block: Fix use-after-free in blkdev_get() Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 061/135] drm: encoder_slave: fix refcouting error for modules Sasha Levin
                   ` (78 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Kai-Heng Feng, John Garry, Jens Axboe, Sasha Levin

From: Kai-Heng Feng <kai.heng.feng@canonical.com>

[ Upstream commit b5292111de9bb70cba3489075970889765302136 ]

Commit 130f4caf145c ("libata: Ensure ata_port probe has completed before
detach") may cause system freeze during suspend.

Using async_synchronize_full() in PM callbacks is wrong, since async
callbacks that are already scheduled may wait for not-yet-scheduled
callbacks, causes a circular dependency.

Instead of using big hammer like async_synchronize_full(), use async
cookie to make sure port probe are synced, without affecting other
scheduled PM callbacks.

Fixes: 130f4caf145c ("libata: Ensure ata_port probe has completed before detach")
Suggested-by: John Garry <john.garry@huawei.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Tested-by: John Garry <john.garry@huawei.com>
BugLink: https://bugs.launchpad.net/bugs/1867983
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/ata/libata-core.c | 11 +++++------
 include/linux/libata.h    |  3 +++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index fc4bf8ff40ead..17cebfe5acc82 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -56,7 +56,6 @@
 #include <linux/workqueue.h>
 #include <linux/scatterlist.h>
 #include <linux/io.h>
-#include <linux/async.h>
 #include <linux/log2.h>
 #include <linux/slab.h>
 #include <linux/glob.h>
@@ -6222,7 +6221,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
 	/* perform each probe asynchronously */
 	for (i = 0; i < host->n_ports; i++) {
 		struct ata_port *ap = host->ports[i];
-		async_schedule(async_port_probe, ap);
+		ap->cookie = async_schedule(async_port_probe, ap);
 	}
 
 	return 0;
@@ -6355,11 +6354,11 @@ void ata_host_detach(struct ata_host *host)
 {
 	int i;
 
-	/* Ensure ata_port probe has completed */
-	async_synchronize_full();
-
-	for (i = 0; i < host->n_ports; i++)
+	for (i = 0; i < host->n_ports; i++) {
+		/* Ensure ata_port probe has completed */
+		async_synchronize_cookie(host->ports[i]->cookie + 1);
 		ata_port_detach(host->ports[i]);
+	}
 
 	/* the host is dead now, dissociate ACPI */
 	ata_acpi_dissociate(host);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6428ac4746dee..af561d33221d6 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -38,6 +38,7 @@
 #include <linux/acpi.h>
 #include <linux/cdrom.h>
 #include <linux/sched.h>
+#include <linux/async.h>
 
 /*
  * Define if arch has non-standard setup.  This is a _PCI_ standard
@@ -872,6 +873,8 @@ struct ata_port {
 	struct timer_list	fastdrain_timer;
 	unsigned long		fastdrain_cnt;
 
+	async_cookie_t		cookie;
+
 	int			em_message_type;
 	void			*private_data;
 
-- 
2.25.1


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

* [PATCH 4.4 061/135] drm: encoder_slave: fix refcouting error for modules
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (59 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 060/135] libata: Use per port sync for detach Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 062/135] drm/dp_mst: Reformat drm_dp_check_act_status() a bit Sasha Levin
                   ` (77 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Wolfram Sang, Emil Velikov, Daniel Vetter, Wolfram Sang, Sasha Levin

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

[ Upstream commit f78d4032de60f50fd4afaa0fb68ea03b985f820a ]

module_put() balances try_module_get(), not request_module(). Fix the
error path to match that.

Fixes: 2066facca4c7 ("drm/kms: slave encoder interface.")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/drm_encoder_slave.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
index d18b88b755c34..5c595d9f7e8f2 100644
--- a/drivers/gpu/drm/drm_encoder_slave.c
+++ b/drivers/gpu/drm/drm_encoder_slave.c
@@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 
 	err = encoder_drv->encoder_init(client, dev, encoder);
 	if (err)
-		goto fail_unregister;
+		goto fail_module_put;
 
 	if (info->platform_data)
 		encoder->slave_funcs->set_config(&encoder->base,
@@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev,
 
 	return 0;
 
+fail_module_put:
+	module_put(module);
 fail_unregister:
 	i2c_unregister_device(client);
-	module_put(module);
 fail:
 	return err;
 }
-- 
2.25.1


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

* [PATCH 4.4 062/135] drm/dp_mst: Reformat drm_dp_check_act_status() a bit
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (60 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 061/135] drm: encoder_slave: fix refcouting error for modules Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 063/135] drm/qxl: Use correct notify port address when creating cursor ring Sasha Levin
                   ` (76 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lyude Paul, Sean Paul, Greg Kroah-Hartman

From: Lyude Paul <lyude@redhat.com>

commit a5cb5fa6c3a5c2cf492db667b8670ee7b044b79f upstream.

Just add a bit more line wrapping, get rid of some extraneous
whitespace, remove an unneeded goto label, and move around some variable
declarations. No functional changes here.

Signed-off-by: Lyude Paul <lyude@redhat.com>
[this isn't a fix, but it's needed for the fix that comes after this]
Fixes: ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)")
Cc: Sean Paul <sean@poorly.run>
Cc: <stable@vger.kernel.org> # v3.17+
Reviewed-by: Sean Paul <sean@poorly.run>
Link: https://patchwork.freedesktop.org/patch/msgid/20200406221253.1307209-3-lyude@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index bb25abba7ad00..5e88988b6c46a 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2656,33 +2656,31 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,
  */
 int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr)
 {
+	int count = 0, ret;
 	u8 status;
-	int ret;
-	int count = 0;
 
 	do {
-		ret = drm_dp_dpcd_readb(mgr->aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status);
-
+		ret = drm_dp_dpcd_readb(mgr->aux,
+					DP_PAYLOAD_TABLE_UPDATE_STATUS,
+					&status);
 		if (ret < 0) {
-			DRM_DEBUG_KMS("failed to read payload table status %d\n", ret);
-			goto fail;
+			DRM_DEBUG_KMS("failed to read payload table status %d\n",
+				      ret);
+			return ret;
 		}
 
 		if (status & DP_PAYLOAD_ACT_HANDLED)
 			break;
 		count++;
 		udelay(100);
-
 	} while (count < 30);
 
 	if (!(status & DP_PAYLOAD_ACT_HANDLED)) {
-		DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n", status, count);
-		ret = -EINVAL;
-		goto fail;
+		DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n",
+			      status, count);
+		return -EINVAL;
 	}
 	return 0;
-fail:
-	return ret;
 }
 EXPORT_SYMBOL(drm_dp_check_act_status);
 
-- 
2.25.1


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

* [PATCH 4.4 063/135] drm/qxl: Use correct notify port address when creating cursor ring
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (61 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 062/135] drm/dp_mst: Reformat drm_dp_check_act_status() a bit Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 064/135] selinux: fix double free Sasha Levin
                   ` (75 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Huacai Chen, Gerd Hoffmann, Greg Kroah-Hartman

From: Huacai Chen <chenhc@lemote.com>

commit 80e5f89da3ab949fbbf1cae01dfaea29f5483a75 upstream.

The command ring and cursor ring use different notify port addresses
definition: QXL_IO_NOTIFY_CMD and QXL_IO_NOTIFY_CURSOR. However, in
qxl_device_init() we use QXL_IO_NOTIFY_CMD to create both command ring
and cursor ring. This doesn't cause any problems now, because QEMU's
behaviors on QXL_IO_NOTIFY_CMD and QXL_IO_NOTIFY_CURSOR are the same.
However, QEMU's behavior may be change in future, so let's fix it.

P.S.: In the X.org QXL driver, the notify port address of cursor ring
      is correct.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: <stable@vger.kernel.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1585635488-17507-1-git-send-email-chenhc@lemote.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/qxl/qxl_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index b2977a1819358..e8664a9f1e770 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -199,7 +199,7 @@ static int qxl_device_init(struct qxl_device *qdev,
 				&(qdev->ram_header->cursor_ring_hdr),
 				sizeof(struct qxl_command),
 				QXL_CURSOR_RING_SIZE,
-				qdev->io_base + QXL_IO_NOTIFY_CMD,
+				qdev->io_base + QXL_IO_NOTIFY_CURSOR,
 				false,
 				&qdev->cursor_event);
 
-- 
2.25.1


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

* [PATCH 4.4 064/135] selinux: fix double free
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (62 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 063/135] drm/qxl: Use correct notify port address when creating cursor ring Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:51 ` [PATCH 4.4 065/135] ext4: fix partial cluster initialization when splitting extent Sasha Levin
                   ` (74 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tom Rix, Stephen Smalley, Paul Moore, Greg Kroah-Hartman

From: Tom Rix <trix@redhat.com>

commit 65de50969a77509452ae590e9449b70a22b923bb upstream.

Clang's static analysis tool reports these double free memory errors.

security/selinux/ss/services.c:2987:4: warning: Attempt to free released memory [unix.Malloc]
                        kfree(bnames[i]);
                        ^~~~~~~~~~~~~~~~
security/selinux/ss/services.c:2990:2: warning: Attempt to free released memory [unix.Malloc]
        kfree(bvalues);
        ^~~~~~~~~~~~~~

So improve the security_get_bools error handling by freeing these variables
and setting their return pointers to NULL and the return len to 0

Cc: stable@vger.kernel.org
Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 security/selinux/ss/services.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 0a258c0602d13..55c869e0a3a08 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2622,8 +2622,12 @@ int security_get_bools(int *len, char ***names, int **values)
 	if (*names) {
 		for (i = 0; i < *len; i++)
 			kfree((*names)[i]);
+		kfree(*names);
 	}
 	kfree(*values);
+	*len = 0;
+	*names = NULL;
+	*values = NULL;
 	goto out;
 }
 
-- 
2.25.1


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

* [PATCH 4.4 065/135] ext4: fix partial cluster initialization when splitting extent
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (63 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 064/135] selinux: fix double free Sasha Levin
@ 2020-06-29 15:51 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 066/135] drm/dp_mst: Increase ACT retry timeout to 3s Sasha Levin
                   ` (73 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:51 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jeffle Xu, Eric Whitney, stable, Theodore Ts'o, Sasha Levin

From: Jeffle Xu <jefflexu@linux.alibaba.com>

[ Upstream commit cfb3c85a600c6aa25a2581b3c1c4db3460f14e46 ]

Fix the bug when calculating the physical block number of the first
block in the split extent.

This bug will cause xfstests shared/298 failure on ext4 with bigalloc
enabled occasionally. Ext4 error messages indicate that previously freed
blocks are being freed again, and the following fsck will fail due to
the inconsistency of block bitmap and bg descriptor.

The following is an example case:

1. First, Initialize a ext4 filesystem with cluster size '16K', block size
'4K', in which case, one cluster contains four blocks.

2. Create one file (e.g., xxx.img) on this ext4 filesystem. Now the extent
tree of this file is like:

...
36864:[0]4:220160
36868:[0]14332:145408
51200:[0]2:231424
...

3. Then execute PUNCH_HOLE fallocate on this file. The hole range is
like:

..
ext4_ext_remove_space: dev 254,16 ino 12 since 49506 end 49506 depth 1
ext4_ext_remove_space: dev 254,16 ino 12 since 49544 end 49546 depth 1
ext4_ext_remove_space: dev 254,16 ino 12 since 49605 end 49607 depth 1
...

4. Then the extent tree of this file after punching is like

...
49507:[0]37:158047
49547:[0]58:158087
...

5. Detailed procedure of punching hole [49544, 49546]

5.1. The block address space:
```
lblk        ~49505  49506   49507~49543     49544~49546    49547~
	  ---------+------+-------------+----------------+--------
	    extent | hole |   extent	|	hole	 | extent
	  ---------+------+-------------+----------------+--------
pblk       ~158045  158046  158047~158083  158084~158086   158087~
```

5.2. The detailed layout of cluster 39521:
```
		cluster 39521
	<------------------------------->

		hole		  extent
	<----------------------><--------

lblk      49544   49545   49546   49547
	+-------+-------+-------+-------+
	|	|	|	|	|
	+-------+-------+-------+-------+
pblk     158084  1580845  158086  158087
```

5.3. The ftrace output when punching hole [49544, 49546]:
- ext4_ext_remove_space (start 49544, end 49546)
  - ext4_ext_rm_leaf (start 49544, end 49546, last_extent [49507(158047), 40], partial [pclu 39522 lblk 0 state 2])
    - ext4_remove_blocks (extent [49507(158047), 40], from 49544 to 49546, partial [pclu 39522 lblk 0 state 2]
      - ext4_free_blocks: (block 158084 count 4)
        - ext4_mballoc_free (extent 1/6753/1)

5.4. Ext4 error message in dmesg:
EXT4-fs error (device vdb): mb_free_blocks:1457: group 1, block 158084:freeing already freed block (bit 6753); block bitmap corrupt.
EXT4-fs error (device vdb): ext4_mb_generate_buddy:747: group 1, block bitmap and bg descriptor inconsistent: 19550 vs 19551 free clusters

In this case, the whole cluster 39521 is freed mistakenly when freeing
pblock 158084~158086 (i.e., the first three blocks of this cluster),
although pblock 158087 (the last remaining block of this cluster) has
not been freed yet.

The root cause of this isuue is that, the pclu of the partial cluster is
calculated mistakenly in ext4_ext_remove_space(). The correct
partial_cluster.pclu (i.e., the cluster number of the first block in the
next extent, that is, lblock 49597 (pblock 158086)) should be 39521 rather
than 39522.

Fixes: f4226d9ea400 ("ext4: fix partial cluster initialization")
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Eric Whitney <enwlinux@gmail.com>
Cc: stable@kernel.org # v3.19+
Link: https://lore.kernel.org/r/1590121124-37096-1-git-send-email-jefflexu@linux.alibaba.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/ext4/extents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 96336830f0350..fc2746e14c42a 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2902,7 +2902,7 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
 			 * in use to avoid freeing it when removing blocks.
 			 */
 			if (sbi->s_cluster_ratio > 1) {
-				pblk = ext4_ext_pblock(ex) + end - ee_block + 2;
+				pblk = ext4_ext_pblock(ex) + end - ee_block + 1;
 				partial_cluster =
 					-(long long) EXT4_B2C(sbi, pblk);
 			}
-- 
2.25.1


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

* [PATCH 4.4 066/135] drm/dp_mst: Increase ACT retry timeout to 3s
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (64 preceding siblings ...)
  2020-06-29 15:51 ` [PATCH 4.4 065/135] ext4: fix partial cluster initialization when splitting extent Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 067/135] sparc64: fix misuses of access_process_vm() in genregs32_[sg]et() Sasha Levin
                   ` (72 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Lyude Paul, Sean Paul, Sasha Levin

From: Lyude Paul <lyude@redhat.com>

[ Upstream commit 873a95e0d59ac06901ae261dda0b7165ffd002b8 ]

Currently we only poll for an ACT up to 30 times, with a busy-wait delay
of 100µs between each attempt - giving us a timeout of 2900µs. While
this might seem sensible, it would appear that in certain scenarios it
can take dramatically longer then that for us to receive an ACT. On one
of the EVGA MST hubs that I have available, I observed said hub
sometimes taking longer then a second before signalling the ACT. These
delays mostly seem to occur when previous sideband messages we've sent
are NAKd by the hub, however it wouldn't be particularly surprising if
it's possible to reproduce times like this simply by introducing branch
devices with large LCTs since payload allocations have to take effect on
every downstream device up to the payload's target.

So, instead of just retrying 30 times we poll for the ACT for up to 3ms,
and additionally use usleep_range() to avoid a very long and rude
busy-wait. Note that the previous retry count of 30 appears to have been
arbitrarily chosen, as I can't find any mention of a recommended timeout
or retry count for ACTs in the DisplayPort 2.0 specification. This also
goes for the range we were previously using for udelay(), although I
suspect that was just copied from the recommended delay for link
training on SST devices.

Changes since v1:
* Use readx_poll_timeout() instead of open-coding timeout loop - Sean
  Paul
Changes since v2:
* Increase poll interval to 200us - Sean Paul
* Print status in hex when we timeout waiting for ACT - Sean Paul

Signed-off-by: Lyude Paul <lyude@redhat.com>
Fixes: ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)")
Cc: Sean Paul <sean@poorly.run>
Cc: <stable@vger.kernel.org> # v3.17+
Reviewed-by: Sean Paul <sean@poorly.run>
Link: https://patchwork.freedesktop.org/patch/msgid/20200406221253.1307209-4-lyude@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 54 ++++++++++++++++-----------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 5e88988b6c46a..51cdff2af8b22 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -29,6 +29,7 @@
 #include <linux/i2c.h>
 #include <drm/drm_dp_mst_helper.h>
 #include <drm/drmP.h>
+#include <linux/iopoll.h>
 
 #include <drm/drm_fixed.h>
 
@@ -2647,6 +2648,17 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,
 	return ret;
 }
 
+static int do_get_act_status(struct drm_dp_aux *aux)
+{
+	int ret;
+	u8 status;
+
+	ret = drm_dp_dpcd_readb(aux, DP_PAYLOAD_TABLE_UPDATE_STATUS, &status);
+	if (ret < 0)
+		return ret;
+
+	return status;
+}
 
 /**
  * drm_dp_check_act_status() - Check ACT handled status.
@@ -2656,30 +2668,28 @@ static int drm_dp_dpcd_write_payload(struct drm_dp_mst_topology_mgr *mgr,
  */
 int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr)
 {
-	int count = 0, ret;
-	u8 status;
-
-	do {
-		ret = drm_dp_dpcd_readb(mgr->aux,
-					DP_PAYLOAD_TABLE_UPDATE_STATUS,
-					&status);
-		if (ret < 0) {
-			DRM_DEBUG_KMS("failed to read payload table status %d\n",
-				      ret);
-			return ret;
-		}
-
-		if (status & DP_PAYLOAD_ACT_HANDLED)
-			break;
-		count++;
-		udelay(100);
-	} while (count < 30);
-
-	if (!(status & DP_PAYLOAD_ACT_HANDLED)) {
-		DRM_DEBUG_KMS("failed to get ACT bit %d after %d retries\n",
-			      status, count);
+	/*
+	 * There doesn't seem to be any recommended retry count or timeout in
+	 * the MST specification. Since some hubs have been observed to take
+	 * over 1 second to update their payload allocations under certain
+	 * conditions, we use a rather large timeout value.
+	 */
+	const int timeout_ms = 3000;
+	int ret, status;
+
+	ret = readx_poll_timeout(do_get_act_status, mgr->aux, status,
+				 status & DP_PAYLOAD_ACT_HANDLED || status < 0,
+				 200, timeout_ms * USEC_PER_MSEC);
+	if (ret < 0 && status >= 0) {
+		DRM_DEBUG_KMS("Failed to get ACT after %dms, last status: %02x\n",
+			      timeout_ms, status);
 		return -EINVAL;
+	} else if (status < 0) {
+		DRM_DEBUG_KMS("Failed to read payload table status: %d\n",
+			      status);
+		return status;
 	}
+
 	return 0;
 }
 EXPORT_SYMBOL(drm_dp_check_act_status);
-- 
2.25.1


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

* [PATCH 4.4 067/135] sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (65 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 066/135] drm/dp_mst: Increase ACT retry timeout to 3s Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 068/135] block: nr_sects_write(): Disable preemption on seqcount write Sasha Levin
                   ` (71 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Al Viro, stable, Sasha Levin

From: Al Viro <viro@zeniv.linux.org.uk>

[ Upstream commit 142cd25293f6a7ecbdff4fb0af17de6438d46433 ]

We do need access_process_vm() to access the target's reg_window.
However, access to caller's memory (storing the result in
genregs32_get(), fetching the new values in case of genregs32_set())
should be done by normal uaccess primitives.

Fixes: ad4f95764040 ([SPARC64]: Fix user accesses in regset code.)
Cc: stable@kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/sparc/kernel/ptrace_64.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index c1566170964f3..829592d5efe0b 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -534,13 +534,8 @@ static int genregs32_get(struct task_struct *target,
 						      &reg, sizeof(reg), 0)
 				    != sizeof(reg))
 					return -EFAULT;
-				if (access_process_vm(target,
-						      (unsigned long) u,
-						      &reg, sizeof(reg), 1)
-				    != sizeof(reg))
+				if (put_user(reg, u++))
 					return -EFAULT;
-				pos++;
-				u++;
 			}
 		}
 	}
@@ -639,11 +634,7 @@ static int genregs32_set(struct task_struct *target,
 			}
 		} else {
 			for (; count > 0 && pos < 32; count--) {
-				if (access_process_vm(target,
-						      (unsigned long)
-						      u,
-						      &reg, sizeof(reg), 0)
-				    != sizeof(reg))
+				if (get_user(reg, u++))
 					return -EFAULT;
 				if (access_process_vm(target,
 						      (unsigned long)
-- 
2.25.1


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

* [PATCH 4.4 068/135] block: nr_sects_write(): Disable preemption on seqcount write
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (66 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 067/135] sparc64: fix misuses of access_process_vm() in genregs32_[sg]et() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 069/135] crypto: algboss - don't wait during notifier callback Sasha Levin
                   ` (70 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ahmed S. Darwish, Sebastian Andrzej Siewior, Jens Axboe, Sasha Levin

From: "Ahmed S. Darwish" <a.darwish@linutronix.de>

[ Upstream commit 15b81ce5abdc4b502aa31dff2d415b79d2349d2f ]

For optimized block readers not holding a mutex, the "number of sectors"
64-bit value is protected from tearing on 32-bit architectures by a
sequence counter.

Disable preemption before entering that sequence counter's write side
critical section. Otherwise, the read side can preempt the write side
section and spin for the entire scheduler tick. If the reader belongs to
a real-time scheduling class, it can spin forever and the kernel will
livelock.

Fixes: c83f6bf98dc1 ("block: add partition resize function to blkpg ioctl")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 include/linux/genhd.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 5012fcdb4c9ed..a27d0aef07f66 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -727,9 +727,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part)
 static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
 {
 #if BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_SMP)
+	preempt_disable();
 	write_seqcount_begin(&part->nr_sects_seq);
 	part->nr_sects = size;
 	write_seqcount_end(&part->nr_sects_seq);
+	preempt_enable();
 #elif BITS_PER_LONG==32 && defined(CONFIG_LBDAF) && defined(CONFIG_PREEMPT)
 	preempt_disable();
 	part->nr_sects = size;
-- 
2.25.1


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

* [PATCH 4.4 069/135] crypto: algboss - don't wait during notifier callback
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (67 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 068/135] block: nr_sects_write(): Disable preemption on seqcount write Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 070/135] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Sasha Levin
                   ` (69 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Eric Biggers, Mike Gerow, Martin K . Petersen, Kai Lüke,
	Herbert Xu, Greg Kroah-Hartman

From: Eric Biggers <ebiggers@google.com>

commit 77251e41f89a813b4090f5199442f217bbf11297 upstream.

When a crypto template needs to be instantiated, CRYPTO_MSG_ALG_REQUEST
is sent to crypto_chain.  cryptomgr_schedule_probe() handles this by
starting a thread to instantiate the template, then waiting for this
thread to complete via crypto_larval::completion.

This can deadlock because instantiating the template may require loading
modules, and this (apparently depending on userspace) may need to wait
for the crc-t10dif module (lib/crc-t10dif.c) to be loaded.  But
crc-t10dif's module_init function uses crypto_register_notifier() and
therefore takes crypto_chain.rwsem for write.  That can't proceed until
the notifier callback has finished, as it holds this semaphore for read.

Fix this by removing the wait on crypto_larval::completion from within
cryptomgr_schedule_probe().  It's actually unnecessary because
crypto_alg_mod_lookup() calls crypto_larval_wait() itself after sending
CRYPTO_MSG_ALG_REQUEST.

This only actually became a problem in v4.20 due to commit b76377543b73
("crc-t10dif: Pick better transform if one becomes available"), but the
unnecessary wait was much older.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207159
Reported-by: Mike Gerow <gerow@google.com>
Fixes: 398710379f51 ("crypto: algapi - Move larval completion into algboss")
Cc: <stable@vger.kernel.org> # v3.6+
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reported-by: Kai Lüke <kai@kinvolk.io>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 crypto/algboss.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index 6e39d9c05b98a..5cbc588555ca0 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -194,8 +194,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
 	if (IS_ERR(thread))
 		goto err_put_larval;
 
-	wait_for_completion_interruptible(&larval->completion);
-
 	return NOTIFY_STOP;
 
 err_put_larval:
-- 
2.25.1


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

* [PATCH 4.4 070/135] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (68 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 069/135] crypto: algboss - don't wait during notifier callback Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 071/135] powerpc/kprobes: Fixes for kprobe_lookup_name() on BE Sasha Levin
                   ` (68 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Masami Hiramatsu, Ingo Molnar, Gustavo A . R . Silva,
	Anders Roxell, Naveen N . Rao, Anil S Keshavamurthy,
	David Miller, Ingo Molnar, Peter Zijlstra, Ziqian SUN,
	Steven Rostedt, Sasha Levin

From: Masami Hiramatsu <mhiramat@kernel.org>

[ Upstream commit 1a0aa991a6274161c95a844c58cfb801d681eb59 ]

In kprobe_optimizer() kick_kprobe_optimizer() is called
without kprobe_mutex, but this can race with other caller
which is protected by kprobe_mutex.

To fix that, expand kprobe_mutex protected area to protect
kick_kprobe_optimizer() call.

Link: http://lkml.kernel.org/r/158927057586.27680.5036330063955940456.stgit@devnote2

Fixes: cd7ebe2298ff ("kprobes: Use text_poke_smp_batch for optimizing")
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>
Cc: Anders Roxell <anders.roxell@linaro.org>
Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ziqian SUN <zsun@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/kprobes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index f59f49bc2a5d5..430baa19e48c3 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -561,11 +561,12 @@ static void kprobe_optimizer(struct work_struct *work)
 	do_free_cleaned_kprobes();
 
 	mutex_unlock(&module_mutex);
-	mutex_unlock(&kprobe_mutex);
 
 	/* Step 5: Kick optimizer again if needed */
 	if (!list_empty(&optimizing_list) || !list_empty(&unoptimizing_list))
 		kick_kprobe_optimizer();
+
+	mutex_unlock(&kprobe_mutex);
 }
 
 /* Wait for completing optimization and unoptimization */
-- 
2.25.1


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

* [PATCH 4.4 071/135] powerpc/kprobes: Fixes for kprobe_lookup_name() on BE
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (69 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 070/135] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 072/135] x86/kprobes: Avoid kretprobe recursion bug Sasha Levin
                   ` (67 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Naveen N. Rao, Michael Ellerman, Sasha Levin

From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>

[ Upstream commit 30176466e36aadba01e1a630cf42397a3438efa4 ]

Fix two issues with kprobes.h on BE which were exposed with the
optprobes work:
  - one, having to do with a missing include for linux/module.h for
    MODULE_NAME_LEN -- this didn't show up previously since the only
    users of kprobe_lookup_name were in kprobes.c, which included
    linux/module.h through other headers, and
  - two, with a missing const qualifier for a local variable which ends
    up referring a string literal. Again, this is unique to how
    kprobe_lookup_name is being invoked in optprobes.c

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/powerpc/include/asm/kprobes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
index 039b583db0292..f0717eedf781c 100644
--- a/arch/powerpc/include/asm/kprobes.h
+++ b/arch/powerpc/include/asm/kprobes.h
@@ -29,6 +29,7 @@
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/percpu.h>
+#include <linux/module.h>
 #include <asm/probes.h>
 #include <asm/code-patching.h>
 
@@ -61,7 +62,7 @@ typedef ppc_opcode_t kprobe_opcode_t;
 #define kprobe_lookup_name(name, addr)					\
 {									\
 	char dot_name[MODULE_NAME_LEN + 1 + KSYM_NAME_LEN];		\
-	char *modsym;							\
+	const char *modsym;							\
 	bool dot_appended = false;					\
 	if ((modsym = strchr(name, ':')) != NULL) {			\
 		modsym++;						\
-- 
2.25.1


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

* [PATCH 4.4 072/135] x86/kprobes: Avoid kretprobe recursion bug
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (70 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 071/135] powerpc/kprobes: Fixes for kprobe_lookup_name() on BE Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 073/135] kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Sasha Levin
                   ` (66 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Masami Hiramatsu, Andrea Righi, Steven Rostedt, Linus Torvalds,
	Mathieu Desnoyers, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	Sasha Levin

From: Masami Hiramatsu <mhiramat@kernel.org>

[ Upstream commit b191fa96ea6dc00d331dcc28c1f7db5e075693a0 ]

Avoid kretprobe recursion loop bg by setting a dummy
kprobes to current_kprobe per-CPU variable.

This bug has been introduced with the asm-coded trampoline
code, since previously it used another kprobe for hooking
the function return placeholder (which only has a nop) and
trampoline handler was called from that kprobe.

This revives the old lost kprobe again.

With this fix, we don't see deadlock anymore.

And you can see that all inner-called kretprobe are skipped.

  event_1                                  235               0
  event_2                                19375           19612

The 1st column is recorded count and the 2nd is missed count.
Above shows (event_1 rec) + (event_2 rec) ~= (event_2 missed)
(some difference are here because the counter is racy)

Reported-by: Andrea Righi <righi.andrea@gmail.com>
Tested-by: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Fixes: c9becf58d935 ("[PATCH] kretprobe: kretprobe-booster")
Link: http://lkml.kernel.org/r/155094064889.6137.972160690963039.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/kernel/kprobes/core.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 7c48aa03fe77a..7d2e2e40bbba3 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -736,11 +736,16 @@ static void __used kretprobe_trampoline_holder(void)
 NOKPROBE_SYMBOL(kretprobe_trampoline_holder);
 NOKPROBE_SYMBOL(kretprobe_trampoline);
 
+static struct kprobe kretprobe_kprobe = {
+	.addr = (void *)kretprobe_trampoline,
+};
+
 /*
  * Called from kretprobe_trampoline
  */
 __visible __used void *trampoline_handler(struct pt_regs *regs)
 {
+	struct kprobe_ctlblk *kcb;
 	struct kretprobe_instance *ri = NULL;
 	struct hlist_head *head, empty_rp;
 	struct hlist_node *tmp;
@@ -750,6 +755,17 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 	void *frame_pointer;
 	bool skipped = false;
 
+	preempt_disable();
+
+	/*
+	 * Set a dummy kprobe for avoiding kretprobe recursion.
+	 * Since kretprobe never run in kprobe handler, kprobe must not
+	 * be running at this point.
+	 */
+	kcb = get_kprobe_ctlblk();
+	__this_cpu_write(current_kprobe, &kretprobe_kprobe);
+	kcb->kprobe_status = KPROBE_HIT_ACTIVE;
+
 	INIT_HLIST_HEAD(&empty_rp);
 	kretprobe_hash_lock(current, &head, &flags);
 	/* fixup registers */
@@ -825,10 +841,9 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 		orig_ret_address = (unsigned long)ri->ret_addr;
 		if (ri->rp && ri->rp->handler) {
 			__this_cpu_write(current_kprobe, &ri->rp->kp);
-			get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
 			ri->ret_addr = correct_ret_addr;
 			ri->rp->handler(ri, regs);
-			__this_cpu_write(current_kprobe, NULL);
+			__this_cpu_write(current_kprobe, &kretprobe_kprobe);
 		}
 
 		recycle_rp_inst(ri, &empty_rp);
@@ -844,6 +859,9 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 
 	kretprobe_hash_unlock(current, &flags);
 
+	__this_cpu_write(current_kprobe, NULL);
+	preempt_enable();
+
 	hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
 		hlist_del(&ri->hlist);
 		kfree(ri);
-- 
2.25.1


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

* [PATCH 4.4 073/135] kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (71 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 072/135] x86/kprobes: Avoid kretprobe recursion bug Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 074/135] e1000e: Do not wake up the system via WOL if device wakeup is disabled Sasha Levin
                   ` (65 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jiri Olsa, Ingo Molnar, Gustavo A . R . Silva, Anders Roxell,
	Naveen N . Rao, Anil S Keshavamurthy, David Miller, Ingo Molnar,
	Peter Zijlstra, Ziqian SUN (Zamir),
	Masami Hiramatsu, Jiri Olsa, Steven Rostedt, Sasha Levin

From: Jiri Olsa <jolsa@redhat.com>

[ Upstream commit 9b38cc704e844e41d9cf74e647bff1d249512cb3 ]

Ziqian reported lockup when adding retprobe on _raw_spin_lock_irqsave.
My test was also able to trigger lockdep output:

 ============================================
 WARNING: possible recursive locking detected
 5.6.0-rc6+ #6 Not tainted
 --------------------------------------------
 sched-messaging/2767 is trying to acquire lock:
 ffffffff9a492798 (&(kretprobe_table_locks[i].lock)){-.-.}, at: kretprobe_hash_lock+0x52/0xa0

 but task is already holding lock:
 ffffffff9a491a18 (&(kretprobe_table_locks[i].lock)){-.-.}, at: kretprobe_trampoline+0x0/0x50

 other info that might help us debug this:
  Possible unsafe locking scenario:

        CPU0
        ----
   lock(&(kretprobe_table_locks[i].lock));
   lock(&(kretprobe_table_locks[i].lock));

  *** DEADLOCK ***

  May be due to missing lock nesting notation

 1 lock held by sched-messaging/2767:
  #0: ffffffff9a491a18 (&(kretprobe_table_locks[i].lock)){-.-.}, at: kretprobe_trampoline+0x0/0x50

 stack backtrace:
 CPU: 3 PID: 2767 Comm: sched-messaging Not tainted 5.6.0-rc6+ #6
 Call Trace:
  dump_stack+0x96/0xe0
  __lock_acquire.cold.57+0x173/0x2b7
  ? native_queued_spin_lock_slowpath+0x42b/0x9e0
  ? lockdep_hardirqs_on+0x590/0x590
  ? __lock_acquire+0xf63/0x4030
  lock_acquire+0x15a/0x3d0
  ? kretprobe_hash_lock+0x52/0xa0
  _raw_spin_lock_irqsave+0x36/0x70
  ? kretprobe_hash_lock+0x52/0xa0
  kretprobe_hash_lock+0x52/0xa0
  trampoline_handler+0xf8/0x940
  ? kprobe_fault_handler+0x380/0x380
  ? find_held_lock+0x3a/0x1c0
  kretprobe_trampoline+0x25/0x50
  ? lock_acquired+0x392/0xbc0
  ? _raw_spin_lock_irqsave+0x50/0x70
  ? __get_valid_kprobe+0x1f0/0x1f0
  ? _raw_spin_unlock_irqrestore+0x3b/0x40
  ? finish_task_switch+0x4b9/0x6d0
  ? __switch_to_asm+0x34/0x70
  ? __switch_to_asm+0x40/0x70

The code within the kretprobe handler checks for probe reentrancy,
so we won't trigger any _raw_spin_lock_irqsave probe in there.

The problem is in outside kprobe_flush_task, where we call:

  kprobe_flush_task
    kretprobe_table_lock
      raw_spin_lock_irqsave
        _raw_spin_lock_irqsave

where _raw_spin_lock_irqsave triggers the kretprobe and installs
kretprobe_trampoline handler on _raw_spin_lock_irqsave return.

The kretprobe_trampoline handler is then executed with already
locked kretprobe_table_locks, and first thing it does is to
lock kretprobe_table_locks ;-) the whole lockup path like:

  kprobe_flush_task
    kretprobe_table_lock
      raw_spin_lock_irqsave
        _raw_spin_lock_irqsave ---> probe triggered, kretprobe_trampoline installed

        ---> kretprobe_table_locks locked

        kretprobe_trampoline
          trampoline_handler
            kretprobe_hash_lock(current, &head, &flags);  <--- deadlock

Adding kprobe_busy_begin/end helpers that mark code with fake
probe installed to prevent triggering of another kprobe within
this code.

Using these helpers in kprobe_flush_task, so the probe recursion
protection check is hit and the probe is never set to prevent
above lockup.

Link: http://lkml.kernel.org/r/158927059835.27680.7011202830041561604.stgit@devnote2

Fixes: ef53d9c5e4da ("kprobes: improve kretprobe scalability with hashed locking")
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Gustavo A . R . Silva" <gustavoars@kernel.org>
Cc: Anders Roxell <anders.roxell@linaro.org>
Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Reported-by: "Ziqian SUN (Zamir)" <zsun@redhat.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/kernel/kprobes/core.c | 16 +++-------------
 include/linux/kprobes.h        |  4 ++++
 kernel/kprobes.c               | 24 ++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 7d2e2e40bbba3..5a6cb30b1c621 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -736,16 +736,11 @@ static void __used kretprobe_trampoline_holder(void)
 NOKPROBE_SYMBOL(kretprobe_trampoline_holder);
 NOKPROBE_SYMBOL(kretprobe_trampoline);
 
-static struct kprobe kretprobe_kprobe = {
-	.addr = (void *)kretprobe_trampoline,
-};
-
 /*
  * Called from kretprobe_trampoline
  */
 __visible __used void *trampoline_handler(struct pt_regs *regs)
 {
-	struct kprobe_ctlblk *kcb;
 	struct kretprobe_instance *ri = NULL;
 	struct hlist_head *head, empty_rp;
 	struct hlist_node *tmp;
@@ -755,16 +750,12 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 	void *frame_pointer;
 	bool skipped = false;
 
-	preempt_disable();
-
 	/*
 	 * Set a dummy kprobe for avoiding kretprobe recursion.
 	 * Since kretprobe never run in kprobe handler, kprobe must not
 	 * be running at this point.
 	 */
-	kcb = get_kprobe_ctlblk();
-	__this_cpu_write(current_kprobe, &kretprobe_kprobe);
-	kcb->kprobe_status = KPROBE_HIT_ACTIVE;
+	kprobe_busy_begin();
 
 	INIT_HLIST_HEAD(&empty_rp);
 	kretprobe_hash_lock(current, &head, &flags);
@@ -843,7 +834,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 			__this_cpu_write(current_kprobe, &ri->rp->kp);
 			ri->ret_addr = correct_ret_addr;
 			ri->rp->handler(ri, regs);
-			__this_cpu_write(current_kprobe, &kretprobe_kprobe);
+			__this_cpu_write(current_kprobe, &kprobe_busy);
 		}
 
 		recycle_rp_inst(ri, &empty_rp);
@@ -859,8 +850,7 @@ __visible __used void *trampoline_handler(struct pt_regs *regs)
 
 	kretprobe_hash_unlock(current, &flags);
 
-	__this_cpu_write(current_kprobe, NULL);
-	preempt_enable();
+	kprobe_busy_end();
 
 	hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) {
 		hlist_del(&ri->hlist);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index cb527c78de9fd..4db62045f01ae 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -366,6 +366,10 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
 	return this_cpu_ptr(&kprobe_ctlblk);
 }
 
+extern struct kprobe kprobe_busy;
+void kprobe_busy_begin(void);
+void kprobe_busy_end(void);
+
 int register_kprobe(struct kprobe *p);
 void unregister_kprobe(struct kprobe *p);
 int register_kprobes(struct kprobe **kps, int num);
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 430baa19e48c3..5bda113a3116c 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1150,6 +1150,26 @@ __releases(hlist_lock)
 }
 NOKPROBE_SYMBOL(kretprobe_table_unlock);
 
+struct kprobe kprobe_busy = {
+	.addr = (void *) get_kprobe,
+};
+
+void kprobe_busy_begin(void)
+{
+	struct kprobe_ctlblk *kcb;
+
+	preempt_disable();
+	__this_cpu_write(current_kprobe, &kprobe_busy);
+	kcb = get_kprobe_ctlblk();
+	kcb->kprobe_status = KPROBE_HIT_ACTIVE;
+}
+
+void kprobe_busy_end(void)
+{
+	__this_cpu_write(current_kprobe, NULL);
+	preempt_enable();
+}
+
 /*
  * This function is called from finish_task_switch when task tk becomes dead,
  * so that we can recycle any function-return probe instances associated
@@ -1167,6 +1187,8 @@ void kprobe_flush_task(struct task_struct *tk)
 		/* Early boot.  kretprobe_table_locks not yet initialized. */
 		return;
 
+	kprobe_busy_begin();
+
 	INIT_HLIST_HEAD(&empty_rp);
 	hash = hash_ptr(tk, KPROBE_HASH_BITS);
 	head = &kretprobe_inst_table[hash];
@@ -1180,6 +1202,8 @@ void kprobe_flush_task(struct task_struct *tk)
 		hlist_del(&ri->hlist);
 		kfree(ri);
 	}
+
+	kprobe_busy_end();
 }
 NOKPROBE_SYMBOL(kprobe_flush_task);
 
-- 
2.25.1


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

* [PATCH 4.4 074/135] e1000e: Do not wake up the system via WOL if device wakeup is disabled
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (72 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 073/135] kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 075/135] sched/rt, net: Use CONFIG_PREEMPTION.patch Sasha Levin
                   ` (64 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Chen Yu, Rafael J. Wysocki, Andy Shevchenko, Stable, Aaron Brown,
	Jeff Kirsher, Sasha Levin

From: Chen Yu <yu.c.chen@intel.com>

[ Upstream commit 6bf6be1127f7e6d4bf39f84d56854e944d045d74 ]

Currently the system will be woken up via WOL(Wake On LAN) even if the
device wakeup ability has been disabled via sysfs:
 cat /sys/devices/pci0000:00/0000:00:1f.6/power/wakeup
 disabled

The system should not be woken up if the user has explicitly
disabled the wake up ability for this device.

This patch clears the WOL ability of this network device if the
user has disabled the wake up ability in sysfs.

Fixes: bc7f75fa9788 ("[E1000E]: New pci-express e1000 driver")
Reported-by: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 203f96faf6fbe..3bd0bdbdfa0e1 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6270,11 +6270,17 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct e1000_adapter *adapter = netdev_priv(netdev);
 	struct e1000_hw *hw = &adapter->hw;
-	u32 ctrl, ctrl_ext, rctl, status;
-	/* Runtime suspend should only enable wakeup for link changes */
-	u32 wufc = runtime ? E1000_WUFC_LNKC : adapter->wol;
+	u32 ctrl, ctrl_ext, rctl, status, wufc;
 	int retval = 0;
 
+	/* Runtime suspend should only enable wakeup for link changes */
+	if (runtime)
+		wufc = E1000_WUFC_LNKC;
+	else if (device_may_wakeup(&pdev->dev))
+		wufc = adapter->wol;
+	else
+		wufc = 0;
+
 	status = er32(STATUS);
 	if (status & E1000_STATUS_LU)
 		wufc &= ~E1000_WUFC_LNKC;
@@ -6332,7 +6338,7 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
 		e1000e_igp3_phy_powerdown_workaround_ich8lan(&adapter->hw);
 	} else if ((hw->mac.type == e1000_pch_lpt) ||
 		   (hw->mac.type == e1000_pch_spt)) {
-		if (!(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)))
+		if (wufc && !(wufc & (E1000_WUFC_EX | E1000_WUFC_MC | E1000_WUFC_BC)))
 			/* ULP does not support wake from unicast, multicast
 			 * or broadcast.
 			 */
-- 
2.25.1


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

* [PATCH 4.4 075/135] sched/rt, net: Use CONFIG_PREEMPTION.patch
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (73 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 074/135] e1000e: Do not wake up the system via WOL if device wakeup is disabled Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 076/135] net: core: device_rename: Use rwsem instead of a seqcount Sasha Levin
                   ` (63 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Thomas Gleixner, Sebastian Andrzej Siewior, David S . Miller,
	Linus Torvalds, Peter Zijlstra, netdev, Ingo Molnar, Sasha Levin

From: Thomas Gleixner <tglx@linutronix.de>

[ Upstream commit 2da2b32fd9346009e9acdb68c570ca8d3966aba7 ]

CONFIG_PREEMPTION is selected by CONFIG_PREEMPT and by CONFIG_PREEMPT_RT.
Both PREEMPT and PREEMPT_RT require the same functionality which today
depends on CONFIG_PREEMPT.

Update the comment to use CONFIG_PREEMPTION.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: netdev@vger.kernel.org
Link: https://lore.kernel.org/r/20191015191821.11479-22-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 38e4977eb09d7..775c8dfeff848 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -865,7 +865,7 @@ EXPORT_SYMBOL(dev_get_by_index);
  *
  *	The use of raw_seqcount_begin() and cond_resched() before
  *	retrying is required as we want to give the writers a chance
- *	to complete when CONFIG_PREEMPT is not set.
+ *	to complete when CONFIG_PREEMPTION is not set.
  */
 int netdev_get_name(struct net *net, char *name, int ifindex)
 {
-- 
2.25.1


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

* [PATCH 4.4 076/135] net: core: device_rename: Use rwsem instead of a seqcount
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (74 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 075/135] sched/rt, net: Use CONFIG_PREEMPTION.patch Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 077/135] net: Revert "pkt_sched: fq: use proper locking in fq_dump_stats()" Sasha Levin
                   ` (62 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ahmed S. Darwish, kbuild test robot, Dan Carpenter,
	Sebastian Andrzej Siewior, David S . Miller, Sasha Levin

From: "Ahmed S. Darwish" <a.darwish@linutronix.de>

[ Upstream commit 11d6011c2cf29f7c8181ebde6c8bc0c4d83adcd7 ]

Sequence counters write paths are critical sections that must never be
preempted, and blocking, even for CONFIG_PREEMPTION=n, is not allowed.

Commit 5dbe7c178d3f ("net: fix kernel deadlock with interface rename and
netdev name retrieval.") handled a deadlock, observed with
CONFIG_PREEMPTION=n, where the devnet_rename seqcount read side was
infinitely spinning: it got scheduled after the seqcount write side
blocked inside its own critical section.

To fix that deadlock, among other issues, the commit added a
cond_resched() inside the read side section. While this will get the
non-preemptible kernel eventually unstuck, the seqcount reader is fully
exhausting its slice just spinning -- until TIF_NEED_RESCHED is set.

The fix is also still broken: if the seqcount reader belongs to a
real-time scheduling policy, it can spin forever and the kernel will
livelock.

Disabling preemption over the seqcount write side critical section will
not work: inside it are a number of GFP_KERNEL allocations and mutex
locking through the drivers/base/ :: device_rename() call chain.

>From all the above, replace the seqcount with a rwsem.

Fixes: 5dbe7c178d3f (net: fix kernel deadlock with interface rename and netdev name retrieval.)
Fixes: 30e6c9fa93cf (net: devnet_rename_seq should be a seqcount)
Fixes: c91f6df2db49 (sockopt: Change getsockopt() of SO_BINDTODEVICE to return an interface name)
Cc: <stable@vger.kernel.org>
Reported-by: kbuild test robot <lkp@intel.com> [ v1 missing up_read() on error exit ]
Reported-by: Dan Carpenter <dan.carpenter@oracle.com> [ v1 missing up_read() on error exit ]
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/core/dev.c | 40 ++++++++++++++++++----------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 775c8dfeff848..82f9ec1bd94b6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -82,6 +82,7 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/rwsem.h>
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/socket.h>
@@ -185,7 +186,7 @@ static DEFINE_SPINLOCK(napi_hash_lock);
 static unsigned int napi_gen_id = NR_CPUS;
 static DEFINE_HASHTABLE(napi_hash, 8);
 
-static seqcount_t devnet_rename_seq;
+static DECLARE_RWSEM(devnet_rename_sem);
 
 static inline void dev_base_seq_inc(struct net *net)
 {
@@ -862,33 +863,28 @@ EXPORT_SYMBOL(dev_get_by_index);
  *	@net: network namespace
  *	@name: a pointer to the buffer where the name will be stored.
  *	@ifindex: the ifindex of the interface to get the name from.
- *
- *	The use of raw_seqcount_begin() and cond_resched() before
- *	retrying is required as we want to give the writers a chance
- *	to complete when CONFIG_PREEMPTION is not set.
  */
 int netdev_get_name(struct net *net, char *name, int ifindex)
 {
 	struct net_device *dev;
-	unsigned int seq;
+	int ret;
 
-retry:
-	seq = raw_seqcount_begin(&devnet_rename_seq);
+	down_read(&devnet_rename_sem);
 	rcu_read_lock();
+
 	dev = dev_get_by_index_rcu(net, ifindex);
 	if (!dev) {
-		rcu_read_unlock();
-		return -ENODEV;
+		ret = -ENODEV;
+		goto out;
 	}
 
 	strcpy(name, dev->name);
-	rcu_read_unlock();
-	if (read_seqcount_retry(&devnet_rename_seq, seq)) {
-		cond_resched();
-		goto retry;
-	}
 
-	return 0;
+	ret = 0;
+out:
+	rcu_read_unlock();
+	up_read(&devnet_rename_sem);
+	return ret;
 }
 
 /**
@@ -1153,10 +1149,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
 	if (dev->flags & IFF_UP)
 		return -EBUSY;
 
-	write_seqcount_begin(&devnet_rename_seq);
+	down_write(&devnet_rename_sem);
 
 	if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
-		write_seqcount_end(&devnet_rename_seq);
+		up_write(&devnet_rename_sem);
 		return 0;
 	}
 
@@ -1164,7 +1160,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
 
 	err = dev_get_valid_name(net, dev, newname);
 	if (err < 0) {
-		write_seqcount_end(&devnet_rename_seq);
+		up_write(&devnet_rename_sem);
 		return err;
 	}
 
@@ -1179,11 +1175,11 @@ int dev_change_name(struct net_device *dev, const char *newname)
 	if (ret) {
 		memcpy(dev->name, oldname, IFNAMSIZ);
 		dev->name_assign_type = old_assign_type;
-		write_seqcount_end(&devnet_rename_seq);
+		up_write(&devnet_rename_sem);
 		return ret;
 	}
 
-	write_seqcount_end(&devnet_rename_seq);
+	up_write(&devnet_rename_sem);
 
 	netdev_adjacent_rename_links(dev, oldname);
 
@@ -1204,7 +1200,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
 		/* err >= 0 after dev_alloc_name() or stores the first errno */
 		if (err >= 0) {
 			err = ret;
-			write_seqcount_begin(&devnet_rename_seq);
+			down_write(&devnet_rename_sem);
 			memcpy(dev->name, oldname, IFNAMSIZ);
 			memcpy(oldname, newname, IFNAMSIZ);
 			dev->name_assign_type = old_assign_type;
-- 
2.25.1


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

* [PATCH 4.4 077/135] net: Revert "pkt_sched: fq: use proper locking in fq_dump_stats()"
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (75 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 076/135] net: core: device_rename: Use rwsem instead of a seqcount Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 078/135] scsi: scsi_devinfo: handle non-terminated strings Sasha Levin
                   ` (61 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Toke Høiland-Jørgensen, Greg Kroah-Hartman

From: Toke Høiland-Jørgensen <toke@redhat.com>

This reverts commit 191cf872190de28a92e1bd2b56d8860e37e07443 which is
commit 695b4ec0f0a9cf29deabd3ac075911d58b31f42b upstream.

That commit should never have been backported since it relies on a change in
locking semantics that was introduced in v4.8 and not backported. Because of
this, the backported commit to sch_fq leads to lockups because of the double
locking.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sched/sch_fq.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index f4aa2ab4713a2..eb814ffc09023 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -830,24 +830,20 @@ static int fq_dump(struct Qdisc *sch, struct sk_buff *skb)
 static int fq_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
 {
 	struct fq_sched_data *q = qdisc_priv(sch);
-	struct tc_fq_qd_stats st;
-
-	sch_tree_lock(sch);
-
-	st.gc_flows		  = q->stat_gc_flows;
-	st.highprio_packets	  = q->stat_internal_packets;
-	st.tcp_retrans		  = q->stat_tcp_retrans;
-	st.throttled		  = q->stat_throttled;
-	st.flows_plimit		  = q->stat_flows_plimit;
-	st.pkts_too_long	  = q->stat_pkts_too_long;
-	st.allocation_errors	  = q->stat_allocation_errors;
-	st.time_next_delayed_flow = q->time_next_delayed_flow - ktime_get_ns();
-	st.flows		  = q->flows;
-	st.inactive_flows	  = q->inactive_flows;
-	st.throttled_flows	  = q->throttled_flows;
-	st.pad			  = 0;
-
-	sch_tree_unlock(sch);
+	u64 now = ktime_get_ns();
+	struct tc_fq_qd_stats st = {
+		.gc_flows		= q->stat_gc_flows,
+		.highprio_packets	= q->stat_internal_packets,
+		.tcp_retrans		= q->stat_tcp_retrans,
+		.throttled		= q->stat_throttled,
+		.flows_plimit		= q->stat_flows_plimit,
+		.pkts_too_long		= q->stat_pkts_too_long,
+		.allocation_errors	= q->stat_allocation_errors,
+		.flows			= q->flows,
+		.inactive_flows		= q->inactive_flows,
+		.throttled_flows	= q->throttled_flows,
+		.time_next_delayed_flow	= q->time_next_delayed_flow - now,
+	};
 
 	return gnet_stats_copy_app(d, &st, sizeof(st));
 }
-- 
2.25.1


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

* [PATCH 4.4 078/135] scsi: scsi_devinfo: handle non-terminated strings
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (76 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 077/135] net: Revert "pkt_sched: fq: use proper locking in fq_dump_stats()" Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 079/135] l2tp: Allow duplicate session creation with UDP Sasha Levin
                   ` (60 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Martin Wilck, Bart Van Assche, Martin K . Petersen,
	Guenter Roeck, Greg Kroah-Hartman

From: Martin Wilck <mwilck@suse.com>

commit ba69ead9e9e9bb3cec5faf03526c36764ac8942a upstream.

devinfo->vendor and devinfo->model aren't necessarily
zero-terminated.

Fixes: b8018b973c7c "scsi_devinfo: fixup string compare"
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/scsi_devinfo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 4055cb7c212b9..3a9b6b61607e6 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -443,7 +443,8 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
 			/*
 			 * vendor strings must be an exact match
 			 */
-			if (vmax != strlen(devinfo->vendor) ||
+			if (vmax != strnlen(devinfo->vendor,
+					    sizeof(devinfo->vendor)) ||
 			    memcmp(devinfo->vendor, vskip, vmax))
 				continue;
 
@@ -451,7 +452,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor,
 			 * @model specifies the full string, and
 			 * must be larger or equal to devinfo->model
 			 */
-			mlen = strlen(devinfo->model);
+			mlen = strnlen(devinfo->model, sizeof(devinfo->model));
 			if (mmax < mlen || memcmp(devinfo->model, mskip, mlen))
 				continue;
 			return devinfo;
-- 
2.25.1


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

* [PATCH 4.4 079/135] l2tp: Allow duplicate session creation with UDP
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (77 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 078/135] scsi: scsi_devinfo: handle non-terminated strings Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 080/135] net: sched: export __netdev_watchdog_up() Sasha Levin
                   ` (59 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Ridge Kennedy, James Chapman, David S . Miller, Guenter Roeck,
	Greg Kroah-Hartman

From: Ridge Kennedy <ridge.kennedy@alliedtelesis.co.nz>

commit 0d0d9a388a858e271bb70e71e99e7fe2a6fd6f64 upstream.

In the past it was possible to create multiple L2TPv3 sessions with the
same session id as long as the sessions belonged to different tunnels.
The resulting sessions had issues when used with IP encapsulated tunnels,
but worked fine with UDP encapsulated ones. Some applications began to
rely on this behaviour to avoid having to negotiate unique session ids.

Some time ago a change was made to require session ids to be unique across
all tunnels, breaking the applications making use of this "feature".

This change relaxes the duplicate session id check to allow duplicates
if both of the colliding sessions belong to UDP encapsulated tunnels.

Fixes: dbdbc73b4478 ("l2tp: fix duplicate session creation")
Signed-off-by: Ridge Kennedy <ridge.kennedy@alliedtelesis.co.nz>
Acked-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/l2tp/l2tp_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 239464045697e..53c53b1c881c5 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -351,8 +351,13 @@ int l2tp_session_register(struct l2tp_session *session,
 
 		spin_lock_bh(&pn->l2tp_session_hlist_lock);
 
+		/* IP encap expects session IDs to be globally unique, while
+		 * UDP encap doesn't.
+		 */
 		hlist_for_each_entry(session_walk, g_head, global_hlist)
-			if (session_walk->session_id == session->session_id) {
+			if (session_walk->session_id == session->session_id &&
+			    (session_walk->tunnel->encap == L2TP_ENCAPTYPE_IP ||
+			     tunnel->encap == L2TP_ENCAPTYPE_IP)) {
 				err = -EEXIST;
 				goto err_tlock_pnlock;
 			}
-- 
2.25.1


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

* [PATCH 4.4 080/135] net: sched: export __netdev_watchdog_up()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (78 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 079/135] l2tp: Allow duplicate session creation with UDP Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 081/135] fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()" Sasha Levin
                   ` (58 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Valentin Longchamp, David S . Miller, Sasha Levin

From: Valentin Longchamp <valentin@longchamp.me>

[ Upstream commit 1a3db27ad9a72d033235b9673653962c02e3486e ]

Since the quiesce/activate rework, __netdev_watchdog_up() is directly
called in the ucc_geth driver.

Unfortunately, this function is not available for modules and thus
ucc_geth cannot be built as a module anymore. Fix it by exporting
__netdev_watchdog_up().

Since the commit introducing the regression was backported to stable
branches, this one should ideally be as well.

Fixes: 79dde73cf9bc ("net/ethernet/freescale: rework quiesce/activate for ucc_geth")
Signed-off-by: Valentin Longchamp <valentin@longchamp.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/sched/sch_generic.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 09cd654347487..10c05fa0e6b35 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -329,6 +329,7 @@ void __netdev_watchdog_up(struct net_device *dev)
 			dev_hold(dev);
 	}
 }
+EXPORT_SYMBOL_GPL(__netdev_watchdog_up);
 
 static void dev_watchdog_up(struct net_device *dev)
 {
-- 
2.25.1


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

* [PATCH 4.4 081/135] fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()"
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (79 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 080/135] net: sched: export __netdev_watchdog_up() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 082/135] net: fix memleak in register_netdevice() Sasha Levin
                   ` (57 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Al Viro, Sasha Levin

From: Al Viro <viro@zeniv.linux.org.uk>

[ Upstream commit 9d964e1b82d8182184153b70174f445ea616f053 ]

lost npc in PTRACE_SETREGSET, breaking PTRACE_SETREGS as well

Fixes: cf51e129b968 "sparc32: fix register window handling in genregs32_[gs]et()"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/sparc/kernel/ptrace_32.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c
index 396dbdea0cfa0..2f4316c142664 100644
--- a/arch/sparc/kernel/ptrace_32.c
+++ b/arch/sparc/kernel/ptrace_32.c
@@ -167,12 +167,17 @@ static int genregs32_set(struct task_struct *target,
 	if (ret || !count)
 		return ret;
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs->y,
+				 &regs->npc,
 				 34 * sizeof(u32), 35 * sizeof(u32));
 	if (ret || !count)
 		return ret;
+	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
+				 &regs->y,
+				 35 * sizeof(u32), 36 * sizeof(u32));
+	if (ret || !count)
+		return ret;
 	return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-					 35 * sizeof(u32), 38 * sizeof(u32));
+					 36 * sizeof(u32), 38 * sizeof(u32));
 }
 
 static int fpregs32_get(struct task_struct *target,
-- 
2.25.1


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

* [PATCH 4.4 082/135] net: fix memleak in register_netdevice()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (80 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 081/135] fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()" Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 083/135] net: usb: ax88179_178a: fix packet alignment padding Sasha Levin
                   ` (56 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yang Yingliang, Hulk Robot, David S . Miller, Greg Kroah-Hartman

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit 814152a89ed52c722ab92e9fbabcac3cb8a39245 ]

I got a memleak report when doing some fuzz test:

unreferenced object 0xffff888112584000 (size 13599):
  comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
  hex dump (first 32 bytes):
    74 61 70 30 00 00 00 00 00 00 00 00 00 00 00 00  tap0............
    00 ee d9 19 81 88 ff ff 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<000000002f60ba65>] __kmalloc_node+0x309/0x3a0
    [<0000000075b211ec>] kvmalloc_node+0x7f/0xc0
    [<00000000d3a97396>] alloc_netdev_mqs+0x76/0xfc0
    [<00000000609c3655>] __tun_chr_ioctl+0x1456/0x3d70
    [<000000001127ca24>] ksys_ioctl+0xe5/0x130
    [<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
    [<00000000e1023498>] do_syscall_64+0x56/0xa0
    [<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff888111845cc0 (size 8):
  comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
  hex dump (first 8 bytes):
    74 61 70 30 00 88 ff ff                          tap0....
  backtrace:
    [<000000004c159777>] kstrdup+0x35/0x70
    [<00000000d8b496ad>] kstrdup_const+0x3d/0x50
    [<00000000494e884a>] kvasprintf_const+0xf1/0x180
    [<0000000097880a2b>] kobject_set_name_vargs+0x56/0x140
    [<000000008fbdfc7b>] dev_set_name+0xab/0xe0
    [<000000005b99e3b4>] netdev_register_kobject+0xc0/0x390
    [<00000000602704fe>] register_netdevice+0xb61/0x1250
    [<000000002b7ca244>] __tun_chr_ioctl+0x1cd1/0x3d70
    [<000000001127ca24>] ksys_ioctl+0xe5/0x130
    [<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
    [<00000000e1023498>] do_syscall_64+0x56/0xa0
    [<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
unreferenced object 0xffff88811886d800 (size 512):
  comm "ip", pid 3048, jiffies 4294911734 (age 343.491s)
  hex dump (first 32 bytes):
    00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00  .....N..........
    ff ff ff ff ff ff ff ff c0 66 3d a3 ff ff ff ff  .........f=.....
  backtrace:
    [<0000000050315800>] device_add+0x61e/0x1950
    [<0000000021008dfb>] netdev_register_kobject+0x17e/0x390
    [<00000000602704fe>] register_netdevice+0xb61/0x1250
    [<000000002b7ca244>] __tun_chr_ioctl+0x1cd1/0x3d70
    [<000000001127ca24>] ksys_ioctl+0xe5/0x130
    [<00000000b7d5e66a>] __x64_sys_ioctl+0x6f/0xb0
    [<00000000e1023498>] do_syscall_64+0x56/0xa0
    [<000000009ec0eb12>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

If call_netdevice_notifiers() failed, then rollback_registered()
calls netdev_unregister_kobject() which holds the kobject. The
reference cannot be put because the netdev won't be add to todo
list, so it will leads a memleak, we need put the reference to
avoid memleak.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/dev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 82f9ec1bd94b6..67725818d562d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6840,6 +6840,13 @@ int register_netdevice(struct net_device *dev)
 		rcu_barrier();
 
 		dev->reg_state = NETREG_UNREGISTERED;
+		/* We should put the kobject that hold in
+		 * netdev_unregister_kobject(), otherwise
+		 * the net device cannot be freed when
+		 * driver calls free_netdev(), because the
+		 * kobject is being hold.
+		 */
+		kobject_put(&dev->dev.kobj);
 	}
 	/*
 	 *	Prevent userspace races by waiting until the network
-- 
2.25.1


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

* [PATCH 4.4 083/135] net: usb: ax88179_178a: fix packet alignment padding
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (81 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 082/135] net: fix memleak in register_netdevice() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 084/135] tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes Sasha Levin
                   ` (55 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Jeremy Kerr, David S . Miller, Greg Kroah-Hartman

From: Jeremy Kerr <jk@ozlabs.org>

[ Upstream commit e869e7a17798d85829fa7d4f9bbe1eebd4b2d3f6 ]

Using a AX88179 device (0b95:1790), I see two bytes of appended data on
every RX packet. For example, this 48-byte ping, using 0xff as a
payload byte:

  04:20:22.528472 IP 192.168.1.1 > 192.168.1.2: ICMP echo request, id 2447, seq 1, length 64
	0x0000:  000a cd35 ea50 000a cd35 ea4f 0800 4500
	0x0010:  0054 c116 4000 4001 f63e c0a8 0101 c0a8
	0x0020:  0102 0800 b633 098f 0001 87ea cd5e 0000
	0x0030:  0000 dcf2 0600 0000 0000 ffff ffff ffff
	0x0040:  ffff ffff ffff ffff ffff ffff ffff ffff
	0x0050:  ffff ffff ffff ffff ffff ffff ffff ffff
	0x0060:  ffff 961f

Those last two bytes - 96 1f - aren't part of the original packet.

In the ax88179 RX path, the usbnet rx_fixup function trims a 2-byte
'alignment pseudo header' from the start of the packet, and sets the
length from a per-packet field populated by hardware. It looks like that
length field *includes* the 2-byte header; the current driver assumes
that it's excluded.

This change trims the 2-byte alignment header after we've set the packet
length, so the resulting packet length is correct. While we're moving
the comment around, this also fixes the spelling of 'pseudo'.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/usb/ax88179_178a.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index e3f2e6098db40..2dcc8a039d42e 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1396,10 +1396,10 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 		}
 
 		if (pkt_cnt == 0) {
-			/* Skip IP alignment psudo header */
-			skb_pull(skb, 2);
 			skb->len = pkt_len;
-			skb_set_tail_pointer(skb, pkt_len);
+			/* Skip IP alignment pseudo header */
+			skb_pull(skb, 2);
+			skb_set_tail_pointer(skb, skb->len);
 			skb->truesize = pkt_len + sizeof(struct sk_buff);
 			ax88179_rx_checksum(skb, pkt_hdr);
 			return 1;
@@ -1408,8 +1408,9 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 		ax_skb = skb_clone(skb, GFP_ATOMIC);
 		if (ax_skb) {
 			ax_skb->len = pkt_len;
-			ax_skb->data = skb->data + 2;
-			skb_set_tail_pointer(ax_skb, pkt_len);
+			/* Skip IP alignment pseudo header */
+			skb_pull(ax_skb, 2);
+			skb_set_tail_pointer(ax_skb, ax_skb->len);
 			ax_skb->truesize = pkt_len + sizeof(struct sk_buff);
 			ax88179_rx_checksum(ax_skb, pkt_hdr);
 			usbnet_skb_return(dev, ax_skb);
-- 
2.25.1


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

* [PATCH 4.4 084/135] tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (82 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 083/135] net: usb: ax88179_178a: fix packet alignment padding Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 085/135] ip_tunnel: fix use-after-free in ip_tunnel_lookup() Sasha Levin
                   ` (54 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: David Christensen, Michael Chan, David S . Miller, Greg Kroah-Hartman

From: David Christensen <drc@linux.vnet.ibm.com>

[ Upstream commit 3a2656a211caf35e56afc9425e6e518fa52f7fbc ]

The driver function tg3_io_error_detected() calls napi_disable twice,
without an intervening napi_enable, when the number of EEH errors exceeds
eeh_max_freezes, resulting in an indefinite sleep while holding rtnl_lock.

Add check for pcierr_recovery which skips code already executed for the
"Frozen" state.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/broadcom/tg3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 58102e96ac5cd..e198427d0f292 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -18182,8 +18182,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev,
 
 	rtnl_lock();
 
-	/* We probably don't have netdev yet */
-	if (!netdev || !netif_running(netdev))
+	/* Could be second call or maybe we don't have netdev yet */
+	if (!netdev || tp->pcierr_recovery || !netif_running(netdev))
 		goto done;
 
 	/* We needn't recover from permanent error */
-- 
2.25.1


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

* [PATCH 4.4 085/135] ip_tunnel: fix use-after-free in ip_tunnel_lookup()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (83 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 084/135] tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 086/135] tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT Sasha Levin
                   ` (53 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Taehee Yoo, Eric Dumazet, David S . Miller, Greg Kroah-Hartman

From: Taehee Yoo <ap420073@gmail.com>

[ Upstream commit ba61539c6ae57f4146284a5cb4f7b7ed8d42bf45 ]

In the datapath, the ip_tunnel_lookup() is used and it internally uses
fallback tunnel device pointer, which is fb_tunnel_dev.
This pointer variable should be set to NULL when a fb interface is deleted.
But there is no routine to set fb_tunnel_dev pointer to NULL.
So, this pointer will be still used after interface is deleted and
it eventually results in the use-after-free problem.

Test commands:
    ip netns add A
    ip netns add B
    ip link add eth0 type veth peer name eth1
    ip link set eth0 netns A
    ip link set eth1 netns B

    ip netns exec A ip link set lo up
    ip netns exec A ip link set eth0 up
    ip netns exec A ip link add gre1 type gre local 10.0.0.1 \
	    remote 10.0.0.2
    ip netns exec A ip link set gre1 up
    ip netns exec A ip a a 10.0.100.1/24 dev gre1
    ip netns exec A ip a a 10.0.0.1/24 dev eth0

    ip netns exec B ip link set lo up
    ip netns exec B ip link set eth1 up
    ip netns exec B ip link add gre1 type gre local 10.0.0.2 \
	    remote 10.0.0.1
    ip netns exec B ip link set gre1 up
    ip netns exec B ip a a 10.0.100.2/24 dev gre1
    ip netns exec B ip a a 10.0.0.2/24 dev eth1
    ip netns exec A hping3 10.0.100.2 -2 --flood -d 60000 &
    ip netns del B

Splat looks like:
[   77.793450][    C3] ==================================================================
[   77.794702][    C3] BUG: KASAN: use-after-free in ip_tunnel_lookup+0xcc4/0xf30
[   77.795573][    C3] Read of size 4 at addr ffff888060bd9c84 by task hping3/2905
[   77.796398][    C3]
[   77.796664][    C3] CPU: 3 PID: 2905 Comm: hping3 Not tainted 5.8.0-rc1+ #616
[   77.797474][    C3] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[   77.798453][    C3] Call Trace:
[   77.798815][    C3]  <IRQ>
[   77.799142][    C3]  dump_stack+0x9d/0xdb
[   77.799605][    C3]  print_address_description.constprop.7+0x2cc/0x450
[   77.800365][    C3]  ? ip_tunnel_lookup+0xcc4/0xf30
[   77.800908][    C3]  ? ip_tunnel_lookup+0xcc4/0xf30
[   77.801517][    C3]  ? ip_tunnel_lookup+0xcc4/0xf30
[   77.802145][    C3]  kasan_report+0x154/0x190
[   77.802821][    C3]  ? ip_tunnel_lookup+0xcc4/0xf30
[   77.803503][    C3]  ip_tunnel_lookup+0xcc4/0xf30
[   77.804165][    C3]  __ipgre_rcv+0x1ab/0xaa0 [ip_gre]
[   77.804862][    C3]  ? rcu_read_lock_sched_held+0xc0/0xc0
[   77.805621][    C3]  gre_rcv+0x304/0x1910 [ip_gre]
[   77.806293][    C3]  ? lock_acquire+0x1a9/0x870
[   77.806925][    C3]  ? gre_rcv+0xfe/0x354 [gre]
[   77.807559][    C3]  ? erspan_xmit+0x2e60/0x2e60 [ip_gre]
[   77.808305][    C3]  ? rcu_read_lock_sched_held+0xc0/0xc0
[   77.809032][    C3]  ? rcu_read_lock_held+0x90/0xa0
[   77.809713][    C3]  gre_rcv+0x1b8/0x354 [gre]
[ ... ]

Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/ip_tunnel.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index 20b21f8578e18..3d9761516683f 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -98,9 +98,10 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
 				   __be32 remote, __be32 local,
 				   __be32 key)
 {
-	unsigned int hash;
 	struct ip_tunnel *t, *cand = NULL;
 	struct hlist_head *head;
+	struct net_device *ndev;
+	unsigned int hash;
 
 	hash = ip_tunnel_hash(key, remote);
 	head = &itn->tunnels[hash];
@@ -175,8 +176,9 @@ struct ip_tunnel *ip_tunnel_lookup(struct ip_tunnel_net *itn,
 	if (t)
 		return t;
 
-	if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags & IFF_UP)
-		return netdev_priv(itn->fb_tunnel_dev);
+	ndev = READ_ONCE(itn->fb_tunnel_dev);
+	if (ndev && ndev->flags & IFF_UP)
+		return netdev_priv(ndev);
 
 	return NULL;
 }
@@ -1160,9 +1162,9 @@ void ip_tunnel_uninit(struct net_device *dev)
 	struct ip_tunnel_net *itn;
 
 	itn = net_generic(net, tunnel->ip_tnl_net_id);
-	/* fb_tunnel_dev will be unregisted in net-exit call. */
-	if (itn->fb_tunnel_dev != dev)
-		ip_tunnel_del(itn, netdev_priv(dev));
+	ip_tunnel_del(itn, netdev_priv(dev));
+	if (itn->fb_tunnel_dev == dev)
+		WRITE_ONCE(itn->fb_tunnel_dev, NULL);
 
 	dst_cache_reset(&tunnel->dst_cache);
 }
-- 
2.25.1


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

* [PATCH 4.4 086/135] tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (84 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 085/135] ip_tunnel: fix use-after-free in ip_tunnel_lookup() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 087/135] ip6_gre: fix use-after-free in ip6gre_tunnel_lookup() Sasha Levin
                   ` (52 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Neal Cardwell, Mirja Kuehlewind, Eric Dumazet,
	Soheil Hassas Yeganeh, David S . Miller, Greg Kroah-Hartman

From: Neal Cardwell <ncardwell@google.com>

[ Upstream commit b344579ca8478598937215f7005d6c7b84d28aee ]

Mirja Kuehlewind reported a bug in Linux TCP CUBIC Hystart, where
Hystart HYSTART_DELAY mechanism can exit Slow Start spuriously on an
ACK when the minimum rtt of a connection goes down. From inspection it
is clear from the existing code that this could happen in an example
like the following:

o The first 8 RTT samples in a round trip are 150ms, resulting in a
  curr_rtt of 150ms and a delay_min of 150ms.

o The 9th RTT sample is 100ms. The curr_rtt does not change after the
  first 8 samples, so curr_rtt remains 150ms. But delay_min can be
  lowered at any time, so delay_min falls to 100ms. The code executes
  the HYSTART_DELAY comparison between curr_rtt of 150ms and delay_min
  of 100ms, and the curr_rtt is declared far enough above delay_min to
  force a (spurious) exit of Slow start.

The fix here is simple: allow every RTT sample in a round trip to
lower the curr_rtt.

Fixes: ae27e98a5152 ("[TCP] CUBIC v2.3")
Reported-by: Mirja Kuehlewind <mirja.kuehlewind@ericsson.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp_cubic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index 448c2615fece9..9fb3a5e83a7c7 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -414,6 +414,8 @@ static void hystart_update(struct sock *sk, u32 delay)
 
 	if (hystart_detect & HYSTART_DELAY) {
 		/* obtain the minimum delay of more than sampling packets */
+		if (ca->curr_rtt > delay)
+			ca->curr_rtt = delay;
 		if (ca->sample_cnt < HYSTART_MIN_SAMPLES) {
 			if (ca->curr_rtt == 0 || ca->curr_rtt > delay)
 				ca->curr_rtt = delay;
-- 
2.25.1


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

* [PATCH 4.4 087/135] ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (85 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 086/135] tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 088/135] tcp: grow window for OOO packets only for SACK flows Sasha Levin
                   ` (51 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Taehee Yoo, Eric Dumazet, David S . Miller, Greg Kroah-Hartman

From: Taehee Yoo <ap420073@gmail.com>

[ Upstream commit dafabb6590cb15f300b77c095d50312e2c7c8e0f ]

In the datapath, the ip6gre_tunnel_lookup() is used and it internally uses
fallback tunnel device pointer, which is fb_tunnel_dev.
This pointer variable should be set to NULL when a fb interface is deleted.
But there is no routine to set fb_tunnel_dev pointer to NULL.
So, this pointer will be still used after interface is deleted and
it eventually results in the use-after-free problem.

Test commands:
    ip netns add A
    ip netns add B
    ip link add eth0 type veth peer name eth1
    ip link set eth0 netns A
    ip link set eth1 netns B

    ip netns exec A ip link set lo up
    ip netns exec A ip link set eth0 up
    ip netns exec A ip link add ip6gre1 type ip6gre local fc:0::1 \
	    remote fc:0::2
    ip netns exec A ip -6 a a fc:100::1/64 dev ip6gre1
    ip netns exec A ip link set ip6gre1 up
    ip netns exec A ip -6 a a fc:0::1/64 dev eth0
    ip netns exec A ip link set ip6gre0 up

    ip netns exec B ip link set lo up
    ip netns exec B ip link set eth1 up
    ip netns exec B ip link add ip6gre1 type ip6gre local fc:0::2 \
	    remote fc:0::1
    ip netns exec B ip -6 a a fc:100::2/64 dev ip6gre1
    ip netns exec B ip link set ip6gre1 up
    ip netns exec B ip -6 a a fc:0::2/64 dev eth1
    ip netns exec B ip link set ip6gre0 up
    ip netns exec A ping fc:100::2 -s 60000 &
    ip netns del B

Splat looks like:
[   73.087285][    C1] BUG: KASAN: use-after-free in ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre]
[   73.088361][    C1] Read of size 4 at addr ffff888040559218 by task ping/1429
[   73.089317][    C1]
[   73.089638][    C1] CPU: 1 PID: 1429 Comm: ping Not tainted 5.7.0+ #602
[   73.090531][    C1] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[   73.091725][    C1] Call Trace:
[   73.092160][    C1]  <IRQ>
[   73.092556][    C1]  dump_stack+0x96/0xdb
[   73.093122][    C1]  print_address_description.constprop.6+0x2cc/0x450
[   73.094016][    C1]  ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre]
[   73.094894][    C1]  ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre]
[   73.095767][    C1]  ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre]
[   73.096619][    C1]  kasan_report+0x154/0x190
[   73.097209][    C1]  ? ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre]
[   73.097989][    C1]  ip6gre_tunnel_lookup+0x1064/0x13f0 [ip6_gre]
[   73.098750][    C1]  ? gre_del_protocol+0x60/0x60 [gre]
[   73.099500][    C1]  gre_rcv+0x1c5/0x1450 [ip6_gre]
[   73.100199][    C1]  ? ip6gre_header+0xf00/0xf00 [ip6_gre]
[   73.100985][    C1]  ? rcu_read_lock_sched_held+0xc0/0xc0
[   73.101830][    C1]  ? ip6_input_finish+0x5/0xf0
[   73.102483][    C1]  ip6_protocol_deliver_rcu+0xcbb/0x1510
[   73.103296][    C1]  ip6_input_finish+0x5b/0xf0
[   73.103920][    C1]  ip6_input+0xcd/0x2c0
[   73.104473][    C1]  ? ip6_input_finish+0xf0/0xf0
[   73.105115][    C1]  ? rcu_read_lock_held+0x90/0xa0
[   73.105783][    C1]  ? rcu_read_lock_sched_held+0xc0/0xc0
[   73.106548][    C1]  ipv6_rcv+0x1f1/0x300
[ ... ]

Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv6/ip6_gre.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index b25f4ad28b032..546172bfaba1e 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -125,6 +125,7 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
 	int dev_type = (gre_proto == htons(ETH_P_TEB)) ?
 		       ARPHRD_ETHER : ARPHRD_IP6GRE;
 	int score, cand_score = 4;
+	struct net_device *ndev;
 
 	for_each_ip_tunnel_rcu(t, ign->tunnels_r_l[h0 ^ h1]) {
 		if (!ipv6_addr_equal(local, &t->parms.laddr) ||
@@ -227,9 +228,9 @@ static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
 	if (cand)
 		return cand;
 
-	dev = ign->fb_tunnel_dev;
-	if (dev->flags & IFF_UP)
-		return netdev_priv(dev);
+	ndev = READ_ONCE(ign->fb_tunnel_dev);
+	if (ndev && ndev->flags & IFF_UP)
+		return netdev_priv(ndev);
 
 	return NULL;
 }
@@ -364,6 +365,8 @@ static void ip6gre_tunnel_uninit(struct net_device *dev)
 	struct ip6gre_net *ign = net_generic(t->net, ip6gre_net_id);
 
 	ip6gre_tunnel_unlink(ign, t);
+	if (ign->fb_tunnel_dev == dev)
+		WRITE_ONCE(ign->fb_tunnel_dev, NULL);
 	dst_cache_reset(&t->dst_cache);
 	dev_put(dev);
 }
-- 
2.25.1


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

* [PATCH 4.4 088/135] tcp: grow window for OOO packets only for SACK flows
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (86 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 087/135] ip6_gre: fix use-after-free in ip6gre_tunnel_lookup() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 089/135] sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket Sasha Levin
                   ` (50 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Eric Dumazet, Venkat Venkatsubra, Neal Cardwell,
	David S . Miller, Greg Kroah-Hartman

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 662051215c758ae8545451628816204ed6cd372d ]

Back in 2013, we made a change that broke fast retransmit
for non SACK flows.

Indeed, for these flows, a sender needs to receive three duplicate
ACK before starting fast retransmit. Sending ACK with different
receive window do not count.

Even if enabling SACK is strongly recommended these days,
there still are some cases where it has to be disabled.

Not increasing the window seems better than having to
rely on RTO.

After the fix, following packetdrill test gives :

// Initialize connection
    0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0

   +0 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7>
   +0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 8>
   +0 < . 1:1(0) ack 1 win 514

   +0 accept(3, ..., ...) = 4

   +0 < . 1:1001(1000) ack 1 win 514
// Quick ack
   +0 > . 1:1(0) ack 1001 win 264

   +0 < . 2001:3001(1000) ack 1 win 514
// DUPACK : Normally we should not change the window
   +0 > . 1:1(0) ack 1001 win 264

   +0 < . 3001:4001(1000) ack 1 win 514
// DUPACK : Normally we should not change the window
   +0 > . 1:1(0) ack 1001 win 264

   +0 < . 4001:5001(1000) ack 1 win 514
// DUPACK : Normally we should not change the window
    +0 > . 1:1(0) ack 1001 win 264

   +0 < . 1001:2001(1000) ack 1 win 514
// Hole is repaired.
   +0 > . 1:1(0) ack 5001 win 272

Fixes: 4e4f1fc22681 ("tcp: properly increase rcv_ssthresh for ofo packets")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp_input.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 64c7265793a59..e2066f2f19b4a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4465,7 +4465,11 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 	if (tcp_ooo_try_coalesce(sk, tp->ooo_last_skb,
 				 skb, &fragstolen)) {
 coalesce_done:
-		tcp_grow_window(sk, skb);
+		/* For non sack flows, do not grow window to force DUPACK
+		 * and trigger fast retransmit.
+		 */
+		if (tcp_is_sack(tp))
+			tcp_grow_window(sk, skb);
 		kfree_skb_partial(skb, fragstolen);
 		skb = NULL;
 		goto add_sack;
@@ -4545,7 +4549,11 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
 		tcp_sack_new_ofo_skb(sk, seq, end_seq);
 end:
 	if (skb) {
-		tcp_grow_window(sk, skb);
+		/* For non sack flows, do not grow window to force DUPACK
+		 * and trigger fast retransmit.
+		 */
+		if (tcp_is_sack(tp))
+			tcp_grow_window(sk, skb);
 		skb_set_owner_r(skb, sk);
 	}
 }
-- 
2.25.1


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

* [PATCH 4.4 089/135] sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (87 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 088/135] tcp: grow window for OOO packets only for SACK flows Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 090/135] net: Fix the arp error in some cases Sasha Levin
                   ` (49 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Marcelo Ricardo Leitner, Corey Minyard, David S . Miller,
	Greg Kroah-Hartman

From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

[ Upstream commit 471e39df96b9a4c4ba88a2da9e25a126624d7a9c ]

If a socket is set ipv6only, it will still send IPv4 addresses in the
INIT and INIT_ACK packets. This potentially misleads the peer into using
them, which then would cause association termination.

The fix is to not add IPv4 addresses to ipv6only sockets.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Tested-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/net/sctp/constants.h | 8 +++++---
 net/sctp/associola.c         | 5 ++++-
 net/sctp/bind_addr.c         | 1 +
 net/sctp/protocol.c          | 1 +
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 8c337cd0e1e45..bf03bab93d9e9 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -357,11 +357,13 @@ typedef enum {
 	 ipv4_is_anycast_6to4(a))
 
 /* Flags used for the bind address copy functions.  */
-#define SCTP_ADDR6_ALLOWED	0x00000001	/* IPv6 address is allowed by
+#define SCTP_ADDR4_ALLOWED	0x00000001	/* IPv4 address is allowed by
 						   local sock family */
-#define SCTP_ADDR4_PEERSUPP	0x00000002	/* IPv4 address is supported by
+#define SCTP_ADDR6_ALLOWED	0x00000002	/* IPv6 address is allowed by
+						   local sock family */
+#define SCTP_ADDR4_PEERSUPP	0x00000004	/* IPv4 address is supported by
 						   peer */
-#define SCTP_ADDR6_PEERSUPP	0x00000004	/* IPv6 address is supported by
+#define SCTP_ADDR6_PEERSUPP	0x00000008	/* IPv6 address is supported by
 						   peer */
 
 /* Reasons to retransmit. */
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index f24d31f12cb44..aa38578fdfcd9 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1575,12 +1575,15 @@ void sctp_assoc_rwnd_decrease(struct sctp_association *asoc, unsigned int len)
 int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *asoc,
 				     sctp_scope_t scope, gfp_t gfp)
 {
+	struct sock *sk = asoc->base.sk;
 	int flags;
 
 	/* Use scoping rules to determine the subset of addresses from
 	 * the endpoint.
 	 */
-	flags = (PF_INET6 == asoc->base.sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
+	flags = (PF_INET6 == sk->sk_family) ? SCTP_ADDR6_ALLOWED : 0;
+	if (!inet_v6_ipv6only(sk))
+		flags |= SCTP_ADDR4_ALLOWED;
 	if (asoc->peer.ipv4_address)
 		flags |= SCTP_ADDR4_PEERSUPP;
 	if (asoc->peer.ipv6_address)
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 871cdf9567e6b..664215448d09f 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -449,6 +449,7 @@ static int sctp_copy_one_addr(struct net *net, struct sctp_bind_addr *dest,
 		 * well as the remote peer.
 		 */
 		if ((((AF_INET == addr->sa.sa_family) &&
+		      (flags & SCTP_ADDR4_ALLOWED) &&
 		      (flags & SCTP_ADDR4_PEERSUPP))) ||
 		    (((AF_INET6 == addr->sa.sa_family) &&
 		      (flags & SCTP_ADDR6_ALLOWED) &&
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 9c6c42fd9f8af..b0e401dfe1600 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -210,6 +210,7 @@ int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp,
 			 * sock as well as the remote peer.
 			 */
 			if ((((AF_INET == addr->a.sa.sa_family) &&
+			      (copy_flags & SCTP_ADDR4_ALLOWED) &&
 			      (copy_flags & SCTP_ADDR4_PEERSUPP))) ||
 			    (((AF_INET6 == addr->a.sa.sa_family) &&
 			      (copy_flags & SCTP_ADDR6_ALLOWED) &&
-- 
2.25.1


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

* [PATCH 4.4 090/135] net: Fix the arp error in some cases
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (88 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 089/135] sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 091/135] net: Do not clear the sock TX queue in sk_set_socket() Sasha Levin
                   ` (48 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: guodeqing, David Ahern, David S . Miller, Greg Kroah-Hartman

From: guodeqing <geffrey.guo@huawei.com>

[ Upstream commit 5eea3a63ff4aba6a26002e657a6d21934b7e2b96 ]

ie.,
$ ifconfig eth0 6.6.6.6 netmask 255.255.255.0

$ ip rule add from 6.6.6.6 table 6666

$ ip route add 9.9.9.9 via 6.6.6.6

$ ping -I 6.6.6.6 9.9.9.9
PING 9.9.9.9 (9.9.9.9) from 6.6.6.6 : 56(84) bytes of data.

3 packets transmitted, 0 received, 100% packet loss, time 2079ms

$ arp
Address     HWtype  HWaddress           Flags Mask            Iface
6.6.6.6             (incomplete)                              eth0

The arp request address is error, this is because fib_table_lookup in
fib_check_nh lookup the destnation 9.9.9.9 nexthop, the scope of
the fib result is RT_SCOPE_LINK,the correct scope is RT_SCOPE_HOST.
Here I add a check of whether this is RT_TABLE_MAIN to solve this problem.

Fixes: 3bfd847203c6 ("net: Use passed in table for nexthop lookups")
Signed-off-by: guodeqing <geffrey.guo@huawei.com>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/fib_semantics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 498d5a929d6f2..3c1e42d495201 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -776,7 +776,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
 			if (fl4.flowi4_scope < RT_SCOPE_LINK)
 				fl4.flowi4_scope = RT_SCOPE_LINK;
 
-			if (cfg->fc_table)
+			if (cfg->fc_table && cfg->fc_table != RT_TABLE_MAIN)
 				tbl = fib_get_table(net, cfg->fc_table);
 
 			if (tbl)
-- 
2.25.1


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

* [PATCH 4.4 091/135] net: Do not clear the sock TX queue in sk_set_socket()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (89 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 090/135] net: Fix the arp error in some cases Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 092/135] net: core: reduce recursion limit value Sasha Levin
                   ` (47 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Tariq Toukan, Boris Pismenny, David S . Miller, Greg Kroah-Hartman

From: Tariq Toukan <tariqt@mellanox.com>

[ Upstream commit 41b14fb8724d5a4b382a63cb4a1a61880347ccb8 ]

Clearing the sock TX queue in sk_set_socket() might cause unexpected
out-of-order transmit when called from sock_orphan(), as outstanding
packets can pick a different TX queue and bypass the ones already queued.

This is undesired in general. More specifically, it breaks the in-order
scheduling property guarantee for device-offloaded TLS sockets.

Remove the call to sk_tx_queue_clear() in sk_set_socket(), and add it
explicitly only where needed.

Fixes: e022f0b4a03f ("net: Introduce sk_tx_queue_mapping")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/net/sock.h | 1 -
 net/core/sock.c    | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index be5ec94020f1a..426a57874964c 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1678,7 +1678,6 @@ static inline int sk_tx_queue_get(const struct sock *sk)
 
 static inline void sk_set_socket(struct sock *sk, struct socket *sock)
 {
-	sk_tx_queue_clear(sk);
 	sk->sk_socket = sock;
 }
 
diff --git a/net/core/sock.c b/net/core/sock.c
index 60b19c3bb0f7d..120d5058d81ae 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1435,6 +1435,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
 
 		sock_update_classid(sk);
 		sock_update_netprioidx(sk);
+		sk_tx_queue_clear(sk);
 	}
 
 	return sk;
@@ -1601,6 +1602,7 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
 		 */
 		sk_refcnt_debug_inc(newsk);
 		sk_set_socket(newsk, NULL);
+		sk_tx_queue_clear(newsk);
 		newsk->sk_wq = NULL;
 
 		sk_update_clone(sk, newsk);
-- 
2.25.1


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

* [PATCH 4.4 092/135] net: core: reduce recursion limit value
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (90 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 091/135] net: Do not clear the sock TX queue in sk_set_socket() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 093/135] mld: fix memory leak in ipv6_mc_destroy_dev() Sasha Levin
                   ` (46 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Taehee Yoo, David S . Miller, Greg Kroah-Hartman

From: Taehee Yoo <ap420073@gmail.com>

[ Upstream commit fb7861d14c8d7edac65b2fcb6e8031cb138457b2 ]

In the current code, ->ndo_start_xmit() can be executed recursively only
10 times because of stack memory.
But, in the case of the vxlan, 10 recursion limit value results in
a stack overflow.
In the current code, the nested interface is limited by 8 depth.
There is no critical reason that the recursion limitation value should
be 10.
So, it would be good to be the same value with the limitation value of
nesting interface depth.

Test commands:
    ip link add vxlan10 type vxlan vni 10 dstport 4789 srcport 4789 4789
    ip link set vxlan10 up
    ip a a 192.168.10.1/24 dev vxlan10
    ip n a 192.168.10.2 dev vxlan10 lladdr fc:22:33:44:55:66 nud permanent

    for i in {9..0}
    do
        let A=$i+1
	ip link add vxlan$i type vxlan vni $i dstport 4789 srcport 4789 4789
	ip link set vxlan$i up
	ip a a 192.168.$i.1/24 dev vxlan$i
	ip n a 192.168.$i.2 dev vxlan$i lladdr fc:22:33:44:55:66 nud permanent
	bridge fdb add fc:22:33:44:55:66 dev vxlan$A dst 192.168.$i.2 self
    done
    hping3 192.168.10.2 -2 -d 60000

Splat looks like:
[  103.814237][ T1127] =============================================================================
[  103.871955][ T1127] BUG kmalloc-2k (Tainted: G    B            ): Padding overwritten. 0x00000000897a2e4f-0x000
[  103.873187][ T1127] -----------------------------------------------------------------------------
[  103.873187][ T1127]
[  103.874252][ T1127] INFO: Slab 0x000000005cccc724 objects=5 used=5 fp=0x0000000000000000 flags=0x10000000001020
[  103.881323][ T1127] CPU: 3 PID: 1127 Comm: hping3 Tainted: G    B             5.7.0+ #575
[  103.882131][ T1127] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[  103.883006][ T1127] Call Trace:
[  103.883324][ T1127]  dump_stack+0x96/0xdb
[  103.883716][ T1127]  slab_err+0xad/0xd0
[  103.884106][ T1127]  ? _raw_spin_unlock+0x1f/0x30
[  103.884620][ T1127]  ? get_partial_node.isra.78+0x140/0x360
[  103.885214][ T1127]  slab_pad_check.part.53+0xf7/0x160
[  103.885769][ T1127]  ? pskb_expand_head+0x110/0xe10
[  103.886316][ T1127]  check_slab+0x97/0xb0
[  103.886763][ T1127]  alloc_debug_processing+0x84/0x1a0
[  103.887308][ T1127]  ___slab_alloc+0x5a5/0x630
[  103.887765][ T1127]  ? pskb_expand_head+0x110/0xe10
[  103.888265][ T1127]  ? lock_downgrade+0x730/0x730
[  103.888762][ T1127]  ? pskb_expand_head+0x110/0xe10
[  103.889244][ T1127]  ? __slab_alloc+0x3e/0x80
[  103.889675][ T1127]  __slab_alloc+0x3e/0x80
[  103.890108][ T1127]  __kmalloc_node_track_caller+0xc7/0x420
[ ... ]

Fixes: 11a766ce915f ("net: Increase xmit RECURSION_LIMIT to 10.")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 67725818d562d..09115c68f29dc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3017,7 +3017,7 @@ static void skb_update_prio(struct sk_buff *skb)
 DEFINE_PER_CPU(int, xmit_recursion);
 EXPORT_SYMBOL(xmit_recursion);
 
-#define RECURSION_LIMIT 10
+#define RECURSION_LIMIT 8
 
 /**
  *	dev_loopback_xmit - loop back @skb
-- 
2.25.1


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

* [PATCH 4.4 093/135] mld: fix memory leak in ipv6_mc_destroy_dev()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (91 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 092/135] net: core: reduce recursion limit value Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 094/135] USB: ohci-sm501: Add missed iounmap() in remove Sasha Levin
                   ` (45 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Wang Hai, Hulk Robot, Hangbin Liu, David S . Miller, Greg Kroah-Hartman

From: Wang Hai <wanghai38@huawei.com>

[ Upstream commit ea2fce88d2fd678ed9d45354ff49b73f1d5615dd ]

Commit a84d01647989 ("mld: fix memory leak in mld_del_delrec()") fixed
the memory leak of MLD, but missing the ipv6_mc_destroy_dev() path, in
which mca_sources are leaked after ma_put().

Using ip6_mc_clear_src() to take care of the missing free.

BUG: memory leak
unreferenced object 0xffff8881113d3180 (size 64):
  comm "syz-executor071", pid 389, jiffies 4294887985 (age 17.943s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 ff 02 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<000000002cbc483c>] kmalloc include/linux/slab.h:555 [inline]
    [<000000002cbc483c>] kzalloc include/linux/slab.h:669 [inline]
    [<000000002cbc483c>] ip6_mc_add1_src net/ipv6/mcast.c:2237 [inline]
    [<000000002cbc483c>] ip6_mc_add_src+0x7f5/0xbb0 net/ipv6/mcast.c:2357
    [<0000000058b8b1ff>] ip6_mc_source+0xe0c/0x1530 net/ipv6/mcast.c:449
    [<000000000bfc4fb5>] do_ipv6_setsockopt.isra.12+0x1b2c/0x3b30 net/ipv6/ipv6_sockglue.c:754
    [<00000000e4e7a722>] ipv6_setsockopt+0xda/0x150 net/ipv6/ipv6_sockglue.c:950
    [<0000000029260d9a>] rawv6_setsockopt+0x45/0x100 net/ipv6/raw.c:1081
    [<000000005c1b46f9>] __sys_setsockopt+0x131/0x210 net/socket.c:2132
    [<000000008491f7db>] __do_sys_setsockopt net/socket.c:2148 [inline]
    [<000000008491f7db>] __se_sys_setsockopt net/socket.c:2145 [inline]
    [<000000008491f7db>] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2145
    [<00000000c7bc11c5>] do_syscall_64+0xa1/0x530 arch/x86/entry/common.c:295
    [<000000005fb7a3f3>] entry_SYSCALL_64_after_hwframe+0x49/0xb3

Fixes: 1666d49e1d41 ("mld: do not remove mld souce list info when set link down")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Acked-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv6/mcast.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 976c8133a2819..2d28f0b544946 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2580,6 +2580,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev)
 		write_unlock_bh(&idev->lock);
 
 		igmp6_group_dropped(i);
+		ip6_mc_clear_src(i);
 		ma_put(i);
 
 		write_lock_bh(&idev->lock);
-- 
2.25.1


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

* [PATCH 4.4 094/135] USB: ohci-sm501: Add missed iounmap() in remove
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (92 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 093/135] mld: fix memory leak in ipv6_mc_destroy_dev() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 095/135] usb: dwc2: Postponed gadget registration to the udc class driver Sasha Levin
                   ` (44 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Chuhong Yuan, Alan Stern, Greg Kroah-Hartman

From: Chuhong Yuan <hslester96@gmail.com>

commit 07c112fb09c86c0231f6ff0061a000ffe91c8eb9 upstream.

This driver misses calling iounmap() in remove to undo the ioremap()
called in probe.
Add the missed call to fix it.

Fixes: f54aab6ebcec ("usb: ohci-sm501 driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20200610024844.3628408-1-hslester96@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/ohci-sm501.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c
index a8b8d8b8d9f39..a960d2bb8dd1e 100644
--- a/drivers/usb/host/ohci-sm501.c
+++ b/drivers/usb/host/ohci-sm501.c
@@ -196,6 +196,7 @@ static int ohci_hcd_sm501_drv_remove(struct platform_device *pdev)
 	struct resource	*mem;
 
 	usb_remove_hcd(hcd);
+	iounmap(hcd->regs);
 	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
 	usb_put_hcd(hcd);
 	dma_release_declared_memory(&pdev->dev);
-- 
2.25.1


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

* [PATCH 4.4 095/135] usb: dwc2: Postponed gadget registration to the udc class driver
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (93 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 094/135] USB: ohci-sm501: Add missed iounmap() in remove Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 096/135] usb: add USB_QUIRK_DELAY_INIT for Logitech C922 Sasha Levin
                   ` (43 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Minas Harutyunyan, kbuild test robot, Marek Vasut,
	Minas Harutyunyan, Greg Kroah-Hartman

From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>

commit 207324a321a866401b098cadf19e4a2dd6584622 upstream.

During dwc2 driver probe, after gadget registration to the udc class
driver, if exist any builtin function driver it immediately bound to
dwc2 and after init host side (dwc2_hcd_init()) stucked in host mode.
Patch postpone gadget registration after host side initialization done.

Fixes: 117777b2c3bb9 ("usb: dwc2: Move gadget probe function into platform code")
Reported-by: kbuild test robot <lkp@intel.com>
Tested-by: Marek Vasut <marex@denx.de>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Minas Harutyunyan <hminas@synopsys.com>
Link: https://lore.kernel.org/r/f21cb38fecc72a230b86155d94c7e60c9cb66f58.1591690938.git.hminas@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/dwc2/gadget.c   |  6 ------
 drivers/usb/dwc2/platform.c | 11 +++++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 842c1ae7a2911..e5ad717cba22f 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3656,12 +3656,6 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
 								epnum, 0);
 	}
 
-	ret = usb_add_gadget_udc(dev, &hsotg->gadget);
-	if (ret) {
-		dwc2_hsotg_ep_free_request(&hsotg->eps_out[0]->ep,
-					   hsotg->ctrl_req);
-		return ret;
-	}
 	dwc2_hsotg_dump(hsotg);
 
 	return 0;
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 39c1cbf0e75d9..5e554b1d5a8f9 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -452,6 +452,17 @@ static int dwc2_driver_probe(struct platform_device *dev)
 	if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL)
 		dwc2_lowlevel_hw_disable(hsotg);
 
+#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
+	IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
+	/* Postponed adding a new gadget to the udc class driver list */
+	if (hsotg->gadget_enabled) {
+		retval = usb_add_gadget_udc(hsotg->dev, &hsotg->gadget);
+		if (retval) {
+			dwc2_hsotg_remove(hsotg);
+			goto error;
+		}
+	}
+#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
 	return 0;
 
 error:
-- 
2.25.1


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

* [PATCH 4.4 096/135] usb: add USB_QUIRK_DELAY_INIT for Logitech C922
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (94 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 095/135] usb: dwc2: Postponed gadget registration to the udc class driver Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 097/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports Sasha Levin
                   ` (42 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tomasz Meresiński, Greg Kroah-Hartman

From: Tomasz Meresiński <tomasz@meresinski.eu>

commit 5d8021923e8a8cc37a421a64e27c7221f0fee33c upstream.

The Logitech C922, just like other Logitech webcams,
needs the USB_QUIRK_DELAY_INIT or it will randomly
not respond after device connection

Signed-off-by: Tomasz Meresiński <tomasz@meresinski.eu>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200603203347.7792-1-tomasz@meresinski.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/core/quirks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 27d05f0134de8..e6e0f786547bf 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -73,11 +73,12 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* Logitech HD Webcam C270 */
 	{ USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
 
-	/* Logitech HD Pro Webcams C920, C920-C, C925e and C930e */
+	/* Logitech HD Pro Webcams C920, C920-C, C922, C925e and C930e */
 	{ USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT },
 	{ USB_DEVICE(0x046d, 0x0841), .driver_info = USB_QUIRK_DELAY_INIT },
 	{ USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT },
 	{ USB_DEVICE(0x046d, 0x085b), .driver_info = USB_QUIRK_DELAY_INIT },
+	{ USB_DEVICE(0x046d, 0x085c), .driver_info = USB_QUIRK_DELAY_INIT },
 
 	/* Logitech ConferenceCam CC3000e */
 	{ USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT },
-- 
2.25.1


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

* [PATCH 4.4 097/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (95 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 096/135] usb: add USB_QUIRK_DELAY_INIT for Logitech C922 Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 098/135] USB: ehci: reopen solution for Synopsys HC bug Sasha Levin
                   ` (41 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dongdong Liu, Bjorn Helgaas, Gabriele Paoloni, Zhou Wang,
	Greg Kroah-Hartman

From: Dongdong Liu <liudongdong3@huawei.com>

commit 72f2ff0deb870145a5a2d24cd75b4f9936159a62 upstream.

The PCIe Root Port in Hip06/Hip07 SoCs advertises an MSI capability, but it
cannot generate MSIs.  It can transfer MSI/MSI-X from downstream devices,
but does not support MSI/MSI-X itself.

Add a quirk to prevent use of MSI/MSI-X by the Root Port.

[bhelgaas: changelog, sort vendor ID #define, drop device ID #define]
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/quirks.c    | 1 +
 include/linux/pci_ids.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 83ad32b07cc39..eeb771ecda15b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1623,6 +1623,7 @@ static void quirk_pcie_mch(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7520_MCH,	quirk_pcie_mch);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7320_MCH,	quirk_pcie_mch);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7525_MCH,	quirk_pcie_mch);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI,	0x1610,	quirk_pcie_mch);
 
 
 /*
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1af616138d1dc..5547f1a0f83b2 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2496,6 +2496,8 @@
 #define PCI_DEVICE_ID_KORENIX_JETCARDF2	0x1700
 #define PCI_DEVICE_ID_KORENIX_JETCARDF3	0x17ff
 
+#define PCI_VENDOR_ID_HUAWEI         	0x19e5
+
 #define PCI_VENDOR_ID_NETRONOME		0x19ee
 #define PCI_DEVICE_ID_NETRONOME_NFP3200	0x3200
 #define PCI_DEVICE_ID_NETRONOME_NFP3240	0x3240
-- 
2.25.1


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

* [PATCH 4.4 098/135] USB: ehci: reopen solution for Synopsys HC bug
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (96 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 097/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 099/135] usb: host: ehci-exynos: Fix error check in exynos_ehci_probe() Sasha Levin
                   ` (40 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Longfang Liu, Alan Stern, Greg Kroah-Hartman

From: Longfang Liu <liulongfang@huawei.com>

commit 1ddcb71a3edf0e1682b6e056158e4c4b00325f66 upstream.

A Synopsys USB2.0 core used in Huawei Kunpeng920 SoC has a bug which
might cause the host controller not issuing ping.

Bug description:
After indicating an Interrupt on Async Advance, the software uses the
doorbell mechanism to delete the Next Link queue head of the last
executed queue head. At this time, the host controller still references
the removed queue head(the queue head is NULL). NULL reference causes
the host controller to lose the USB device.

Solution:
After deleting the Next Link queue head, when has_synopsys_hc_bug set
to 1,the software can write one of the valid queue head addresses to
the ASYNCLISTADDR register to allow the host controller to get
the valid queue head. in order to solve that problem, this patch set
the flag for Huawei Kunpeng920

There are detailed instructions and solutions in this patch:
commit 2f7ac6c19997 ("USB: ehci: add workaround for Synopsys HC bug")

Signed-off-by: Longfang Liu <liulongfang@huawei.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/1591588019-44284-1-git-send-email-liulongfang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/ehci-pci.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 2a5d2fd76040c..33e9ed7fe0266 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -229,6 +229,13 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
 		ehci_info(ehci, "applying MosChip frame-index workaround\n");
 		ehci->frame_index_bug = 1;
 		break;
+	case PCI_VENDOR_ID_HUAWEI:
+		/* Synopsys HC bug */
+		if (pdev->device == 0xa239) {
+			ehci_info(ehci, "applying Synopsys HC workaround\n");
+			ehci->has_synopsys_hc_bug = 1;
+		}
+		break;
 	}
 
 	/* optional debug port, normally in the first BAR */
-- 
2.25.1


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

* [PATCH 4.4 099/135] usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (97 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 098/135] USB: ehci: reopen solution for Synopsys HC bug Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 100/135] ALSA: usb-audio: add quirk for Denon DCD-1500RE Sasha Levin
                   ` (39 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Tang Bin, Zhang Shengju, Greg Kroah-Hartman

From: Tang Bin <tangbin@cmss.chinamobile.com>

commit 44ed240d62736ad29943ec01e41e194b96f7c5e9 upstream.

If the function platform_get_irq() failed, the negative value
returned will not be detected here. So fix error handling in
exynos_ehci_probe(). And when get irq failed, the function
platform_get_irq() logs an error message, so remove redundant
message here.

Fixes: 1bcc5aa87f04 ("USB: Add initial S5P EHCI driver")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20200602114708.28620-1-tangbin@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/ehci-exynos.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 46f5354c534d4..3b5a28f43ef95 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -199,9 +199,8 @@ static int exynos_ehci_probe(struct platform_device *pdev)
 	hcd->rsrc_len = resource_size(res);
 
 	irq = platform_get_irq(pdev, 0);
-	if (!irq) {
-		dev_err(&pdev->dev, "Failed to get IRQ\n");
-		err = -ENODEV;
+	if (irq < 0) {
+		err = irq;
 		goto fail_io;
 	}
 
-- 
2.25.1


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

* [PATCH 4.4 100/135] ALSA: usb-audio: add quirk for Denon DCD-1500RE
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (98 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 099/135] usb: host: ehci-exynos: Fix error check in exynos_ehci_probe() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 101/135] xhci: Fix incorrect EP_STATE_MASK Sasha Levin
                   ` (38 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Yick W. Tse, Takashi Iwai, Greg Kroah-Hartman

From: "Yick W. Tse" <y_w_tse@yahoo.com.hk>

commit c9808bbfed3cfc911ecb60fe8e80c0c27876c657 upstream.

fix error "clock source 41 is not valid, cannot use"

[] New USB device found, idVendor=154e, idProduct=1002, bcdDevice= 1.00
[] New USB device strings: Mfr=1, Product=2, SerialNumber=0
[] Product: DCD-1500RE
[] Manufacturer: D & M Holdings Inc.
[]
[] clock source 41 is not valid, cannot use
[] usbcore: registered new interface driver snd-usb-audio

Signed-off-by: Yick W. Tse <y_w_tse@yahoo.com.hk>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1373857985.210365.1592048406997@mail.yahoo.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/quirks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index b7a7bf0e566c4..47979c9c3e290 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1162,6 +1162,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip)
 static bool is_marantz_denon_dac(unsigned int id)
 {
 	switch (id) {
+	case USB_ID(0x154e, 0x1002): /* Denon DCD-1500RE */
 	case USB_ID(0x154e, 0x1003): /* Denon DA-300USB */
 	case USB_ID(0x154e, 0x3005): /* Marantz HD-DAC1 */
 	case USB_ID(0x154e, 0x3006): /* Marantz SA-14S1 */
-- 
2.25.1


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

* [PATCH 4.4 101/135] xhci: Fix incorrect EP_STATE_MASK
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (99 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 100/135] ALSA: usb-audio: add quirk for Denon DCD-1500RE Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 102/135] xhci: Fix enumeration issue when setting max packet size for FS devices Sasha Levin
                   ` (37 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mathias Nyman, Greg Kroah-Hartman

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

commit dceea67058fe22075db3aed62d5cb62092be5053 upstream.

EP_STATE_MASK should be 0x7 instead of 0xf

xhci spec 6.2.3 shows that the EP state field in the endpoint context data
structure consist of bits [2:0].
The old value included a bit from the next field which fortunately is a
 RsvdZ region. So hopefully this hasn't caused too much harm

Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200624135949.22611-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/xhci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 0a3aa38b3c96e..a7f346529f913 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -706,7 +706,7 @@ struct xhci_ep_ctx {
  * 4 - TRB error
  * 5-7 - reserved
  */
-#define EP_STATE_MASK		(0xf)
+#define EP_STATE_MASK		(0x7)
 #define EP_STATE_DISABLED	0
 #define EP_STATE_RUNNING	1
 #define EP_STATE_HALTED		2
-- 
2.25.1


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

* [PATCH 4.4 102/135] xhci: Fix enumeration issue when setting max packet size for FS devices.
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (100 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 101/135] xhci: Fix incorrect EP_STATE_MASK Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 103/135] cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip Sasha Levin
                   ` (36 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Al Cooper, Mathias Nyman, Greg Kroah-Hartman

From: Al Cooper <alcooperx@gmail.com>

commit a73d9d9cfc3cfceabd91fb0b0c13e4062b6dbcd7 upstream.

Unable to complete the enumeration of a USB TV Tuner device.

Per XHCI spec (4.6.5), the EP state field of the input context shall
be cleared for a set address command. In the special case of an FS
device that has "MaxPacketSize0 = 8", the Linux XHCI driver does
not do this before evaluating the context. With an XHCI controller
that checks the EP state field for parameter context error this
causes a problem in cases such as the device getting reset again
after enumeration.

When that field is cleared, the problem does not occur.

This was found and fixed by Sasi Kumar.

Cc: stable@vger.kernel.org
Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200624135949.22611-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/xhci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index af4e68152776e..7272c98becb8b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1340,6 +1340,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
 				xhci->devs[slot_id]->out_ctx, ep_index);
 
 		ep_ctx = xhci_get_ep_ctx(xhci, command->in_ctx, ep_index);
+		ep_ctx->ep_info &= cpu_to_le32(~EP_STATE_MASK);/* must clear */
 		ep_ctx->ep_info2 &= cpu_to_le32(~MAX_PACKET_MASK);
 		ep_ctx->ep_info2 |= cpu_to_le32(MAX_PACKET(max_packet_size));
 
-- 
2.25.1


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

* [PATCH 4.4 103/135] cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (101 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 102/135] xhci: Fix enumeration issue when setting max packet size for FS devices Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 104/135] ALSA: usb-audio: uac1: Invalidate ctl on interrupt Sasha Levin
                   ` (35 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Joakim Tjernlund, Oliver Neukum, Greg Kroah-Hartman

From: Joakim Tjernlund <joakim.tjernlund@infinera.com>

commit 03894573f2913181ee5aae0089f333b2131f2d4b upstream.

USB_DEVICE(0x0424, 0x274e) can send data before cdc_acm is ready,
causing garbage chars on the TTY causing stray input to the shell
and/or login prompt.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: stable@vger.kernel.org
Acked-by: Oliver Neukum <oneukum@suse.com>
Link: https://lore.kernel.org/r/20200605105418.22263-1-joakim.tjernlund@infinera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/class/cdc-acm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 04fd6c8e3090d..515839034dfbc 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1684,6 +1684,8 @@ static int acm_reset_resume(struct usb_interface *intf)
 
 static const struct usb_device_id acm_ids[] = {
 	/* quirky and broken devices */
+	{ USB_DEVICE(0x0424, 0x274e), /* Microchip Technology, Inc. (formerly SMSC) */
+	  .driver_info = DISABLE_ECHO, }, /* DISABLE ECHO in termios flag */
 	{ USB_DEVICE(0x076d, 0x0006), /* Denso Cradle CU-321 */
 	.driver_info = NO_UNION_NORMAL, },/* has no union descriptor */
 	{ USB_DEVICE(0x17ef, 0x7000), /* Lenovo USB modem */
-- 
2.25.1


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

* [PATCH 4.4 104/135] ALSA: usb-audio: uac1: Invalidate ctl on interrupt
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (102 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 103/135] cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 105/135] ALSA: usb-audio: allow clock source validity interrupts Sasha Levin
                   ` (34 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Julian Scheel, Takashi Iwai, Sasha Levin

From: Julian Scheel <julian@jusst.de>

[ Upstream commit b2500b584cfd228d67e1e43daf27c8af865b499e ]

When an interrupt occurs, the value of at least one of the belonging
controls should have changed. To make sure they get re-read from device
on the next read, invalidate the cache. This was correctly implemented
for uac2 already, but missing for uac1.

Signed-off-by: Julian Scheel <julian@jusst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/usb/mixer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 9bbe84ce7d07f..a2a9712bd6fa7 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2330,9 +2330,14 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
 {
 	struct usb_mixer_elem_list *list;
 
-	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem)
+	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) {
+		struct usb_mixer_elem_info *info =
+			(struct usb_mixer_elem_info *)list;
+		/* invalidate cache, so the value is read from the device */
+		info->cached = 0;
 		snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
 			       &list->kctl->id);
+	}
 }
 
 static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer,
-- 
2.25.1


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

* [PATCH 4.4 105/135] ALSA: usb-audio: allow clock source validity interrupts
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (103 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 104/135] ALSA: usb-audio: uac1: Invalidate ctl on interrupt Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 106/135] ALSA: usb-audio: Clean up mixer element list traverse Sasha Levin
                   ` (33 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Daniel Mack, Takashi Iwai, Sasha Levin

From: Daniel Mack <daniel@zonque.org>

[ Upstream commit 191227d99a281333b50aaf82ab4152fbfa249c19 ]

miniDSP USBStreamer UAC2 devices send clock validity changes with the
control field set to zero. The current interrupt handler ignores all
packets if the control field does not match the mixer element's, but
it really should only do that in case that field is needed to
distinguish multiple elements with the same ID.

This patch implements a logic that lets notifications packets pass
if the element ID is unique for a given device.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/usb/mixer.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index a2a9712bd6fa7..eb98e60e57335 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2391,6 +2391,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
 	__u8 unitid = (index >> 8) & 0xff;
 	__u8 control = (value >> 8) & 0xff;
 	__u8 channel = value & 0xff;
+	unsigned int count = 0;
 
 	if (channel >= MAX_CHANNELS) {
 		usb_audio_dbg(mixer->chip,
@@ -2399,6 +2400,12 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
 		return;
 	}
 
+	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem)
+		count++;
+
+	if (count == 0)
+		return;
+
 	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) {
 		struct usb_mixer_elem_info *info;
 
@@ -2406,7 +2413,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
 			continue;
 
 		info = (struct usb_mixer_elem_info *)list;
-		if (info->control != control)
+		if (count > 1 && info->control != control)
 			continue;
 
 		switch (attribute) {
-- 
2.25.1


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

* [PATCH 4.4 106/135] ALSA: usb-audio: Clean up mixer element list traverse
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (104 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 105/135] ALSA: usb-audio: allow clock source validity interrupts Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 107/135] ALSA: usb-audio: Fix OOB access of mixer element list Sasha Levin
                   ` (32 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Takashi Iwai, Sasha Levin

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 8c558076c740e8009a96c6fdc3d4245dde62be77 ]

Introduce a new macro for iterating over mixer element list for
avoiding the open codes in many places.  Also the open-coded
container_of() and the forced cast to struct usb_mixer_elem_info are
replaced with another simple macro, too.

No functional changes but just readability improvement.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/usb/mixer.c          | 20 +++++++++-----------
 sound/usb/mixer.h          |  6 ++++++
 sound/usb/mixer_quirks.c   |  2 +-
 sound/usb/mixer_scarlett.c |  6 ++----
 4 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index eb98e60e57335..c29931cd461fc 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2330,9 +2330,9 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
 {
 	struct usb_mixer_elem_list *list;
 
-	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) {
+	for_each_mixer_elem(list, mixer, unitid) {
 		struct usb_mixer_elem_info *info =
-			(struct usb_mixer_elem_info *)list;
+			mixer_elem_list_to_info(list);
 		/* invalidate cache, so the value is read from the device */
 		info->cached = 0;
 		snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
@@ -2343,7 +2343,7 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
 static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer,
 				    struct usb_mixer_elem_list *list)
 {
-	struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list;
+	struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list);
 	static char *val_types[] = {"BOOLEAN", "INV_BOOLEAN",
 				    "S8", "U8", "S16", "U16"};
 	snd_iprintf(buffer, "    Info: id=%i, control=%i, cmask=0x%x, "
@@ -2369,8 +2369,7 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry,
 				mixer->ignore_ctl_error);
 		snd_iprintf(buffer, "Card: %s\n", chip->card->longname);
 		for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) {
-			for (list = mixer->id_elems[unitid]; list;
-			     list = list->next_id_elem) {
+			for_each_mixer_elem(list, mixer, unitid) {
 				snd_iprintf(buffer, "  Unit: %i\n", list->id);
 				if (list->kctl)
 					snd_iprintf(buffer,
@@ -2400,19 +2399,19 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
 		return;
 	}
 
-	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem)
+	for_each_mixer_elem(list, mixer, unitid)
 		count++;
 
 	if (count == 0)
 		return;
 
-	for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) {
+	for_each_mixer_elem(list, mixer, unitid) {
 		struct usb_mixer_elem_info *info;
 
 		if (!list->kctl)
 			continue;
 
-		info = (struct usb_mixer_elem_info *)list;
+		info = mixer_elem_list_to_info(list);
 		if (count > 1 && info->control != control)
 			continue;
 
@@ -2632,7 +2631,7 @@ int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer)
 
 static int restore_mixer_value(struct usb_mixer_elem_list *list)
 {
-	struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list;
+	struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list);
 	int c, err, idx;
 
 	if (cval->cmask) {
@@ -2668,8 +2667,7 @@ int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume)
 	if (reset_resume) {
 		/* restore cached mixer values */
 		for (id = 0; id < MAX_ID_ELEMS; id++) {
-			for (list = mixer->id_elems[id]; list;
-			     list = list->next_id_elem) {
+			for_each_mixer_elem(list, mixer, id) {
 				if (list->resume) {
 					err = list->resume(list);
 					if (err < 0)
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 545d99b09706b..004d99037210f 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -52,6 +52,12 @@ struct usb_mixer_elem_list {
 	usb_mixer_elem_resume_func_t resume;
 };
 
+/* iterate over mixer element list of the given unit id */
+#define for_each_mixer_elem(list, mixer, id)	\
+	for ((list) = (mixer)->id_elems[id]; (list); (list) = (list)->next_id_elem)
+#define mixer_elem_list_to_info(list) \
+	container_of(list, struct usb_mixer_elem_info, head)
+
 struct usb_mixer_elem_info {
 	struct usb_mixer_elem_list head;
 	unsigned int control;	/* CS or ICN (high byte) */
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 723b535ca2ec5..5d6af9c861ad9 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1170,7 +1170,7 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
 	int unitid = 12; /* SamleRate ExtensionUnit ID */
 
 	list_for_each_entry(mixer, &chip->mixer_list, list) {
-		cval = (struct usb_mixer_elem_info *)mixer->id_elems[unitid];
+		cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
 		if (cval) {
 			snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
 						    cval->control << 8,
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c
index 7438e7c4a842d..2876cd9b35b38 100644
--- a/sound/usb/mixer_scarlett.c
+++ b/sound/usb/mixer_scarlett.c
@@ -287,8 +287,7 @@ static int scarlett_ctl_switch_put(struct snd_kcontrol *kctl,
 
 static int scarlett_ctl_resume(struct usb_mixer_elem_list *list)
 {
-	struct usb_mixer_elem_info *elem =
-		container_of(list, struct usb_mixer_elem_info, head);
+	struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list);
 	int i;
 
 	for (i = 0; i < elem->channels; i++)
@@ -447,8 +446,7 @@ static int scarlett_ctl_enum_put(struct snd_kcontrol *kctl,
 
 static int scarlett_ctl_enum_resume(struct usb_mixer_elem_list *list)
 {
-	struct usb_mixer_elem_info *elem =
-		container_of(list, struct usb_mixer_elem_info, head);
+	struct usb_mixer_elem_info *elem = mixer_elem_list_to_info(list);
 
 	if (elem->cached)
 		snd_usb_set_cur_mix_value(elem, 0, 0, *elem->cache_val);
-- 
2.25.1


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

* [PATCH 4.4 107/135] ALSA: usb-audio: Fix OOB access of mixer element list
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (105 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 106/135] ALSA: usb-audio: Clean up mixer element list traverse Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 108/135] xhci: Poll for U0 after disabling USB2 LPM Sasha Levin
                   ` (31 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Takashi Iwai, syzbot+fb14314433463ad51625,
	syzbot+2405ca3401e943c538b5, Sasha Levin

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 220345e98f1cdc768eeb6e3364a0fa7ab9647fe7 ]

The USB-audio mixer code holds a linked list of usb_mixer_elem_list,
and several operations are performed for each mixer element.  A few of
them (snd_usb_mixer_notify_id() and snd_usb_mixer_interrupt_v2())
assume each mixer element being a usb_mixer_elem_info object that is a
subclass of usb_mixer_elem_list, cast via container_of() and access it
members.  This may result in an out-of-bound access when a
non-standard list element has been added, as spotted by syzkaller
recently.

This patch adds a new field, is_std_info, in usb_mixer_elem_list to
indicate that the element is the usb_mixer_elem_info type or not, and
skip the access to such an element if needed.

Reported-by: syzbot+fb14314433463ad51625@syzkaller.appspotmail.com
Reported-by: syzbot+2405ca3401e943c538b5@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200624122340.9615-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/usb/mixer.c        | 15 +++++++++++----
 sound/usb/mixer.h        |  9 +++++++--
 sound/usb/mixer_quirks.c |  3 ++-
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c29931cd461fc..9b9d653d5e90b 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -584,8 +584,9 @@ static int check_matrix_bitmap(unsigned char *bmap,
  * if failed, give up and free the control instance.
  */
 
-int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
-			      struct snd_kcontrol *kctl)
+int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
+			   struct snd_kcontrol *kctl,
+			   bool is_std_info)
 {
 	struct usb_mixer_interface *mixer = list->mixer;
 	int err;
@@ -598,6 +599,7 @@ int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
 		return err;
 	}
 	list->kctl = kctl;
+	list->is_std_info = is_std_info;
 	list->next_id_elem = mixer->id_elems[list->id];
 	mixer->id_elems[list->id] = list;
 	return 0;
@@ -2331,8 +2333,11 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
 	struct usb_mixer_elem_list *list;
 
 	for_each_mixer_elem(list, mixer, unitid) {
-		struct usb_mixer_elem_info *info =
-			mixer_elem_list_to_info(list);
+		struct usb_mixer_elem_info *info;
+
+		if (!list->is_std_info)
+			continue;
+		info = mixer_elem_list_to_info(list);
 		/* invalidate cache, so the value is read from the device */
 		info->cached = 0;
 		snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
@@ -2410,6 +2415,8 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
 
 		if (!list->kctl)
 			continue;
+		if (!list->is_std_info)
+			continue;
 
 		info = mixer_elem_list_to_info(list);
 		if (count > 1 && info->control != control)
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 004d99037210f..7d16a92210705 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -48,6 +48,7 @@ struct usb_mixer_elem_list {
 	struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */
 	struct snd_kcontrol *kctl;
 	unsigned int id;
+	bool is_std_info;
 	usb_mixer_elem_dump_func_t dump;
 	usb_mixer_elem_resume_func_t resume;
 };
@@ -85,8 +86,12 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid);
 int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
 				int request, int validx, int value_set);
 
-int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list,
-			      struct snd_kcontrol *kctl);
+int snd_usb_mixer_add_list(struct usb_mixer_elem_list *list,
+			   struct snd_kcontrol *kctl,
+			   bool is_std_info);
+
+#define snd_usb_mixer_add_control(list, kctl) \
+	snd_usb_mixer_add_list(list, kctl, true)
 
 void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
 				 struct usb_mixer_interface *mixer,
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 5d6af9c861ad9..198515f86fcc2 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -168,7 +168,8 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer,
 		return -ENOMEM;
 	}
 	kctl->private_free = snd_usb_mixer_elem_free;
-	return snd_usb_mixer_add_control(list, kctl);
+	/* don't use snd_usb_mixer_add_control() here, this is a special list element */
+	return snd_usb_mixer_add_list(list, kctl, false);
 }
 
 /*
-- 
2.25.1


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

* [PATCH 4.4 108/135] xhci: Poll for U0 after disabling USB2 LPM
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (106 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 107/135] ALSA: usb-audio: Fix OOB access of mixer element list Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 109/135] cifs/smb3: Fix data inconsistent when punch hole Sasha Levin
                   ` (30 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Kai-Heng Feng, Mathias Nyman, Greg Kroah-Hartman, Sasha Levin

From: Kai-Heng Feng <kai.heng.feng@canonical.com>

[ Upstream commit b3d71abd135e6919ca0b6cab463738472653ddfb ]

USB2 devices with LPM enabled may interrupt the system suspend:
[  932.510475] usb 1-7: usb suspend, wakeup 0
[  932.510549] hub 1-0:1.0: hub_suspend
[  932.510581] usb usb1: bus suspend, wakeup 0
[  932.510590] xhci_hcd 0000:00:14.0: port 9 not suspended
[  932.510593] xhci_hcd 0000:00:14.0: port 8 not suspended
..
[  932.520323] xhci_hcd 0000:00:14.0: Port change event, 1-7, id 7, portsc: 0x400e03
..
[  932.591405] PM: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -16
[  932.591414] PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -16
[  932.591418] PM: Device 0000:00:14.0 failed to suspend async: error -16

During system suspend, USB core will let HC suspends the device if it
doesn't have remote wakeup enabled and doesn't have any children.
However, from the log above we can see that the usb 1-7 doesn't get bus
suspended due to not in U0. After a while the port finished U2 -> U0
transition, interrupts the suspend process.

The observation is that after disabling LPM, port doesn't transit to U0
immediately and can linger in U2. xHCI spec 4.23.5.2 states that the
maximum exit latency for USB2 LPM should be BESL + 10us. The BESL for
the affected device is advertised as 400us, which is still not enough
based on my testing result.

So let's use the maximum permitted latency, 10000, to poll for U0
status to solve the issue.

Cc: stable@vger.kernel.org
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20200624135949.22611-6-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/host/xhci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 7272c98becb8b..51d84332eb786 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4264,6 +4264,9 @@ int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
 			mutex_lock(hcd->bandwidth_mutex);
 			xhci_change_max_exit_latency(xhci, udev, 0);
 			mutex_unlock(hcd->bandwidth_mutex);
+			readl_poll_timeout(port_array[port_num], pm_val,
+					   (pm_val & PORT_PLS_MASK) == XDEV_U0,
+					   100, 10000);
 			return 0;
 		}
 	}
-- 
2.25.1


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

* [PATCH 4.4 109/135] cifs/smb3: Fix data inconsistent when punch hole
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (107 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 108/135] xhci: Poll for U0 after disabling USB2 LPM Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 110/135] cifs/smb3: Fix data inconsistent when zero file range Sasha Levin
                   ` (29 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zhang Xiaoxu, Pavel Shilovsky, Steve French, Sasha Levin

From: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>

[ Upstream commit acc91c2d8de4ef46ed751c5f9df99ed9a109b100 ]

When punch hole success, we also can read old data from file:
  # strace -e trace=pread64,fallocate xfs_io -f -c "pread 20 40" \
           -c "fpunch 20 40" -c"pread 20 40" file
  pread64(3, " version 5.8.0-rc1+"..., 40, 20) = 40
  fallocate(3, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE, 20, 40) = 0
  pread64(3, " version 5.8.0-rc1+"..., 40, 20) = 40

CIFS implements the fallocate(FALLOCATE_FL_PUNCH_HOLE) with send SMB
ioctl(FSCTL_SET_ZERO_DATA) to server. It just set the range of the
remote file to zero, but local page caches not updated, then the
local page caches inconsistent with server.

Also can be found by xfstests generic/316.

So, we need to remove the page caches before send the SMB
ioctl(FSCTL_SET_ZERO_DATA) to server.

Fixes: 31742c5a33176 ("enable fallocate punch hole ("fallocate -p") for SMB3")
Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Cc: stable@vger.kernel.org # v3.17
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/smb2ops.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 0fcf42401a5df..870b7e763bab9 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1201,6 +1201,12 @@ static long smb3_punch_hole(struct file *file, struct cifs_tcon *tcon,
 	if (!smb2_set_sparse(xid, tcon, cfile, inode, set_sparse))
 		return -EOPNOTSUPP;
 
+	/*
+	 * We implement the punch hole through ioctl, so we need remove the page
+	 * caches first, otherwise the data may be inconsistent with the server.
+	 */
+	truncate_pagecache_range(inode, offset, offset + len - 1);
+
 	cifs_dbg(FYI, "offset %lld len %lld", offset, len);
 
 	fsctl_buf.FileOffset = cpu_to_le64(offset);
-- 
2.25.1


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

* [PATCH 4.4 110/135] cifs/smb3: Fix data inconsistent when zero file range
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (108 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 109/135] cifs/smb3: Fix data inconsistent when punch hole Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 111/135] efi/esrt: Fix reference count leak in esre_create_sysfs_entry Sasha Levin
                   ` (28 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zhang Xiaoxu, Hulk Robot, Pavel Shilovsky, Steve French, Sasha Levin

From: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>

[ Upstream commit 6b69040247e14b43419a520f841f2b3052833df9 ]

CIFS implements the fallocate(FALLOC_FL_ZERO_RANGE) with send SMB
ioctl(FSCTL_SET_ZERO_DATA) to server. It just set the range of the
remote file to zero, but local page cache not update, then the data
inconsistent with server, which leads the xfstest generic/008 failed.

So we need to remove the local page caches before send SMB
ioctl(FSCTL_SET_ZERO_DATA) to server. After next read, it will
re-cache it.

Fixes: 30175628bf7f5 ("[SMB3] Enable fallocate -z support for SMB3 mounts")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Cc: stable@vger.kernel.org # v3.17
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/smb2ops.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 870b7e763bab9..087261ca6d463 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1145,6 +1145,12 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
 	inode = d_inode(cfile->dentry);
 	cifsi = CIFS_I(inode);
 
+	/*
+	 * We zero the range through ioctl, so we need remove the page caches
+	 * first, otherwise the data may be inconsistent with the server.
+	 */
+	truncate_pagecache_range(inode, offset, offset + len - 1);
+
 	/* if file not oplocked can't be sure whether asking to extend size */
 	if (!CIFS_CACHE_READ(cifsi))
 		if (keep_size == false)
-- 
2.25.1


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

* [PATCH 4.4 111/135] efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (109 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 110/135] cifs/smb3: Fix data inconsistent when zero file range Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 112/135] RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads() Sasha Levin
                   ` (27 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Qiushi Wu, Ard Biesheuvel, Sasha Levin

From: Qiushi Wu <wu000273@umn.edu>

[ Upstream commit 4ddf4739be6e375116c375f0a68bf3893ffcee21 ]

kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object. Previous
commit "b8eb718348b8" fixed a similar problem.

Fixes: 0bb549052d33 ("efi: Add esrt support")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Link: https://lore.kernel.org/r/20200528183804.4497-1-wu000273@umn.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/firmware/efi/esrt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
index 341b8c686ec7b..4aaaccf95b362 100644
--- a/drivers/firmware/efi/esrt.c
+++ b/drivers/firmware/efi/esrt.c
@@ -182,7 +182,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
 		rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
 					  "%s", name);
 		if (rc) {
-			kfree(entry);
+			kobject_put(&entry->kobj);
 			return rc;
 		}
 	}
-- 
2.25.1


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

* [PATCH 4.4 112/135] RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (110 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 111/135] efi/esrt: Fix reference count leak in esre_create_sysfs_entry Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 113/135] ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram() Sasha Levin
                   ` (26 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Fan Guo, Jason Gunthorpe, Sasha Levin

From: Fan Guo <guofan5@huawei.com>

[ Upstream commit a17f4bed811c60712d8131883cdba11a105d0161 ]

If ib_dma_mapping_error() returns non-zero value,
ib_mad_post_receive_mads() will jump out of loops and return -ENOMEM
without freeing mad_priv. Fix this memory-leak problem by freeing mad_priv
in this case.

Fixes: 2c34e68f4261 ("IB/mad: Check and handle potential DMA mapping errors")
Link: https://lore.kernel.org/r/20200612063824.180611-1-guofan5@huawei.com
Signed-off-by: Fan Guo <guofan5@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/infiniband/core/mad.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 616173b7a5e8a..c26fdcb7dddf8 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2912,6 +2912,7 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info,
 						 DMA_FROM_DEVICE);
 		if (unlikely(ib_dma_mapping_error(qp_info->port_priv->device,
 						  sg_list.addr))) {
+			kfree(mad_priv);
 			ret = -ENOMEM;
 			break;
 		}
-- 
2.25.1


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

* [PATCH 4.4 113/135] ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (111 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 112/135] RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 114/135] usb: gadget: udc: Potential Oops in error handling code Sasha Levin
                   ` (25 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: yu kuai, Shawn Guo, Sasha Levin

From: yu kuai <yukuai3@huawei.com>

[ Upstream commit 586745f1598ccf71b0a5a6df2222dee0a865954e ]

if of_find_device_by_node() succeed, imx_suspend_alloc_ocram() doesn't
have a corresponding put_device(). Thus add a jump target to fix the
exception handling for this function implementation.

Fixes: 1579c7b9fe01 ("ARM: imx53: Set DDR pins to high impedance when in suspend to RAM.")
Signed-off-by: yu kuai <yukuai3@huawei.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/arm/mach-imx/pm-imx5.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/pm-imx5.c b/arch/arm/mach-imx/pm-imx5.c
index 532d4b08276dc..fd996187fc5fb 100644
--- a/arch/arm/mach-imx/pm-imx5.c
+++ b/arch/arm/mach-imx/pm-imx5.c
@@ -301,14 +301,14 @@ static int __init imx_suspend_alloc_ocram(
 	if (!ocram_pool) {
 		pr_warn("%s: ocram pool unavailable!\n", __func__);
 		ret = -ENODEV;
-		goto put_node;
+		goto put_device;
 	}
 
 	ocram_base = gen_pool_alloc(ocram_pool, size);
 	if (!ocram_base) {
 		pr_warn("%s: unable to alloc ocram!\n", __func__);
 		ret = -ENOMEM;
-		goto put_node;
+		goto put_device;
 	}
 
 	phys = gen_pool_virt_to_phys(ocram_pool, ocram_base);
@@ -318,6 +318,8 @@ static int __init imx_suspend_alloc_ocram(
 	if (virt_out)
 		*virt_out = virt;
 
+put_device:
+	put_device(&pdev->dev);
 put_node:
 	of_node_put(node);
 
-- 
2.25.1


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

* [PATCH 4.4 114/135] usb: gadget: udc: Potential Oops in error handling code
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (112 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 113/135] ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 115/135] netfilter: ipset: fix unaligned atomic access Sasha Levin
                   ` (24 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Dan Carpenter, Felipe Balbi, Sasha Levin

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

[ Upstream commit e55f3c37cb8d31c7e301f46396b2ac6a19eb3a7c ]

If this is in "transceiver" mode the the ->qwork isn't required and is
a NULL pointer.  This can lead to a NULL dereference when we call
destroy_workqueue(udc->qwork).

Fixes: 3517c31a8ece ("usb: gadget: mv_udc: use devm_xxx for probe")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/usb/gadget/udc/mv_udc_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/usb/gadget/udc/mv_udc_core.c
index 81b6229c78054..4f480059f851c 100644
--- a/drivers/usb/gadget/udc/mv_udc_core.c
+++ b/drivers/usb/gadget/udc/mv_udc_core.c
@@ -2322,7 +2322,8 @@ static int mv_udc_probe(struct platform_device *pdev)
 	return 0;
 
 err_create_workqueue:
-	destroy_workqueue(udc->qwork);
+	if (udc->qwork)
+		destroy_workqueue(udc->qwork);
 err_destroy_dma:
 	dma_pool_destroy(udc->dtd_pool);
 err_free_dma:
-- 
2.25.1


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

* [PATCH 4.4 115/135] netfilter: ipset: fix unaligned atomic access
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (113 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 114/135] usb: gadget: udc: Potential Oops in error handling code Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 116/135] sched/core: Fix PI boosting between RT and DEADLINE tasks Sasha Levin
                   ` (23 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Russell King, Jozsef Kadlecsik, Pablo Neira Ayuso, Sasha Levin

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

[ Upstream commit 715028460082d07a7ec6fcd87b14b46784346a72 ]

When using ip_set with counters and comment, traffic causes the kernel
to panic on 32-bit ARM:

Alignment trap: not handling instruction e1b82f9f at [<bf01b0dc>]
Unhandled fault: alignment exception (0x221) at 0xea08133c
PC is at ip_set_match_extensions+0xe0/0x224 [ip_set]

The problem occurs when we try to update the 64-bit counters - the
faulting address above is not 64-bit aligned.  The problem occurs
due to the way elements are allocated, for example:

	set->dsize = ip_set_elem_len(set, tb, 0, 0);
	map = ip_set_alloc(sizeof(*map) + elements * set->dsize);

If the element has a requirement for a member to be 64-bit aligned,
and set->dsize is not a multiple of 8, but is a multiple of four,
then every odd numbered elements will be misaligned - and hitting
an atomic64_add() on that element will cause the kernel to panic.

ip_set_elem_len() must return a size that is rounded to the maximum
alignment of any extension field stored in the element.  This change
ensures that is the case.

Fixes: 95ad1f4a9358 ("netfilter: ipset: Fix extension alignment")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/netfilter/ipset/ip_set_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 0583e2491770d..3231030a73edb 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -379,6 +379,8 @@ ip_set_elem_len(struct ip_set *set, struct nlattr *tb[], size_t len,
 	for (id = 0; id < IPSET_EXT_ID_MAX; id++) {
 		if (!add_extension(id, cadt_flags, tb))
 			continue;
+		if (align < ip_set_extensions[id].align)
+			align = ip_set_extensions[id].align;
 		len = ALIGN(len, ip_set_extensions[id].align);
 		set->offset[id] = len;
 		set->extensions |= ip_set_extensions[id].type;
-- 
2.25.1


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

* [PATCH 4.4 116/135] sched/core: Fix PI boosting between RT and DEADLINE tasks
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (114 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 115/135] netfilter: ipset: fix unaligned atomic access Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 117/135] net: alx: fix race condition in alx_remove Sasha Levin
                   ` (22 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Juri Lelli, syzbot+119ba87189432ead09b4, Peter Zijlstra,
	Ingo Molnar, Daniel Bristot de Oliveira, Daniel Wagner,
	Sasha Levin

From: Juri Lelli <juri.lelli@redhat.com>

[ Upstream commit 740797ce3a124b7dd22b7fb832d87bc8fba1cf6f ]

syzbot reported the following warning:

 WARNING: CPU: 1 PID: 6351 at kernel/sched/deadline.c:628
 enqueue_task_dl+0x22da/0x38a0 kernel/sched/deadline.c:1504

At deadline.c:628 we have:

 623 static inline void setup_new_dl_entity(struct sched_dl_entity *dl_se)
 624 {
 625 	struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
 626 	struct rq *rq = rq_of_dl_rq(dl_rq);
 627
 628 	WARN_ON(dl_se->dl_boosted);
 629 	WARN_ON(dl_time_before(rq_clock(rq), dl_se->deadline));
        [...]
     }

Which means that setup_new_dl_entity() has been called on a task
currently boosted. This shouldn't happen though, as setup_new_dl_entity()
is only called when the 'dynamic' deadline of the new entity
is in the past w.r.t. rq_clock and boosted tasks shouldn't verify this
condition.

Digging through the PI code I noticed that what above might in fact happen
if an RT tasks blocks on an rt_mutex hold by a DEADLINE task. In the
first branch of boosting conditions we check only if a pi_task 'dynamic'
deadline is earlier than mutex holder's and in this case we set mutex
holder to be dl_boosted. However, since RT 'dynamic' deadlines are only
initialized if such tasks get boosted at some point (or if they become
DEADLINE of course), in general RT 'dynamic' deadlines are usually equal
to 0 and this verifies the aforementioned condition.

Fix it by checking that the potential donor task is actually (even if
temporary because in turn boosted) running at DEADLINE priority before
using its 'dynamic' deadline value.

Fixes: 2d3d891d3344 ("sched/deadline: Add SCHED_DEADLINE inheritance logic")
Reported-by: syzbot+119ba87189432ead09b4@syzkaller.appspotmail.com
Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Tested-by: Daniel Wagner <dwagner@suse.de>
Link: https://lkml.kernel.org/r/20181119153201.GB2119@localhost.localdomain
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/sched/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d81bcc6362fff..14a87c1f3a3ac 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3439,7 +3439,8 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
 	if (dl_prio(prio)) {
 		struct task_struct *pi_task = rt_mutex_get_top_task(p);
 		if (!dl_prio(p->normal_prio) ||
-		    (pi_task && dl_entity_preempt(&pi_task->dl, &p->dl))) {
+		    (pi_task && dl_prio(pi_task->prio) &&
+		     dl_entity_preempt(&pi_task->dl, &p->dl))) {
 			p->dl.dl_boosted = 1;
 			enqueue_flag |= ENQUEUE_REPLENISH;
 		} else
-- 
2.25.1


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

* [PATCH 4.4 117/135] net: alx: fix race condition in alx_remove
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (115 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 116/135] sched/core: Fix PI boosting between RT and DEADLINE tasks Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 118/135] kbuild: improve cc-option to clean up all temporary files Sasha Levin
                   ` (21 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Zekun Shen, David S . Miller, Sasha Levin

From: Zekun Shen <bruceshenzk@gmail.com>

[ Upstream commit e89df5c4322c1bf495f62d74745895b5fd2a4393 ]

There is a race condition exist during termination. The path is
alx_stop and then alx_remove. An alx_schedule_link_check could be called
before alx_stop by interrupt handler and invoke alx_link_check later.
Alx_stop frees the napis, and alx_remove cancels any pending works.
If any of the work is scheduled before termination and invoked before
alx_remove, a null-ptr-deref occurs because both expect alx->napis[i].

This patch fix the race condition by moving cancel_work_sync functions
before alx_free_napis inside alx_stop. Because interrupt handler can call
alx_schedule_link_check again, alx_free_irq is moved before
cancel_work_sync calls too.

Signed-off-by: Zekun Shen <bruceshenzk@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/atheros/alx/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index df54475d163bf..43bcc19c90680 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -872,8 +872,12 @@ static int __alx_open(struct alx_priv *alx, bool resume)
 
 static void __alx_stop(struct alx_priv *alx)
 {
-	alx_halt(alx);
 	alx_free_irq(alx);
+
+	cancel_work_sync(&alx->link_check_wk);
+	cancel_work_sync(&alx->reset_wk);
+
+	alx_halt(alx);
 	alx_free_rings(alx);
 }
 
@@ -1406,9 +1410,6 @@ static void alx_remove(struct pci_dev *pdev)
 	struct alx_priv *alx = pci_get_drvdata(pdev);
 	struct alx_hw *hw = &alx->hw;
 
-	cancel_work_sync(&alx->link_check_wk);
-	cancel_work_sync(&alx->reset_wk);
-
 	/* restore permanent mac address */
 	alx_set_macaddr(hw, hw->perm_addr);
 
-- 
2.25.1


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

* [PATCH 4.4 118/135] kbuild: improve cc-option to clean up all temporary files
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (116 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 117/135] net: alx: fix race condition in alx_remove Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 119/135] blktrace: break out of blktrace setup on concurrent calls Sasha Levin
                   ` (20 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Masahiro Yamada, Sasha Levin

From: Masahiro Yamada <masahiroy@kernel.org>

[ Upstream commit f2f02ebd8f3833626642688b2d2c6a7b3c141fa9 ]

When cc-option and friends evaluate compiler flags, the temporary file
$$TMP is created as an output object, and automatically cleaned up.
The actual file path of $$TMP is .<pid>.tmp, here <pid> is the process
ID of $(shell ...) invoked from cc-option. (Please note $$$$ is the
escape sequence of $$).

Such garbage files are cleaned up in most cases, but some compiler flags
create additional output files.

For example, -gsplit-dwarf creates a .dwo file.

When CONFIG_DEBUG_INFO_SPLIT=y, you will see a bunch of .<pid>.dwo files
left in the top of build directories. You may not notice them unless you
do 'ls -a', but the garbage files will increase every time you run 'make'.

This commit changes the temporary object path to .tmp_<pid>/tmp, and
removes .tmp_<pid> directory when exiting. Separate build artifacts such
as *.dwo will be cleaned up all together because their file paths are
usually determined based on the base name of the object.

Another example is -ftest-coverage, which outputs the coverage data into
<base-name-of-object>.gcno

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/Kbuild.include | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index e61a5c29b08c5..b6f055157b89a 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -81,20 +81,21 @@ cc-cross-prefix =  \
 		fi)))
 
 # output directory for tests below
-TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
+TMPOUT = $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_$$$$
 
 # try-run
 # Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
 # Exit code chooses option. "$$TMP" is can be used as temporary file and
 # is automatically cleaned up.
 try-run = $(shell set -e;		\
-	TMP="$(TMPOUT).$$$$.tmp";	\
-	TMPO="$(TMPOUT).$$$$.o";	\
+	TMP=$(TMPOUT)/tmp;		\
+	TMPO=$(TMPOUT)/tmp.o;		\
+	mkdir -p $(TMPOUT);		\
+	trap "rm -rf $(TMPOUT)" EXIT;	\
 	if ($(1)) >/dev/null 2>&1;	\
 	then echo "$(2)";		\
 	else echo "$(3)";		\
-	fi;				\
-	rm -f "$$TMP" "$$TMPO")
+	fi)
 
 # as-option
 # Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
-- 
2.25.1


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

* [PATCH 4.4 119/135] blktrace: break out of blktrace setup on concurrent calls
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (117 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 118/135] kbuild: improve cc-option to clean up all temporary files Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 120/135] ACPI: sysfs: Fix pm_profile_attr type Sasha Levin
                   ` (19 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Luis Chamberlain, Jan Kara, Bart Van Assche, Christoph Hellwig,
	Jens Axboe, Sasha Levin

From: Luis Chamberlain <mcgrof@kernel.org>

[ Upstream commit 1b0b283648163dae2a214ca28ed5a99f62a77319 ]

We use one blktrace per request_queue, that means one per the entire
disk.  So we cannot run one blktrace on say /dev/vda and then /dev/vda1,
or just two calls on /dev/vda.

We check for concurrent setup only at the very end of the blktrace setup though.

If we try to run two concurrent blktraces on the same block device the
second one will fail, and the first one seems to go on. However when
one tries to kill the first one one will see things like this:

The kernel will show these:

```
debugfs: File 'dropped' in directory 'nvme1n1' already present!
debugfs: File 'msg' in directory 'nvme1n1' already present!
debugfs: File 'trace0' in directory 'nvme1n1' already present!
``

And userspace just sees this error message for the second call:

```
blktrace /dev/nvme1n1
BLKTRACESETUP(2) /dev/nvme1n1 failed: 5/Input/output error
```

The first userspace process #1 will also claim that the files
were taken underneath their nose as well. The files are taken
away form the first process given that when the second blktrace
fails, it will follow up with a BLKTRACESTOP and BLKTRACETEARDOWN.
This means that even if go-happy process #1 is waiting for blktrace
data, we *have* been asked to take teardown the blktrace.

This can easily be reproduced with break-blktrace [0] run_0005.sh test.

Just break out early if we know we're already going to fail, this will
prevent trying to create the files all over again, which we know still
exist.

[0] https://github.com/mcgrof/break-blktrace

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/trace/blktrace.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 6737564680193..8ac3663e0012d 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -15,6 +15,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/blkdev.h>
 #include <linux/blktrace_api.h>
@@ -481,6 +484,16 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 	 */
 	strreplace(buts->name, '/', '_');
 
+	/*
+	 * bdev can be NULL, as with scsi-generic, this is a helpful as
+	 * we can be.
+	 */
+	if (q->blk_trace) {
+		pr_warn("Concurrent blktraces are not allowed on %s\n",
+			buts->name);
+		return -EBUSY;
+	}
+
 	bt = kzalloc(sizeof(*bt), GFP_KERNEL);
 	if (!bt)
 		return -ENOMEM;
-- 
2.25.1


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

* [PATCH 4.4 120/135] ACPI: sysfs: Fix pm_profile_attr type
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (118 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 119/135] blktrace: break out of blktrace setup on concurrent calls Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 121/135] KVM: X86: Fix MSR range of APIC registers in X2APIC mode Sasha Levin
                   ` (18 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Nathan Chancellor, yuu ichii, Rafael J . Wysocki, Greg Kroah-Hartman

From: Nathan Chancellor <natechancellor@gmail.com>

commit e6d701dca9893990d999fd145e3e07223c002b06 upstream.

When running a kernel with Clang's Control Flow Integrity implemented,
there is a violation that happens when accessing
/sys/firmware/acpi/pm_profile:

$ cat /sys/firmware/acpi/pm_profile
0

$ dmesg
...
[   17.352564] ------------[ cut here ]------------
[   17.352568] CFI failure (target: acpi_show_profile+0x0/0x8):
[   17.352572] WARNING: CPU: 3 PID: 497 at kernel/cfi.c:29 __cfi_check_fail+0x33/0x40
[   17.352573] Modules linked in:
[   17.352575] CPU: 3 PID: 497 Comm: cat Tainted: G        W         5.7.0-microsoft-standard+ #1
[   17.352576] RIP: 0010:__cfi_check_fail+0x33/0x40
[   17.352577] Code: 48 c7 c7 50 b3 85 84 48 c7 c6 50 0a 4e 84 e8 a4 d8 60 00 85 c0 75 02 5b c3 48 c7 c7 dc 5e 49 84 48 89 de 31 c0 e8 7d 06 eb ff <0f> 0b 5b c3 00 00 cc cc 00 00 cc cc 00 85 f6 74 25 41 b9 ea ff ff
[   17.352577] RSP: 0018:ffffaa6dc3c53d30 EFLAGS: 00010246
[   17.352578] RAX: 331267e0c06cee00 RBX: ffffffff83d85890 RCX: ffffffff8483a6f8
[   17.352579] RDX: ffff9cceabbb37c0 RSI: 0000000000000082 RDI: ffffffff84bb9e1c
[   17.352579] RBP: ffffffff845b2bc8 R08: 0000000000000001 R09: ffff9cceabbba200
[   17.352579] R10: 000000000000019d R11: 0000000000000000 R12: ffff9cc947766f00
[   17.352580] R13: ffffffff83d6bd50 R14: ffff9ccc6fa80000 R15: ffffffff845bd328
[   17.352582] FS:  00007fdbc8d13580(0000) GS:ffff9cce91ac0000(0000) knlGS:0000000000000000
[   17.352582] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   17.352583] CR2: 00007fdbc858e000 CR3: 00000005174d0000 CR4: 0000000000340ea0
[   17.352584] Call Trace:
[   17.352586]  ? rev_id_show+0x8/0x8
[   17.352587]  ? __cfi_check+0x45bac/0x4b640
[   17.352589]  ? kobj_attr_show+0x73/0x80
[   17.352590]  ? sysfs_kf_seq_show+0xc1/0x140
[   17.352592]  ? ext4_seq_options_show.cfi_jt+0x8/0x8
[   17.352593]  ? seq_read+0x180/0x600
[   17.352595]  ? sysfs_create_file_ns.cfi_jt+0x10/0x10
[   17.352596]  ? tlbflush_read_file+0x8/0x8
[   17.352597]  ? __vfs_read+0x6b/0x220
[   17.352598]  ? handle_mm_fault+0xa23/0x11b0
[   17.352599]  ? vfs_read+0xa2/0x130
[   17.352599]  ? ksys_read+0x6a/0xd0
[   17.352601]  ? __do_sys_getpgrp+0x8/0x8
[   17.352602]  ? do_syscall_64+0x72/0x120
[   17.352603]  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   17.352604] ---[ end trace 7b1fa81dc897e419 ]---

When /sys/firmware/acpi/pm_profile is read, sysfs_kf_seq_show is called,
which in turn calls kobj_attr_show, which gets the ->show callback
member by calling container_of on attr (casting it to struct
kobj_attribute) then calls it.

There is a CFI violation because pm_profile_attr is of type
struct device_attribute but kobj_attr_show calls ->show expecting it
to be from struct kobj_attribute. CFI checking ensures that function
pointer types match when doing indirect calls. Fix pm_profile_attr to
be defined in terms of kobj_attribute so there is no violation or
mismatch.

Fixes: 362b646062b2 ("ACPI: Export FADT pm_profile integer value to userspace")
Link: https://github.com/ClangBuiltLinux/linux/issues/1051
Reported-by: yuu ichii <byahu140@heisei.be>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/acpi/sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index ef3dfc90e8171..13c308323e94c 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -776,13 +776,13 @@ static void __exit interrupt_stats_exit(void)
 }
 
 static ssize_t
-acpi_show_profile(struct device *dev, struct device_attribute *attr,
+acpi_show_profile(struct kobject *kobj, struct kobj_attribute *attr,
 		  char *buf)
 {
 	return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
 }
 
-static const struct device_attribute pm_profile_attr =
+static const struct kobj_attribute pm_profile_attr =
 	__ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
 
 static ssize_t hotplug_enabled_show(struct kobject *kobj,
-- 
2.25.1


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

* [PATCH 4.4 121/135] KVM: X86: Fix MSR range of APIC registers in X2APIC mode
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (119 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 120/135] ACPI: sysfs: Fix pm_profile_attr type Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 122/135] mm/slab: use memzero_explicit() in kzfree() Sasha Levin
                   ` (17 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Xiaoyao Li, Sean Christopherson, Jim Mattson, Paolo Bonzini,
	Greg Kroah-Hartman

From: Xiaoyao Li <xiaoyao.li@intel.com>

commit bf10bd0be53282183f374af23577b18b5fbf7801 upstream.

Only MSR address range 0x800 through 0x8ff is architecturally reserved
and dedicated for accessing APIC registers in x2APIC mode.

Fixes: 0105d1a52640 ("KVM: x2apic interface to lapic")
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20200616073307.16440-1-xiaoyao.li@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/kvm/x86.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index aac60d1605ffe..61fc92f92e0a0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2162,7 +2162,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 		return kvm_mtrr_set_msr(vcpu, msr, data);
 	case MSR_IA32_APICBASE:
 		return kvm_set_apic_base(vcpu, msr_info);
-	case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
+	case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
 		return kvm_x2apic_msr_write(vcpu, msr, data);
 	case MSR_IA32_TSCDEADLINE:
 		kvm_set_lapic_tscdeadline_msr(vcpu, data);
@@ -2432,7 +2432,7 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 	case MSR_IA32_APICBASE:
 		msr_info->data = kvm_get_apic_base(vcpu);
 		break;
-	case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
+	case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
 		return kvm_x2apic_msr_read(vcpu, msr_info->index, &msr_info->data);
 		break;
 	case MSR_IA32_TSCDEADLINE:
-- 
2.25.1


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

* [PATCH 4.4 122/135] mm/slab: use memzero_explicit() in kzfree()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (120 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 121/135] KVM: X86: Fix MSR range of APIC registers in X2APIC mode Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 123/135] ocfs2: load global_inode_alloc Sasha Levin
                   ` (16 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Waiman Long, Michal Hocko, David Howells, Jarkko Sakkinen,
	James Morris, Serge E. Hallyn, Joe Perches, Matthew Wilcox,
	David Rientjes, Johannes Weiner, Dan Carpenter,
	Jason A . Donenfeld, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman

From: Waiman Long <longman@redhat.com>

commit 8982ae527fbef170ef298650c15d55a9ccd33973 upstream.

The kzfree() function is normally used to clear some sensitive
information, like encryption keys, in the buffer before freeing it back to
the pool.  Memset() is currently used for buffer clearing.  However
unlikely, there is still a non-zero probability that the compiler may
choose to optimize away the memory clearing especially if LTO is being
used in the future.

To make sure that this optimization will never happen,
memzero_explicit(), which is introduced in v3.18, is now used in
kzfree() to future-proof it.

Link: http://lkml.kernel.org/r/20200616154311.12314-2-longman@redhat.com
Fixes: 3ef0e5ba4673 ("slab: introduce kzfree()")
Signed-off-by: Waiman Long <longman@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Joe Perches <joe@perches.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 mm/slab_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 01e7246de8dfa..5d8c809a3ff71 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -1269,7 +1269,7 @@ void kzfree(const void *p)
 	if (unlikely(ZERO_OR_NULL_PTR(mem)))
 		return;
 	ks = ksize(mem);
-	memset(mem, 0, ks);
+	memzero_explicit(mem, ks);
 	kfree(mem);
 }
 EXPORT_SYMBOL(kzfree);
-- 
2.25.1


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

* [PATCH 4.4 123/135] ocfs2: load global_inode_alloc
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (121 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 122/135] mm/slab: use memzero_explicit() in kzfree() Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 124/135] ocfs2: fix value of OCFS2_INVALID_SLOT Sasha Levin
                   ` (15 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Junxiao Bi, Joseph Qi, Changwei Ge, Gang He, Joel Becker,
	Jun Piao, Mark Fasheh, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman

From: Junxiao Bi <junxiao.bi@oracle.com>

commit 7569d3c754e452769a5747eeeba488179e38a5da upstream.

Set global_inode_alloc as OCFS2_FIRST_ONLINE_SYSTEM_INODE, that will
make it load during mount.  It can be used to test whether some
global/system inodes are valid.  One use case is that nfsd will test
whether root inode is valid.

Link: http://lkml.kernel.org/r/20200616183829.87211-3-junxiao.bi@oracle.com
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ocfs2/ocfs2_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 540ab5b75dbb0..88c1bd3898faf 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -340,8 +340,8 @@ struct ocfs2_system_inode_info {
 enum {
 	BAD_BLOCK_SYSTEM_INODE = 0,
 	GLOBAL_INODE_ALLOC_SYSTEM_INODE,
+#define OCFS2_FIRST_ONLINE_SYSTEM_INODE GLOBAL_INODE_ALLOC_SYSTEM_INODE
 	SLOT_MAP_SYSTEM_INODE,
-#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
 	HEARTBEAT_SYSTEM_INODE,
 	GLOBAL_BITMAP_SYSTEM_INODE,
 	USER_QUOTA_SYSTEM_INODE,
-- 
2.25.1


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

* [PATCH 4.4 124/135] ocfs2: fix value of OCFS2_INVALID_SLOT
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (122 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 123/135] ocfs2: load global_inode_alloc Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:52 ` [PATCH 4.4 125/135] ocfs2: fix panic on nfs server over ocfs2 Sasha Levin
                   ` (14 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Junxiao Bi, Joseph Qi, Mark Fasheh, Joel Becker, Changwei Ge,
	Gang He, Jun Piao, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman

From: Junxiao Bi <junxiao.bi@oracle.com>

commit 9277f8334ffc719fe922d776444d6e4e884dbf30 upstream.

In the ocfs2 disk layout, slot number is 16 bits, but in ocfs2
implementation, slot number is 32 bits.  Usually this will not cause any
issue, because slot number is converted from u16 to u32, but
OCFS2_INVALID_SLOT was defined as -1, when an invalid slot number from
disk was obtained, its value was (u16)-1, and it was converted to u32.
Then the following checking in get_local_system_inode will be always
skipped:

 static struct inode **get_local_system_inode(struct ocfs2_super *osb,
                                               int type,
                                               u32 slot)
 {
 	BUG_ON(slot == OCFS2_INVALID_SLOT);
	...
 }

Link: http://lkml.kernel.org/r/20200616183829.87211-5-junxiao.bi@oracle.com
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ocfs2/ocfs2_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 88c1bd3898faf..5617ec167a9d7 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -304,7 +304,7 @@
 #define OCFS2_MAX_SLOTS			255
 
 /* Slot map indicator for an empty slot */
-#define OCFS2_INVALID_SLOT		-1
+#define OCFS2_INVALID_SLOT		((u16)-1)
 
 #define OCFS2_VOL_UUID_LEN		16
 #define OCFS2_MAX_VOL_LABEL_LEN		64
-- 
2.25.1


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

* [PATCH 4.4 125/135] ocfs2: fix panic on nfs server over ocfs2
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (123 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 124/135] ocfs2: fix value of OCFS2_INVALID_SLOT Sasha Levin
@ 2020-06-29 15:52 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 126/135] arm64: perf: Report the PC value in REGS_ABI_32 mode Sasha Levin
                   ` (13 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:52 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Junxiao Bi, Joseph Qi, Changwei Ge, Gang He, Joel Becker,
	Jun Piao, Mark Fasheh, Andrew Morton, Linus Torvalds,
	Greg Kroah-Hartman

From: Junxiao Bi <junxiao.bi@oracle.com>

commit e5a15e17a78d58f933d17cafedfcf7486a29f5b4 upstream.

The following kernel panic was captured when running nfs server over
ocfs2, at that time ocfs2_test_inode_bit() was checking whether one
inode locating at "blkno" 5 was valid, that is ocfs2 root inode, its
"suballoc_slot" was OCFS2_INVALID_SLOT(65535) and it was allocted from
//global_inode_alloc, but here it wrongly assumed that it was got from per
slot inode alloctor which would cause array overflow and trigger kernel
panic.

  BUG: unable to handle kernel paging request at 0000000000001088
  IP: [<ffffffff816f6898>] _raw_spin_lock+0x18/0xf0
  PGD 1e06ba067 PUD 1e9e7d067 PMD 0
  Oops: 0002 [#1] SMP
  CPU: 6 PID: 24873 Comm: nfsd Not tainted 4.1.12-124.36.1.el6uek.x86_64 #2
  Hardware name: Huawei CH121 V3/IT11SGCA1, BIOS 3.87 02/02/2018
  RIP: _raw_spin_lock+0x18/0xf0
  RSP: e02b:ffff88005ae97908  EFLAGS: 00010206
  RAX: ffff88005ae98000 RBX: 0000000000001088 RCX: 0000000000000000
  RDX: 0000000000020000 RSI: 0000000000000009 RDI: 0000000000001088
  RBP: ffff88005ae97928 R08: 0000000000000000 R09: ffff880212878e00
  R10: 0000000000007ff0 R11: 0000000000000000 R12: 0000000000001088
  R13: ffff8800063c0aa8 R14: ffff8800650c27d0 R15: 000000000000ffff
  FS:  0000000000000000(0000) GS:ffff880218180000(0000) knlGS:ffff880218180000
  CS:  e033 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000000001088 CR3: 00000002033d0000 CR4: 0000000000042660
  Call Trace:
    igrab+0x1e/0x60
    ocfs2_get_system_file_inode+0x63/0x3a0 [ocfs2]
    ocfs2_test_inode_bit+0x328/0xa00 [ocfs2]
    ocfs2_get_parent+0xba/0x3e0 [ocfs2]
    reconnect_path+0xb5/0x300
    exportfs_decode_fh+0xf6/0x2b0
    fh_verify+0x350/0x660 [nfsd]
    nfsd4_putfh+0x4d/0x60 [nfsd]
    nfsd4_proc_compound+0x3d3/0x6f0 [nfsd]
    nfsd_dispatch+0xe0/0x290 [nfsd]
    svc_process_common+0x412/0x6a0 [sunrpc]
    svc_process+0x123/0x210 [sunrpc]
    nfsd+0xff/0x170 [nfsd]
    kthread+0xcb/0xf0
    ret_from_fork+0x61/0x90
  Code: 83 c2 02 0f b7 f2 e8 18 dc 91 ff 66 90 eb bf 0f 1f 40 00 55 48 89 e5 41 56 41 55 41 54 53 0f 1f 44 00 00 48 89 fb ba 00 00 02 00 <f0> 0f c1 17 89 d0 45 31 e4 45 31 ed c1 e8 10 66 39 d0 41 89 c6
  RIP   _raw_spin_lock+0x18/0xf0
  CR2: 0000000000001088
  ---[ end trace 7264463cd1aac8f9 ]---
  Kernel panic - not syncing: Fatal exception

Link: http://lkml.kernel.org/r/20200616183829.87211-4-junxiao.bi@oracle.com
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/ocfs2/suballoc.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index fc6d25f6d4442..28cc343bf6e3b 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2863,9 +2863,12 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res)
 		goto bail;
 	}
 
-	inode_alloc_inode =
-		ocfs2_get_system_file_inode(osb, INODE_ALLOC_SYSTEM_INODE,
-					    suballoc_slot);
+	if (suballoc_slot == (u16)OCFS2_INVALID_SLOT)
+		inode_alloc_inode = ocfs2_get_system_file_inode(osb,
+			GLOBAL_INODE_ALLOC_SYSTEM_INODE, suballoc_slot);
+	else
+		inode_alloc_inode = ocfs2_get_system_file_inode(osb,
+			INODE_ALLOC_SYSTEM_INODE, suballoc_slot);
 	if (!inode_alloc_inode) {
 		/* the error code could be inaccurate, but we are not able to
 		 * get the correct one. */
-- 
2.25.1


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

* [PATCH 4.4 126/135] arm64: perf: Report the PC value in REGS_ABI_32 mode
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (124 preceding siblings ...)
  2020-06-29 15:52 ` [PATCH 4.4 125/135] ocfs2: fix panic on nfs server over ocfs2 Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 127/135] tracing: Fix event trigger to accept redundant spaces Sasha Levin
                   ` (12 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Jiping Ma, Mark Rutland, Will Deacon, Greg Kroah-Hartman

From: Jiping Ma <jiping.ma2@windriver.com>

commit 8dfe804a4031ca6ba3a3efb2048534249b64f3a5 upstream.

A 32-bit perf querying the registers of a compat task using REGS_ABI_32
will receive zeroes from w15, when it expects to find the PC.

Return the PC value for register dwarf register 15 when returning register
values for a compat task to perf.

Cc: <stable@vger.kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
Link: https://lore.kernel.org/r/1589165527-188401-1-git-send-email-jiping.ma2@windriver.com
[will: Shuffled code and added a comment]
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/kernel/perf_regs.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index 3f62b35fb6f15..815c395a1076c 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -13,15 +13,34 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
 		return 0;
 
 	/*
-	 * Compat (i.e. 32 bit) mode:
-	 * - PC has been set in the pt_regs struct in kernel_entry,
-	 * - Handle SP and LR here.
+	 * Our handling of compat tasks (PERF_SAMPLE_REGS_ABI_32) is weird, but
+	 * we're stuck with it for ABI compatability reasons.
+	 *
+	 * For a 32-bit consumer inspecting a 32-bit task, then it will look at
+	 * the first 16 registers (see arch/arm/include/uapi/asm/perf_regs.h).
+	 * These correspond directly to a prefix of the registers saved in our
+	 * 'struct pt_regs', with the exception of the PC, so we copy that down
+	 * (x15 corresponds to SP_hyp in the architecture).
+	 *
+	 * So far, so good.
+	 *
+	 * The oddity arises when a 64-bit consumer looks at a 32-bit task and
+	 * asks for registers beyond PERF_REG_ARM_MAX. In this case, we return
+	 * SP_usr, LR_usr and PC in the positions where the AArch64 SP, LR and
+	 * PC registers would normally live. The initial idea was to allow a
+	 * 64-bit unwinder to unwind a 32-bit task and, although it's not clear
+	 * how well that works in practice, somebody might be relying on it.
+	 *
+	 * At the time we make a sample, we don't know whether the consumer is
+	 * 32-bit or 64-bit, so we have to cater for both possibilities.
 	 */
 	if (compat_user_mode(regs)) {
 		if ((u32)idx == PERF_REG_ARM64_SP)
 			return regs->compat_sp;
 		if ((u32)idx == PERF_REG_ARM64_LR)
 			return regs->compat_lr;
+		if (idx == 15)
+			return regs->pc;
 	}
 
 	if ((u32)idx == PERF_REG_ARM64_SP)
-- 
2.25.1


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

* [PATCH 4.4 127/135] tracing: Fix event trigger to accept redundant spaces
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (125 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 126/135] arm64: perf: Report the PC value in REGS_ABI_32 mode Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 128/135] drm/radeon: fix fb_div check in ni_init_smc_spll_table() Sasha Levin
                   ` (11 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Masami Hiramatsu, Tom Zanussi, Steven Rostedt, Greg Kroah-Hartman

From: Masami Hiramatsu <mhiramat@kernel.org>

commit 6784beada631800f2c5afd567e5628c843362cee upstream.

Fix the event trigger to accept redundant spaces in
the trigger input.

For example, these return -EINVAL

echo " traceon" > events/ftrace/print/trigger
echo "traceon  if common_pid == 0" > events/ftrace/print/trigger
echo "disable_event:kmem:kmalloc " > events/ftrace/print/trigger

But these are hard to find what is wrong.

To fix this issue, use skip_spaces() to remove spaces
in front of actual tokens, and set NULL if there is no
token.

Link: http://lkml.kernel.org/r/159262476352.185015.5261566783045364186.stgit@devnote2

Cc: Tom Zanussi <zanussi@kernel.org>
Cc: stable@vger.kernel.org
Fixes: 85f2b08268c0 ("tracing: Add basic event trigger framework")
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 kernel/trace/trace_events_trigger.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 78346aba6980e..94fca4d687adc 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -204,11 +204,17 @@ static int event_trigger_regex_open(struct inode *inode, struct file *file)
 
 static int trigger_process_regex(struct trace_event_file *file, char *buff)
 {
-	char *command, *next = buff;
+	char *command, *next;
 	struct event_command *p;
 	int ret = -EINVAL;
 
+	next = buff = skip_spaces(buff);
 	command = strsep(&next, ": \t");
+	if (next) {
+		next = skip_spaces(next);
+		if (!*next)
+			next = NULL;
+	}
 	command = (command[0] != '!') ? command : command + 1;
 
 	mutex_lock(&trigger_cmd_mutex);
@@ -615,8 +621,14 @@ event_trigger_callback(struct event_command *cmd_ops,
 	int ret;
 
 	/* separate the trigger from the filter (t:n [if filter]) */
-	if (param && isdigit(param[0]))
+	if (param && isdigit(param[0])) {
 		trigger = strsep(&param, " \t");
+		if (param) {
+			param = skip_spaces(param);
+			if (!*param)
+				param = NULL;
+		}
+	}
 
 	trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger);
 
@@ -1185,6 +1197,11 @@ event_enable_trigger_func(struct event_command *cmd_ops,
 	trigger = strsep(&param, " \t");
 	if (!trigger)
 		return -EINVAL;
+	if (param) {
+		param = skip_spaces(param);
+		if (!*param)
+			param = NULL;
+	}
 
 	system = strsep(&trigger, ":");
 	if (!trigger)
-- 
2.25.1


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

* [PATCH 4.4 128/135] drm/radeon: fix fb_div check in ni_init_smc_spll_table()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (126 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 127/135] tracing: Fix event trigger to accept redundant spaces Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 129/135] sunrpc: fixed rollback in rpc_gssd_dummy_populate() Sasha Levin
                   ` (10 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Denis Efremov, Alex Deucher, Greg Kroah-Hartman

From: Denis Efremov <efremov@linux.com>

commit 35f760b44b1b9cb16a306bdcc7220fbbf78c4789 upstream.

clk_s is checked twice in a row in ni_init_smc_spll_table().
fb_div should be checked instead.

Fixes: 69e0b57a91ad ("drm/radeon/kms: add dpm support for cayman (v5)")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/radeon/ni_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index c3d531a1114b6..14ee1d9a56a76 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -2128,7 +2128,7 @@ static int ni_init_smc_spll_table(struct radeon_device *rdev)
 		if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT))
 			ret = -EINVAL;
 
-		if (clk_s & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT))
+		if (fb_div & ~(SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT))
 			ret = -EINVAL;
 
 		if (clk_v & ~(SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_MASK >> SMC_NISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT))
-- 
2.25.1


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

* [PATCH 4.4 129/135] sunrpc: fixed rollback in rpc_gssd_dummy_populate()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (127 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 128/135] drm/radeon: fix fb_div check in ni_init_smc_spll_table() Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 130/135] SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment() Sasha Levin
                   ` (9 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vasily Averin, Jeff Layton, Anna Schumaker, Greg Kroah-Hartman

From: Vasily Averin <vvs@virtuozzo.com>

commit b7ade38165ca0001c5a3bd5314a314abbbfbb1b7 upstream.

__rpc_depopulate(gssd_dentry) was lost on error path

cc: stable@vger.kernel.org
Fixes: commit 4b9a445e3eeb ("sunrpc: create a new dummy pipe for gssd to hold open")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sunrpc/rpc_pipe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 9103dd15511cc..12dd5cc499c1e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -1347,6 +1347,7 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
 	q.len = strlen(gssd_dummy_clnt_dir[0].name);
 	clnt_dentry = d_hash_and_lookup(gssd_dentry, &q);
 	if (!clnt_dentry) {
+		__rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1);
 		pipe_dentry = ERR_PTR(-ENOENT);
 		goto out;
 	}
-- 
2.25.1


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

* [PATCH 4.4 130/135] SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (128 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 129/135] sunrpc: fixed rollback in rpc_gssd_dummy_populate() Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 131/135] pNFS/flexfiles: Fix list corruption if the mirror count changes Sasha Levin
                   ` (8 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Chuck Lever, Anna Schumaker, Greg Kroah-Hartman

From: Chuck Lever <chuck.lever@oracle.com>

commit 89a3c9f5b9f0bcaa9aea3e8b2a616fcaea9aad78 upstream.

@subbuf is an output parameter of xdr_buf_subsegment(). A survey of
call sites shows that @subbuf is always uninitialized before
xdr_buf_segment() is invoked by callers.

There are some execution paths through xdr_buf_subsegment() that do
not set all of the fields in @subbuf, leaving some pointer fields
containing garbage addresses. Subsequent processing of that buffer
then results in a page fault.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sunrpc/xdr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
index ed9bbd383f7d3..df7ecf9584f68 100644
--- a/net/sunrpc/xdr.c
+++ b/net/sunrpc/xdr.c
@@ -1031,6 +1031,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
 		base = 0;
 	} else {
 		base -= buf->head[0].iov_len;
+		subbuf->head[0].iov_base = buf->head[0].iov_base;
 		subbuf->head[0].iov_len = 0;
 	}
 
@@ -1043,6 +1044,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
 		base = 0;
 	} else {
 		base -= buf->page_len;
+		subbuf->pages = buf->pages;
+		subbuf->page_base = 0;
 		subbuf->page_len = 0;
 	}
 
@@ -1054,6 +1057,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
 		base = 0;
 	} else {
 		base -= buf->tail[0].iov_len;
+		subbuf->tail[0].iov_base = buf->tail[0].iov_base;
 		subbuf->tail[0].iov_len = 0;
 	}
 
-- 
2.25.1


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

* [PATCH 4.4 131/135] pNFS/flexfiles: Fix list corruption if the mirror count changes
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (129 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 130/135] SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment() Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 132/135] NFSv4 fix CLOSE not waiting for direct IO compeletion Sasha Levin
                   ` (7 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Trond Myklebust, Anna Schumaker, Greg Kroah-Hartman

From: Trond Myklebust <trond.myklebust@hammerspace.com>

commit 8b04013737341442ed914b336cde866b902664ae upstream.

If the mirror count changes in the new layout we pick up inside
ff_layout_pg_init_write(), then we can end up adding the
request to the wrong mirror and corrupting the mirror->pg_list.

Fixes: d600ad1f2bdb ("NFS41: pop some layoutget errors to application")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfs/flexfilelayout/flexfilelayout.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 6506775575aa6..17771e157e929 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -855,9 +855,8 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 		goto out_mds;
 
 	/* Use a direct mapping of ds_idx to pgio mirror_idx */
-	if (WARN_ON_ONCE(pgio->pg_mirror_count !=
-	    FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg)))
-		goto out_mds;
+	if (pgio->pg_mirror_count != FF_LAYOUT_MIRROR_COUNT(pgio->pg_lseg))
+		goto out_eagain;
 
 	for (i = 0; i < pgio->pg_mirror_count; i++) {
 		ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, i, true);
@@ -869,11 +868,15 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 	}
 
 	return;
-
+out_eagain:
+	pnfs_generic_pg_cleanup(pgio);
+	pgio->pg_error = -EAGAIN;
+	return;
 out_mds:
 	pnfs_put_lseg(pgio->pg_lseg);
 	pgio->pg_lseg = NULL;
 	nfs_pageio_reset_write_mds(pgio);
+	pgio->pg_error = -EAGAIN;
 }
 
 static unsigned int
-- 
2.25.1


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

* [PATCH 4.4 132/135] NFSv4 fix CLOSE not waiting for direct IO compeletion
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (130 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 131/135] pNFS/flexfiles: Fix list corruption if the mirror count changes Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 133/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode Sasha Levin
                   ` (6 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Olga Kornievskaia, Olga Kornievskaia, Neil Brown, Anna Schumaker,
	Greg Kroah-Hartman

From: Olga Kornievskaia <olga.kornievskaia@gmail.com>

commit d03727b248d0dae6199569a8d7b629a681154633 upstream.

Figuring out the root case for the REMOVE/CLOSE race and
suggesting the solution was done by Neil Brown.

Currently what happens is that direct IO calls hold a reference
on the open context which is decremented as an asynchronous task
in the nfs_direct_complete(). Before reference is decremented,
control is returned to the application which is free to close the
file. When close is being processed, it decrements its reference
on the open_context but since directIO still holds one, it doesn't
sent a close on the wire. It returns control to the application
which is free to do other operations. For instance, it can delete a
file. Direct IO is finally releasing its reference and triggering
an asynchronous close. Which races with the REMOVE. On the server,
REMOVE can be processed before the CLOSE, failing the REMOVE with
EACCES as the file is still opened.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Suggested-by: Neil Brown <neilb@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/nfs/direct.c | 13 +++++++++----
 fs/nfs/file.c   |  1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 7789f0b9b999e..4d76e9a97538d 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -385,8 +385,6 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
 	if (write)
 		nfs_zap_mapping(inode, inode->i_mapping);
 
-	inode_dio_end(inode);
-
 	if (dreq->iocb) {
 		long res = (long) dreq->error;
 		if (!res)
@@ -396,7 +394,10 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
 
 	complete_all(&dreq->completion);
 
+	igrab(inode);
 	nfs_direct_req_release(dreq);
+	inode_dio_end(inode);
+	iput(inode);
 }
 
 static void nfs_direct_readpage_release(struct nfs_page *req)
@@ -537,8 +538,10 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq,
 	 * generic layer handle the completion.
 	 */
 	if (requested_bytes == 0) {
-		inode_dio_end(inode);
+		igrab(inode);
 		nfs_direct_req_release(dreq);
+		inode_dio_end(inode);
+		iput(inode);
 		return result < 0 ? result : -EIO;
 	}
 
@@ -939,8 +942,10 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
 	 * generic layer handle the completion.
 	 */
 	if (requested_bytes == 0) {
-		inode_dio_end(inode);
+		igrab(inode);
 		nfs_direct_req_release(dreq);
+		inode_dio_end(inode);
+		iput(inode);
 		return result < 0 ? result : -EIO;
 	}
 
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index dc875cd0e11d5..eaa6697d256ea 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -82,6 +82,7 @@ nfs_file_release(struct inode *inode, struct file *filp)
 	dprintk("NFS: release(%pD2)\n", filp);
 
 	nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
+	inode_dio_wait(inode);
 	nfs_file_clear_open_context(filp);
 	return 0;
 }
-- 
2.25.1


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

* [PATCH 4.4 133/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (131 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 132/135] NFSv4 fix CLOSE not waiting for direct IO compeletion Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 134/135] ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate() Sasha Levin
                   ` (5 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Dongdong Liu, Bjorn Helgaas, Zhou Wang, Greg Kroah-Hartman

From: Dongdong Liu <liudongdong3@huawei.com>

commit deb86999323661c019ef2740eb9d479d1e526b5c upstream.

HiSilicon Hip06/Hip07 can operate as either a Root Port or an Endpoint.  It
always advertises an MSI capability, but it can only generate MSIs when in
Endpoint mode.

The device has the same Vendor and Device IDs in both modes, so check the
Class Code and disable MSI only when operating as a Root Port.

[bhelgaas: changelog]
Fixes: 72f2ff0deb87 ("PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports")
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
Cc: stable@vger.kernel.org	# v4.11+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/quirks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index eeb771ecda15b..ab161bbeb4d41 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1623,8 +1623,8 @@ static void quirk_pcie_mch(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7520_MCH,	quirk_pcie_mch);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7320_MCH,	quirk_pcie_mch);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_E7525_MCH,	quirk_pcie_mch);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI,	0x1610,	quirk_pcie_mch);
 
+DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_HUAWEI, 0x1610, PCI_CLASS_BRIDGE_PCI, 8, quirk_pcie_mch);
 
 /*
  * It's possible for the MSI to get corrupted if shpc and acpi
-- 
2.25.1


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

* [PATCH 4.4 134/135] ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (132 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 133/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-29 15:53 ` [PATCH 4.4 135/135] Linux 4.4.229-rc1 Sasha Levin
                   ` (4 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Takashi Iwai, Greg Kroah-Hartman

From: Takashi Iwai <tiwai@suse.de>

commit 6de3c9e3f6b3eaf66859e1379b3f35dda781416b upstream.

The quirk function snd_emuusb_set_samplerate() has a NULL check for
the mixer element, but this is useless in the current code.  It used
to be a check against mixer->id_elems[unitid] but it was changed later
to the value after mixer_eleme_list_to_info() which is always non-NULL
due to the container_of() usage.

This patch fixes the check before the conversion.

While we're at it, correct a typo in the comment in the function,
too.

Fixes: 8c558076c740 ("ALSA: usb-audio: Clean up mixer element list traverse")
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/usb/mixer_quirks.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 198515f86fcc2..9646513f4b4ad 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1168,17 +1168,17 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
 {
 	struct usb_mixer_interface *mixer;
 	struct usb_mixer_elem_info *cval;
-	int unitid = 12; /* SamleRate ExtensionUnit ID */
+	int unitid = 12; /* SampleRate ExtensionUnit ID */
 
 	list_for_each_entry(mixer, &chip->mixer_list, list) {
-		cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
-		if (cval) {
+		if (mixer->id_elems[unitid]) {
+			cval = mixer_elem_list_to_info(mixer->id_elems[unitid]);
 			snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR,
 						    cval->control << 8,
 						    samplerate_id);
 			snd_usb_mixer_notify_id(mixer, unitid);
+			break;
 		}
-		break;
 	}
 }
 
-- 
2.25.1


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

* [PATCH 4.4 135/135] Linux 4.4.229-rc1
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (133 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 134/135] ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate() Sasha Levin
@ 2020-06-29 15:53 ` Sasha Levin
  2020-06-30  8:17 ` [PATCH 4.4 000/135] 4.4.229-rc1 review Naresh Kamboju
                   ` (3 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Sasha Levin @ 2020-06-29 15:53 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Sasha Levin

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 009a36b276f7e..1b4b356c1bcbe 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 4
 PATCHLEVEL = 4
-SUBLEVEL = 228
-EXTRAVERSION =
+SUBLEVEL = 229
+EXTRAVERSION = -rc1
 NAME = Blurry Fish Butt
 
 # *DOCUMENTATION*
-- 
2.25.1


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

* Re: [PATCH 4.4 000/135] 4.4.229-rc1 review
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (134 preceding siblings ...)
  2020-06-29 15:53 ` [PATCH 4.4 135/135] Linux 4.4.229-rc1 Sasha Levin
@ 2020-06-30  8:17 ` Naresh Kamboju
       [not found] ` <20200629155309.2495516-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                   ` (2 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Naresh Kamboju @ 2020-06-30  8:17 UTC (permalink / raw)
  To: Sasha Levin
  Cc: open list, linux- stable, Ben Hutchings, Linus Torvalds, patches,
	lkft-triage, Andrew Morton, Shuah Khan, Guenter Roeck

On Mon, 29 Jun 2020 at 21:23, Sasha Levin <sashal@kernel.org> wrote:
>
>
> This is the start of the stable review cycle for the 4.4.229 release.
> There are 135 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Wed 01 Jul 2020 03:53:07 PM UTC.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
>         https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.4.y&id2=v4.4.228
>
> or in the git tree and branch at:
>         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
> and the diffstat can be found below.
>
> --
> Thanks,
> Sasha

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Summary
------------------------------------------------------------------------

kernel: 4.4.229-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 136455f30e399451a9ddc66f1473d12ad4c23e3c
git describe: v4.4.228-135-g136455f30e39
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.228-135-g136455f30e39

No regressions (compared to build v4.4.228)

No fixes (compared to build v4.4.228)

Ran 18159 total tests in the following environments and test suites.

Environments
--------------
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- x15 - arm
- x86_64
- x86-kasan

Test Suites
-----------
* build
* kselftest
* kselftest/drivers
* kselftest/filesystems
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* network-basic-tests
* perf
* v4l2-compliance
* libhugetlbfs
* install-android-platform-tools-r2600
* install-android-platform-tools-r2800
* kselftest/net

Summary
------------------------------------------------------------------------

kernel: 4.4.229-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git branch: 4.4.229-rc1-hikey-20200629-759
git commit: d32bb5b0e45faf6152d5b4771924d4680e4d3e0c
git describe: 4.4.229-rc1-hikey-20200629-759
Test details: https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.229-rc1-hikey-20200629-759

No regressions (compared to build 4.4.229-rc1-hikey-20200623-756)

No fixes (compared to build 4.4.229-rc1-hikey-20200623-756)

Ran 1841 total tests in the following environments and test suites.

Environments
--------------
- hi6220-hikey - arm64

Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* kselftest/drivers
* kselftest/filesystems
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance

-- 
Linaro LKFT
https://lkft.linaro.org

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

* Re: [PATCH 4.4 000/135] 4.4.229-rc1 review
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
@ 2020-06-30  9:13     ` Jon Hunter
  2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
                       ` (137 subsequent siblings)
  138 siblings, 0 replies; 144+ messages in thread
From: Jon Hunter @ 2020-06-30  9:13 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	stable-u79uwXL29TY76Z2rM5mHXA
  Cc: torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	linux-0h96xk9xTtrk1uMJSBkQmQ, shuah-DgEjT+Ai2ygdnm+yROfE0A,
	patches-ssFOTAMYnuFg9hUCZPvPmw,
	ben.hutchings-4yDnlxn2s6sWdaTGBSpHTA,
	lkft-triage-cunTk1MwBs8s++Sfvej+rw, linux-tegra


On 29/06/2020 16:50, Sasha Levin wrote:
> 
> This is the start of the stable review cycle for the 4.4.229 release.
> There are 135 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed 01 Jul 2020 03:53:07 PM UTC.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.4.y&id2=v4.4.228
> 
> or in the git tree and branch at:
>         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
> and the diffstat can be found below.
> 
> --
> Thanks,
> Sasha


All tests are passing for Tegra ...

Test results for stable-v4.4:
    6 builds:	6 pass, 0 fail
    12 boots:	12 pass, 0 fail
    25 tests:	25 pass, 0 fail

Linux version:	4.4.229-rc1-g136455f30e39
Boards tested:	tegra124-jetson-tk1, tegra20-ventana,
                tegra30-cardhu-a04

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH 4.4 000/135] 4.4.229-rc1 review
@ 2020-06-30  9:13     ` Jon Hunter
  0 siblings, 0 replies; 144+ messages in thread
From: Jon Hunter @ 2020-06-30  9:13 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: torvalds, akpm, linux, shuah, patches, ben.hutchings,
	lkft-triage, linux-tegra


On 29/06/2020 16:50, Sasha Levin wrote:
> 
> This is the start of the stable review cycle for the 4.4.229 release.
> There are 135 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed 01 Jul 2020 03:53:07 PM UTC.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/patch/?id=linux-4.4.y&id2=v4.4.228
> 
> or in the git tree and branch at:
>         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
> and the diffstat can be found below.
> 
> --
> Thanks,
> Sasha


All tests are passing for Tegra ...

Test results for stable-v4.4:
    6 builds:	6 pass, 0 fail
    12 boots:	12 pass, 0 fail
    25 tests:	25 pass, 0 fail

Linux version:	4.4.229-rc1-g136455f30e39
Boards tested:	tegra124-jetson-tk1, tegra20-ventana,
                tegra30-cardhu-a04

Cheers
Jon

-- 
nvpublic

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

* RE: [PATCH 4.4 000/135] 4.4.229-rc1 review
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (136 preceding siblings ...)
       [not found] ` <20200629155309.2495516-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2020-06-30 13:17 ` Chris Paterson
  2020-06-30 17:20 ` Guenter Roeck
  138 siblings, 0 replies; 144+ messages in thread
From: Chris Paterson @ 2020-06-30 13:17 UTC (permalink / raw)
  To: Sasha Levin, linux-kernel, stable
  Cc: torvalds, akpm, linux, shuah, patches, ben.hutchings, lkft-triage

Hello Sasha,

> From: stable-owner@vger.kernel.org <stable-owner@vger.kernel.org> On
> Behalf Of Sasha Levin
> Sent: 29 June 2020 16:51
> 
> 
> This is the start of the stable review cycle for the 4.4.229 release.
> There are 135 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.

No build/boot issues seen for CIP configs with Linux 4.4.229-rc1 (cd92dec91c4b).

Build/test pipeline/logs: https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/pipelines/161164215
GitLab CI pipeline: https://gitlab.com/cip-project/cip-testing/linux-cip-pipelines/-/blob/master/trees/linux-4.4.y.yml
Relevant LAVA jobs: https://lava.ciplatform.org/scheduler/alljobs?length=25&search=cd92de#table

Kind regards, Chris

> 
> Responses should be made by Wed 01 Jul 2020 03:53:07 PM UTC.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-
> rc.git/patch/?id=linux-4.4.y&id2=v4.4.228
> 
> or in the git tree and branch at:
>         git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
> linux-4.4.y
> and the diffstat can be found below.
> 
> --
> Thanks,
> Sasha
> 
> -------------------------
> 
> Pseudo-Shortlog of commits:
> 
> Adam Honse (1):
>   i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets
> 
> Ahmed S. Darwish (2):
>   block: nr_sects_write(): Disable preemption on seqcount write
>   net: core: device_rename: Use rwsem instead of a seqcount
> 
> Al Cooper (1):
>   xhci: Fix enumeration issue when setting max packet size for FS
>     devices.
> 
> Al Viro (2):
>   sparc64: fix misuses of access_process_vm() in genregs32_[sg]et()
>   fix a braino in "sparc32: fix register window handling in
>     genregs32_[gs]et()"
> 
> Alex Williamson (1):
>   vfio-pci: Mask cap zero
> 
> Alexander Tsoy (1):
>   ALSA: usb-audio: Improve frames size computation
> 
> Arnd Bergmann (2):
>   dlm: remove BUG() before panic()
>   include/linux/bitops.h: avoid clang shift-count-overflow warnings
> 
> Bob Peterson (1):
>   gfs2: Allow lock_nolock mount to specify jid=X
> 
> Bryan O'Donoghue (1):
>   clk: qcom: msm8916: Fix the address location of pll->config_reg
> 
> Chen Yu (1):
>   e1000e: Do not wake up the system via WOL if device wakeup is disabled
> 
> Christophe JAILLET (1):
>   scsi: acornscsi: Fix an error handling path in acornscsi_probe()
> 
> Chuck Lever (1):
>   SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
> 
> Chuhong Yuan (1):
>   USB: ohci-sm501: Add missed iounmap() in remove
> 
> Colin Ian King (1):
>   usb: gadget: lpc32xx_udc: don't dereference ep pointer before null
>     check
> 
> Dan Carpenter (2):
>   ALSA: isa/wavefront: prevent out of bounds write in ioctl
>   usb: gadget: udc: Potential Oops in error handling code
> 
> Daniel Mack (1):
>   ALSA: usb-audio: allow clock source validity interrupts
> 
> David Christensen (1):
>   tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes
> 
> Denis Efremov (1):
>   drm/radeon: fix fb_div check in ni_init_smc_spll_table()
> 
> Dmitry Osipenko (1):
>   power: supply: smb347-charger: IRQSTAT_D is volatile
> 
> Dmitry V. Levin (1):
>   s390: fix syscall_get_error for compat processes
> 
> Dongdong Liu (2):
>   PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports
>   PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode
> 
> Emmanuel Nicolet (1):
>   ps3disk: use the default segment boundary
> 
> Eric Biggers (1):
>   crypto: algboss - don't wait during notifier callback
> 
> Eric Dumazet (1):
>   tcp: grow window for OOO packets only for SACK flows
> 
> Fabrice Gasnier (1):
>   usb: dwc2: gadget: move gadget resume after the core is in L0 state
> 
> Fan Guo (1):
>   RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads()
> 
> Fedor Tokarev (1):
>   net: sunrpc: Fix off-by-one issues in 'rpc_ntop6'
> 
> Gaurav Singh (1):
>   perf report: Fix NULL pointer dereference in
>     hists__fprintf_nr_sample_events()
> 
> Geoff Levand (1):
>   powerpc/ps3: Fix kexec shutdown hang
> 
> Gregory CLEMENT (3):
>   tty: n_gsm: Fix SOF skipping
>   tty: n_gsm: Fix waking up upper tty layer when room available
>   tty: n_gsm: Fix bogus i++ in gsm_data_kick
> 
> Huacai Chen (1):
>   drm/qxl: Use correct notify port address when creating cursor ring
> 
> Jann Horn (1):
>   lib/zlib: remove outdated and incorrect pre-increment optimization
> 
> Jason Yan (1):
>   block: Fix use-after-free in blkdev_get()
> 
> Jeffle Xu (1):
>   ext4: fix partial cluster initialization when splitting extent
> 
> Jeremy Kerr (1):
>   net: usb: ax88179_178a: fix packet alignment padding
> 
> Jiping Ma (1):
>   arm64: perf: Report the PC value in REGS_ABI_32 mode
> 
> Jiri Olsa (1):
>   kretprobe: Prevent triggering kretprobe from within kprobe_flush_task
> 
> Joakim Tjernlund (1):
>   cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip
> 
> John Stultz (1):
>   serial: amba-pl011: Make sure we initialize the port.lock spinlock
> 
> Julian Scheel (1):
>   ALSA: usb-audio: uac1: Invalidate ctl on interrupt
> 
> Julian Wiedmann (1):
>   s390/qdio: put thinint indicator after early error
> 
> Junxiao Bi (3):
>   ocfs2: load global_inode_alloc
>   ocfs2: fix value of OCFS2_INVALID_SLOT
>   ocfs2: fix panic on nfs server over ocfs2
> 
> Juri Lelli (1):
>   sched/core: Fix PI boosting between RT and DEADLINE tasks
> 
> Kai-Heng Feng (3):
>   PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
>   libata: Use per port sync for detach
>   xhci: Poll for U0 after disabling USB2 LPM
> 
> Kuppuswamy Sathyanarayanan (1):
>   drivers: base: Fix NULL pointer exception in __platform_driver_probe()
>     if a driver developer is foolish
> 
> Longfang Liu (1):
>   USB: ehci: reopen solution for Synopsys HC bug
> 
> Luis Chamberlain (1):
>   blktrace: break out of blktrace setup on concurrent calls
> 
> Lyude Paul (2):
>   drm/dp_mst: Reformat drm_dp_check_act_status() a bit
>   drm/dp_mst: Increase ACT retry timeout to 3s
> 
> Marcelo Ricardo Leitner (1):
>   sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket
> 
> Marek Szyprowski (2):
>   mfd: wm8994: Fix driver operation if loaded as modules
>   clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1
> 
> Martin Wilck (1):
>   scsi: scsi_devinfo: handle non-terminated strings
> 
> Masahiro Yamada (1):
>   kbuild: improve cc-option to clean up all temporary files
> 
> Masami Hiramatsu (3):
>   kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex
>   x86/kprobes: Avoid kretprobe recursion bug
>   tracing: Fix event trigger to accept redundant spaces
> 
> Matej Dujava (1):
>   staging: sm750fb: add missing case while setting FB_VISUAL
> 
> Mathias Nyman (1):
>   xhci: Fix incorrect EP_STATE_MASK
> 
> Minas Harutyunyan (1):
>   usb: dwc2: Postponed gadget registration to the udc class driver
> 
> Nathan Chancellor (2):
>   USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in
>     s3c2410_udc_nuke
>   ACPI: sysfs: Fix pm_profile_attr type
> 
> Naveen N. Rao (1):
>   powerpc/kprobes: Fixes for kprobe_lookup_name() on BE
> 
> Neal Cardwell (1):
>   tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT
> 
> Nicholas Piggin (1):
>   powerpc/pseries/ras: Fix FWNMI_VALID off by one
> 
> Nick Desaulniers (1):
>   elfnote: mark all .note sections SHF_ALLOC
> 
> Olga Kornievskaia (1):
>   NFSv4 fix CLOSE not waiting for direct IO compeletion
> 
> Oliver Neukum (1):
>   usblp: poison URBs upon disconnect
> 
> Pingfan Liu (1):
>   powerpc/crashkernel: Take "mem=" option into account
> 
> Qais Yousef (3):
>   usb/ohci-platform: Fix a warning when hibernating
>   usb/xhci-plat: Set PM runtime as active on resume
>   usb/ehci-platform: Set PM runtime as active on resume
> 
> Qian Cai (1):
>   vfio/pci: fix memory leaks in alloc_perm_bits()
> 
> Qiushi Wu (3):
>   usb: gadget: fix potential double-free in m66592_probe.
>   scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
>   efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
> 
> Raghavendra Rao Ananta (1):
>   tty: hvc: Fix data abort due to race in hvc_open
> 
> Ridge Kennedy (1):
>   l2tp: Allow duplicate session creation with UDP
> 
> Rikard Falkeborn (1):
>   clk: sunxi: Fix incorrect usage of round_down()
> 
> Russell King (3):
>   i2c: pxa: clear all master action bits in i2c_pxa_stop_message()
>   i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
>   netfilter: ipset: fix unaligned atomic access
> 
> Sasha Levin (1):
>   Linux 4.4.229-rc1
> 
> Simon Arlott (1):
>   scsi: sr: Fix sr_probe() missing deallocate of device minor
> 
> Stafford Horne (1):
>   openrisc: Fix issue with argument clobbering for clone/fork
> 
> Stefan Riedmueller (1):
>   watchdog: da9062: No need to ping manually before setting timeout
> 
> Suganath Prabu S (1):
>   scsi: mpt3sas: Fix double free warnings
> 
> Taehee Yoo (3):
>   ip_tunnel: fix use-after-free in ip_tunnel_lookup()
>   ip6_gre: fix use-after-free in ip6gre_tunnel_lookup()
>   net: core: reduce recursion limit value
> 
> Takashi Iwai (3):
>   ALSA: usb-audio: Clean up mixer element list traverse
>   ALSA: usb-audio: Fix OOB access of mixer element list
>   ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()
> 
> Tang Bin (2):
>   USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe()
>   usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()
> 
> Tariq Toukan (1):
>   net: Do not clear the sock TX queue in sk_set_socket()
> 
> Tero Kristo (1):
>   clk: ti: composite: fix memory leak
> 
> Thomas Gleixner (1):
>   sched/rt, net: Use CONFIG_PREEMPTION.patch
> 
> Toke Høiland-Jørgensen (1):
>   net: Revert "pkt_sched: fq: use proper locking in fq_dump_stats()"
> 
> Tom Rix (1):
>   selinux: fix double free
> 
> Tomasz Meresiński (1):
>   usb: add USB_QUIRK_DELAY_INIT for Logitech C922
> 
> Trond Myklebust (1):
>   pNFS/flexfiles: Fix list corruption if the mirror count changes
> 
> Tyrel Datwyler (1):
>   scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM
> 
> Valentin Longchamp (1):
>   net: sched: export __netdev_watchdog_up()
> 
> Vasily Averin (1):
>   sunrpc: fixed rollback in rpc_gssd_dummy_populate()
> 
> Viacheslav Dubeyko (1):
>   scsi: qla2xxx: Fix issue with adapter's stopping state
> 
> Waiman Long (1):
>   mm/slab: use memzero_explicit() in kzfree()
> 
> Wang Hai (2):
>   yam: fix possible memory leak in yam_init_driver
>   mld: fix memory leak in ipv6_mc_destroy_dev()
> 
> Wolfram Sang (1):
>   drm: encoder_slave: fix refcouting error for modules
> 
> Xiaoyao Li (1):
>   KVM: X86: Fix MSR range of APIC registers in X2APIC mode
> 
> Xiyu Yang (3):
>   scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event
>   nfsd: Fix svc_xprt refcnt leak when setup callback client failed
>   ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed
> 
> Yang Yingliang (1):
>   net: fix memleak in register_netdevice()
> 
> Yick W. Tse (1):
>   ALSA: usb-audio: add quirk for Denon DCD-1500RE
> 
> Zekun Shen (1):
>   net: alx: fix race condition in alx_remove
> 
> Zhang Xiaoxu (2):
>   cifs/smb3: Fix data inconsistent when punch hole
>   cifs/smb3: Fix data inconsistent when zero file range
> 
> Zhiqiang Liu (1):
>   bcache: fix potential deadlock problem in btree_gc_coalesce
> 
> ashimida (1):
>   mksysmap: Fix the mismatch of '.L' symbols in System.map
> 
> guodeqing (1):
>   net: Fix the arp error in some cases
> 
> tannerlove (1):
>   selftests/net: in timestamping, strncpy needs to preserve null byte
> 
> yu kuai (1):
>   ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram()
> 
>  Makefile                                      |  4 +-
>  arch/arm/mach-imx/pm-imx5.c                   |  6 +-
>  arch/arm64/kernel/perf_regs.c                 | 25 ++++-
>  arch/openrisc/kernel/entry.S                  |  4 +-
>  arch/powerpc/include/asm/kprobes.h            |  3 +-
>  arch/powerpc/kernel/machine_kexec.c           |  8 +-
>  arch/powerpc/platforms/ps3/mm.c               | 22 +++--
>  arch/powerpc/platforms/pseries/ras.c          |  5 +-
>  arch/s390/include/asm/syscall.h               | 12 ++-
>  arch/sparc/kernel/ptrace_32.c                 |  9 +-
>  arch/sparc/kernel/ptrace_64.c                 | 13 +--
>  arch/x86/kernel/kprobes/core.c                | 12 ++-
>  arch/x86/kvm/x86.c                            |  4 +-
>  crypto/algboss.c                              |  2 -
>  drivers/acpi/sysfs.c                          |  4 +-
>  drivers/ata/libata-core.c                     | 11 +--
>  drivers/base/platform.c                       |  2 +
>  drivers/block/ps3disk.c                       |  1 -
>  drivers/clk/qcom/gcc-msm8916.c                |  8 +-
>  drivers/clk/samsung/clk-exynos5433.c          |  3 +-
>  drivers/clk/sunxi/clk-sunxi.c                 |  2 +-
>  drivers/clk/ti/composite.c                    |  1 +
>  drivers/firmware/efi/esrt.c                   |  2 +-
>  drivers/gpu/drm/drm_dp_mst_topology.c         | 58 +++++++-----
>  drivers/gpu/drm/drm_encoder_slave.c           |  5 +-
>  drivers/gpu/drm/qxl/qxl_kms.c                 |  2 +-
>  drivers/gpu/drm/radeon/ni_dpm.c               |  2 +-
>  drivers/i2c/busses/i2c-piix4.c                |  3 +-
>  drivers/i2c/busses/i2c-pxa.c                  | 13 +--
>  drivers/infiniband/core/mad.c                 |  1 +
>  drivers/md/bcache/btree.c                     |  8 +-
>  drivers/mfd/wm8994-core.c                     |  1 +
>  drivers/net/ethernet/atheros/alx/main.c       |  9 +-
>  drivers/net/ethernet/broadcom/tg3.c           |  4 +-
>  drivers/net/ethernet/intel/e1000e/netdev.c    | 14 ++-
>  drivers/net/hamradio/yam.c                    |  1 +
>  drivers/net/usb/ax88179_178a.c                | 11 ++-
>  drivers/pci/pcie/aspm.c                       | 10 --
>  drivers/pci/quirks.c                          |  1 +
>  drivers/power/smb347-charger.c                |  1 +
>  drivers/s390/cio/qdio.h                       |  1 -
>  drivers/s390/cio/qdio_setup.c                 |  1 -
>  drivers/s390/cio/qdio_thinint.c               | 14 +--
>  drivers/scsi/arm/acornscsi.c                  |  4 +-
>  drivers/scsi/ibmvscsi/ibmvscsi.c              |  2 +
>  drivers/scsi/iscsi_boot_sysfs.c               |  2 +-
>  drivers/scsi/lpfc/lpfc_els.c                  |  2 +
>  drivers/scsi/mpt3sas/mpt3sas_base.c           |  2 +
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c            |  2 +
>  drivers/scsi/scsi_devinfo.c                   |  5 +-
>  drivers/scsi/sr.c                             |  6 +-
>  drivers/staging/sm750fb/sm750.c               |  1 +
>  drivers/tty/hvc/hvc_console.c                 | 16 +++-
>  drivers/tty/n_gsm.c                           | 26 +++---
>  drivers/tty/serial/amba-pl011.c               |  1 +
>  drivers/usb/class/cdc-acm.c                   |  2 +
>  drivers/usb/class/usblp.c                     |  5 +-
>  drivers/usb/core/quirks.c                     |  3 +-
>  drivers/usb/dwc2/core_intr.c                  |  7 +-
>  drivers/usb/dwc2/gadget.c                     |  6 --
>  drivers/usb/dwc2/platform.c                   | 11 +++
>  drivers/usb/gadget/udc/lpc32xx_udc.c          | 11 ++-
>  drivers/usb/gadget/udc/m66592-udc.c           |  2 +-
>  drivers/usb/gadget/udc/mv_udc_core.c          |  3 +-
>  drivers/usb/gadget/udc/s3c2410_udc.c          |  4 -
>  drivers/usb/host/ehci-exynos.c                |  5 +-
>  drivers/usb/host/ehci-mxc.c                   |  2 +
>  drivers/usb/host/ehci-pci.c                   |  7 ++
>  drivers/usb/host/ehci-platform.c              |  5 +
>  drivers/usb/host/ohci-platform.c              |  5 +
>  drivers/usb/host/ohci-sm501.c                 |  1 +
>  drivers/usb/host/xhci-plat.c                  | 11 ++-
>  drivers/usb/host/xhci.c                       |  4 +
>  drivers/usb/host/xhci.h                       |  2 +-
>  drivers/vfio/pci/vfio_pci_config.c            | 14 ++-
>  drivers/watchdog/da9062_wdt.c                 |  5 -
>  fs/block_dev.c                                | 12 ++-
>  fs/cifs/smb2ops.c                             | 12 +++
>  fs/dlm/dlm_internal.h                         |  1 -
>  fs/ext4/extents.c                             |  2 +-
>  fs/gfs2/ops_fstype.c                          |  2 +-
>  fs/nfs/direct.c                               | 13 ++-
>  fs/nfs/file.c                                 |  1 +
>  fs/nfs/flexfilelayout/flexfilelayout.c        | 11 ++-
>  fs/nfsd/nfs4callback.c                        |  2 +
>  fs/ocfs2/ocfs2_fs.h                           |  4 +-
>  fs/ocfs2/suballoc.c                           |  9 +-
>  include/linux/bitops.h                        |  2 +-
>  include/linux/elfnote.h                       |  2 +-
>  include/linux/genhd.h                         |  2 +
>  include/linux/kprobes.h                       |  4 +
>  include/linux/libata.h                        |  3 +
>  include/linux/pci_ids.h                       |  2 +
>  include/net/sctp/constants.h                  |  8 +-
>  include/net/sock.h                            |  1 -
>  kernel/kprobes.c                              | 27 +++++-
>  kernel/sched/core.c                           |  3 +-
>  kernel/trace/blktrace.c                       | 13 +++
>  kernel/trace/trace_events_trigger.c           | 21 ++++-
>  lib/zlib_inflate/inffast.c                    | 91 +++++++------------
>  mm/slab_common.c                              |  2 +-
>  net/core/dev.c                                | 49 +++++-----
>  net/core/sock.c                               |  2 +
>  net/ipv4/fib_semantics.c                      |  2 +-
>  net/ipv4/ip_tunnel.c                          | 14 +--
>  net/ipv4/tcp_cubic.c                          |  2 +
>  net/ipv4/tcp_input.c                          | 12 ++-
>  net/ipv6/ip6_gre.c                            |  9 +-
>  net/ipv6/mcast.c                              |  1 +
>  net/l2tp/l2tp_core.c                          |  7 +-
>  net/netfilter/ipset/ip_set_core.c             |  2 +
>  net/sched/sch_fq.c                            | 32 +++----
>  net/sched/sch_generic.c                       |  1 +
>  net/sctp/associola.c                          |  5 +-
>  net/sctp/bind_addr.c                          |  1 +
>  net/sctp/protocol.c                           |  1 +
>  net/sunrpc/addr.c                             |  4 +-
>  net/sunrpc/rpc_pipe.c                         |  1 +
>  net/sunrpc/xdr.c                              |  4 +
>  scripts/Kbuild.include                        | 11 ++-
>  scripts/mksysmap                              |  2 +-
>  security/selinux/ss/services.c                |  4 +
>  sound/isa/wavefront/wavefront_synth.c         |  8 +-
>  sound/soc/fsl/fsl_asrc_dma.c                  |  1 +
>  sound/usb/card.h                              |  4 +
>  sound/usb/endpoint.c                          | 43 ++++++++-
>  sound/usb/endpoint.h                          |  1 +
>  sound/usb/mixer.c                             | 41 ++++++---
>  sound/usb/mixer.h                             | 15 ++-
>  sound/usb/mixer_quirks.c                      | 11 ++-
>  sound/usb/mixer_scarlett.c                    |  6 +-
>  sound/usb/pcm.c                               |  2 +
>  sound/usb/quirks.c                            |  1 +
>  tools/perf/builtin-report.c                   |  3 +-
>  .../networking/timestamping/timestamping.c    | 10 +-
>  135 files changed, 699 insertions(+), 370 deletions(-)
> 
> --
> 2.25.1


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

* Re: [PATCH 4.4 000/135] 4.4.229-rc1 review
  2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
                   ` (137 preceding siblings ...)
  2020-06-30 13:17 ` Chris Paterson
@ 2020-06-30 17:20 ` Guenter Roeck
  138 siblings, 0 replies; 144+ messages in thread
From: Guenter Roeck @ 2020-06-30 17:20 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, torvalds, akpm, shuah, patches,
	ben.hutchings, lkft-triage

On Mon, Jun 29, 2020 at 11:50:54AM -0400, Sasha Levin wrote:
> 
> This is the start of the stable review cycle for the 4.4.229 release.
> There are 135 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Wed 01 Jul 2020 03:53:07 PM UTC.
> Anything received after that time might be too late.
> 

Build results:
	total: 169 pass: 169 fail: 0
Qemu test results:
	total: 331 pass: 331 fail: 0

Guenter

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

end of thread, other threads:[~2020-06-30 17:20 UTC | newest]

Thread overview: 144+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 15:50 [PATCH 4.4 000/135] 4.4.229-rc1 review Sasha Levin
2020-06-29 15:50 ` [PATCH 4.4 001/135] s390: fix syscall_get_error for compat processes Sasha Levin
2020-06-29 15:50 ` [PATCH 4.4 002/135] clk: sunxi: Fix incorrect usage of round_down() Sasha Levin
2020-06-29 15:50 ` [PATCH 4.4 003/135] i2c: piix4: Detect secondary SMBus controller on AMD AM4 chipsets Sasha Levin
2020-06-29 15:50 ` [PATCH 4.4 004/135] clk: qcom: msm8916: Fix the address location of pll->config_reg Sasha Levin
2020-06-29 15:50 ` [PATCH 4.4 005/135] ALSA: isa/wavefront: prevent out of bounds write in ioctl Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 006/135] scsi: qla2xxx: Fix issue with adapter's stopping state Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 007/135] i2c: pxa: clear all master action bits in i2c_pxa_stop_message() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 008/135] usblp: poison URBs upon disconnect Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 009/135] ps3disk: use the default segment boundary Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 010/135] vfio/pci: fix memory leaks in alloc_perm_bits() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 011/135] mfd: wm8994: Fix driver operation if loaded as modules Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 012/135] scsi: lpfc: Fix lpfc_nodelist leak when processing unsolicited event Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 013/135] nfsd: Fix svc_xprt refcnt leak when setup callback client failed Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 014/135] powerpc/crashkernel: Take "mem=" option into account Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 015/135] yam: fix possible memory leak in yam_init_driver Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 016/135] mksysmap: Fix the mismatch of '.L' symbols in System.map Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 017/135] scsi: sr: Fix sr_probe() missing deallocate of device minor Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 018/135] scsi: ibmvscsi: Don't send host info in adapter info MAD after LPM Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 019/135] ALSA: usb-audio: Improve frames size computation Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 020/135] s390/qdio: put thinint indicator after early error Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 021/135] tty: hvc: Fix data abort due to race in hvc_open Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 022/135] staging: sm750fb: add missing case while setting FB_VISUAL Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 023/135] i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 024/135] serial: amba-pl011: Make sure we initialize the port.lock spinlock Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 025/135] drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 026/135] PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 027/135] power: supply: smb347-charger: IRQSTAT_D is volatile Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 028/135] scsi: mpt3sas: Fix double free warnings Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 029/135] dlm: remove BUG() before panic() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 030/135] clk: ti: composite: fix memory leak Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 031/135] tty: n_gsm: Fix SOF skipping Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 032/135] tty: n_gsm: Fix waking up upper tty layer when room available Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 033/135] powerpc/pseries/ras: Fix FWNMI_VALID off by one Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 034/135] powerpc/ps3: Fix kexec shutdown hang Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 035/135] vfio-pci: Mask cap zero Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 036/135] usb/ohci-platform: Fix a warning when hibernating Sasha Levin
2020-06-29 15:51   ` Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 037/135] USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 038/135] tty: n_gsm: Fix bogus i++ in gsm_data_kick Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 039/135] clk: samsung: exynos5433: Add IGNORE_UNUSED flag to sclk_i2s1 Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 040/135] watchdog: da9062: No need to ping manually before setting timeout Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 041/135] usb: dwc2: gadget: move gadget resume after the core is in L0 state Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 042/135] USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 043/135] usb: gadget: lpc32xx_udc: don't dereference ep pointer before null check Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 044/135] usb: gadget: fix potential double-free in m66592_probe Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 045/135] net: sunrpc: Fix off-by-one issues in 'rpc_ntop6' Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 046/135] ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 047/135] openrisc: Fix issue with argument clobbering for clone/fork Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 048/135] gfs2: Allow lock_nolock mount to specify jid=X Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 049/135] scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 050/135] lib/zlib: remove outdated and incorrect pre-increment optimization Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 051/135] include/linux/bitops.h: avoid clang shift-count-overflow warnings Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 052/135] elfnote: mark all .note sections SHF_ALLOC Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 053/135] selftests/net: in timestamping, strncpy needs to preserve null byte Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 054/135] scsi: acornscsi: Fix an error handling path in acornscsi_probe() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 055/135] usb/xhci-plat: Set PM runtime as active on resume Sasha Levin
2020-06-29 15:51   ` Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 056/135] usb/ehci-platform: " Sasha Levin
2020-06-29 15:51   ` Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 057/135] perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 058/135] bcache: fix potential deadlock problem in btree_gc_coalesce Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 059/135] block: Fix use-after-free in blkdev_get() Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 060/135] libata: Use per port sync for detach Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 061/135] drm: encoder_slave: fix refcouting error for modules Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 062/135] drm/dp_mst: Reformat drm_dp_check_act_status() a bit Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 063/135] drm/qxl: Use correct notify port address when creating cursor ring Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 064/135] selinux: fix double free Sasha Levin
2020-06-29 15:51 ` [PATCH 4.4 065/135] ext4: fix partial cluster initialization when splitting extent Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 066/135] drm/dp_mst: Increase ACT retry timeout to 3s Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 067/135] sparc64: fix misuses of access_process_vm() in genregs32_[sg]et() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 068/135] block: nr_sects_write(): Disable preemption on seqcount write Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 069/135] crypto: algboss - don't wait during notifier callback Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 070/135] kprobes: Fix to protect kick_kprobe_optimizer() by kprobe_mutex Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 071/135] powerpc/kprobes: Fixes for kprobe_lookup_name() on BE Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 072/135] x86/kprobes: Avoid kretprobe recursion bug Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 073/135] kretprobe: Prevent triggering kretprobe from within kprobe_flush_task Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 074/135] e1000e: Do not wake up the system via WOL if device wakeup is disabled Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 075/135] sched/rt, net: Use CONFIG_PREEMPTION.patch Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 076/135] net: core: device_rename: Use rwsem instead of a seqcount Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 077/135] net: Revert "pkt_sched: fq: use proper locking in fq_dump_stats()" Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 078/135] scsi: scsi_devinfo: handle non-terminated strings Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 079/135] l2tp: Allow duplicate session creation with UDP Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 080/135] net: sched: export __netdev_watchdog_up() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 081/135] fix a braino in "sparc32: fix register window handling in genregs32_[gs]et()" Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 082/135] net: fix memleak in register_netdevice() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 083/135] net: usb: ax88179_178a: fix packet alignment padding Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 084/135] tg3: driver sleeps indefinitely when EEH errors exceed eeh_max_freezes Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 085/135] ip_tunnel: fix use-after-free in ip_tunnel_lookup() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 086/135] tcp_cubic: fix spurious HYSTART_DELAY exit upon drop in min RTT Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 087/135] ip6_gre: fix use-after-free in ip6gre_tunnel_lookup() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 088/135] tcp: grow window for OOO packets only for SACK flows Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 089/135] sctp: Don't advertise IPv4 addresses if ipv6only is set on the socket Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 090/135] net: Fix the arp error in some cases Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 091/135] net: Do not clear the sock TX queue in sk_set_socket() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 092/135] net: core: reduce recursion limit value Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 093/135] mld: fix memory leak in ipv6_mc_destroy_dev() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 094/135] USB: ohci-sm501: Add missed iounmap() in remove Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 095/135] usb: dwc2: Postponed gadget registration to the udc class driver Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 096/135] usb: add USB_QUIRK_DELAY_INIT for Logitech C922 Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 097/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 Root Ports Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 098/135] USB: ehci: reopen solution for Synopsys HC bug Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 099/135] usb: host: ehci-exynos: Fix error check in exynos_ehci_probe() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 100/135] ALSA: usb-audio: add quirk for Denon DCD-1500RE Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 101/135] xhci: Fix incorrect EP_STATE_MASK Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 102/135] xhci: Fix enumeration issue when setting max packet size for FS devices Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 103/135] cdc-acm: Add DISABLE_ECHO quirk for Microchip/SMSC chip Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 104/135] ALSA: usb-audio: uac1: Invalidate ctl on interrupt Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 105/135] ALSA: usb-audio: allow clock source validity interrupts Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 106/135] ALSA: usb-audio: Clean up mixer element list traverse Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 107/135] ALSA: usb-audio: Fix OOB access of mixer element list Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 108/135] xhci: Poll for U0 after disabling USB2 LPM Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 109/135] cifs/smb3: Fix data inconsistent when punch hole Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 110/135] cifs/smb3: Fix data inconsistent when zero file range Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 111/135] efi/esrt: Fix reference count leak in esre_create_sysfs_entry Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 112/135] RDMA/mad: Fix possible memory leak in ib_mad_post_receive_mads() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 113/135] ARM: imx5: add missing put_device() call in imx_suspend_alloc_ocram() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 114/135] usb: gadget: udc: Potential Oops in error handling code Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 115/135] netfilter: ipset: fix unaligned atomic access Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 116/135] sched/core: Fix PI boosting between RT and DEADLINE tasks Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 117/135] net: alx: fix race condition in alx_remove Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 118/135] kbuild: improve cc-option to clean up all temporary files Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 119/135] blktrace: break out of blktrace setup on concurrent calls Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 120/135] ACPI: sysfs: Fix pm_profile_attr type Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 121/135] KVM: X86: Fix MSR range of APIC registers in X2APIC mode Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 122/135] mm/slab: use memzero_explicit() in kzfree() Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 123/135] ocfs2: load global_inode_alloc Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 124/135] ocfs2: fix value of OCFS2_INVALID_SLOT Sasha Levin
2020-06-29 15:52 ` [PATCH 4.4 125/135] ocfs2: fix panic on nfs server over ocfs2 Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 126/135] arm64: perf: Report the PC value in REGS_ABI_32 mode Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 127/135] tracing: Fix event trigger to accept redundant spaces Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 128/135] drm/radeon: fix fb_div check in ni_init_smc_spll_table() Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 129/135] sunrpc: fixed rollback in rpc_gssd_dummy_populate() Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 130/135] SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment() Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 131/135] pNFS/flexfiles: Fix list corruption if the mirror count changes Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 132/135] NFSv4 fix CLOSE not waiting for direct IO compeletion Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 133/135] PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 134/135] ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate() Sasha Levin
2020-06-29 15:53 ` [PATCH 4.4 135/135] Linux 4.4.229-rc1 Sasha Levin
2020-06-30  8:17 ` [PATCH 4.4 000/135] 4.4.229-rc1 review Naresh Kamboju
     [not found] ` <20200629155309.2495516-1-sashal-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-06-30  9:13   ` Jon Hunter
2020-06-30  9:13     ` Jon Hunter
2020-06-30 13:17 ` Chris Paterson
2020-06-30 17:20 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.