Skip to content
Snippets Groups Projects
  1. Jan 29, 2020
    • Andrey Shvetsov's avatar
      UPSTREAM: staging: most: net: fix buffer overflow · 075851e5
      Andrey Shvetsov authored
      
      If the length of the socket buffer is 0xFFFFFFFF (max size for an
      unsigned int), then payload_len becomes 0xFFFFFFF1 after subtracting 14
      (ETH_HLEN).  Then, mdp_len is set to payload_len + 16 (MDP_HDR_LEN)
      which overflows and results in a value of 2.  These values for
      payload_len and mdp_len will pass current buffer size checks.
      
      This patch checks if derived from skb->len sum may overflow.
      
      The check is based on the following idea:
      
      For any `unsigned V1, V2` and derived `unsigned SUM = V1 + V2`,
      `V1 + V2` overflows iif `SUM < V1`.
      
      Bug: 143560807
      Reported-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrey Shvetsov <andrey.shvetsov@k2l.de>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200116172238.6046-1-andrey.shvetsov@microchip.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      (cherry picked from commit 4d1356ac)
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      Change-Id: I71197b2963735ba181314332737fc0c1ca2cab96
    • Takashi Iwai's avatar
      UPSTREAM: ALSA: pcm: Add missing copy ops check before clearing buffer · d63fdf31
      Takashi Iwai authored
      
      [ this is a fix specific to 4.4.y and 4.9.y stable trees;
        4.14.y and older already contain the right fix ]
      
      The stable 4.4.y and 4.9.y backports of the upstream commit
      add9d56d ("ALSA: pcm: Avoid possible info leaks from PCM stream
      buffers") dropped the check of substream->ops->copy_user as copy_user
      is a new member that isn't present in the older kernels.
      Although upstream drivers should work without this NULL check, it may
      cause a regression with a downstream driver that sets some
      inaccessible address to runtime->dma_area, leading to a crash at
      worst.
      
      Since such drivers must have ops->copy member on older kernels instead
      of ops->copy_user, this patch adds the missing check of ops->copy for
      fixing the regression.
      
      Change-Id: Ib7b856364a75695268f2dfcf3315d92478508ada
      Reported-and-tested-by: default avatarAndreas Schneider <asn@cryptomilk.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      d63fdf31
    • Greg Kroah-Hartman's avatar
      Merge 4.4.212 into android-4.4-o · e7648ad2
      Greg Kroah-Hartman authored
      
      Changes in 4.4.212
      	xfs: Sanity check flags of Q_XQUOTARM call
      	powerpc/archrandom: fix arch_get_random_seed_int()
      	mt7601u: fix bbp version check in mt7601u_wait_bbp_ready
      	drm/virtio: fix bounds check in virtio_gpu_cmd_get_capset()
      	ALSA: hda: fix unused variable warning
      	ALSA: usb-audio: update quirk for B&W PX to remove microphone
      	staging: comedi: ni_mio_common: protect register write overflow
      	pcrypt: use format specifier in kobject_add
      	exportfs: fix 'passing zero to ERR_PTR()' warning
      	drm/dp_mst: Skip validating ports during destruction, just ref
      	pinctrl: sh-pfc: r8a7740: Add missing REF125CK pin to gether_gmii group
      	pinctrl: sh-pfc: r8a7740: Add missing LCD0 marks to lcd0_data24_1 group
      	pinctrl: sh-pfc: r8a7791: Remove bogus ctrl marks from qspi_data4_b group
      	pinctrl: sh-pfc: r8a7791: Remove bogus marks from vin1_b_data18 group
      	pinctrl: sh-pfc: sh73a0: Add missing TO pin to tpu4_to3 group
      	pinctrl: sh-pfc: r8a7794: Remove bogus IPSR9 field
      	pinctrl: sh-pfc: sh7734: Add missing IPSR11 field
      	pinctrl: sh-pfc: sh7269: Add missing PCIOR0 field
      	pinctrl: sh-pfc: sh7734: Remove bogus IPSR10 value
      	Input: nomadik-ske-keypad - fix a loop timeout test
      	clk: highbank: fix refcount leak in hb_clk_init()
      	clk: qoriq: fix refcount leak in clockgen_init()
      	clk: socfpga: fix refcount leak
      	clk: samsung: exynos4: fix refcount leak in exynos4_get_xom()
      	clk: imx6q: fix refcount leak in imx6q_clocks_init()
      	clk: imx6sx: fix refcount leak in imx6sx_clocks_init()
      	clk: imx7d: fix refcount leak in imx7d_clocks_init()
      	clk: vf610: fix refcount leak in vf610_clocks_init()
      	clk: armada-370: fix refcount leak in a370_clk_init()
      	clk: kirkwood: fix refcount leak in kirkwood_clk_init()
      	clk: armada-xp: fix refcount leak in axp_clk_init()
      	IB/usnic: Fix out of bounds index check in query pkey
      	RDMA/ocrdma: Fix out of bounds index check in query pkey
      	media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL
      	crypto: tgr192 - fix unaligned memory access
      	ASoC: imx-sgtl5000: put of nodes if finding codec fails
      	rtc: cmos: ignore bogus century byte
      	tty: ipwireless: Fix potential NULL pointer dereference
      	rtc: ds1672: fix unintended sign extension
      	rtc: 88pm860x: fix unintended sign extension
      	rtc: 88pm80x: fix unintended sign extension
      	rtc: pm8xxx: fix unintended sign extension
      	fbdev: chipsfb: remove set but not used variable 'size'
      	pinctrl: sh-pfc: emev2: Add missing pinmux functions
      	pinctrl: sh-pfc: r8a7791: Fix scifb2_data_c pin group
      	pinctrl: sh-pfc: sh73a0: Fix fsic_spdif pin groups
      	block: don't use bio->bi_vcnt to figure out segment number
      	vfio_pci: Enable memory accesses before calling pci_map_rom
      	cdc-wdm: pass return value of recover_from_urb_loss
      	drm/nouveau/bios/ramcfg: fix missing parentheses when calculating RON
      	drm/nouveau/pmu: don't print reply values if exec is false
      	ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of()
      	fs/nfs: Fix nfs_parse_devname to not modify it's argument
      	clocksource/drivers/sun5i: Fail gracefully when clock rate is unavailable
      	ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used
      	regulator: wm831x-dcdc: Fix list of wm831x_dcdc_ilim from mA to uA
      	nios2: ksyms: Add missing symbol exports
      	scsi: megaraid_sas: reduce module load time
      	xen, cpu_hotplug: Prevent an out of bounds access
      	net: sh_eth: fix a missing check of of_get_phy_mode
      	media: ivtv: update *pos correctly in ivtv_read_pos()
      	media: cx18: update *pos correctly in cx18_read_pos()
      	media: wl128x: Fix an error code in fm_download_firmware()
      	media: cx23885: check allocation return
      	jfs: fix bogus variable self-initialization
      	m68k: mac: Fix VIA timer counter accesses
      	ARM: OMAP2+: Fix potentially uninitialized return value for _setup_reset()
      	media: davinci-isif: avoid uninitialized variable use
      	spi: tegra114: clear packed bit for unpacked mode
      	spi: tegra114: fix for unpacked mode transfers
      	soc/fsl/qe: Fix an error code in qe_pin_request()
      	spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios
      	ehea: Fix a copy-paste err in ehea_init_port_res
      	scsi: qla2xxx: Unregister chrdev if module initialization fails
      	ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data"
      	hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses
      	tipc: set sysctl_tipc_rmem and named_timeout right range
      	powerpc: vdso: Make vdso32 installation conditional in vdso_install
      	media: ov2659: fix unbalanced mutex_lock/unlock
      	6lowpan: Off by one handling ->nexthdr
      	dmaengine: axi-dmac: Don't check the number of frames for alignment
      	ALSA: usb-audio: Handle the error from snd_usb_mixer_apply_create_quirk()
      	packet: in recvmsg msg_name return at least sizeof sockaddr_ll
      	ASoC: fix valid stream condition
      	IB/mlx5: Add missing XRC options to QP optional params mask
      	iommu/vt-d: Make kernel parameter igfx_off work with vIOMMU
      	media: omap_vout: potential buffer overflow in vidioc_dqbuf()
      	media: davinci/vpbe: array underflow in vpbe_enum_outputs()
      	platform/x86: alienware-wmi: printing the wrong error code
      	netfilter: ebtables: CONFIG_COMPAT: reject trailing data after last rule
      	ARM: riscpc: fix lack of keyboard interrupts after irq conversion
      	kdb: do a sanity check on the cpu in kdb_per_cpu()
      	backlight: lm3630a: Return 0 on success in update_status functions
      	thermal: cpu_cooling: Actually trace CPU load in thermal_power_cpu_get_power
      	spi: spi-fsl-spi: call spi_finalize_current_message() at the end
      	misc: sgi-xp: Properly initialize buf in xpc_get_rsvd_page_pa
      	iommu: Use right function to get group for device
      	signal/cifs: Fix cifs_put_tcp_session to call send_sig instead of force_sig
      	inet: frags: call inet_frags_fini() after unregister_pernet_subsys()
      	media: vivid: fix incorrect assignment operation when setting video mode
      	powerpc/cacheinfo: add cacheinfo_teardown, cacheinfo_rebuild
      	drm/msm/mdp5: Fix mdp5_cfg_init error return
      	net/af_iucv: always register net_device notifier
      	ASoC: ti: davinci-mcasp: Fix slot mask settings when using multiple AXRs
      	rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
      	drm/msm/a3xx: remove TPL1 regs from snapshot
      	iommu/amd: Make iommu_disable safer
      	mfd: intel-lpss: Release IDA resources
      	devres: allow const resource arguments
      	net: pasemi: fix an use-after-free in pasemi_mac_phy_init()
      	scsi: libfc: fix null pointer dereference on a null lport
      	libertas_tf: Use correct channel range in lbtf_geo_init
      	usb: host: xhci-hub: fix extra endianness conversion
      	mic: avoid statically declaring a 'struct device'.
      	x86/kgbd: Use NMI_VECTOR not APIC_DM_NMI
      	ALSA: aoa: onyx: always initialize register read value
      	cifs: fix rmmod regression in cifs.ko caused by force_sig changes
      	crypto: caam - free resources in case caam_rng registration failed
      	ext4: set error return correctly when ext4_htree_store_dirent fails
      	ASoC: es8328: Fix copy-paste error in es8328_right_line_controls
      	ASoC: cs4349: Use PM ops 'cs4349_runtime_pm'
      	ASoC: wm8737: Fix copy-paste error in wm8737_snd_controls
      	signal: Allow cifs and drbd to receive their terminating signals
      	dmaengine: dw: platform: Switch to acpi_dma_controller_register()
      	mac80211: minstrel_ht: fix per-group max throughput rate initialization
      	mips: avoid explicit UB in assignment of mips_io_port_base
      	ahci: Do not export local variable ahci_em_messages
      	Partially revert "kfifo: fix kfifo_alloc() and kfifo_init()"
      	power: supply: Init device wakeup after device_add()
      	x86, perf: Fix the dependency of the x86 insn decoder selftest
      	bcma: fix incorrect update of BCMA_CORE_PCI_MDIO_DATA
      	iio: dac: ad5380: fix incorrect assignment to val
      	ath9k: dynack: fix possible deadlock in ath_dynack_node_{de}init
      	net: sonic: return NETDEV_TX_OK if failed to map buffer
      	Btrfs: fix hang when loading existing inode cache off disk
      	hwmon: (shtc1) fix shtc1 and shtw1 id mask
      	net: sonic: replace dev_kfree_skb in sonic_send_packet
      	net/rds: Fix 'ib_evt_handler_call' element in 'rds_ib_stat_names'
      	iommu/amd: Wait for completion of IOTLB flush in attach_device
      	net: hisilicon: Fix signedness bug in hix5hd2_dev_probe()
      	net: broadcom/bcmsysport: Fix signedness in bcm_sysport_probe()
      	net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse()
      	mac80211: accept deauth frames in IBSS mode
      	llc: fix another potential sk_buff leak in llc_ui_sendmsg()
      	llc: fix sk_buff refcounting in llc_conn_state_process()
      	net: stmmac: fix length of PTP clock's name string
      	drm/msm/dsi: Implement reset correctly
      	dmaengine: imx-sdma: fix size check for sdma script_number
      	net: qca_spi: Move reset_count to struct qcaspi
      	media: ov6650: Fix incorrect use of JPEG colorspace
      	media: ov6650: Fix some format attributes not under control
      	media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support
      	MIPS: Loongson: Fix return value of loongson_hwmon_init
      	net: neigh: use long type to store jiffies delta
      	packet: fix data-race in fanout_flow_is_huge()
      	dmaengine: ti: edma: fix missed failure handling
      	drm/radeon: fix bad DMA from INTERRUPT_CNTL2
      	arm64: dts: juno: Fix UART frequency
      	m68k: Call timer_interrupt() with interrupts disabled
      	can, slip: Protect tty->disc_data in write_wakeup and close with RCU
      	firestream: fix memory leaks
      	net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM
      	net, ip_tunnel: fix namespaces move
      	net_sched: fix datalen for ematch
      	net: usb: lan78xx: Add .ndo_features_check
      	hwmon: (adt7475) Make volt2reg return same reg as reg2volt input
      	Input: keyspan-remote - fix control-message timeouts
      	ARM: 8950/1: ftrace/recordmcount: filter relocation types
      	mmc: sdhci: fix minimum clock rate for v3 controller
      	Input: sur40 - fix interface sanity checks
      	Input: gtco - fix endpoint sanity check
      	Input: aiptek - fix endpoint sanity check
      	hwmon: (nct7802) Fix voltage limits to wrong registers
      	scsi: RDMA/isert: Fix a recently introduced regression related to logout
      	tracing: xen: Ordered comparison of function pointers
      	do_last(): fetch directory ->i_mode and ->i_uid before it's too late
      	iio: buffer: align the size of scan bytes to size of the largest element
      	scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func
      	md: Avoid namespace collision with bitmap API
      	bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free()
      	netfilter: ipset: use bitmap infrastructure completely
      	net/x25: fix nonblocking connect
      	libertas: Fix two buffer overflows at parsing bss descriptor
      	Linux 4.4.212
      
      Change-Id: Id8b4edfe0ac702c749be46aa588263e5bc30703e
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      e7648ad2
    • Greg Kroah-Hartman's avatar
      Linux 4.4.212 · 475d90ca
      Greg Kroah-Hartman authored
      v4.4.212
      475d90ca
    • Wen Huang's avatar
      libertas: Fix two buffer overflows at parsing bss descriptor · 4d7f4d38
      Wen Huang authored
      
      commit e5e884b4 upstream.
      
      add_ie_rates() copys rates without checking the length
      in bss descriptor from remote AP.when victim connects to
      remote attacker, this may trigger buffer overflow.
      lbs_ibss_join_existing() copys rates without checking the length
      in bss descriptor from remote IBSS node.when victim connects to
      remote attacker, this may trigger buffer overflow.
      Fix them by putting the length check before performing copy.
      
      This fix addresses CVE-2019-14896 and CVE-2019-14897.
      This also fix build warning of mixed declarations and code.
      
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarWen Huang <huangwenabc@gmail.com>
      Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d7f4d38
    • Martin Schiller's avatar
      net/x25: fix nonblocking connect · 52a95511
      Martin Schiller authored
      
      commit e21dba7a upstream.
      
      This patch fixes 2 issues in x25_connect():
      
      1. It makes absolutely no sense to reset the neighbour and the
      connection state after a (successful) nonblocking call of x25_connect.
      This prevents any connection from being established, since the response
      (call accept) cannot be processed.
      
      2. Any further calls to x25_connect() while a call is pending should
      simply return, instead of creating new Call Request (on different
      logical channels).
      
      This patch should also fix the "KASAN: null-ptr-deref Write in
      x25_connect" and "BUG: unable to handle kernel NULL pointer dereference
      in x25_connect" bugs reported by syzbot.
      
      Signed-off-by: default avatarMartin Schiller <ms@dev.tdt.de>
      Reported-by: default avatar <syzbot+429c200ffc8772bfe070@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+eec0c87f31a7c3b66f7b@syzkaller.appspotmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      52a95511
    • Kadlecsik József's avatar
      netfilter: ipset: use bitmap infrastructure completely · 2348440c
      Kadlecsik József authored
      
      commit 32c72165 upstream.
      
      The bitmap allocation did not use full unsigned long sizes
      when calculating the required size and that was triggered by KASAN
      as slab-out-of-bounds read in several places. The patch fixes all
      of them.
      
      Reported-by: default avatar <syzbot+fabca5cbf5e54f3fe2de@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+827ced406c9a1d9570ed@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+190d63957b22ef673ea5@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+dfccdb2bdb4a12ad425e@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+df0d0f5895ef1f41a65b@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+b08bd19bb37513357fd4@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+53cdd0ec0bbabd53370a@syzkaller.appspotmail.com>
      Signed-off-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2348440c
    • Andy Shevchenko's avatar
      bitmap: Add bitmap_alloc(), bitmap_zalloc() and bitmap_free() · ce30078e
      Andy Shevchenko authored
      
      commit c42b65e3 upstream.
      
      A lot of code become ugly because of open coding allocations for bitmaps.
      
      Introduce three helpers to allow users be more clear of intention
      and keep their code neat.
      
      Note, due to multiple circular dependencies we may not provide
      the helpers as inliners. For now we keep them exported and, perhaps,
      at some point in the future we will sort out header inclusion and
      inheritance.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ce30078e
    • Andy Shevchenko's avatar
      md: Avoid namespace collision with bitmap API · e531b76d
      Andy Shevchenko authored
      
      commit e64e4018 upstream.
      
      bitmap API (include/linux/bitmap.h) has 'bitmap' prefix for its methods.
      
      On the other hand MD bitmap API is special case.
      Adding 'md' prefix to it to avoid name space collision.
      
      No functional changes intended.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarShaohua Li <shli@kernel.org>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      [only take the bitmap_free change for stable - gregkh]
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e531b76d
    • Bo Wu's avatar
      scsi: iscsi: Avoid potential deadlock in iscsi_if_rx func · 4f35b1be
      Bo Wu authored
      commit bba340c7 upstream.
      
      In iscsi_if_rx func, after receiving one request through
      iscsi_if_recv_msg func, iscsi_if_send_reply will be called to try to
      reply to the request in a do-while loop.  If the iscsi_if_send_reply
      function keeps returning -EAGAIN, a deadlock will occur.
      
      For example, a client only send msg without calling recvmsg func, then
      it will result in the watchdog soft lockup.  The details are given as
      follows:
      
      	sock_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_ISCSI);
      	retval = bind(sock_fd, (struct sock addr*) & src_addr, sizeof(src_addr);
      	while (1) {
      		state_msg = sendmsg(sock_fd, &msg, 0);
      		//Note: recvmsg(sock_fd, &msg, 0) is not processed here.
      	}
      	close(sock_fd);
      
      watchdog: BUG: soft lockup - CPU#7 stuck for 22s! [netlink_test:253305] Sample time: 4000897528 ns(HZ: 250) Sample stat:
      curr: user: 675503481560, nice: 321724050, sys: 448689506750, idle: 4654054240530, iowait: 40885550700, irq: 14161174020, softirq: 8104324140, st: 0
      deta: user: 0, nice: 0, sys: 3998210100, idle: 0, iowait: 0, irq: 1547170, softirq: 242870, st: 0 Sample softirq:
               TIMER:        992
               SCHED:          8
      Sample irqstat:
               irq    2: delta       1003, curr:    3103802, arch_timer
      CPU: 7 PID: 253305 Comm: netlink_test Kdump: loaded Tainted: G           OE
      Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
      pstate: 40400005 (nZcv daif +PAN -UAO)
      pc : __alloc_skb+0x104/0x1b0
      lr : __alloc_skb+0x9c/0x1b0
      sp : ffff000033603a30
      x29: ffff000033603a30 x28: 00000000000002dd
      x27: ffff800b34ced810 x26: ffff800ba7569f00
      x25: 00000000ffffffff x24: 0000000000000000
      x23: ffff800f7c43f600 x22: 0000000000480020
      x21: ffff0000091d9000 x20: ffff800b34eff200
      x19: ffff800ba7569f00 x18: 0000000000000000
      x17: 0000000000000000 x16: 0000000000000000
      x15: 0000000000000000 x14: 0001000101000100
      x13: 0000000101010000 x12: 0101000001010100
      x11: 0001010101010001 x10: 00000000000002dd
      x9 : ffff000033603d58 x8 : ffff800b34eff400
      x7 : ffff800ba7569200 x6 : ffff800b34eff400
      x5 : 0000000000000000 x4 : 00000000ffffffff
      x3 : 0000000000000000 x2 : 0000000000000001
      x1 : ffff800b34eff2c0 x0 : 0000000000000300 Call trace:
      __alloc_skb+0x104/0x1b0
      iscsi_if_rx+0x144/0x12bc [scsi_transport_iscsi]
      netlink_unicast+0x1e0/0x258
      netlink_sendmsg+0x310/0x378
      sock_sendmsg+0x4c/0x70
      sock_write_iter+0x90/0xf0
      __vfs_write+0x11c/0x190
      vfs_write+0xac/0x1c0
      ksys_write+0x6c/0xd8
      __arm64_sys_write+0x24/0x30
      el0_svc_common+0x78/0x130
      el0_svc_handler+0x38/0x78
      el0_svc+0x8/0xc
      
      Link: https://lore.kernel.org/r/EDBAAA0BBBA2AC4E9C8B6B81DEEE1D6915E3D4D2@dggeml505-mbx.china.huawei.com
      
      
      Signed-off-by: default avatarBo Wu <wubo40@huawei.com>
      Reviewed-by: default avatarZhiqiang Liu <liuzhiqiang26@huawei.com>
      Reviewed-by: default avatarLee Duncan <lduncan@suse.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f35b1be
    • Lars Möllendorf's avatar
      iio: buffer: align the size of scan bytes to size of the largest element · 2dd55100
      Lars Möllendorf authored
      
      commit 883f6165 upstream.
      
      Previous versions of `iio_compute_scan_bytes` only aligned each element
      to its own length (i.e. its own natural alignment). Because multiple
      consecutive sets of scan elements are buffered this does not work in
      case the computed scan bytes do not align with the natural alignment of
      the first scan element in the set.
      
      This commit fixes this by aligning the scan bytes to the natural
      alignment of the largest scan element in the set.
      
      Fixes: 959d2952 ("staging:iio: make iio_sw_buffer_preenable much more general.")
      Signed-off-by: default avatarLars Möllendorf <lars.moellendorf@plating.de>
      Reviewed-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      2dd55100
    • Al Viro's avatar
      do_last(): fetch directory ->i_mode and ->i_uid before it's too late · 0da89b16
      Al Viro authored
      
      commit d0cb5018 upstream.
      
      may_create_in_sticky() call is done when we already have dropped the
      reference to dir.
      
      Fixes: 30aba665 (namei: allow restricted O_CREAT of FIFOs and regular files)
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0da89b16
    • Changbin Du's avatar
      tracing: xen: Ordered comparison of function pointers · 28414404
      Changbin Du authored
      
      commit d0695e23 upstream.
      
      Just as commit 0566e40c ("tracing: initcall: Ordered comparison of
      function pointers"), this patch fixes another remaining one in xen.h
      found by clang-9.
      
      In file included from arch/x86/xen/trace.c:21:
      In file included from ./include/trace/events/xen.h:475:
      In file included from ./include/trace/define_trace.h:102:
      In file included from ./include/trace/trace_events.h:473:
      ./include/trace/events/xen.h:69:7: warning: ordered comparison of function \
      pointers ('xen_mc_callback_fn_t' (aka 'void (*)(void *)') and 'xen_mc_callback_fn_t') [-Wordered-compare-function-pointers]
                          __field(xen_mc_callback_fn_t, fn)
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/trace/trace_events.h:421:29: note: expanded from macro '__field'
                                      ^
      ./include/trace/trace_events.h:407:6: note: expanded from macro '__field_ext'
                                       is_signed_type(type), filter_type);    \
                                       ^
      ./include/linux/trace_events.h:554:44: note: expanded from macro 'is_signed_type'
                                                    ^
      
      Fixes: c796f213 ("xen/trace: add multicall tracing")
      Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28414404
    • Bart Van Assche's avatar
      scsi: RDMA/isert: Fix a recently introduced regression related to logout · 1c90e57c
      Bart Van Assche authored
      commit 04060db4 upstream.
      
      iscsit_close_connection() calls isert_wait_conn(). Due to commit
      e9d3009c both functions call target_wait_for_sess_cmds() although that
      last function should be called only once. Fix this by removing the
      target_wait_for_sess_cmds() call from isert_wait_conn() and by only calling
      isert_wait_conn() after target_wait_for_sess_cmds().
      
      Fixes: e9d3009c ("scsi: target: iscsi: Wait for all commands to finish before freeing a session").
      Link: https://lore.kernel.org/r/20200116044737.19507-1-bvanassche@acm.org
      
      
      Reported-by: default avatarRahul Kundu <rahul.kundu@chelsio.com>
      Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
      Tested-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
      Acked-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1c90e57c
    • Gilles Buloz's avatar
      hwmon: (nct7802) Fix voltage limits to wrong registers · 31710ab4
      Gilles Buloz authored
      
      commit 7713e62c upstream.
      
      in0 thresholds are written to the in2 thresholds registers
      in2 thresholds to in3 thresholds
      in3 thresholds to in4 thresholds
      in4 thresholds to in0 thresholds
      
      Signed-off-by: default avatarGilles Buloz <gilles.buloz@kontron.com>
      Link: https://lore.kernel.org/r/5de0f509.rc0oEvPOMjbfPW1w%gilles.buloz@kontron.com
      
      
      Fixes: 3434f378 ("hwmon: Driver for Nuvoton NCT7802Y")
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31710ab4
    • Johan Hovold's avatar
      Input: aiptek - fix endpoint sanity check · 71befe0a
      Johan Hovold authored
      
      commit 3111491f upstream.
      
      The driver was checking the number of endpoints of the first alternate
      setting instead of the current one, something which could lead to the
      driver binding to an invalid interface.
      
      This in turn could cause the driver to misbehave or trigger a WARN() in
      usb_submit_urb() that kernels with panic_on_warn set would choke on.
      
      Fixes: 8e20cf2b ("Input: aiptek - fix crash on detecting device without endpoints")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Acked-by: default avatarVladis Dronov <vdronov@redhat.com>
      Link: https://lore.kernel.org/r/20191210113737.4016-3-johan@kernel.org
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      71befe0a
    • Johan Hovold's avatar
      Input: gtco - fix endpoint sanity check · 4ada19cf
      Johan Hovold authored
      
      commit a8eeb74d upstream.
      
      The driver was checking the number of endpoints of the first alternate
      setting instead of the current one, something which could lead to the
      driver binding to an invalid interface.
      
      This in turn could cause the driver to misbehave or trigger a WARN() in
      usb_submit_urb() that kernels with panic_on_warn set would choke on.
      
      Fixes: 162f98de ("Input: gtco - fix crash on detecting device without endpoints")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Acked-by: default avatarVladis Dronov <vdronov@redhat.com>
      Link: https://lore.kernel.org/r/20191210113737.4016-5-johan@kernel.org
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ada19cf
    • Johan Hovold's avatar
      Input: sur40 - fix interface sanity checks · dc738295
      Johan Hovold authored
      
      commit 6b32391e upstream.
      
      Make sure to use the current alternate setting when verifying the
      interface descriptors to avoid binding to an invalid interface.
      
      This in turn could cause the driver to misbehave or trigger a WARN() in
      usb_submit_urb() that kernels with panic_on_warn set would choke on.
      
      Fixes: bdb5c57f ("Input: add sur40 driver for Samsung SUR40 (aka MS Surface 2.0/Pixelsense)")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Acked-by: default avatarVladis Dronov <vdronov@redhat.com>
      Link: https://lore.kernel.org/r/20191210113737.4016-8-johan@kernel.org
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dc738295
    • Michał Mirosław's avatar
      mmc: sdhci: fix minimum clock rate for v3 controller · 131df943
      Michał Mirosław authored
      
      commit 2a187d03 upstream.
      
      For SDHCIv3+ with programmable clock mode, minimal clock frequency is
      still base clock / max(divider). Minimal programmable clock frequency is
      always greater than minimal divided clock frequency. Without this patch,
      SDHCI uses out-of-spec initial frequency when multiplier is big enough:
      
      mmc1: mmc_rescan_try_freq: trying to init card at 468750 Hz
      [for 480 MHz source clock divided by 1024]
      
      The code in sdhci_calc_clk() already chooses a correct SDCLK clock mode.
      
      Fixes: c3ed3877 ("mmc: sdhci: add support for programmable clock mode")
      Cc: <stable@vger.kernel.org> # 4f6aa326: mmc: tegra: Only advertise UHS modes if IO regulator is present
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Link: https://lore.kernel.org/r/ffb489519a446caffe7a0a05c4b9372bd52397bb.1579082031.git.mirq-linux@rere.qmqm.pl
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      131df943
    • Alex Sverdlin's avatar
      ARM: 8950/1: ftrace/recordmcount: filter relocation types · f2b7596f
      Alex Sverdlin authored
      commit 927d780e upstream.
      
      Scenario 1, ARMv7
      =================
      
      If code in arch/arm/kernel/ftrace.c would operate on mcount() pointer
      the following may be generated:
      
      00000230 <prealloc_fixed_plts>:
       230:   b5f8            push    {r3, r4, r5, r6, r7, lr}
       232:   b500            push    {lr}
       234:   f7ff fffe       bl      0 <__gnu_mcount_nc>
                              234: R_ARM_THM_CALL     __gnu_mcount_nc
       238:   f240 0600       movw    r6, #0
                              238: R_ARM_THM_MOVW_ABS_NC      __gnu_mcount_nc
       23c:   f8d0 1180       ldr.w   r1, [r0, #384]  ; 0x180
      
      FTRACE currently is not able to deal with it:
      
      WARNING: CPU: 0 PID: 0 at .../kernel/trace/ftrace.c:1979 ftrace_bug+0x1ad/0x230()
      ...
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.116-... #1
      ...
      [<c0314e3d>] (unwind_backtrace) from [<c03115e9>] (show_stack+0x11/0x14)
      [<c03115e9>] (show_stack) from [<c051a7f1>] (dump_stack+0x81/0xa8)
      [<c051a7f1>] (dump_stack) from [<c0321c5d>] (warn_slowpath_common+0x69/0x90)
      [<c0321c5d>] (warn_slowpath_common) from [<c0321cf3>] (warn_slowpath_null+0x17/0x1c)
      [<c0321cf3>] (warn_slowpath_null) from [<c038ee9d>] (ftrace_bug+0x1ad/0x230)
      [<c038ee9d>] (ftrace_bug) from [<c038f1f9>] (ftrace_process_locs+0x27d/0x444)
      [<c038f1f9>] (ftrace_process_locs) from [<c08915bd>] (ftrace_init+0x91/0xe8)
      [<c08915bd>] (ftrace_init) from [<c0885a67>] (start_kernel+0x34b/0x358)
      [<c0885a67>] (start_kernel) from [<00308095>] (0x308095)
      ---[ end trace cb88537fdc8fa200 ]---
      ftrace failed to modify [<c031266c>] prealloc_fixed_plts+0x8/0x60
       actual: 44:f2:e1:36
      ftrace record flags: 0
       (0)   expected tramp: c03143e9
      
      Scenario 2, ARMv4T
      ==================
      
      ftrace: allocating 14435 entries in 43 pages
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 0 at kernel/trace/ftrace.c:2029 ftrace_bug+0x204/0x310
      CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.5 #1
      Hardware name: Cirrus Logic EDB9302 Evaluation Board
      [<c0010a24>] (unwind_backtrace) from [<c000ecb0>] (show_stack+0x20/0x2c)
      [<c000ecb0>] (show_stack) from [<c03c72e8>] (dump_stack+0x20/0x30)
      [<c03c72e8>] (dump_stack) from [<c0021c18>] (__warn+0xdc/0x104)
      [<c0021c18>] (__warn) from [<c0021d7c>] (warn_slowpath_null+0x4c/0x5c)
      [<c0021d7c>] (warn_slowpath_null) from [<c0095360>] (ftrace_bug+0x204/0x310)
      [<c0095360>] (ftrace_bug) from [<c04dabac>] (ftrace_init+0x3b4/0x4d4)
      [<c04dabac>] (ftrace_init) from [<c04cef4c>] (start_kernel+0x20c/0x410)
      [<c04cef4c>] (start_kernel) from [<00000000>] (  (null))
      ---[ end trace 0506a2f5dae6b341 ]---
      ftrace failed to modify
      [<c000c350>] perf_trace_sys_exit+0x5c/0xe8
       actual:   1e:ff:2f:e1
      Initializing ftrace call sites
      ftrace record flags: 0
       (0)
       expected tramp: c000fb24
      
      The analysis for this problem has been already performed previously,
      refer to the link below.
      
      Fix the above problems by allowing only selected reloc types in
      __mcount_loc. The list itself comes from the legacy recordmcount.pl
      script.
      
      Link: https://lore.kernel.org/lkml/56961010.6000806@pengutronix.de/
      
      
      Cc: stable@vger.kernel.org
      Fixes: ed60453f ("ARM: 6511/1: ftrace: add ARM support for C version of recordmcount")
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Acked-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f2b7596f
    • Johan Hovold's avatar
      Input: keyspan-remote - fix control-message timeouts · 64847abe
      Johan Hovold authored
      
      commit ba9a103f upstream.
      
      The driver was issuing synchronous uninterruptible control requests
      without using a timeout. This could lead to the driver hanging on probe
      due to a malfunctioning (or malicious) device until the device is
      physically disconnected. While sleeping in probe the driver prevents
      other devices connected to the same hub from being added to (or removed
      from) the bus.
      
      The USB upper limit of five seconds per request should be more than
      enough.
      
      Fixes: 99f83c9c ("[PATCH] USB: add driver for Keyspan Digital Remote")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable <stable@vger.kernel.org>     # 2.6.13
      Link: https://lore.kernel.org/r/20200113171715.30621-1-johan@kernel.org
      
      
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      64847abe
    • Luuk Paulussen's avatar
      hwmon: (adt7475) Make volt2reg return same reg as reg2volt input · 594b9cf2
      Luuk Paulussen authored
      
      commit cf3ca187 upstream.
      
      reg2volt returns the voltage that matches a given register value.
      Converting this back the other way with volt2reg didn't return the same
      register value because it used truncation instead of rounding.
      
      This meant that values read from sysfs could not be written back to sysfs
      to set back the same register value.
      
      With this change, volt2reg will return the same value for every voltage
      previously returned by reg2volt (for the set of possible input values)
      
      Signed-off-by: default avatarLuuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
      Link: https://lore.kernel.org/r/20191205231659.1301-1-luuk.paulussen@alliedtelesis.co.nz
      
      
      cc: stable@vger.kernel.org
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      594b9cf2
    • James Hughes's avatar
      net: usb: lan78xx: Add .ndo_features_check · fd5bfca7
      James Hughes authored
      
      [ Upstream commit ce896476 ]
      
      As reported by Eric Dumazet, there are still some outstanding
      cases where the driver does not handle TSO correctly when skb's
      are over a certain size. Most cases have been fixed, this patch
      should ensure that forwarded SKB's that are greater than
      MAX_SINGLE_PACKET_SIZE - TX_OVERHEAD are software segmented
      and handled correctly.
      
      Signed-off-by: default avatarJames Hughes <james.hughes@raspberrypi.org>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fd5bfca7
    • Cong Wang's avatar
      net_sched: fix datalen for ematch · 9bfa1646
      Cong Wang authored
      
      [ Upstream commit 61678d28 ]
      
      syzbot reported an out-of-bound access in em_nbyte. As initially
      analyzed by Eric, this is because em_nbyte sets its own em->datalen
      in em_nbyte_change() other than the one specified by user, but this
      value gets overwritten later by its caller tcf_em_validate().
      We should leave em->datalen untouched to respect their choices.
      
      I audit all the in-tree ematch users, all of those implement
      ->change() set em->datalen, so we can just avoid setting it twice
      in this case.
      
      Reported-and-tested-by: default avatar <syzbot+5af9a90dad568aa9f611@syzkaller.appspotmail.com>
      Reported-by: default avatar <syzbot+2f07903a5b05e7f36410@syzkaller.appspotmail.com>
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9bfa1646
    • William Dauchy's avatar
      net, ip_tunnel: fix namespaces move · 108ba5cf
      William Dauchy authored
      
      [ Upstream commit d0f41851 ]
      
      in the same manner as commit 690afc16 ("net: ip6_gre: fix moving
      ip6gre between namespaces"), fix namespace moving as it was broken since
      commit 2e15ea39 ("ip_gre: Add support to collect tunnel metadata.").
      Indeed, the ip6_gre commit removed the local flag for collect_md
      condition, so there is no reason to keep it for ip_gre/ip_tunnel.
      
      this patch will fix both ip_tunnel and ip_gre modules.
      
      Fixes: 2e15ea39 ("ip_gre: Add support to collect tunnel metadata.")
      Signed-off-by: default avatarWilliam Dauchy <w.dauchy@criteo.com>
      Acked-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      108ba5cf
    • Michael Ellerman's avatar
      net: cxgb3_main: Add CAP_NET_ADMIN check to CHELSIO_GET_MEM · 8e562bd9
      Michael Ellerman authored
      
      [ Upstream commit 3546d8f1 =
      
      The cxgb3 driver for "Chelsio T3-based gigabit and 10Gb Ethernet
      adapters" implements a custom ioctl as SIOCCHIOCTL/SIOCDEVPRIVATE in
      cxgb_extension_ioctl().
      
      One of the subcommands of the ioctl is CHELSIO_GET_MEM, which appears
      to read memory directly out of the adapter and return it to userspace.
      It's not entirely clear what the contents of the adapter memory
      contains, but the assumption is that it shouldn't be accessible to all
      users.
      
      So add a CAP_NET_ADMIN check to the CHELSIO_GET_MEM case. Put it after
      the is_offload() check, which matches two of the other subcommands in
      the same function which also check for is_offload() and CAP_NET_ADMIN.
      
      Found by Ilja by code inspection, not tested as I don't have the
      required hardware.
      
      Reported-by: default avatarIlja Van Sprundel <ivansprundel@ioactive.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e562bd9
    • Wenwen Wang's avatar
      firestream: fix memory leaks · 78709564
      Wenwen Wang authored
      
      [ Upstream commit fa865ba1 ]
      
      In fs_open(), 'vcc' is allocated through kmalloc() and assigned to
      'atm_vcc->dev_data.' In the following execution, if an error occurs, e.g.,
      there is no more free channel, an error code EBUSY or ENOMEM will be
      returned. However, 'vcc' is not deallocated, leading to memory leaks. Note
      that, in normal cases where fs_open() returns 0, 'vcc' will be deallocated
      in fs_close(). But, if fs_open() fails, there is no guarantee that
      fs_close() will be invoked.
      
      To fix this issue, deallocate 'vcc' before the error code is returned.
      
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      78709564
    • Richard Palethorpe's avatar
      can, slip: Protect tty->disc_data in write_wakeup and close with RCU · 6169e11e
      Richard Palethorpe authored
      
      [ Upstream commit 0ace17d5 ]
      
      write_wakeup can happen in parallel with close/hangup where tty->disc_data
      is set to NULL and the netdevice is freed thus also freeing
      disc_data. write_wakeup accesses disc_data so we must prevent close from
      freeing the netdev while write_wakeup has a non-NULL view of
      tty->disc_data.
      
      We also need to make sure that accesses to disc_data are atomic. Which can
      all be done with RCU.
      
      This problem was found by Syzkaller on SLCAN, but the same issue is
      reproducible with the SLIP line discipline using an LTP test based on the
      Syzkaller reproducer.
      
      A fix which didn't use RCU was posted by Hillf Danton.
      
      Fixes: 661f7fda ("slip: Fix deadlock in write_wakeup")
      Fixes: a8e83b17 ("slcan: Port write_wakeup deadlock fix from slip")
      Reported-by: default avatar <syzbot+017e491ae13c0068598a@syzkaller.appspotmail.com>
      Signed-off-by: default avatarRichard Palethorpe <rpalethorpe@suse.com>
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Cc: Marc Kleine-Budde <mkl@pengutronix.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Tyler Hall <tylerwhall@gmail.com>
      Cc: linux-can@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: syzkaller@googlegroups.com
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6169e11e
    • Finn Thain's avatar
      m68k: Call timer_interrupt() with interrupts disabled · eb0d764e
      Finn Thain authored
      
      [ Upstream commit 1efdd4bd ]
      
      Some platforms execute their timer handler with the interrupt priority
      level set below 6. That means the handler could be interrupted by another
      driver and this could lead to re-entry of the timer core.
      
      Avoid this by use of local_irq_save/restore for timer interrupt dispatch.
      This provides mutual exclusion around the timer interrupt flag access
      which is needed later in this series for the clocksource conversion.
      
      Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1811131407120.2697@nanos.tec.linutronix.de
      
      
      Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eb0d764e
    • Andre Przywara's avatar
      arm64: dts: juno: Fix UART frequency · 0f8e73eb
      Andre Przywara authored
      [ Upstream commit 39a1a894 ]
      
      Older versions of the Juno *SoC* TRM [1] recommended that the UART clock
      source should be 7.2738 MHz, whereas the *system* TRM [2] stated a more
      correct value of 7.3728 MHz. Somehow the wrong value managed to end up in
      our DT.
      
      Doing a prime factorisation, a modulo divide by 115200 and trying
      to buy a 7.2738 MHz crystal at your favourite electronics dealer suggest
      that the old value was actually a typo. The actual UART clock is driven
      by a PLL, configured via a parameter in some board.txt file in the
      firmware, which reads 7.37 MHz (sic!).
      
      Fix this to correct the baud rate divisor calculation on the Juno board.
      
      [1] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0515b.b/DDI0515B_b_juno_arm_development_platform_soc_trm.pdf
      [2] http://infocenter.arm.com/help/topic/com.arm.doc.100113_0000_07_en/arm_versatile_express_juno_development_platform_(v2m_juno)_technical_reference_manual_100113_0000_07_en.pdf
      
      
      
      Fixes: 71f867ec ("arm64: Add Juno board device tree.")
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Acked-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
      Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0f8e73eb
    • Sam Bobroff's avatar
      drm/radeon: fix bad DMA from INTERRUPT_CNTL2 · 6394d187
      Sam Bobroff authored
      
      [ Upstream commit 62d91dd2 ]
      
      The INTERRUPT_CNTL2 register expects a valid DMA address, but is
      currently set with a GPU MC address.  This can cause problems on
      systems that detect the resulting DMA read from an invalid address
      (found on a Power8 guest).
      
      Instead, use the DMA address of the dummy page because it will always
      be safe.
      
      Fixes: d8f60cfc ("drm/radeon/kms: Add support for interrupts on r6xx/r7xx chips (v3)")
      Fixes: 25a857fb ("drm/radeon/kms: add support for interrupts on SI")
      Fixes: a59781bb ("drm/radeon: add support for interrupts on CIK (v5)")
      Signed-off-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6394d187
    • Chuhong Yuan's avatar
      dmaengine: ti: edma: fix missed failure handling · fe1787af
      Chuhong Yuan authored
      
      [ Upstream commit 340049d4 ]
      
      When devm_kcalloc fails, it forgets to call edma_free_slot.
      Replace direct return with failure handler to fix it.
      
      Fixes: 1be5336b ("dmaengine: edma: New device tree binding")
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Link: https://lore.kernel.org/r/20191118073802.28424-1-hslester96@gmail.com
      
      
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fe1787af
    • Eric Dumazet's avatar
      packet: fix data-race in fanout_flow_is_huge() · 496f5e2f
      Eric Dumazet authored
      
      [ Upstream commit b756ad92 ]
      
      KCSAN reported the following data-race [1]
      
      Adding a couple of READ_ONCE()/WRITE_ONCE() should silence it.
      
      Since the report hinted about multiple cpus using the history
      concurrently, I added a test avoiding writing on it if the
      victim slot already contains the desired value.
      
      [1]
      
      BUG: KCSAN: data-race in fanout_demux_rollover / fanout_demux_rollover
      
      read to 0xffff8880b01786cc of 4 bytes by task 18921 on cpu 1:
       fanout_flow_is_huge net/packet/af_packet.c:1303 [inline]
       fanout_demux_rollover+0x33e/0x3f0 net/packet/af_packet.c:1353
       packet_rcv_fanout+0x34e/0x490 net/packet/af_packet.c:1453
       deliver_skb net/core/dev.c:1888 [inline]
       dev_queue_xmit_nit+0x15b/0x540 net/core/dev.c:1958
       xmit_one net/core/dev.c:3195 [inline]
       dev_hard_start_xmit+0x3f5/0x430 net/core/dev.c:3215
       __dev_queue_xmit+0x14ab/0x1b40 net/core/dev.c:3792
       dev_queue_xmit+0x21/0x30 net/core/dev.c:3825
       neigh_direct_output+0x1f/0x30 net/core/neighbour.c:1530
       neigh_output include/net/neighbour.h:511 [inline]
       ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116
       __ip6_finish_output net/ipv6/ip6_output.c:142 [inline]
       __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127
       ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152
       NF_HOOK_COND include/linux/netfilter.h:294 [inline]
       ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175
       dst_output include/net/dst.h:436 [inline]
       ip6_local_out+0x74/0x90 net/ipv6/output_core.c:179
       ip6_send_skb+0x53/0x110 net/ipv6/ip6_output.c:1795
       udp_v6_send_skb.isra.0+0x3ec/0xa70 net/ipv6/udp.c:1173
       udpv6_sendmsg+0x1906/0x1c20 net/ipv6/udp.c:1471
       inet6_sendmsg+0x6d/0x90 net/ipv6/af_inet6.c:576
       sock_sendmsg_nosec net/socket.c:637 [inline]
       sock_sendmsg+0x9f/0xc0 net/socket.c:657
       ___sys_sendmsg+0x2b7/0x5d0 net/socket.c:2311
       __sys_sendmmsg+0x123/0x350 net/socket.c:2413
       __do_sys_sendmmsg net/socket.c:2442 [inline]
       __se_sys_sendmmsg net/socket.c:2439 [inline]
       __x64_sys_sendmmsg+0x64/0x80 net/socket.c:2439
       do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      write to 0xffff8880b01786cc of 4 bytes by task 18922 on cpu 0:
       fanout_flow_is_huge net/packet/af_packet.c:1306 [inline]
       fanout_demux_rollover+0x3a4/0x3f0 net/packet/af_packet.c:1353
       packet_rcv_fanout+0x34e/0x490 net/packet/af_packet.c:1453
       deliver_skb net/core/dev.c:1888 [inline]
       dev_queue_xmit_nit+0x15b/0x540 net/core/dev.c:1958
       xmit_one net/core/dev.c:3195 [inline]
       dev_hard_start_xmit+0x3f5/0x430 net/core/dev.c:3215
       __dev_queue_xmit+0x14ab/0x1b40 net/core/dev.c:3792
       dev_queue_xmit+0x21/0x30 net/core/dev.c:3825
       neigh_direct_output+0x1f/0x30 net/core/neighbour.c:1530
       neigh_output include/net/neighbour.h:511 [inline]
       ip6_finish_output2+0x7a2/0xec0 net/ipv6/ip6_output.c:116
       __ip6_finish_output net/ipv6/ip6_output.c:142 [inline]
       __ip6_finish_output+0x2d7/0x330 net/ipv6/ip6_output.c:127
       ip6_finish_output+0x41/0x160 net/ipv6/ip6_output.c:152
       NF_HOOK_COND include/linux/netfilter.h:294 [inline]
       ip6_output+0xf2/0x280 net/ipv6/ip6_output.c:175
       dst_output include/net/dst.h:436 [inline]
       ip6_local_out+0x74/0x90 net/ipv6/output_core.c:179
       ip6_send_skb+0x53/0x110 net/ipv6/ip6_output.c:1795
       udp_v6_send_skb.isra.0+0x3ec/0xa70 net/ipv6/udp.c:1173
       udpv6_sendmsg+0x1906/0x1c20 net/ipv6/udp.c:1471
       inet6_sendmsg+0x6d/0x90 net/ipv6/af_inet6.c:576
       sock_sendmsg_nosec net/socket.c:637 [inline]
       sock_sendmsg+0x9f/0xc0 net/socket.c:657
       ___sys_sendmsg+0x2b7/0x5d0 net/socket.c:2311
       __sys_sendmmsg+0x123/0x350 net/socket.c:2413
       __do_sys_sendmmsg net/socket.c:2442 [inline]
       __se_sys_sendmmsg net/socket.c:2439 [inline]
       __x64_sys_sendmmsg+0x64/0x80 net/socket.c:2439
       do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 18922 Comm: syz-executor.3 Not tainted 5.4.0-rc6+ #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      
      Fixes: 3b3a5b0a ("packet: rollover huge flows before small flows")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      496f5e2f
    • Eric Dumazet's avatar
      net: neigh: use long type to store jiffies delta · ca3e3364
      Eric Dumazet authored
      
      [ Upstream commit 9d027e3a ]
      
      A difference of two unsigned long needs long storage.
      
      Fixes: c7fb64db ("[NETLINK]: Neighbour table configuration and statistics via rtnetlink")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ca3e3364
    • Tiezhu Yang's avatar
      MIPS: Loongson: Fix return value of loongson_hwmon_init · 3a70aa65
      Tiezhu Yang authored
      
      [ Upstream commit dece3c2a ]
      
      When call function hwmon_device_register failed, use the actual
      return value instead of always -ENOMEM.
      
      Fixes: 64f09aa9 ("MIPS: Loongson-3: Add CPU Hwmon platform driver")
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarPaul Burton <paulburton@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Jiaxun Yang <jiaxun.yang@flygoat.com>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3a70aa65
    • Janusz Krzysztofik's avatar
      media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support · d71e2360
      Janusz Krzysztofik authored
      
      [ Upstream commit 39034bb0 ]
      
      Commit da298c6d ("[media] v4l2: replace video op g_mbus_fmt by pad
      op get_fmt") converted a former ov6650_g_fmt() video operation callback
      to an ov6650_get_fmt() pad operation callback.  However, the converted
      function disregards a format->which flag that pad operations should
      obey and always returns active frame format settings.
      
      That can be fixed by always responding to V4L2_SUBDEV_FORMAT_TRY with
      -EINVAL, or providing the response from a pad config argument, likely
      updated by a former user call to V4L2_SUBDEV_FORMAT_TRY .set_fmt().
      Since implementation of the latter is trivial, go for it.
      
      Fixes: da298c6d ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt")
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d71e2360
    • Janusz Krzysztofik's avatar
      media: ov6650: Fix some format attributes not under control · 3fd13fc6
      Janusz Krzysztofik authored
      
      [ Upstream commit 1c6a2b63 ]
      
      User arguments passed to .get/set_fmt() pad operation callbacks may
      contain unsupported values.  The driver takes control over frame size
      and pixel code as well as colorspace and field attributes but has never
      cared for remainig format attributes, i.e., ycbcr_enc, quantization
      and xfer_func, introduced by commit 11ff030c ("[media]
      v4l2-mediabus: improve colorspace support").  Fix it.
      
      Set up a static v4l2_mbus_framefmt structure with attributes
      initialized to reasonable defaults and use it for updating content of
      user provided arguments.  In case of V4L2_SUBDEV_FORMAT_ACTIVE,
      postpone frame size update, now performed from inside ov6650_s_fmt()
      helper, util the user argument is first updated in ov6650_set_fmt() with
      default frame format content.  For V4L2_SUBDEV_FORMAT_TRY, don't copy
      all attributes to pad config, only those handled by the driver, then
      fill the response with the default frame format updated with resulting
      pad config format code and frame size.
      
      Fixes: 11ff030c ("[media] v4l2-mediabus: improve colorspace support")
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3fd13fc6
    • Janusz Krzysztofik's avatar
      media: ov6650: Fix incorrect use of JPEG colorspace · 3498854e
      Janusz Krzysztofik authored
      
      [ Upstream commit 12500731 ]
      
      Since its initial submission, the driver selects V4L2_COLORSPACE_JPEG
      for supported formats other than V4L2_MBUS_FMT_SBGGR8_1X8.  According
      to v4l2-compliance test program, V4L2_COLORSPACE_JPEG applies
      exclusively to V4L2_PIX_FMT_JPEG.  Since the sensor does not support
      JPEG format, fix it to always select V4L2_COLORSPACE_SRGB.
      
      Fixes: 2f6e2404 ("[media] SoC Camera: add driver for OV6650 sensor")
      Signed-off-by: default avatarJanusz Krzysztofik <jmkrzyszt@gmail.com>
      Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3498854e
    • Stefan Wahren's avatar
      net: qca_spi: Move reset_count to struct qcaspi · 77530583
      Stefan Wahren authored
      
      [ Upstream commit bc19c329 ]
      
      The reset counter is specific for every QCA700x chip. So move this
      into the private driver struct. Otherwise we get unpredictable reset
      behavior in setups with multiple QCA700x chips.
      
      Fixes: 291ab06e (net: qualcomm: new Ethernet over SPI driver for QCA7000)
      Signed-off-by: default avatarStefan Wahren <stefan.wahren@in-tech.com>
      Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      77530583
    • Robin Gong's avatar
      dmaengine: imx-sdma: fix size check for sdma script_number · c6fe228a
      Robin Gong authored
      [ Upstream commit bd73dfab ]
      
      Illegal memory will be touch if SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
      (41) exceed the size of structure sdma_script_start_addrs(40),
      thus cause memory corrupt such as slob block header so that kernel
      trap into while() loop forever in slob_free(). Please refer to below
      code piece in imx-sdma.c:
      for (i = 0; i < sdma->script_number; i++)
      	if (addr_arr[i] > 0)
      		saddr_arr[i] = addr_arr[i]; /* memory corrupt here */
      That issue was brought by commit a572460b ("dmaengine: imx-sdma: Add
      support for version 3 firmware") because SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
      (38->41 3 scripts added) not align with script number added in
      sdma_script_start_addrs(2 scripts).
      
      Fixes: a572460b ("dmaengine: imx-sdma: Add support for version 3 firmware")
      Cc: stable@vger.kernel
      Link: https://www.spinics.net/lists/arm-kernel/msg754895.html
      
      
      Signed-off-by: default avatarRobin Gong <yibin.gong@nxp.com>
      Reported-by: default avatarJurgen Lambrecht <J.Lambrecht@TELEVIC.com>
      Link: https://lore.kernel.org/r/1569347584-3478-1-git-send-email-yibin.gong@nxp.com
      
      
      [vkoul: update the patch title]
      Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c6fe228a
Loading