4.9.259-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainercover 4.9.259-rc1 review
This is the start of the stable review cycle for the 4.9.259 release. There are 134 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, 03 Mar 2021 16:09:49 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.259-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.259-rc1
Nikos Tsironis <[email protected]>
dm era: Update in-core bitset after committing the metadata
Jason A. Donenfeld <[email protected]>
net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending
Leon Romanovsky <[email protected]>
ipv6: silence compilation warning for non-IPV6 builds
Eric Dumazet <[email protected]>
ipv6: icmp6: avoid indirect call for icmpv6_send()
Jason A. Donenfeld <[email protected]>
sunvnet: use icmp_ndo_send helper
Jason A. Donenfeld <[email protected]>
gtp: use icmp_ndo_send helper
Jason A. Donenfeld <[email protected]>
icmp: introduce helper for nat'd source address in network device context
Thomas Gleixner <[email protected]>
futex: fix dead code in attach_to_pi_owner()
Peter Zijlstra <[email protected]>
futex: Fix OWNER_DEAD fixup
Nikos Tsironis <[email protected]>
dm era: only resize metadata in preresume
Nikos Tsironis <[email protected]>
dm era: Reinitialize bitset cache before digesting a new writeset
Nikos Tsironis <[email protected]>
dm era: Use correct value size in equality function of writeset tree
Nikos Tsironis <[email protected]>
dm era: Fix bitset memory leaks
Nikos Tsironis <[email protected]>
dm era: Verify the data block size hasn't changed
Nikos Tsironis <[email protected]>
dm era: Recover committed writeset after crash
Bob Peterson <[email protected]>
gfs2: Don't skip dlm unlock if glock has an lvb
Al Viro <[email protected]>
sparc32: fix a user-triggerable oops in clear_user()
Chao Yu <[email protected]>
f2fs: fix out-of-repair __setattr_copy()
Maxim Kiselev <[email protected]>
gpio: pcf857x: Fix missing first interrupt
Frank Li <[email protected]>
mmc: sdhci-esdhc-imx: fix kernel panic when remove module
Fangrui Song <[email protected]>
module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols
Dan Williams <[email protected]>
libnvdimm/dimm: Avoid race between probe and available_slots_show()
Yoshihiro Shimoda <[email protected]>
usb: renesas_usbhs: Clear pipe running flag in usbhs_pkt_pop()
Muchun Song <[email protected]>
mm: hugetlb: fix a race between freeing and dissolving the page
Pan Bian <[email protected]>
mtd: spi-nor: hisi-sfc: Put child node np on error path
Jiri Kosina <[email protected]>
floppy: reintroduce O_NDELAY fix
Sean Christopherson <[email protected]>
x86/reboot: Force all cpus to exit VMX root if VMX is supported
Martin Kaiser <[email protected]>
staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table
Sabyrzhan Tasbolatov <[email protected]>
drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue
Paul Cercueil <[email protected]>
seccomp: Add missing return in non-void function
Filipe Manana <[email protected]>
btrfs: fix extent buffer leak on failure to copy root
Josef Bacik <[email protected]>
btrfs: fix reloc root leak with 0 ref reloc roots on recovery
Josef Bacik <[email protected]>
btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root
Jarkko Sakkinen <[email protected]>
KEYS: trusted: Fix migratable=1 failing
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt
Thinh Nguyen <[email protected]>
usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1
Dan Carpenter <[email protected]>
USB: serial: mos7720: fix error code in mos7720_write()
Dan Carpenter <[email protected]>
USB: serial: mos7840: fix error code in mos7840_write()
Paul Cercueil <[email protected]>
usb: musb: Fix runtime PM race in musb_queue_resume_work
Lech Perczak <[email protected]>
USB: serial: option: update interface mapping for ZTE P685M
Marcos Paulo de Souza <[email protected]>
Input: i8042 - add ASUS Zenbook Flip to noselftest list
Dan Carpenter <[email protected]>
Input: joydev - prevent potential read overflow in ioctl
Olivier Crête <[email protected]>
Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S
jeffrey.lin <[email protected]>
Input: raydium_ts_i2c - do not send zero length
Qinglang Miao <[email protected]>
ACPI: configfs: add missing check after configfs_register_default_group()
Mikulas Patocka <[email protected]>
blk-settings: align max_sectors on "logical_block_size" boundary
Randy Dunlap <[email protected]>
scsi: bnx2fc: Fix Kconfig warning & CNIC build errors
Maxime Ripard <[email protected]>
i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
Marc Zyngier <[email protected]>
arm64: Add missing ISB after invalidating TLB in __primary_switch
Miaohe Lin <[email protected]>
mm/hugetlb: fix potential double free in hugetlb_register_node() error path
Miaohe Lin <[email protected]>
mm/memory.c: fix potential pte_unmap_unlock pte error
Dan Carpenter <[email protected]>
ocfs2: fix a use after free on error
Chuhong Yuan <[email protected]>
net/mlx4_core: Add missed mlx4_free_cmd_mailbox()
Jann Horn <[email protected]>
Take mmap lock in cacheflush syscall
Slawomir Laba <[email protected]>
i40e: Fix flow for IPv6 next header (extension header)
Konrad Dybcio <[email protected]>
drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY)
Heiner Kallweit <[email protected]>
PCI: Align checking of syscall user config accessors
Jorgen Hansen <[email protected]>
VMCI: Use set_page_dirty_lock() when unregistering guest memory
Simon South <[email protected]>
pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare()
Aswath Govindraju <[email protected]>
misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users
Aswath Govindraju <[email protected]>
misc: eeprom_93xx46: Fix module alias to enable module autoprobe
Randy Dunlap <[email protected]>
sparc64: only select COMPAT_BINFMT_ELF if BINFMT_ELF is set
Dan Carpenter <[email protected]>
Input: elo - fix an error code in elo_connect()
Namhyung Kim <[email protected]>
perf test: Fix unaligned access in sample parsing test
Adrian Hunter <[email protected]>
perf intel-pt: Fix missing CYC processing in PSB
Andy Shevchenko <[email protected]>
spi: pxa2xx: Fix the controller numbering for Wildcat Point
Nathan Lynch <[email protected]>
powerpc/pseries/dlpar: handle ibm, configure-connector delay status
Dan Carpenter <[email protected]>
mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()
Bob Pearson <[email protected]>
RDMA/rxe: Fix coding error in rxe_recv.c
Arnaldo Carvalho de Melo <[email protected]>
perf tools: Fix DSO filtering when not finding a map for a sampled address
Steven Rostedt (VMware) <[email protected]>
tracepoint: Do not fail unregistering a probe due to memory failure
Uwe Kleine-König <[email protected]>
amba: Fix resource leak for drivers without .remove
Vladimir Murzin <[email protected]>
ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores
Christophe JAILLET <[email protected]>
mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe
Christophe Leroy <[email protected]>
powerpc/47x: Disable 256k page size
Shay Drory <[email protected]>
IB/umad: Return EIO in case of when device disassociated
Pan Bian <[email protected]>
isofs: release buffer head before return
Pan Bian <[email protected]>
regulator: axp20x: Fix reference cout leak
Tom Rix <[email protected]>
clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined
Claudiu Beznea <[email protected]>
power: reset: at91-sama5d2_shdwc: fix wkupdbc mask
Nicolas Boichat <[email protected]>
of/fdt: Make sure no-map does not remove already reserved regions
KarimAllah Ahmed <[email protected]>
fdt: Properly handle "no-map" field in the memory region
Christophe JAILLET <[email protected]>
dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function
Christophe JAILLET <[email protected]>
dmaengine: fsldma: Fix a resource leak in the remove function
Randy Dunlap <[email protected]>
HID: core: detect and skip invalid inputs to snto32()
Pratyush Yadav <[email protected]>
spi: cadence-quadspi: Abort read if dummy cycles required are too many
Martin Blumenstingl <[email protected]>
clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL
Tom Rix <[email protected]>
jffs2: fix use after free in jffs2_sum_write_data()
Colin Ian King <[email protected]>
fs/jfs: fix potential integer overflow on shift of a int
Daniele Alessandrelli <[email protected]>
crypto: ecdh_helper - Ensure 'len >= secret.len' in decode_key()
Zhihao Cheng <[email protected]>
btrfs: clarify error returns values in __load_free_space_cache
Florian Fainelli <[email protected]>
ata: ahci_brcm: Add back regulators management
Laurent Pinchart <[email protected]>
media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values
Tom Rix <[email protected]>
media: pxa_camera: declare variable when DEBUG is defined
Christophe JAILLET <[email protected]>
media: cx25821: Fix a bug when reallocating some dma memory
Luo Meng <[email protected]>
media: qm1d1c0042: fix error return code in qm1d1c0042_init()
Joe Perches <[email protected]>
media: lmedm04: Fix misuse of comma
Dan Carpenter <[email protected]>
ASoC: cs42l56: fix up error handling in probe
Dinghao Liu <[email protected]>
media: tm6000: Fix memleak in tm6000_start_stream
Dinghao Liu <[email protected]>
media: media/pci: Fix memleak in empress_init
Christophe JAILLET <[email protected]>
media: vsp1: Fix an error handling path in the probe function
Nathan Chancellor <[email protected]>
MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0
Nathan Chancellor <[email protected]>
MIPS: c-r4k: Fix section mismatch for loongson2_sc_init
Dan Carpenter <[email protected]>
gma500: clean up error handling in init
Jialin Zhang <[email protected]>
drm/gma500: Fix error return code in psb_driver_load()
Randy Dunlap <[email protected]>
fbdev: aty: SPARC64 requires FB_ATY_CT
Colin Ian King <[email protected]>
b43: N-PHY: Fix the update of coef for the PHY revision >= 3case
Colin Ian King <[email protected]>
mac80211: fix potential overflow when multiplying to u32 integers
Juergen Gross <[email protected]>
xen/netback: fix spurious event detection for common event case
Edwin Peer <[email protected]>
bnxt_en: reverse order of TX disable and carrier off
Arnd Bergmann <[email protected]>
ARM: s3c: fix fiq for clang IAS
Vincent Knecht <[email protected]>
arm64: dts: msm8916: Fix reserved and rfsa nodes unit address
Guenter Roeck <[email protected]>
usb: dwc2: Make "trimming xfer length" a debug message
Guenter Roeck <[email protected]>
usb: dwc2: Abort transaction after errors with unknown reason
Guenter Roeck <[email protected]>
usb: dwc2: Do not update data length if it is 0 on inbound transfers
Tony Lindgren <[email protected]>
ARM: dts: Configure missing thermal interrupt for 4430
Pan Bian <[email protected]>
Bluetooth: Put HCI device if inquiry procedure interrupts
Pan Bian <[email protected]>
Bluetooth: drop HCI device reference before return
Krzysztof Kozlowski <[email protected]>
arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso
Krzysztof Kozlowski <[email protected]>
ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa
Krzysztof Kozlowski <[email protected]>
ARM: dts: exynos: correct PMIC interrupt trigger level on Spring
Christopher William Snowhill <[email protected]>
Bluetooth: Fix initializing response id after clearing struct
Vlastimil Babka <[email protected]>
mm, thp: make do_huge_pmd_wp_page() lock page for testing mapcount
Eric Biggers <[email protected]>
random: fix the RNDRESEEDCRNG ioctl
Alexander Lobakin <[email protected]>
MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section
Sumit Garg <[email protected]>
kdb: Make memory allocations more robust
Rong Chen <[email protected]>
scripts/recordmcount.pl: support big endian for ARCH sh
Shyam Prasad N <[email protected]>
cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
Christoph Schemmel <[email protected]>
NET: usb: qmi_wwan: Adding support for Cinterion MV31
Sameer Pujar <[email protected]>
arm64: tegra: Add power-domain for Tegra210 HDA
Corinna Vinschen <[email protected]>
igb: Remove incorrect "unexpected SYS WRAP" log message
Rustam Kovhaev <[email protected]>
ntfs: check for valid standard information attribute
Stefan Ursella <[email protected]>
usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable
Will McVicker <[email protected]>
HID: make arrays usage and value to be the same
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/compressed/head.S | 4 +- arch/arm/boot/dts/exynos5250-spring.dts | 2 +- arch/arm/boot/dts/exynos5420-arndale-octa.dts | 2 +- arch/arm/boot/dts/omap443x.dtsi | 2 + arch/arm64/boot/dts/exynos/exynos7-espresso.dts | 2 +- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 1 + arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 +- arch/arm64/kernel/head.S | 1 + arch/mips/kernel/vmlinux.lds.S | 1 + arch/mips/lantiq/irq.c | 2 +- arch/mips/mm/c-r4k.c | 2 +- arch/nios2/kernel/sys_nios2.c | 11 ++- arch/powerpc/Kconfig | 2 +- arch/powerpc/platforms/pseries/dlpar.c | 7 +- arch/sparc/Kconfig | 2 +- arch/sparc/lib/memset.S | 1 + arch/x86/kernel/reboot.c | 29 +++---- block/blk-settings.c | 12 +++ crypto/ecdh_helper.c | 3 + drivers/acpi/acpi_configfs.c | 7 +- drivers/amba/bus.c | 20 +++-- drivers/ata/ahci_brcm.c | 14 +++- drivers/block/floppy.c | 27 ++++--- drivers/char/random.c | 2 +- drivers/clk/meson/clk-pll.c | 2 +- drivers/clocksource/mxs_timer.c | 5 +- drivers/dma/fsldma.c | 6 ++ drivers/gpio/gpio-pcf857x.c | 2 +- drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 22 ++--- drivers/gpu/drm/gma500/psb_drv.c | 2 + drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 2 +- drivers/hid/hid-core.c | 9 ++- drivers/i2c/busses/i2c-brcmstb.c | 2 +- drivers/infiniband/core/user_mad.c | 7 +- drivers/infiniband/sw/rxe/rxe_recv.c | 11 ++- drivers/input/joydev.c | 7 +- drivers/input/joystick/xpad.c | 1 + drivers/input/serio/i8042-x86ia64io.h | 4 + drivers/input/touchscreen/elo.c | 4 +- drivers/input/touchscreen/raydium_i2c_ts.c | 3 +- drivers/md/dm-era-target.c | 93 ++++++++++++++-------- drivers/media/pci/cx25821/cx25821-core.c | 4 +- drivers/media/pci/saa7134/saa7134-empress.c | 5 +- drivers/media/platform/pxa_camera.c | 3 + drivers/media/platform/vsp1/vsp1_drv.c | 4 +- drivers/media/tuners/qm1d1c0042.c | 4 +- drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- drivers/media/usb/tm6000/tm6000-dvb.c | 4 + drivers/media/usb/uvc/uvc_v4l2.c | 18 ++--- drivers/mfd/wm831x-auxadc.c | 3 +- drivers/misc/eeprom/eeprom_93xx46.c | 1 + drivers/misc/vmw_vmci/vmci_queue_pair.c | 5 +- drivers/mmc/host/sdhci-esdhc-imx.c | 3 +- drivers/mmc/host/usdhi6rol0.c | 4 +- drivers/mtd/spi-nor/cadence-quadspi.c | 2 +- drivers/mtd/spi-nor/hisi-sfc.c | 4 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 +- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++- drivers/net/ethernet/intel/igb/igb_main.c | 2 - .../net/ethernet/mellanox/mlx4/resource_tracker.c | 1 + drivers/net/ethernet/sun/sunvnet_common.c | 24 +----- drivers/net/gtp.c | 5 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/wireless/broadcom/b43/phy_n.c | 2 +- drivers/net/xen-netback/interface.c | 8 +- drivers/nvdimm/dimm_devs.c | 18 ++++- drivers/of/fdt.c | 12 ++- drivers/pci/syscall.c | 10 +-- drivers/power/reset/at91-sama5d2_shdwc.c | 2 +- drivers/pwm/pwm-rockchip.c | 1 - drivers/regulator/axp20x-regulator.c | 7 +- drivers/scsi/bnx2fc/Kconfig | 1 + drivers/spi/spi-pxa2xx-pci.c | 27 +++++-- drivers/spi/spi-s3c24xx-fiq.S | 9 +-- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + drivers/usb/core/quirks.c | 3 + drivers/usb/dwc2/hcd.c | 15 ++-- drivers/usb/dwc2/hcd_intr.c | 14 +++- drivers/usb/dwc3/gadget.c | 19 ++++- drivers/usb/musb/musb_core.c | 31 ++++---- drivers/usb/renesas_usbhs/fifo.c | 2 + drivers/usb/serial/mos7720.c | 4 +- drivers/usb/serial/mos7840.c | 4 +- drivers/usb/serial/option.c | 3 +- drivers/video/fbdev/Kconfig | 2 +- fs/btrfs/ctree.c | 7 +- fs/btrfs/free-space-cache.c | 6 +- fs/btrfs/relocation.c | 4 +- fs/cifs/connect.c | 1 + fs/f2fs/file.c | 3 +- fs/gfs2/lock_dlm.c | 8 +- fs/isofs/dir.c | 1 + fs/isofs/namei.c | 1 + fs/jffs2/summary.c | 3 + fs/jfs/jfs_dmap.c | 2 +- fs/ntfs/inode.c | 6 ++ fs/ocfs2/cluster/heartbeat.c | 8 +- include/linux/icmpv6.h | 44 +++++++++- include/linux/ipv6.h | 2 +- include/net/icmp.h | 10 +++ kernel/debug/kdb/kdb_private.h | 2 +- kernel/futex.c | 12 +-- kernel/module.c | 21 ++++- kernel/seccomp.c | 2 + kernel/tracepoint.c | 80 +++++++++++++++---- mm/huge_memory.c | 15 ++++ mm/hugetlb.c | 43 +++++++++- mm/memory.c | 6 +- net/bluetooth/a2mp.c | 3 +- net/bluetooth/hci_core.c | 6 +- net/ipv4/icmp.c | 34 ++++++++ net/ipv6/icmp.c | 19 ++--- net/ipv6/ip6_icmp.c | 46 +++++++++-- net/mac80211/mesh_hwmp.c | 2 +- scripts/recordmcount.pl | 6 +- security/keys/trusted.c | 2 +- sound/soc/codecs/cs42l56.c | 3 +- tools/perf/tests/sample-parsing.c | 2 +- tools/perf/util/event.c | 2 + .../perf/util/intel-pt-decoder/intel-pt-decoder.c | 3 + 121 files changed, 763 insertions(+), 304 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/134 HID: make arrays usage and value to be the same
From: Will McVicker <[email protected]>
commit ed9be64eefe26d7d8b0b5b9fa3ffdf425d87a01f upstream.
The HID subsystem allows an "HID report field" to have a different number of "values" and "usages" when it is allocated. When a field struct is created, the size of the usage array is guaranteed to be at least as large as the values array, but it may be larger. This leads to a potential out-of-bounds write in __hidinput_change_resolution_multipliers() and an out-of-bounds read in hidinput_count_leds().
To fix this, let's make sure that both the usage and value arrays are the same size.
--- drivers/hid/hid-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/hid/hid-core.c +3 -3
@@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);* Register a new field for this report. */ -static struct hid_field *hid_register_field (struct hid_report *report,unsigned usages,unsigned values) +static struct hid_field *hid_register_field (struct hid_report *report,unsigned usages) {struct hid_field *field;
@@ -102,7 +102,7 @@ static struct hid_field *hid_register_fi field =kzalloc ((sizeof (struct hid_field ) + usages *sizeof (struct hid_usage ) + - values *sizeof (unsigned )),GFP_KERNEL ); + usages *sizeof (unsigned )),GFP_KERNEL );if (!field)return NULL ;
@@ -281,7 +281,7 @@ static int hid_add_field(struct hid_pars usages =max_t (unsigned, parser->local.usage_index, parser->global.report_count); - field =hid_register_field (report, usages, parser->global.report_count); + field =hid_register_field (report, usages);if (!field)return 0 ;
Greg Kroah-Hartman
maintainerPATCH 2/134 usb: quirks: add quirk to start video capture on ELMO L-12F document camera reliable
In reply to Greg Kroah-HartmanFrom: Stefan Ursella <[email protected]>
commit 1ebe718bb48278105816ba03a0408ecc2d6cf47f upstream.
Without this quirk starting a video capture from the device often fails with
kernel: uvcvideo: Failed to set UVC probe control : -110 (exp. 34).
--- drivers/usb/core/quirks.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/core/quirks.c +3 -0
@@ -230,6 +230,9 @@ static const struct usb_device_id usb_qu/* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, + /* ELMO L-12F document camera */ + { USB_DEVICE(0x09a1, 0x0028), .driver_info = USB_QUIRK_DELAY_CTRL_MSG }, + /* Broadcom BCM92035DGROM BT dongle */ { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
Greg Kroah-Hartman
maintainerPATCH 3/134 ntfs: check for valid standard information attribute
In reply to Greg Kroah-HartmanFrom: Rustam Kovhaev <[email protected]>
commit 4dfe6bd94959222e18d512bdf15f6bf9edb9c27c upstream.
Mounting a corrupted filesystem with NTFS resulted in a kernel crash.
We should check for valid STANDARD_INFORMATION attribute offset and length before trying to access it
--- fs/ntfs/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ntfs/inode.c +6 -0
@@ -661,6 +661,12 @@ static int ntfs_read_locked_inode(struct } a = ctx->attr;/* Get the standard information attribute value. */ +if ((u8 *)a +le16_to_cpu (a->data.resident.value_offset) + +le32_to_cpu (a->data.resident.value_length) > + (u8 *)ctx->mrec + vol->mft_record_size) { +ntfs_error (vi->i_sb,"Corrupt standard information attribute in inode." ); + goto unm_err_out; + } si = (STANDARD_INFORMATION *)((u8 *)a +le16_to_cpu (a->data.resident.value_offset));
Greg Kroah-Hartman
maintainerPATCH 4/134 igb: Remove incorrect "unexpected SYS WRAP" log message
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
commit 2643e6e90210e16c978919617170089b7c2164f7 upstream.
TSAUXC.DisableSystime is never set, so SYSTIM runs into a SYS WRAP every 1100 secs on 80580/i350/i354 (40 bit SYSTIM) and every 35000 secs on 80576 (45 bit SYSTIM).
This wrap event sets the TSICR.SysWrap bit unconditionally.
However, checking TSIM at interrupt time shows that this event does not actually cause the interrupt. Rather, it's just bycatch while the actual interrupt is caused by, for instance, TSICR.TXTS.
The conclusion is that the SYS WRAP is actually expected, so the "unexpected SYS WRAP" message is entirely bogus and just helps to confuse users. Drop it.
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +0 -2
@@ -5665,8 +5665,6 @@ static void igb_tsync_interrupt(struct i event.type =PTP_CLOCK_PPS ;if (adapter->ptp_caps.pps)ptp_clock_event (adapter->ptp_clock, &event); -else -dev_err (&adapter->pdev->dev,"unexpected SYS WRAP" ); ack |=TSINTR_SYS_WRAP ; }
Greg Kroah-Hartman
maintainerPATCH 5/134 arm64: tegra: Add power-domain for Tegra210 HDA
In reply to Greg Kroah-HartmanFrom: Sameer Pujar <[email protected]>
commit 1e0ca5467445bc1f41a9e403d6161a22f313dae7 upstream.
HDA initialization is failing occasionally on Tegra210 and following print is observed in the boot log. Because of this probe() fails and no sound card is registered.
[16.800802] tegra-hda 70030000.hda: no codecs found!
Codecs request a state change and enumeration by the controller. In failure cases this does not seem to happen as STATETS register reads 0.
The problem seems to be related to the HDA codec dependency on SOR power domain. If it is gated during HDA probe then the failure is observed. Building Tegra HDA driver into kernel image avoids this failure but does not completely address the dependency part. Fix this problem by adding 'power-domains' DT property for Tegra210 HDA. Note that Tegra186 and Tegra194 HDA do this already.
Depends-on: 96d1f078ff0 ("arm64: tegra: Add SOR power-domain for Tegra210")
--- arch/arm64/boot/dts/nvidia/tegra210.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +1 -0
@@ -727,6 +727,7 @@ <&tegra_car 128>, /* hda2hdmi */ <&tegra_car 111>; /* hda2codec_2x */ reset-names = "hda", "hda2hdmi", "hda2codec_2x"; + power-domains = <&pd_sor>; status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 6/134 NET: usb: qmi_wwan: Adding support for Cinterion MV31
In reply to Greg Kroah-HartmanFrom: Christoph Schemmel <[email protected]>
[ Upstream commit a4dc7eee9106a9d2a6e08b442db19677aa9699c7 ]
Adding support for Cinterion MV31 with PID 0x00B7.
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 11 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs= 1 P: Vendor=1e2d ProdID=00b7 Rev=04.14 S: Manufacturer=Cinterion S: Product=Cinterion USB Mobile Broadband S: SerialNumber=b3246eed C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=896mA I: If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I: If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -949,6 +949,7 @@ static const struct usb_device_id products[] = { {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */ {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/ {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */ + {QMI_FIXED_INTF(0x1e2d, 0x00b7, 0)}, /* Cinterion MV31 RmNet */ {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */ {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 7/134 cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath.
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
[ Upstream commit a738c93fb1c17e386a09304b517b1c6b2a6a5a8b ]
While debugging another issue today, Steve and I noticed that if a subdir for a file share is already mounted on the client, any new mount of any other subdir (or the file share root) of the same share results in sharing the cifs superblock, which e.g. can result in incorrect device name.
While setting prefix path for the root of a cifs_sb, CIFS_MOUNT_USE_PREFIX_PATH flag should also be set. Without it, prepath is not even considered in some places, and output of "mount" and various /proc/<>/*mount* related options can be missing part of the device name.
--- fs/cifs/connect.c | 1 + 1 file changed, 1 insertion(+)
fs/cifs/connect.c +1 -0
@@ -3488,6 +3488,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info, cifs_sb->prepath =kstrdup (pvolume_info->prepath,GFP_KERNEL );if (cifs_sb->prepath ==NULL )return -ENOMEM ; + cifs_sb->mnt_cifs_flags |=CIFS_MOUNT_USE_PREFIX_PATH ; }return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 8/134 scripts/recordmcount.pl: support big endian for ARCH sh
In reply to Greg Kroah-HartmanFrom: Rong Chen <[email protected]>
[ Upstream commit 93ca696376dd3d44b9e5eae835ffbc84772023ec ]
The kernel test robot reported the following issue:
CC [M] drivers/soc/litex/litex_soc_ctrl.o
sh4-linux-objcopy: Unable to change endianness of input file(s)
sh4-linux-ld: cannot find drivers/soc/litex/.tmp_gl_litex_soc_ctrl.o: No such file or directory
sh4-linux-objcopy: 'drivers/soc/litex/.tmp_mx_litex_soc_ctrl.o': No such file
The problem is that the format of input file is elf32-shbig-linux, but sh4-linux-objcopy wants to output a file which format is elf32-sh-linux:
$ sh4-linux-objdump -d drivers/soc/litex/litex_soc_ctrl.o | grep format drivers/soc/litex/litex_soc_ctrl.o: file format elf32-shbig-linux
--- scripts/recordmcount.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/recordmcount.pl +5 -1
@@ -261,7 +261,11 @@ if ($arch eq "x86_64") { # force flags for this arch $ld .= " -m shlelf_linux"; - $objcopy .= " -O elf32-sh-linux"; + if ($endian eq "big") { + $objcopy .= " -O elf32-shbig-linux"; + } else { + $objcopy .= " -O elf32-sh-linux"; + } } elsif ($arch eq "powerpc") { $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 9/134 kdb: Make memory allocations more robust
In reply to Greg Kroah-HartmanFrom: Sumit Garg <[email protected]>
commit 93f7a6d818deef69d0ba652d46bae6fbabbf365c upstream.
Currently kdb uses in_interrupt() to determine whether its library code has been called from the kgdb trap handler or from a saner calling context such as driver init. This approach is broken because in_interrupt() alone isn't able to determine kgdb trap handler entry from normal task context. This can happen during normal use of basic features such as breakpoints and can also be trivially reproduced using:
echo g > /proc/sysrq-trigger
We can improve this by adding check for in_dbg_master() instead which explicitly determines if we are running in debugger context.
--- kernel/debug/kdb/kdb_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/debug/kdb/kdb_private.h +1 -1
@@ -234,7 +234,7 @@ extern struct task_struct *kdb_curr_task#define kdb_do_each_thread (g, p) do_each_thread(g, p)#define kdb_while_each_thread (g, p) while_each_thread(g, p) -#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) +#define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL)extern void *debug_kmalloc (size_t size,gfp_t flags);extern void debug_kfree (void *);
Greg Kroah-Hartman
maintainerPATCH 10/134 MIPS: vmlinux.lds.S: add missing PAGE_ALIGNED_DATA() section
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit 8ac7c87acdcac156670f9920c8acbd84308ff4b1 upstream.
MIPS uses its own declaration of rwdata, and thus it should be kept in sync with the asm-generic one. Currently PAGE_ALIGNED_DATA() is missing from the linker script, which emits the following ld warnings:
mips-alpine-linux-musl-ld: warning: orphan section .data..page_aligned' from arch/mips/kernel/vdso.o' being placed in section `.data..page_aligned'
mips-alpine-linux-musl-ld: warning: orphan section .data..page_aligned' from arch/mips/vdso/vdso-image.o' being placed in section `.data..page_aligned'
Add the necessary declaration, so the mentioned structures will be placed in vmlinux as intended:
ffffffff80630580 D __end_onceffffffff80630580 D __start___dyndbgffffffff80630580 D __start_onceffffffff80630580 D __stop___dyndbgffffffff80634000 d mips_vdso_dataffffffff80638000 d vdso_dataffffffff80638580 D _gpffffffff8063c000 T __init_beginffffffff8063c000 D _edataffffffff8063c000 T _sinittext
->
ffffffff805a4000 D __end_init_taskffffffff805a4000 D __nosave_beginffffffff805a4000 D __nosave_endffffffff805a4000 d mips_vdso_dataffffffff805a8000 d vdso_dataffffffff805ac000 D mmlist_lockffffffff805ac080 D tasklist_lock
--- arch/mips/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+)
arch/mips/kernel/vmlinux.lds.S +1 -0
@@ -92,6 +92,7 @@ SECTIONS INIT_TASK_DATA(THREAD_SIZE) NOSAVE_DATA + PAGE_ALIGNED_DATA(PAGE_SIZE) CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT) DATA_DATA
Greg Kroah-Hartman
maintainerPATCH 11/134 random: fix the RNDRESEEDCRNG ioctl
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 11a0b5e0ec8c13bef06f7414f9e914506140d5cb upstream.
The RNDRESEEDCRNG ioctl reseeds the primary_crng from itself, which doesn't make sense. Reseed it from the input_pool instead.
--- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/random.c +1 -1
@@ -1913,7 +1913,7 @@ static long random_ioctl(struct file *f,return -EPERM ;if (crng_init <2 )return -ENODATA ; -crng_reseed (&primary_crng,NULL ); +crng_reseed (&primary_crng, &input_pool); crng_global_init_time = jiffies -1 ;return 0 ;default :
Greg Kroah-Hartman
maintainerPATCH 12/134 mm, thp: make do_huge_pmd_wp_page() lock page for testing mapcount
In reply to Greg Kroah-HartmanFrom: Vlastimil Babka <[email protected]>
Jann reported [1] a race between __split_huge_pmd_locked() and page_trans_huge_map_swapcount() which can result in a page to be reused instead of COWed. This was later assigned CVE-2020-29368.
This was fixed by commit c444eb564fb1 ("mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()") by doing the split under the page lock, while all users of page_trans_huge_map_swapcount() were already also under page lock. The fix was backported also to 4.9 stable series.
When testing the backport on a 4.12 based kernel, Nicolai noticed the POC from
[1] still reproduces after backporting c444eb564fb1 and identified a missing page lock in do_huge_pmd_wp_page() around the call to page_trans_huge_mapcount(). The page lock was only added in ba3c4ce6def4 ("mm, THP, swap: make reuse_swap_page() works for THP swapped out") in 4.14. The commit also wrapped page_trans_huge_mapcount() into page_trans_huge_map_swapcount() for the purposes of COW decisions.
I have verified that 4.9.y indeed also reproduces with the POC. Backporting ba3c4ce6def4 alone however is not possible as it's part of a larger effort of optimizing THP swapping, which would be risky to backport fully.
Therefore this 4.9-stable-only patch just wraps page_trans_huge_mapcount() in page_trans_huge_mapcount() under page lock the same way as ba3c4ce6def4 does, but without the page_trans_huge_map_swapcount() part. Other callers of page_trans_huge_mapcount() are all under page lock already. I have verified the POC no longer reproduces afterwards.
[1] https://bugs.chromium.org/p/project-zero/issues/detail?id=2045
--- mm/huge_memory.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
mm/huge_memory.c +15 -0
@@ -1022,6 +1022,19 @@ int do_huge_pmd_wp_page(struct fault_env* We can only reuse the page if nobody else maps the huge page or it's * part. */ +if (!trylock_page (page)) { +get_page (page); +spin_unlock (fe->ptl); +lock_page (page); +spin_lock (fe->ptl); +if (unlikely (!pmd_same (*fe->pmd, orig_pmd))) { +unlock_page (page); +put_page (page); + goto out_unlock; + } +put_page (page); + } +if (page_trans_huge_mapcount (page,NULL ) ==1 ) {pmd_t entry; entry =pmd_mkyoung (orig_pmd);
@@ -1029,8 +1042,10 @@ int do_huge_pmd_wp_page(struct fault_envif (pmdp_set_access_flags (vma, haddr, fe->pmd, entry,1 ))update_mmu_cache_pmd (vma, fe->address, fe->pmd); ret |=VM_FAULT_WRITE ; +unlock_page (page); goto out_unlock; } +unlock_page (page);get_page (page);spin_unlock (fe->ptl); alloc:
Greg Kroah-Hartman
maintainerPATCH 13/134 Bluetooth: Fix initializing response id after clearing struct
In reply to Greg Kroah-HartmanFrom: Christopher William Snowhill <[email protected]>
[ Upstream commit a5687c644015a097304a2e47476c0ecab2065734 ]
Looks like this was missed when patching the source to clear the structures throughout, causing this one instance to clear the struct after the response id is assigned.
--- net/bluetooth/a2mp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/a2mp.c +1 -1
@@ -388,9 +388,9 @@ static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb, hdev =hci_dev_get (req->id);if (!hdev || hdev->amp_type ==AMP_TYPE_BREDR || tmp) {struct a2mp_amp_assoc_rsp rsp; - rsp.id = req->id;memset (&rsp,0 ,sizeof (rsp)); + rsp.id = req->id;if (tmp) { rsp.status =A2MP_STATUS_COLLISION_OCCURED ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 14/134 ARM: dts: exynos: correct PMIC interrupt trigger level on Spring
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 77e6a5467cb8657cf8b5e610a30a4c502085e4f9 ]
The Samsung PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
--- arch/arm/boot/dts/exynos5250-spring.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5250-spring.dts +1 -1
@@ -112,7 +112,7 @@ compatible = "samsung,s5m8767-pmic"; reg = <0x66>; interrupt-parent = <&gpx3>; - interrupts = <2 IRQ_TYPE_NONE>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&s5m8767_irq &s5m8767_dvs &s5m8767_ds>; wakeup-source;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 15/134 ARM: dts: exynos: correct PMIC interrupt trigger level on Arndale Octa
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 1ac8893c4fa3d4a34915dc5cdab568a39db5086c ]
The Samsung PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.
--- arch/arm/boot/dts/exynos5420-arndale-octa.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5420-arndale-octa.dts +1 -1
@@ -88,7 +88,7 @@ reg = <0x66>; interrupt-parent = <&gpx3>; - interrupts = <2 IRQ_TYPE_EDGE_FALLING>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default"; pinctrl-0 = <&s2mps11_irq>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 16/134 arm64: dts: exynos: correct PMIC interrupt trigger level on Espresso
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 1fea2eb2f5bbd3fbbe2513d2386b5f6e6db17fd7 ]
The Samsung PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.
--- arch/arm64/boot/dts/exynos/exynos7-espresso.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/exynos/exynos7-espresso.dts +1 -1
@@ -64,7 +64,7 @@ s2mps15_pmic@66 { compatible = "samsung,s2mps15-pmic"; reg = <0x66>; - interrupts = <2 IRQ_TYPE_NONE>; + interrupts = <2 IRQ_TYPE_LEVEL_LOW>; interrupt-parent = <&gpa0>; pinctrl-names = "default"; pinctrl-0 = <&pmic_irq>;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 17/134 Bluetooth: drop HCI device reference before return
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 5a3ef03afe7e12982dc3b978f4c5077c907f7501 ]
Call hci_dev_put() to decrement reference count of HCI device hdev if fails to duplicate memory.
--- net/bluetooth/a2mp.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/a2mp.c +1 -0
@@ -519,6 +519,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb, assoc =kmemdup (req->amp_assoc, assoc_len,GFP_KERNEL );if (!assoc) {amp_ctrl_put (ctrl); +hci_dev_put (hdev);return -ENOMEM ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 18/134 Bluetooth: Put HCI device if inquiry procedure interrupts
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 28a758c861ff290e39d4f1ee0aa5df0f0b9a45ee ]
Jump to the label done to decrement the reference count of HCI device hdev on path that the Inquiry procedure is interrupted.
--- net/bluetooth/hci_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +4 -2
@@ -1243,8 +1243,10 @@ int hci_inquiry(void __user *arg)* cleared). If it is interrupted by a signal, return -EINTR. */ if (wait_on_bit (&hdev->flags,HCI_INQUIRY , -TASK_INTERRUPTIBLE )) -return -EINTR ; +TASK_INTERRUPTIBLE )) { + err = -EINTR ; + goto done; + } }/* for unlimited number of responses we will use buffer with
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 19/134 ARM: dts: Configure missing thermal interrupt for 4430
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 44f416879a442600b006ef7dec3a6dc98bcf59c6 ]
We have gpio_86 wired internally to the bandgap thermal shutdown interrupt on 4430 like we have it on 4460 according to the TRM. This can be found easily by searching for TSHUT.
For some reason the thermal shutdown interrupt was never added for 4430, let's add it. I believe this is needed for the thermal shutdown interrupt handler ti_bandgap_tshut_irq_handler() to call orderly_poweroff().
--- arch/arm/boot/dts/omap443x.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/omap443x.dtsi +2 -0
@@ -35,10 +35,12 @@ }; ocp { + /* 4430 has only gpio_86 tshut and no talert interrupt */ bandgap: bandgap@4a002260 { reg = <0x4a002260 0x4 0x4a00232C 0x4>; compatible = "ti,omap4430-bandgap"; + gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>; #thermal-sensor-cells = <0>; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 20/134 usb: dwc2: Do not update data length if it is 0 on inbound transfers
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 415fa1c7305dedbb345e2cc8ac91769bc1c83f1a ]
The DWC2 documentation states that transfers with zero data length should set the number of packets to 1 and the transfer length to 0. This is not currently the case for inbound transfers: the transfer length is set to the maximum packet length. This can have adverse effects if the chip actually does transfer data as it is programmed to do. Follow chip documentation and keep the transfer length set to 0 in that situation.
--- drivers/usb/dwc2/hcd.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/usb/dwc2/hcd.c +8 -7
@@ -1425,19 +1425,20 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,if (num_packets > max_hc_pkt_count) { num_packets = max_hc_pkt_count; chan->xfer_len = num_packets * chan->max_packet; + }else if (chan->ep_is_in) { +/* +* Always program an integral # of max packets +* for IN transfers. +* Note: This assumes that the input buffer is +* aligned and sized accordingly. +*/ + chan->xfer_len = num_packets * chan->max_packet; } }else {/* Need 1 packet for transfer length of 0 */ num_packets =1 ; } -if (chan->ep_is_in) -/* -* Always program an integral # of max packets for IN -* transfers -*/ - chan->xfer_len = num_packets * chan->max_packet; -if (chan->ep_type ==USB_ENDPOINT_XFER_INT || chan->ep_type ==USB_ENDPOINT_XFER_ISOC )/*
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 21/134 usb: dwc2: Abort transaction after errors with unknown reason
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit f74b68c61cbc4b2245022fcce038509333d63f6f ]
In some situations, the following error messages are reported.
dwc2 ff540000.usb: dwc2_hc_chhltd_intr_dma: Channel 1 - ChHltd set, but reason is unknown dwc2 ff540000.usb: hcint 0x00000002, intsts 0x04000021
This is sometimes followed by:
dwc2 ff540000.usb: dwc2_update_urb_state_abn(): trimming xfer length
and then:
WARNING: CPU: 0 PID: 0 at kernel/v4.19/drivers/usb/dwc2/hcd.c:2913 dwc2_assign_and_init_hc+0x98c/0x990
The warning suggests that an odd buffer address is to be used for DMA.
After an error is observed, the receive buffer may be full (urb->actual_length >= urb->length). However, the urb is still left in the queue unless three errors were observed in a row. When it is queued again, the dwc2 hcd code translates this into a 1-block transfer. If urb->actual_length (ie the total expected receive length) is not DMA-aligned, the buffer pointer programmed into the chip will be unaligned. This results in the observed warning.
To solve the problem, abort input transactions after an error with unknown cause if the entire packet was already received. This may be a bit drastic, but we don't really know why the transfer was aborted even though the entire packet was received. Aborting the transfer in this situation is less risky than accepting a potentially corrupted packet.
With this patch in place, the 'ChHltd set' and 'trimming xfer length' messages are still observed, but there are no more transfer attempts with odd buffer addresses.
--- drivers/usb/dwc2/hcd_intr.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/usb/dwc2/hcd_intr.c +12 -0
@@ -1921,6 +1921,18 @@ error: qtd->error_count++;dwc2_update_urb_state_abn (hsotg, chan, chnum, qtd->urb, qtd,DWC2_HC_XFER_XACT_ERR ); +/* +* We can get here after a completed transaction +* (urb->actual_length >= urb->length) which was not reported +* as completed. If that is the case, and we do not abort +* the transfer, a transfer of size 0 will be enqueued +* subsequently. If urb->actual_length is not DMA-aligned, +* the buffer will then point to an unaligned address, and +* the resulting behavior is undefined. Bail out in that +* situation. +*/ +if (qtd->urb->actual_length >= qtd->urb->length) + qtd->error_count =3 ;dwc2_hcd_save_data_toggle (hsotg, chan, chnum, qtd);dwc2_halt_channel (hsotg, chan, qtd,DWC2_HC_XFER_XACT_ERR ); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 22/134 usb: dwc2: Make "trimming xfer length" a debug message
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 1a9e38cabd80356ffb98c2c88fec528ea9644fd5 ]
With some USB network adapters, such as DM96xx, the following message is seen for each maximum size receive packet.
dwc2 ff540000.usb: dwc2_update_urb_state(): trimming xfer length
This happens because the packet size requested by the driver is 1522 bytes, wMaxPacketSize is 64, the dwc2 driver configures the chip to receive 24*64 = 1536 bytes, and the chip does indeed send more than 1522 bytes of data. Since the event does not indicate an error condition, the message is just noise. Demote it to debug level.
--- drivers/usb/dwc2/hcd_intr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc2/hcd_intr.c +1 -1
@@ -488,7 +488,7 @@ static int dwc2_update_urb_state(struct dwc2_hsotg *hsotg, &short_read);if (urb->actual_length + xfer_length > urb->length) { -dev_warn (hsotg->dev,"%s(): trimming xfer length\n" , __func__); +dev_dbg (hsotg->dev,"%s(): trimming xfer length\n" , __func__); xfer_length = urb->length - urb->actual_length; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 23/134 arm64: dts: msm8916: Fix reserved and rfsa nodes unit address
In reply to Greg Kroah-HartmanFrom: Vincent Knecht <[email protected]>
[ Upstream commit d5ae2528b0b56cf054b27d48b0cb85330900082f ]
Fix reserved and rfsa unit address according to their reg address
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +2 -2
@@ -62,7 +62,7 @@ no-map; }; - reserved@8668000 { + reserved@86680000 { reg = <0x0 0x86680000 0x0 0x80000>; no-map; };
@@ -72,7 +72,7 @@ no-map; }; - rfsa@867e00000 { + rfsa@867e0000 { reg = <0x0 0x867e0000 0x0 0x20000>; no-map; };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 24/134 ARM: s3c: fix fiq for clang IAS
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 7f9942c61fa60eda7cc8e42f04bd25b7d175876e ]
Building with the clang integrated assembler produces a couple of errors for the s3c24xx fiq support:
arch/arm/mach-s3c/irq-s3c24xx-fiq.S:52:2: error: instruction 'subne' can not set flags, but 's' suffix specified
subnes pc, lr, #4 @@ return, still have work to do
arch/arm/mach-s3c/irq-s3c24xx-fiq.S:64:1: error: invalid symbol redefinition
s3c24xx_spi_fiq_txrx:
There are apparently two problems: one with extraneous or duplicate labels, and one with old-style opcode mnemonics. Stefan Agner has previously fixed other problems like this, but missed this particular file.
--- drivers/spi/spi-s3c24xx-fiq.S | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/spi/spi-s3c24xx-fiq.S +3 -6
@@ -36,7 +36,6 @@ @ and an offset to the irq acknowledgment word ENTRY(s3c24xx_spi_fiq_rx) -s3c24xx_spi_fix_rx: .word fiq_rx_end - fiq_rx_start .word fiq_rx_irq_ack - fiq_rx_start fiq_rx_start:
@@ -50,7 +49,7 @@ fiq_rx_start: strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ] subs fiq_rcount, fiq_rcount, #1 - subnes pc, lr, #4 @@ return, still have work to do + subsne pc, lr, #4 @@ return, still have work to do @@ set IRQ controller so that next op will trigger IRQ mov fiq_rtmp, #0
@@ -62,7 +61,6 @@ fiq_rx_irq_ack: fiq_rx_end: ENTRY(s3c24xx_spi_fiq_txrx) -s3c24xx_spi_fiq_txrx: .word fiq_txrx_end - fiq_txrx_start .word fiq_txrx_irq_ack - fiq_txrx_start fiq_txrx_start:
@@ -77,7 +75,7 @@ fiq_txrx_start: strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ] subs fiq_rcount, fiq_rcount, #1 - subnes pc, lr, #4 @@ return, still have work to do + subsne pc, lr, #4 @@ return, still have work to do mov fiq_rtmp, #0 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
@@ -89,7 +87,6 @@ fiq_txrx_irq_ack: fiq_txrx_end: ENTRY(s3c24xx_spi_fiq_tx) -s3c24xx_spi_fix_tx: .word fiq_tx_end - fiq_tx_start .word fiq_tx_irq_ack - fiq_tx_start fiq_tx_start:
@@ -102,7 +99,7 @@ fiq_tx_start: strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ] subs fiq_rcount, fiq_rcount, #1 - subnes pc, lr, #4 @@ return, still have work to do + subsne pc, lr, #4 @@ return, still have work to do mov fiq_rtmp, #0 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 25/134 bnxt_en: reverse order of TX disable and carrier off
In reply to Greg Kroah-HartmanFrom: Edwin Peer <[email protected]>
[ Upstream commit 132e0b65dc2b8bfa9721bfce834191f24fd1d7ed ]
A TX queue can potentially immediately timeout after it is stopped and the last TX timestamp on that queue was more than 5 seconds ago with carrier still up. Prevent these intermittent false TX timeouts by bringing down carrier first before calling netif_tx_disable().
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
@@ -5095,9 +5095,10 @@ static void bnxt_tx_disable(struct bnxt *bp) txr->dev_state =BNXT_DEV_STATE_CLOSING ; } } +/* Drop carrier first to prevent TX timeout */ +netif_carrier_off (bp->dev);/* Stop all TX queues */ netif_tx_disable (bp->dev); -netif_carrier_off (bp->dev); }static void bnxt_tx_enable (struct bnxt *bp)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 26/134 xen/netback: fix spurious event detection for common event case
In reply to Greg Kroah-HartmanFrom: Juergen Gross <[email protected]>
[ Upstream commit a3daf3d39132b405781be8d9ede0c449b244b64e ]
In case of a common event for rx and tx queue the event should be regarded to be spurious if no rx and no tx requests are pending.
Unfortunately the condition for testing that is wrong causing to decide a event being spurious if no rx OR no tx requests are pending.
Fix that plus using local variables for rx/tx pending indicators in order to split function calls and if condition.
--- drivers/net/xen-netback/interface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/xen-netback/interface.c +5 -3
@@ -161,13 +161,15 @@ irqreturn_t xenvif_interrupt(int irq, void *dev_id) {struct xenvif_queue *queue = dev_id;int old; +bool has_rx, has_tx; old =atomic_fetch_or (NETBK_COMMON_EOI , &queue->eoi_pending);WARN (old,"Interrupt while EOI pending\n" ); -/* Use bitwise or as we need to call both functions. */ -if ((!xenvif_handle_tx_interrupt (queue) | - !xenvif_handle_rx_interrupt (queue))) { + has_tx =xenvif_handle_tx_interrupt (queue); + has_rx =xenvif_handle_rx_interrupt (queue); + +if (!has_rx && !has_tx) {atomic_andnot (NETBK_COMMON_EOI , &queue->eoi_pending);xen_irq_lateeoi (irq,XEN_EOI_FLAG_SPURIOUS ); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 27/134 mac80211: fix potential overflow when multiplying to u32 integers
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 6194f7e6473be78acdc5d03edd116944bdbb2c4e ]
The multiplication of the u32 variables tx_time and estimated_retx is performed using a 32 bit multiplication and the result is stored in a u64 result. This has a potential u32 overflow issue, so avoid this by casting tx_time to a u64 to force a 64 bit multiply.
Addresses-Coverity: ("Unintentional integer overflow")
--- net/mac80211/mesh_hwmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mesh_hwmp.c +1 -1
@@ -355,7 +355,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,*/ tx_time = (device_constant +10 * test_frame_len / rate); estimated_retx = ((1 << (2 *ARITH_SHIFT )) / (s_unit - err)); - result = (tx_time * estimated_retx) >> (2 *ARITH_SHIFT ); + result = ((u64 )tx_time * estimated_retx) >> (2 *ARITH_SHIFT );return (u32 )result; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 28/134 b43: N-PHY: Fix the update of coef for the PHY revision >= 3case
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 4773acf3d4b50768bf08e9e97a204819e9ea0895 ]
The documentation for the PHY update [1] states:
Loop 4 times with index i
If PHY Revision >= 3
Copy table[i] to coef[i]
Otherwise
Set coef[i] to 0
the copy of the table to coef is currently implemented the wrong way around, table is being updated from uninitialized values in coeff. Fix this by swapping the assignment around.
[1] https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal/
Addresses-Coverity: ("Uninitialized scalar variable")
--- drivers/net/wireless/broadcom/b43/phy_n.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/phy_n.c +1 -1
@@ -5320,7 +5320,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)for (i =0 ; i <4 ; i++) {if (dev->phy.rev >=3 ) - table[i] = coef[i]; + coef[i] = table[i];else coef[i] =0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 29/134 fbdev: aty: SPARC64 requires FB_ATY_CT
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit c6c90c70db4d9a0989111d6b994d545659410f7a ]
It looks like SPARC64 requires FB_ATY_CT to build without errors, so have FB_ATY select FB_ATY_CT if both SPARC64 and PCI are enabled instead of using "default y if SPARC64 && PCI", which is not strong enough to prevent build errors.
As it currently is, FB_ATY_CT can be disabled, resulting in build errors:
ERROR: modpost: "aty_postdividers" [drivers/video/fbdev/aty/atyfb.ko] undefined!
ERROR: modpost: "aty_ld_pll_ct" [drivers/video/fbdev/aty/atyfb.ko] undefined!
--- drivers/video/fbdev/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/Kconfig +1 -1
@@ -1405,6 +1405,7 @@ config FB_ATY select FB_CFB_IMAGEBLIT select FB_BACKLIGHT if FB_ATY_BACKLIGHT select FB_MACMODES if PPC + select FB_ATY_CT if SPARC64 && PCI help This driver supports graphics boards with the ATI Mach64 chips. Say Y if you have such a graphics board.
@@ -1415,7 +1416,6 @@ config FB_ATY config FB_ATY_CT bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support" depends on PCI && FB_ATY - default y if SPARC64 && PCI help Say Y here to support use of ATI's 64-bit Rage boards (or other boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 30/134 drm/gma500: Fix error return code in psb_driver_load()
In reply to Greg Kroah-HartmanFrom: Jialin Zhang <[email protected]>
[ Upstream commit 6926872ae24452d4f2176a3ba2dee659497de2c4 ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/gpu/drm/gma500/psb_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/gma500/psb_drv.c +2 -0
@@ -323,6 +323,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)if (ret) goto out_err; + ret = -ENOMEM ; + dev_priv->mmu =psb_mmu_driver_init (dev,1 ,0 ,0 );if (!dev_priv->mmu) goto out_err;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 31/134 gma500: clean up error handling in init
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 15ccc39b3aab667c6fa131206f01f31bfbccdf6a ]
The main problem with this error handling was that it didn't clean up if i2c_add_numbered_adapter() failed. This code is pretty old, and doesn't match with today's checkpatch.pl standards so I took the opportunity to tidy it up a bit. I changed the NULL comparison, and removed the WARNING message if kzalloc() fails and updated the label names.
--- drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c +13 -9
@@ -279,11 +279,8 @@ int oaktrail_hdmi_i2c_init(struct pci_dev *dev) hdmi_dev =pci_get_drvdata (dev); i2c_dev =kzalloc (sizeof (struct hdmi_i2c_dev ),GFP_KERNEL ); -if (i2c_dev ==NULL ) { -DRM_ERROR ("Can't allocate interface\n" ); - ret = -ENOMEM ; - goto exit; - } +if (!i2c_dev) +return -ENOMEM ; i2c_dev->adap = &oaktrail_hdmi_i2c_adapter; i2c_dev->status =I2C_STAT_INIT ;
@@ -300,16 +297,23 @@ int oaktrail_hdmi_i2c_init(struct pci_dev *dev) oaktrail_hdmi_i2c_adapter.name, hdmi_dev);if (ret) {DRM_ERROR ("Failed to request IRQ for I2C controller\n" ); - goto err; + goto free_dev; }/* Adapter registration */ ret =i2c_add_numbered_adapter (&oaktrail_hdmi_i2c_adapter); -return ret; +if (ret) { +DRM_ERROR ("Failed to add I2C adapter\n" ); + goto free_irq; + } -err: +return 0 ; + +free_irq: +free_irq (dev->irq, hdmi_dev); +free_dev:kfree (i2c_dev); -exit: +return ret; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 32/134 MIPS: c-r4k: Fix section mismatch for loongson2_sc_init
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit c58734eee6a2151ba033c0dcb31902c89e310374 ]
When building with clang, the following section mismatch warning occurs:
WARNING: modpost: vmlinux.o(.text+0x24490): Section mismatch in reference from the function r4k_cache_init() to the function .init.text:loongson2_sc_init()
This should have been fixed with commit ad4fddef5f23 ("mips: fix Section mismatch in reference") but it was missed. Remove the improper __init annotation like that commit did.
--- arch/mips/mm/c-r4k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/mm/c-r4k.c +1 -1
@@ -1630,7 +1630,7 @@ static int probe_scache(void)return 1 ; } -static void __init loongson2_sc_init (void ) +static void loongson2_sc_init (void ) {struct cpuinfo_mips *c = ¤t_cpu_data;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 33/134 MIPS: lantiq: Explicitly compare LTQ_EBU_PCC_ISTAT against 0
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit c6f2a9e17b9bef7677caddb1626c2402f3e9d2bd ]
When building xway_defconfig with clang:
arch/mips/lantiq/irq.c:305:48: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
^ ~~~~~~~~~~~~~~~~~
arch/mips/lantiq/irq.c:305:48: note: use '&' for a bitwise operation
if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
^~
&
arch/mips/lantiq/irq.c:305:48: note: remove constant to silence this
warning
if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
~^~~~~~~~~~~~~~~~~~~~1 error generated.
Explicitly compare the constant LTQ_EBU_PCC_ISTAT against 0 to fix the warning. Additionally, remove the unnecessary parentheses as this is a simple conditional statement and shorthand '== 0' to '!'.
--- arch/mips/lantiq/irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/lantiq/irq.c +1 -1
@@ -245,7 +245,7 @@ static void ltq_hw_irqdispatch(int module)do_IRQ ((int )irq +MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module));/* if this is a EBU irq, we need to ack it or get a deadlock */ -if ((irq ==LTQ_ICU_EBU_IRQ ) && (module ==0 ) &<Q_EBU_PCC_ISTAT ) +if (irq ==LTQ_ICU_EBU_IRQ && !module &<Q_EBU_PCC_ISTAT !=0 )ltq_ebu_w32 (ltq_ebu_r32 (LTQ_EBU_PCC_ISTAT ) |0x10 ,LTQ_EBU_PCC_ISTAT ); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 34/134 media: vsp1: Fix an error handling path in the probe function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 7113469dafc2d545fa4fa9bc649c31dc27db492e ]
A previous 'rcar_fcp_get()' call must be undone in the error handling path, as already done in the remove function.
--- drivers/media/platform/vsp1/vsp1_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/vsp1/vsp1_drv.c +3 -1
@@ -764,8 +764,10 @@ static int vsp1_probe(struct platform_device *pdev) } done: -if (ret) +if (ret) {pm_runtime_disable (&pdev->dev); +rcar_fcp_put (vsp1->fcp); + }return ret; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 35/134 media: media/pci: Fix memleak in empress_init
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 15d0c52241ecb1c9d802506bff6f5c3f7872c0df ]
When vb2_queue_init() fails, dev->empress_dev
should be released just like other error handling
paths.
--- drivers/media/pci/saa7134/saa7134-empress.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/media/pci/saa7134/saa7134-empress.c +4 -1
@@ -297,8 +297,11 @@ static int empress_init(struct saa7134_dev *dev) q->lock = &dev->lock; q->dev = &dev->pci->dev; err =vb2_queue_init (q); -if (err) +if (err) { +video_device_release (dev->empress_dev); + dev->empress_dev =NULL ;return err; + } dev->empress_dev->queue = q;video_set_drvdata (dev->empress_dev, dev);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 36/134 media: tm6000: Fix memleak in tm6000_start_stream
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 76aaf8a96771c16365b8510f1fb97738dc88026e ]
When usb_clear_halt() fails, dvb->bulk_urb->transfer_buffer and dvb->bulk_urb should be freed just like when usb_submit_urb() fails.
--- drivers/media/usb/tm6000/tm6000-dvb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/usb/tm6000/tm6000-dvb.c +4 -0
@@ -156,6 +156,10 @@ static int tm6000_start_stream(struct tm6000_core *dev)if (ret <0 ) {printk (KERN_ERR "tm6000: error %i in %s during pipe reset\n" , ret, __func__); + +kfree (dvb->bulk_urb->transfer_buffer); +usb_free_urb (dvb->bulk_urb); + dvb->bulk_urb =NULL ;return ret; }else printk (KERN_ERR "tm6000: pipe resetted\n" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 37/134 ASoC: cs42l56: fix up error handling in probe
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 856fe64da84c95a1d415564b981ae3908eea2a76 ]
There are two issues with this code. The first error path forgot to set the error code and instead returns success. The second error path doesn't clean up.
--- sound/soc/codecs/cs42l56.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/cs42l56.c +2 -1
@@ -1270,6 +1270,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,dev_err (&i2c_client->dev,"CS42L56 Device ID (%X). Expected %X\n" , devid,CS42L56_DEVID ); + ret = -EINVAL ; goto err_enable; } alpha_rev = reg &CS42L56_AREV_MASK ;
@@ -1325,7 +1326,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client, ret =snd_soc_register_codec (&i2c_client->dev, &soc_codec_dev_cs42l56, &cs42l56_dai,1 );if (ret <0 ) -return ret; + goto err_enable;return 0 ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 38/134 media: lmedm04: Fix misuse of comma
In reply to Greg Kroah-HartmanFrom: Joe Perches <[email protected]>
[ Upstream commit 59a3e78f8cc33901fe39035c1ab681374bba95ad ]
There's a comma used instead of a semicolon that causes multiple statements to be executed after an if instead of just the intended single statement.
Replace the comma with a semicolon.
--- drivers/media/usb/dvb-usb-v2/lmedm04.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb-v2/lmedm04.c +1 -1
@@ -446,7 +446,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) ep =usb_pipe_endpoint (d->udev, lme_int->lme_urb->pipe);if (usb_endpoint_type (&ep->desc) ==USB_ENDPOINT_XFER_BULK ) - lme_int->lme_urb->pipe =usb_rcvbulkpipe (d->udev,0xa ), + lme_int->lme_urb->pipe =usb_rcvbulkpipe (d->udev,0xa ); lme_int->lme_urb->transfer_flags |=URB_NO_TRANSFER_DMA_MAP ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 39/134 media: qm1d1c0042: fix error return code in qm1d1c0042_init()
In reply to Greg Kroah-HartmanFrom: Luo Meng <[email protected]>
[ Upstream commit fcf8d018bdca0453b8d6359062e6bc1512d04c38 ]
Fix to return a negative error code from the error handling case instead of 0 in function qm1d1c0042_init(), as done elsewhere in this function.
--- drivers/media/tuners/qm1d1c0042.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/tuners/qm1d1c0042.c +3 -1
@@ -352,8 +352,10 @@ static int qm1d1c0042_init(struct dvb_frontend *fe)if (val == reg_initval[reg_index][0x00 ])break ; } -if (reg_index >=QM1D1C0042_NUM_REG_ROWS ) +if (reg_index >=QM1D1C0042_NUM_REG_ROWS ) { + ret = -EINVAL ; goto failed; + }memcpy (state->regs, reg_initval[reg_index],QM1D1C0042_NUM_REGS );usleep_range (2000 ,3000 );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 40/134 media: cx25821: Fix a bug when reallocating some dma memory
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b2de3643c5024fc4fd128ba7767c7fb8b714bea7 ]
This function looks like a realloc.
However, if 'risc->cpu != NULL', the memory will be freed, but never reallocated with the bigger 'size'.
Explicitly set 'risc->cpu' to NULL, so that the reallocation is correctly performed a few lines below.
[hverkuil: NULL != risc->cpu -> risc->cpu]
--- drivers/media/pci/cx25821/cx25821-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/pci/cx25821/cx25821-core.c +3 -1
@@ -990,8 +990,10 @@ int cx25821_riscmem_alloc(struct pci_dev *pci,__le32 *cpu;dma_addr_t dma =0 ; -if (NULL != risc->cpu && risc->size < size) +if (risc->cpu && risc->size < size) {pci_free_consistent (pci, risc->size, risc->cpu, risc->dma); + risc->cpu =NULL ; + }if (NULL == risc->cpu) { cpu =pci_zalloc_consistent (pci, size, &dma);if (NULL == cpu)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 41/134 media: pxa_camera: declare variable when DEBUG is defined
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 031b9212eeee365443aaef013360ea6cded7b2c4 ]
When DEBUG is defined this error occurs
drivers/media/platform/pxa_camera.c:1410:7: error:
‘i’ undeclared (first use in this function) for (i = 0; i < vb->num_planes; i++)
^
The variable 'i' is missing, so declare it.
--- drivers/media/platform/pxa_camera.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/pxa_camera.c +3 -0
@@ -1420,6 +1420,9 @@ static int pxac_vb2_prepare(struct vb2_buffer *vb)struct pxa_camera_dev *pcdev =vb2_get_drv_priv (vb->vb2_queue);struct pxa_buffer *buf =vb2_to_pxa_buffer (vb);int ret =0 ; +#ifdef DEBUG +int i; +#endif switch (pcdev->channels) {case 1 :
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 42/134 media: uvcvideo: Accept invalid bFormatIndex and bFrameIndex values
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit dc9455ffae02d7b7fb51ba1e007fffcb9dc5d890 ]
The Renkforce RF AC4K 300 Action Cam 4K reports invalid bFormatIndex and bFrameIndex values when negotiating the video probe and commit controls. The UVC descriptors report a single supported format and frame size, with bFormatIndex and bFrameIndex both equal to 2, but the video probe and commit controls report bFormatIndex and bFrameIndex set to 1.
The device otherwise operates correctly, but the driver rejects the values and fails the format try operation. Fix it by ignoring the invalid indices, and assuming that the format and frame requested by the driver are accepted by the device.
--- drivers/media/usb/uvc/uvc_v4l2.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/media/usb/uvc/uvc_v4l2.c +9 -9
@@ -258,7 +258,9 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, goto done;/* After the probe, update fmt with the values returned from -* negotiation with the device. +* negotiation with the device. Some devices return invalid bFormatIndex +* and bFrameIndex values, in which case we can only assume they have +* accepted the requested format as-is. */ for (i =0 ; i < stream->nformats; ++i) {if (probe->bFormatIndex == stream->format[i].index) {
@@ -267,11 +269,10 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, } } -if (i == stream->nformats) { -uvc_trace (UVC_TRACE_FORMAT ,"Unknown bFormatIndex %u\n" , +if (i == stream->nformats) +uvc_trace (UVC_TRACE_FORMAT , +"Unknown bFormatIndex %u, using default\n" , probe->bFormatIndex); -return -EINVAL ; - }for (i =0 ; i < format->nframes; ++i) {if (probe->bFrameIndex == format->frame[i].bFrameIndex) {
@@ -280,11 +281,10 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, } } -if (i == format->nframes) { -uvc_trace (UVC_TRACE_FORMAT ,"Unknown bFrameIndex %u\n" , +if (i == format->nframes) +uvc_trace (UVC_TRACE_FORMAT , +"Unknown bFrameIndex %u, using default\n" , probe->bFrameIndex); -return -EINVAL ; - } fmt->fmt.pix.width = frame->wWidth; fmt->fmt.pix.height = frame->wHeight;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 43/134 ata: ahci_brcm: Add back regulators management
In reply to Greg Kroah-HartmanFrom: Florian Fainelli <[email protected]>
[ Upstream commit 10340f8d7b6dd54e616339c8ccb2f397133ebea0 ]
While reworking the resources management and departing from using ahci_platform_enable_resources() which did not allow a proper step separation like we need, we unfortunately lost the ability to control AHCI regulators. This broke some Broadcom STB systems that do expect regulators to be turned on to link up with attached hard drives.
--- drivers/ata/ahci_brcm.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/ata/ahci_brcm.c +13 -1
@@ -285,6 +285,10 @@ static int brcm_ahci_resume(struct device *dev)if (ret)return ret; + ret =ahci_platform_enable_regulators (hpriv); +if (ret) + goto out_disable_clks; +brcm_sata_init (priv);brcm_sata_phys_enable (priv);brcm_sata_alpm_init (hpriv);
@@ -314,6 +318,8 @@ out_disable_platform_phys:ahci_platform_disable_phys (hpriv); out_disable_phys:brcm_sata_phys_disable (priv); +ahci_platform_disable_regulators (hpriv); +out_disable_clks:ahci_platform_disable_clks (hpriv);return ret; }
@@ -377,6 +383,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)if (ret) goto out_reset; + ret =ahci_platform_enable_regulators (hpriv); +if (ret) + goto out_disable_clks; +/* Must be first so as to configure endianness including that * of the standard AHCI register space. */
@@ -386,7 +396,7 @@ static int brcm_ahci_probe(struct platform_device *pdev) priv->port_mask =brcm_ahci_get_portmask (hpriv, priv);if (!priv->port_mask) { ret = -ENODEV ; - goto out_disable_clks; + goto out_disable_regulators; }/* Must be done before ahci_platform_enable_phys() */
@@ -417,6 +427,8 @@ out_disable_platform_phys:ahci_platform_disable_phys (hpriv); out_disable_phys:brcm_sata_phys_disable (priv); +out_disable_regulators: +ahci_platform_disable_regulators (hpriv); out_disable_clks:ahci_platform_disable_clks (hpriv); out_reset:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 44/134 btrfs: clarify error returns values in __load_free_space_cache
In reply to Greg Kroah-HartmanFrom: Zhihao Cheng <[email protected]>
[ Upstream commit 3cc64e7ebfb0d7faaba2438334c43466955a96e8 ]
Return value in __load_free_space_cache is not properly set after (unlikely) memory allocation failures and 0 is returned instead. This is not a problem for the caller load_free_space_cache because only value 1 is considered as 'cache loaded' but for clarity it's better to set the errors accordingly.
--- fs/btrfs/free-space-cache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/free-space-cache.c +5 -1
@@ -753,8 +753,10 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,while (num_entries) { e =kmem_cache_zalloc (btrfs_free_space_cachep,GFP_NOFS ); -if (!e) +if (!e) { + ret = -ENOMEM ; goto free_cache; + } ret =io_ctl_read_entry (&io_ctl, e, &type);if (ret) {
@@ -763,6 +765,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, }if (!e->bytes) { + ret =-1 ;kmem_cache_free (btrfs_free_space_cachep, e); goto free_cache; }
@@ -782,6 +785,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, num_bitmaps--; e->bitmap =kzalloc (PAGE_SIZE ,GFP_NOFS );if (!e->bitmap) { + ret = -ENOMEM ;kmem_cache_free ( btrfs_free_space_cachep, e); goto free_cache;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 45/134 crypto: ecdh_helper - Ensure len >= secret.len in decode_key()
In reply to Greg Kroah-HartmanFrom: Daniele Alessandrelli <[email protected]>
[ Upstream commit a53ab94eb6850c3657392e2d2ce9b38c387a2633 ]
The length ('len' parameter) passed to crypto_ecdh_decode_key() is never checked against the length encoded in the passed buffer ('buf' parameter). This could lead to an out-of-bounds access when the passed length is less than the encoded length.
Add a check to prevent that.
--- crypto/ecdh_helper.c | 3 +++ 1 file changed, 3 insertions(+)
crypto/ecdh_helper.c +3 -0
@@ -71,6 +71,9 @@ int crypto_ecdh_decode_key(const char *buf, unsigned int len,if (secret.type !=CRYPTO_KPP_SECRET_TYPE_ECDH )return -EINVAL ; +if (unlikely (len < secret.len)) +return -EINVAL ; + ptr =ecdh_unpack_data (¶ms->curve_id, ptr,sizeof (params->curve_id)); ptr =ecdh_unpack_data (¶ms->key_size, ptr,sizeof (params->key_size));if (secret.len !=crypto_ecdh_key_len (params))
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 46/134 fs/jfs: fix potential integer overflow on shift of a int
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit 4208c398aae4c2290864ba15c3dab7111f32bec1 ]
The left shift of int 32 bit integer constant 1 is evaluated using 32 bit arithmetic and then assigned to a signed 64 bit integer. In the case where l2nb is 32 or more this can lead to an overflow. Avoid this by shifting the value 1LL instead.
Addresses-Coverity: ("Uninitentional integer overflow")
--- fs/jfs/jfs_dmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +1 -1
@@ -1669,7 +1669,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen) }else if (rc == -ENOSPC ) {/* search for next smaller log2 block */ l2nb =BLKSTOL2 (nblocks) -1 ; - nblocks =1 << l2nb; + nblocks =1LL << l2nb; }else {/* Trim any already allocated blocks */ jfs_error (bmp->db_ipbmap->i_sb,"-EIO\n" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 47/134 jffs2: fix use after free in jffs2_sum_write_data()
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 19646447ad3a680d2ab08c097585b7d96a66126b ]
clang static analysis reports this problem
fs/jffs2/summary.c:794:31: warning: Use of memory after it is freed
c->summary->sum_list_head = temp->u.next;
^~~~~~~~~~~~In jffs2_sum_write_data(), in a loop summary data is handles a node at a time. When it has written out the node it is removed the summary list, and the node is deleted. In the corner case when a JFFS2_FEATURE_RWCOMPAT_COPY is seen, a call is made to jffs2_sum_disable_collecting(). jffs2_sum_disable_collecting() deletes the whole list which conflicts with the loop's deleting the list by parts.
To preserve the old behavior of stopping the write midway, bail out of the loop after disabling summary collection.
--- fs/jffs2/summary.c | 3 +++ 1 file changed, 3 insertions(+)
fs/jffs2/summary.c +3 -0
@@ -783,6 +783,8 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblockdbg_summary ("Writing unknown RWCOMPAT_COPY node type %x\n" ,je16_to_cpu (temp->u.nodetype));jffs2_sum_disable_collecting (c->summary); +/* The above call removes the list, nothing more to do */ + goto bail_rwcompat; }else {BUG ();/* unknown node in summary information */ }
@@ -794,6 +796,7 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock c->summary->sum_num--; } + bail_rwcompat:jffs2_sum_reset_collected (c->summary);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 48/134 clk: meson: clk-pll: fix initializing the old rate (fallback) for a PLL
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 2f290b7c67adf6459a17a4c978102af35cd62e4a ]
The "rate" parameter in meson_clk_pll_set_rate() contains the new rate. Retrieve the old rate with clk_hw_get_rate() so we don't inifinitely try to switch from the new rate to the same rate again.
--- drivers/clk/meson/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/clk-pll.c +1 -1
@@ -145,7 +145,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,if (parent_rate ==0 || rate ==0 )return -EINVAL ; - old_rate = rate; + old_rate =clk_hw_get_rate (hw); rate_set =meson_clk_get_pll_settings (pll, rate);if (!rate_set)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 49/134 spi: cadence-quadspi: Abort read if dummy cycles required are too many
In reply to Greg Kroah-HartmanFrom: Pratyush Yadav <[email protected]>
[ Upstream commit ceeda328edeeeeac7579e9dbf0610785a3b83d39 ]
The controller can only support up to 31 dummy cycles. If the command requires more it falls back to using 31. This command is likely to fail because the correct number of cycles are not waited upon. Rather than silently issuing an incorrect command, fail loudly so the caller can get a chance to find out the command can't be supported by the controller.
--- drivers/mtd/spi-nor/cadence-quadspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi-nor/cadence-quadspi.c +1 -1
@@ -461,7 +461,7 @@ static int cqspi_indirect_read_setup(struct spi_nor *nor,/* Setup dummy clock cycles */ dummy_clk = nor->read_dummy;if (dummy_clk >CQSPI_DUMMY_CLKS_MAX ) - dummy_clk =CQSPI_DUMMY_CLKS_MAX ; +return -EOPNOTSUPP ;if (dummy_clk /8 ) { reg |= (1 <<CQSPI_REG_RD_INSTR_MODE_EN_LSB );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 50/134 HID: core: detect and skip invalid inputs to snto32()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit a0312af1f94d13800e63a7d0a66e563582e39aec ]
Prevent invalid (0, 0) inputs to hid-core's snto32() function.
Maybe it is just the dummy device here that is causing this, but there are hundreds of calls to snto32(0, 0). Having n (bits count) of 0 is causing the current UBSAN trap with a shift value of 0xffffffff (-1, or n - 1 in this function).
Either of the value to shift being 0 or the bits count being 0 can be handled by just returning 0 to the caller, avoiding the following complex shift + OR operations:
return value & (1 << (n - 1)) ? value | (~0U << n) : value;
--- drivers/hid/hid-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -1109,6 +1109,9 @@ EXPORT_SYMBOL_GPL(hid_open_report);static s32 snto32 (__u32 value,unsigned n) { +if (!value || !n) +return 0 ; +switch (n) {case 8 :return ((__s8 )value);case 16 :return ((__s16 )value);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 51/134 dmaengine: fsldma: Fix a resource leak in the remove function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit cbc0ad004c03ad7971726a5db3ec84dba3dcb857 ]
A 'irq_dispose_mapping()' call is missing in the remove function. Add it.
This is needed to undo the 'irq_of_parse_and_map() call from the probe function and already part of the error handling path of the probe function.
It was added in the probe function only in commit d3f620b2c4fe ("fsldma:
simplify IRQ probing and handling")
--- drivers/dma/fsldma.c | 1 + 1 file changed, 1 insertion(+)
drivers/dma/fsldma.c +1 -0
@@ -1433,6 +1433,7 @@ static int fsldma_of_remove(struct platform_device *op)if (fdev->chan[i])fsl_dma_chan_remove (fdev->chan[i]); } +irq_dispose_mapping (fdev->irq);iounmap (fdev->regs);kfree (fdev);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 52/134 dmaengine: fsldma: Fix a resource leak in an error handling path of the probe function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b202d4e82531a62a33a6b14d321dd2aad491578e ]
In case of error, the previous 'fsl_dma_chan_probe()' calls must be undone by some 'fsl_dma_chan_remove()', as already done in the remove function.
It was added in the remove function in commit 77cd62e8082b ("fsldma: allow Freescale Elo DMA driver to be compiled as a module")
--- drivers/dma/fsldma.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/dma/fsldma.c +5 -0
@@ -1331,6 +1331,7 @@ static int fsldma_of_probe(struct platform_device *op) {struct fsldma_device *fdev;struct device_node *child; +unsigned int i;int err; fdev =kzalloc (sizeof (*fdev),GFP_KERNEL );
@@ -1411,6 +1412,10 @@ static int fsldma_of_probe(struct platform_device *op)return 0 ; out_free_fdev: +for (i =0 ; i <FSL_DMA_MAX_CHANS_PER_DEVICE ; i++) { +if (fdev->chan[i]) +fsl_dma_chan_remove (fdev->chan[i]); + }irq_dispose_mapping (fdev->irq);iounmap (fdev->regs); out_free:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 53/134 fdt: Properly handle "no-map" field in the memory region
In reply to Greg Kroah-HartmanFrom: KarimAllah Ahmed <[email protected]>
[ Upstream commit 86588296acbfb1591e92ba60221e95677ecadb43 ]
Mark the memory region with NOMAP flag instead of completely removing it from the memory blocks. That makes the FDT handling consistent with the EFI memory map handling.
--- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/fdt.c +1 -1
@@ -1159,7 +1159,7 @@ int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, bool nomap) { if (nomap) - return memblock_remove(base, size); + return memblock_mark_nomap(base, size);return memblock_reserve (base, size); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 54/134 of/fdt: Make sure no-map does not remove already reserved regions
In reply to Greg Kroah-HartmanFrom: Nicolas Boichat <[email protected]>
[ Upstream commit 8a5a75e5e9e55de1cef5d83ca3589cb4899193ef ]
If the device tree is incorrectly configured, and attempts to define a "no-map" reserved memory that overlaps with the kernel data/code, the kernel would crash quickly after boot, with no obvious clue about the nature of the issue.
For example, this would happen if we have the kernel mapped at these addresses (from /proc/iomem):
40000000-41ffffff : System RAM
40080000-40dfffff : Kernel code
40e00000-411fffff : reserved
41200000-413e0fff : Kernel data
And we declare a no-map shared-dma-pool region at a fixed address within that range:
mem_reserved: mem_region {
compatible = "shared-dma-pool";
reg = <0 0x40000000 0 0x01A00000>;
no-map;
};To fix this, when removing memory regions at early boot (which is what "no-map" regions do), we need to make sure that the memory is not already reserved. If we do, __reserved_mem_reserve_reg will throw an error:
[ 0.000000] OF: fdt: Reserved memory: failed to reserve memory for node 'mem_region': base 0x0000000040000000, size 26 MiB
and the code that will try to use the region should also fail, later on.
We do not do anything for non-"no-map" regions, as memblock explicitly allows reserved regions to overlap, and the commit that this fixes removed the check for that precise reason.
[ qperret: fixed conflicts caused by the usage of memblock_mark_nomap ]
--- drivers/of/fdt.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/of/fdt.c +9 -1
@@ -1158,8 +1158,16 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)int __init __weak early_init_dt_reserve_memory_arch (phys_addr_t base,phys_addr_t size,bool nomap) { -if (nomap) +if (nomap) { +/* +* If the memory is already reserved (by another region), we +* should not allow it to be marked nomap. +*/ +if (memblock_is_region_reserved (base, size)) +return -EBUSY ; +return memblock_mark_nomap (base, size); + }return memblock_reserve (base, size); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 55/134 power: reset: at91-sama5d2_shdwc: fix wkupdbc mask
In reply to Greg Kroah-HartmanFrom: Claudiu Beznea <[email protected]>
[ Upstream commit 95aa21a3f1183260db1b0395e03df5bebc5ed641 ]
According to datasheet WKUPDBC mask is b/w bits 26..24.
--- drivers/power/reset/at91-sama5d2_shdwc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/reset/at91-sama5d2_shdwc.c +1 -1
@@ -36,7 +36,7 @@#define AT91_SHDW_MR 0x04/* Shut Down Mode Register */ #define AT91_SHDW_WKUPDBC_SHIFT 24 -#define AT91_SHDW_WKUPDBC_MASK GENMASK(31, 16) +#define AT91_SHDW_WKUPDBC_MASK GENMASK(26, 24)#define AT91_SHDW_WKUPDBC (x) (((x) << AT91_SHDW_WKUPDBC_SHIFT) \ & AT91_SHDW_WKUPDBC_MASK)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 56/134 clocksource/drivers/mxs_timer: Add missing semicolon when DEBUG is defined
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 7da390694afbaed8e0f05717a541dfaf1077ba51 ]
When DEBUG is defined this error occurs
drivers/clocksource/mxs_timer.c:138:1: error:
expected ‘;’ before ‘}’ token
The preceding statement needs a semicolon.
Replace pr_info() with pr_debug() and remove the unneeded ifdef.
--- drivers/clocksource/mxs_timer.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/clocksource/mxs_timer.c +1 -4
@@ -152,10 +152,7 @@ static void mxs_irq_clear(char *state)/* Clear pending interrupt */ timrot_irq_acknowledge (); - -#ifdef DEBUG - pr_info("%s: changing mode to %s\n", __func__, state) -#endif /* DEBUG */ +pr_debug ("%s: changing mode to %s\n" , __func__, state); }static int mxs_shutdown (struct clock_event_device *evt)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 57/134 regulator: axp20x: Fix reference cout leak
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit e78bf6be7edaacb39778f3a89416caddfc6c6d70 ]
Decrements the reference count of device node and its child node.
--- drivers/regulator/axp20x-regulator.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/regulator/axp20x-regulator.c +3 -4
@@ -415,7 +415,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)static int axp20x_regulator_parse_dt (struct platform_device *pdev) {struct device_node *np, *regulators; -int ret; +int ret =0 ;u32 dcdcfreq =0 ; np =of_node_get (pdev->dev.parent->of_node);
@@ -430,13 +430,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev) ret =axp20x_set_dcdc_freq (pdev, dcdcfreq);if (ret <0 ) {dev_err (&pdev->dev,"Error setting dcdc frequency: %d\n" , ret); -return ret; } -of_node_put (regulators); } -return 0 ; +of_node_put (np); +return ret; }static int axp20x_set_dcdc_workmode (struct regulator_dev *rdev,int id,u32 workmode)
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 58/134 isofs: release buffer head before return
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 0a6dc67a6aa45f19bd4ff89b4f468fc50c4b8daa ]
Release the buffer_head before returning error code in do_isofs_readdir() and isofs_find_entry().
--- fs/isofs/dir.c | 1 + fs/isofs/namei.c | 1 + 2 files changed, 2 insertions(+)
fs/isofs/dir.c +1 -0
@@ -151,6 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,printk (KERN_NOTICE "iso9660: Corrupted directory entry" " in block %lu of inode %lu\n" , block, inode->i_ino); +brelse (bh);return -EIO ; }
fs/isofs/namei.c +1 -0
@@ -101,6 +101,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,printk (KERN_NOTICE "iso9660: Corrupted directory entry" " in block %lu of inode %lu\n" , block, dir->i_ino); +brelse (bh);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 59/134 IB/umad: Return EIO in case of when device disassociated
In reply to Greg Kroah-HartmanFrom: Shay Drory <[email protected]>
[ Upstream commit 4fc5461823c9cad547a9bdfbf17d13f0da0d6bb5 ]
MAD message received by the user has EINVAL error in all flows including when the device is disassociated. That makes it impossible for the applications to treat such flow differently.
Change it to return EIO, so the applications will be able to perform disassociation recovery.
--- drivers/infiniband/core/user_mad.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/infiniband/core/user_mad.c +6 -1
@@ -343,6 +343,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,mutex_lock (&file->mutex); +if (file->agents_dead) { +mutex_unlock (&file->mutex); +return -EIO ; + } +while (list_empty (&file->recv_list)) {mutex_unlock (&file->mutex);
@@ -485,7 +490,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, agent =__get_agent (file, packet->mad.hdr.id);if (!agent) { - ret = -EINVAL ; + ret = -EIO ; goto err_up; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 60/134 powerpc/47x: Disable 256k page size
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 910a0cb6d259736a0c86e795d4c2f42af8d0d775 ]
PPC47x_TLBE_SIZE isn't defined for 256k pages, leading to a build break if 256k pages is selected.
So change the kconfig so that 256k pages can't be selected for 47x.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -622,7 +622,7 @@ config PPC_64K_PAGES config PPC_256K_PAGES bool "256k page size" - depends on 44x && !STDBINUTILS + depends on 44x && !STDBINUTILS && !PPC_47x help Make the page size 256k.
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 61/134 mmc: usdhi6rol0: Fix a resource leak in the error handling path of the probe
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 6052b3c370fb82dec28bcfff6d7ec0da84ac087a ]
A call to 'ausdhi6_dma_release()' to undo a previous call to 'usdhi6_dma_request()' is missing in the error handling path of the probe function.
It is already present in the remove function.
--- drivers/mmc/host/usdhi6rol0.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +3 -1
@@ -1866,10 +1866,12 @@ static int usdhi6_probe(struct platform_device *pdev) ret =mmc_add_host (mmc);if (ret <0 ) - goto e_clk_off; + goto e_release_dma;return 0 ; +e_release_dma: +usdhi6_dma_release (host); e_clk_off:clk_disable_unprepare (host->clk); e_free_mmc:
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 62/134 ARM: 9046/1: decompressor: Do not clear SCTLR.nTLSMD for ARMv7+ cores
In reply to Greg Kroah-HartmanFrom: Vladimir Murzin <[email protected]>
[ Upstream commit 2acb909750431030b65a0a2a17fd8afcbd813a84 ]
It was observed that decompressor running on hardware implementing ARM v8.2 Load/Store Multiple Atomicity and Ordering Control (LSMAOC), say, as guest, would stuck just after:
Uncompressing Linux... done, booting the kernel.
The reason is that it clears nTLSMD bit when disabling caches:
nTLSMD, bit [3]
When ARMv8.2-LSMAOC is implemented:
No Trap Load Multiple and Store Multiple to Device-nGRE/Device-nGnRE/Device-nGnRnE memory.
0b0 All memory accesses by A32 and T32 Load Multiple and Store
Multiple at EL1 or EL0 that are marked at stage 1 as Device-nGRE/Device-nGnRE/Device-nGnRnE memory are trapped and generate a stage 1 Alignment fault.
0b1 All memory accesses by A32 and T32 Load Multiple and Store
Multiple at EL1 or EL0 that are marked at stage 1 as Device-nGRE/Device-nGnRE/Device-nGnRnE memory are not trapped.
This bit is permitted to be cached in a TLB.
This field resets to 1.
Otherwise:
Reserved, RES1
So as effect we start getting traps we are not quite ready for.
Looking into history it seems that mask used for SCTLR clear came from the similar code for ARMv4, where bit[3] is the enable/disable bit for the write buffer. That not applicable to ARMv7 and onwards, so retire that bit from the masks.
--- arch/arm/boot/compressed/head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/compressed/head.S +2 -2
@@ -1080,9 +1080,9 @@ __armv4_mmu_cache_off: __armv7_mmu_cache_off: mrc p15, 0, r0, c1, c0 #ifdef CONFIG_MMU - bic r0, r0, #0x000d + bic r0, r0, #0x0005 #else - bic r0, r0, #0x000c + bic r0, r0, #0x0004 #endif mcr p15, 0, r0, c1, c0 @ turn MMU and cache off mov r12, lr
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 63/134 amba: Fix resource leak for drivers without .remove
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit de5d7adb89367bbc87b4e5ce7afe7ae9bd86dc12 ]
Consider an amba driver with a .probe but without a .remove callback (e.g. pl061_gpio_driver). The function amba_probe() is called to bind a device and so dev_pm_domain_attach() and others are called. As there is no remove callback amba_remove() isn't called at unbind time however and so calling dev_pm_domain_detach() is missed and the pm domain keeps active.
To fix this always use the core driver callbacks and handle missing amba callbacks there. For probe refuse registration as a driver without probe doesn't make sense.
--- drivers/amba/bus.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/amba/bus.c +12 -8
@@ -280,10 +280,11 @@ static int amba_remove(struct device *dev) {struct amba_device *pcdev =to_amba_device (dev);struct amba_driver *drv =to_amba_driver (dev->driver); -int ret; +int ret =0 ;pm_runtime_get_sync (dev); - ret = drv->remove (pcdev); +if (drv->remove) + ret = drv->remove (pcdev);pm_runtime_put_noidle (dev);/* Undo the runtime PM settings in amba_probe() */
@@ -300,7 +301,9 @@ static int amba_remove(struct device *dev)static void amba_shutdown (struct device *dev) {struct amba_driver *drv =to_amba_driver (dev->driver); - drv->shutdown (to_amba_device (dev)); + +if (drv->shutdown) + drv->shutdown (to_amba_device (dev)); }/**
@@ -313,12 +316,13 @@ static void amba_shutdown(struct device *dev)*/ int amba_driver_register (struct amba_driver *drv) { - drv->drv.bus = &amba_bustype; +if (!drv->probe) +return -EINVAL ; -#define SETFN (fn) if (drv->fn) drv->drv.fn = amba_##fn -SETFN (probe); -SETFN (remove); -SETFN (shutdown); + drv->drv.bus = &amba_bustype; + drv->drv.probe = amba_probe; + drv->drv.remove = amba_remove; + drv->drv.shutdown = amba_shutdown;return driver_register (&drv->drv); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 64/134 tracepoint: Do not fail unregistering a probe due to memory failure
In reply to Greg Kroah-HartmanFrom: Steven Rostedt (VMware) <[email protected]>
[ Upstream commit befe6d946551d65cddbd32b9cb0170b0249fd5ed ]
The list of tracepoint callbacks is managed by an array that is protected by RCU. To update this array, a new array is allocated, the updates are copied over to the new array, and then the list of functions for the tracepoint is switched over to the new array. After a completion of an RCU grace period, the old array is freed.
This process happens for both adding a callback as well as removing one. But on removing a callback, if the new array fails to be allocated, the callback is not removed, and may be used after it is freed by the clients of the tracepoint.
There's really no reason to fail if the allocation for a new array fails when removing a function. Instead, the function can simply be replaced by a stub function that could be cleaned up on the next modification of the array. That is, instead of calling the function registered to the tracepoint, it would call a stub function in its place.
[ Note, this version does use undefined compiler behavior (assuming that
a stub function with no parameters or return, can be called by a location that thinks it has parameters but still no return value. Static calls do the same thing, so this trick is not without precedent.
There's another solution that uses RCU tricks and is more complex, but can be an alternative if this solution becomes an issue.
]
--- kernel/tracepoint.c | 80 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 16 deletions(-)
kernel/tracepoint.c +64 -16
@@ -59,6 +59,12 @@ struct tp_probes {struct tracepoint_func probes[0 ]; }; +/* Called in removal of a func but failed to allocate a new tp_funcs */ +static void tp_stub_func (void ) +{ +return ; +} +static inline void *allocate_probes (int count) { struct tp_probes *p = kmalloc(count * sizeof(struct tracepoint_func)
@@ -97,6 +103,7 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func, {struct tracepoint_func *old, *new;int nr_probes =0 ; +int stub_funcs =0 ;int pos =-1 ;if (WARN_ON (!tp_func->func))
@@ -113,14 +120,34 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func,if (old[nr_probes].func == tp_func->func && old[nr_probes].data == tp_func->data)return ERR_PTR (-EEXIST ); +if (old[nr_probes].func == tp_stub_func) + stub_funcs++; } } -/* + 2 : one for new probe, one for NULL func */ - new =allocate_probes (nr_probes +2 ); +/* + 2 : one for new probe, one for NULL func - stub functions */ + new =allocate_probes (nr_probes +2 - stub_funcs);if (new ==NULL )return ERR_PTR (-ENOMEM );if (old) { -if (pos <0 ) { +if (stub_funcs) { +/* Need to copy one at a time to remove stubs */ +int probes =0 ; + + pos =-1 ; +for (nr_probes =0 ; old[nr_probes].func; nr_probes++) { +if (old[nr_probes].func == tp_stub_func) +continue ; +if (pos <0 && old[nr_probes].prio < prio) + pos = probes++; + new[probes++] = old[nr_probes]; + } + nr_probes = probes; +if (pos <0 ) + pos = probes; +else + nr_probes--;/* Account for insertion */ + + }else if (pos <0 ) { pos = nr_probes;memcpy (new, old, nr_probes *sizeof (struct tracepoint_func )); }else {
@@ -154,8 +181,9 @@ static void *func_remove(struct tracepoint_func **funcs,/* (N -> M), (N > 1, M >= 0) probes */ if (tp_func->func) {for (nr_probes =0 ; old[nr_probes].func; nr_probes++) { -if (old[nr_probes].func == tp_func->func && - old[nr_probes].data == tp_func->data) +if ((old[nr_probes].func == tp_func->func && + old[nr_probes].data == tp_func->data) || + old[nr_probes].func == tp_stub_func) nr_del++; } }
@@ -174,14 +202,32 @@ static void *func_remove(struct tracepoint_func **funcs,/* N -> M, (N > 1, M > 0) */ /* + 1 for NULL */ new =allocate_probes (nr_probes - nr_del +1 ); -if (new ==NULL ) -return ERR_PTR (-ENOMEM ); -for (i =0 ; old[i].func; i++) -if (old[i].func != tp_func->func - || old[i].data != tp_func->data) - new[j++] = old[i]; - new[nr_probes - nr_del].func =NULL ; - *funcs = new; +if (new) { +for (i =0 ; old[i].func; i++) +if ((old[i].func != tp_func->func + || old[i].data != tp_func->data) + && old[i].func != tp_stub_func) + new[j++] = old[i]; + new[nr_probes - nr_del].func =NULL ; + *funcs = new; + }else { +/* +* Failed to allocate, replace the old function +* with calls to tp_stub_func. +*/ +for (i =0 ; old[i].func; i++) +if (old[i].func == tp_func->func && + old[i].data == tp_func->data) { + old[i].func = tp_stub_func; +/* Set the prio to the next event. */ +if (old[i +1 ].func) + old[i].prio = + old[i +1 ].prio; +else + old[i].prio =-1 ; + } + *funcs = old; + } }debug_print_probes (*funcs);return old;
@@ -234,10 +280,12 @@ static int tracepoint_remove_func(struct tracepoint *tp, tp_funcs =rcu_dereference_protected (tp->funcs,lockdep_is_held (&tracepoints_mutex)); old =func_remove (&tp_funcs, func); -if (IS_ERR (old)) { -WARN_ON_ONCE (PTR_ERR (old) != -ENOMEM ); +if (WARN_ON_ONCE (IS_ERR (old)))return PTR_ERR (old); - } + +if (tp_funcs == old) +/* Failed allocating new tp_funcs, replaced func with stub */ +return 0 ;if (!tp_funcs) {/* Removed last function */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 65/134 perf tools: Fix DSO filtering when not finding a map for a sampled address
In reply to Greg Kroah-HartmanFrom: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit c69bf11ad3d30b6bf01cfa538ddff1a59467c734 ]
When we lookup an address and don't find a map we should filter that sample if the user specified a list of --dso entries to filter on, fix it.
Before:
$ perf script
sleep 274800 2843.556162: 1 cycles:u: ffffffffbb26bff4 [unknown] ([unknown])
sleep 274800 2843.556168: 1 cycles:u: ffffffffbb2b047d [unknown] ([unknown])
sleep 274800 2843.556171: 1 cycles:u: ffffffffbb2706b2 [unknown] ([unknown])
sleep 274800 2843.556174: 6 cycles:u: ffffffffbb2b0267 [unknown] ([unknown])
sleep 274800 2843.556176: 59 cycles:u: ffffffffbb2b03b1 [unknown] ([unknown])
sleep 274800 2843.556180: 691 cycles:u: ffffffffbb26bff4 [unknown] ([unknown])
sleep 274800 2843.556189: 9160 cycles:u: 7fa9550eeaa3 __GI___tunables_init+0xf3 (/usr/lib64/ld-2.32.so)
sleep 274800 2843.556312: 86937 cycles:u: 7fa9550e157b _dl_lookup_symbol_x+0x4b (/usr/lib64/ld-2.32.so)
$So we have some samples we somehow didn't find in a map for, if we now do:
$ perf report --stdio --dso /usr/lib64/ld-2.32.so
# dso: /usr/lib64/ld-2.32.so
#
# Total Lost Samples: 0
#
# Samples: 8 of event 'cycles:u'
# Event count (approx.): 96856
#
# Overhead Command Symbol
# ........ ....... ........................
#
89.76% sleep [.] _dl_lookup_symbol_x
9.46% sleep [.] __GI___tunables_init
0.71% sleep [k] 0xffffffffbb26bff4
0.06% sleep [k] 0xffffffffbb2b03b1
0.01% sleep [k] 0xffffffffbb2b0267
0.00% sleep [k] 0xffffffffbb2706b2
0.00% sleep [k] 0xffffffffbb2b047d
$After this patch we get the right output with just entries for the DSOs specified in --dso:
$ perf report --stdio --dso /usr/lib64/ld-2.32.so
# dso: /usr/lib64/ld-2.32.so
#
# Total Lost Samples: 0
#
# Samples: 8 of event 'cycles:u'
# Event count (approx.): 96856
#
# Overhead Command Symbol
# ........ ....... ........................
#
89.76% sleep [.] _dl_lookup_symbol_x
9.46% sleep [.] __GI___tunables_init
$
#--- tools/perf/util/event.c | 2 ++ 1 file changed, 2 insertions(+)
tools/perf/util/event.c +2 -0
@@ -1370,6 +1370,8 @@ int machine__resolve(struct machine *machine, struct addr_location *al, } al->sym =map__find_symbol (al->map, al->addr); + }else if (symbol_conf.dso_list) { + al->filtered |= (1 <<HIST_FILTER__DSO ); } if (symbol_conf.sym_list &&
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 66/134 RDMA/rxe: Fix coding error in rxe_recv.c
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 7d9ae80e31df57dd3253e1ec514f0000aa588a81 ]
check_type_state() in rxe_recv.c is written as if the type bits in the packet opcode were a bit mask which is not correct. This patch corrects this code to compare all 3 type bits to the required type.
--- drivers/infiniband/sw/rxe/rxe_recv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_recv.c +8 -3
@@ -36,21 +36,26 @@#include "rxe.h" #include "rxe_loc.h" +/* check that QP matches packet opcode type and is in a valid state */ static int check_type_state (struct rxe_dev *rxe,struct rxe_pkt_info *pkt,struct rxe_qp *qp) { +unsigned int pkt_type; +if (unlikely (!qp->valid)) goto err1; + pkt_type = pkt->opcode &0xe0 ; +switch (qp_type (qp)) {case IB_QPT_RC : -if (unlikely ((pkt->opcode &IB_OPCODE_RC ) !=0 )) { +if (unlikely (pkt_type !=IB_OPCODE_RC )) {pr_warn_ratelimited ("bad qp type\n" ); goto err1; }break ;case IB_QPT_UC : -if (unlikely (!(pkt->opcode &IB_OPCODE_UC ))) { +if (unlikely (pkt_type !=IB_OPCODE_UC )) {pr_warn_ratelimited ("bad qp type\n" ); goto err1; }
@@ -58,7 +63,7 @@ static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,case IB_QPT_UD :case IB_QPT_SMI :case IB_QPT_GSI : -if (unlikely (!(pkt->opcode &IB_OPCODE_UD ))) { +if (unlikely (pkt_type !=IB_OPCODE_UD )) {pr_warn_ratelimited ("bad qp type\n" ); goto err1; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 67/134 mfd: wm831x-auxadc: Prevent use after free in wm831x_auxadc_read_irq()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 26783d74cc6a440ee3ef9836a008a697981013d0 ]
The "req" struct is always added to the "wm831x->auxadc_pending" list, but it's only removed from the list on the success path. If a failure occurs then the "req" struct is freed but it's still on the list, leading to a use after free.
--- drivers/mfd/wm831x-auxadc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mfd/wm831x-auxadc.c +1 -2
@@ -98,11 +98,10 @@ static int wm831x_auxadc_read_irq(struct wm831x *wm831x,wait_for_completion_timeout (&req->done,msecs_to_jiffies (500 ));mutex_lock (&wm831x->auxadc_lock); - -list_del (&req->list); ret = req->val; out: +list_del (&req->list);mutex_unlock (&wm831x->auxadc_lock);kfree (req);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 68/134 powerpc/pseries/dlpar: handle ibm, configure-connector delay status
In reply to Greg Kroah-HartmanFrom: Nathan Lynch <[email protected]>
[ Upstream commit 768d70e19ba525debd571b36e6d0ab19956c63d7 ]
dlpar_configure_connector() has two problems in its handling of ibm,configure-connector's return status:
1. When the status is -2 (busy, call again), we call ibm,configure-connector again immediately without checking whether to schedule, which can result in monopolizing the CPU.
2. Extended delay status (9900..9905) goes completely unhandled, causing the configuration to unnecessarily terminate.
Fix both of these issues by using rtas_busy_delay().
--- arch/powerpc/platforms/pseries/dlpar.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/powerpc/platforms/pseries/dlpar.c +3 -4
@@ -139,7 +139,6 @@ void dlpar_free_cc_nodes(struct device_node *dn)#define NEXT_PROPERTY 3#define PREV_PARENT 4#define MORE_MEMORY 5 -#define CALL_AGAIN -2#define ERR_CFG_USE -9003 struct device_node *dlpar_configure_connector(__be32 drc_index,
@@ -181,6 +180,9 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,spin_unlock (&rtas_data_buf_lock); +if (rtas_busy_delay (rc)) +continue ; +switch (rc) {case COMPLETE :break ;
@@ -233,9 +235,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index, parent_path = last_dn->parent->full_name;break ; -case CALL_AGAIN : -break ; -case MORE_MEMORY :case ERR_CFG_USE :default :
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 69/134 spi: pxa2xx: Fix the controller numbering for Wildcat Point
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 54c5d3bfb0cfb7b31259765524567871dee11615 ]
Wildcat Point has two SPI controllers and added one is actually second one. Fix the numbering by adding the description of the first one.
--- drivers/spi/spi-pxa2xx-pci.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
drivers/spi/spi-pxa2xx-pci.c +19 -8
@@ -21,7 +21,8 @@ enum {PORT_BSW1 ,PORT_BSW2 ,PORT_CE4100 , - PORT_LPT, +PORT_LPT0 , + PORT_LPT1, }; struct pxa_spi_info {
@@ -48,8 +49,10 @@ static struct dw_dma_slave bsw1_rx_param = { .src_id = 7 };static struct dw_dma_slave bsw2_tx_param = { .dst_id =8 };static struct dw_dma_slave bsw2_rx_param = { .src_id =9 }; -static struct dw_dma_slave lpt_tx_param = { .dst_id =0 }; -static struct dw_dma_slave lpt_rx_param = { .src_id =1 }; +static struct dw_dma_slave lpt1_tx_param = { .dst_id =0 }; +static struct dw_dma_slave lpt1_rx_param = { .src_id =1 }; +static struct dw_dma_slave lpt0_tx_param = { .dst_id =2 }; +static struct dw_dma_slave lpt0_rx_param = { .src_id =3 };static bool lpss_dma_filter (struct dma_chan *chan,void *param) {
@@ -158,12 +161,19 @@ static struct pxa_spi_info spi_info_configs[] = { .num_chipselect = 1, .max_clk_rate = 50000000, }, - [PORT_LPT] = { + [PORT_LPT0] = { .type = LPSS_LPT_SSP, .port_id = 0, .setup = lpss_spi_setup, - .tx_param = &lpt_tx_param, - .rx_param = &lpt_rx_param, + .tx_param = &lpt0_tx_param, + .rx_param = &lpt0_rx_param, + }, + [PORT_LPT1] = { + .type = LPSS_LPT_SSP, + .port_id = 1, + .setup = lpss_spi_setup, + .tx_param = &lpt1_tx_param, + .rx_param = &lpt1_rx_param, }, };
@@ -251,8 +261,9 @@ static const struct pci_device_id pxa2xx_spi_pci_devices[] = { { PCI_VDEVICE(INTEL, 0x2290), PORT_BSW1 }, { PCI_VDEVICE(INTEL, 0x22ac), PORT_BSW2 }, { PCI_VDEVICE(INTEL, 0x2e6a), PORT_CE4100 }, - { PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT }, - { }, + { PCI_VDEVICE(INTEL, 0x9ce5), PORT_LPT0 }, + { PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT1 }, + { } };MODULE_DEVICE_TABLE (pci, pxa2xx_spi_pci_devices);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 70/134 perf intel-pt: Fix missing CYC processing in PSB
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit 03fb0f859b45d1eb05c984ab4bd3bef67e45ede2 ]
Add missing CYC packet processing when walking through PSB+. This improves the accuracy of timestamps that follow PSB+, until the next MTC.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +3 -0
@@ -1508,6 +1508,9 @@ static int intel_pt_walk_psbend(struct intel_pt_decoder *decoder)break ;case INTEL_PT_CYC : +intel_pt_calc_cyc_timestamp (decoder); +break ; +case INTEL_PT_VMCS :case INTEL_PT_MNT :case INTEL_PT_PAD :
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 71/134 perf test: Fix unaligned access in sample parsing test
In reply to Greg Kroah-HartmanFrom: Namhyung Kim <[email protected]>
[ Upstream commit c5c97cadd7ed13381cb6b4bef5c841a66938d350 ]
The ubsan reported the following error. It was because sample's raw data missed u32 padding at the end. So it broke the alignment of the array after it.
The raw data contains an u32 size prefix so the data size should have an u32 padding after 8-byte aligned data.
27: Sample parsing :util/synthetic-events.c:1539:4:
runtime error: store to misaligned address 0x62100006b9bc for type
'__u64' (aka 'unsigned long long'), which requires 8 byte alignment0x62100006b9bc: note: pointer points here
00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
#0 0x561532a9fc96 in perf_event__synthesize_sample util/synthetic-events.c:1539:13
#1 0x5615327f4a4f in do_test tests/sample-parsing.c:284:8
#2 0x5615327f3f50 in test__sample_parsing tests/sample-parsing.c:381:9
#3 0x56153279d3a1 in run_test tests/builtin-test.c:424:9
#4 0x56153279c836 in test_and_print tests/builtin-test.c:454:9
#5 0x56153279b7eb in __cmd_test tests/builtin-test.c:675:4
#6 0x56153279abf0 in cmd_test tests/builtin-test.c:821:9
#7 0x56153264e796 in run_builtin perf.c:312:11
#8 0x56153264cf03 in handle_internal_command perf.c:364:8
#9 0x56153264e47d in run_argv perf.c:408:2
#10 0x56153264c9a9 in main perf.c:538:3
#11 0x7f137ab6fbbc in __libc_start_main (/lib64/libc.so.6+0x38bbc)
#12 0x561532596828 in _start ...SUMMARY: UndefinedBehaviorSanitizer: misaligned-pointer-use
util/synthetic-events.c:1539:4 in
--- tools/perf/tests/sample-parsing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/tests/sample-parsing.c +1 -1
@@ -167,7 +167,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format) .data = {1, 211, 212, 213}, };u64 regs[64 ]; -const u64 raw_data[] = {0x123456780a0b0c0dULL ,0x1102030405060708ULL }; +const u32 raw_data[] = {0x12345678 ,0x0a0b0c0d ,0x11020304 ,0x05060708 ,0 };const u64 data[] = {0x2211443366558877ULL ,0 ,0xaabbccddeeff4321ULL };struct perf_sample sample = { .ip = 101,
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 72/134 Input: elo - fix an error code in elo_connect()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 0958351e93fa0ac142f6dd8bd844441594f30a57 ]
If elo_setup_10() fails then this should return an error code instead of success.
--- drivers/input/touchscreen/elo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/input/touchscreen/elo.c +3 -1
@@ -345,8 +345,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)switch (elo->id) {case 0 :/* 10-byte protocol */ -if (elo_setup_10 (elo)) +if (elo_setup_10 (elo)) { + err = -EIO ; goto fail3; + }break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 73/134 sparc64: only select COMPAT_BINFMT_ELF if BINFMT_ELF is set
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 80bddf5c93a99e11fc9faf7e4b575d01cecd45d3 ]
Currently COMPAT on SPARC64 selects COMPAT_BINFMT_ELF unconditionally, even when BINFMT_ELF is not enabled. This causes a kconfig warning.
Instead, just select COMPAT_BINFMT_ELF if BINFMT_ELF is enabled. This builds cleanly with no kconfig warnings.
WARNING: unmet direct dependencies detected for COMPAT_BINFMT_ELF
Depends on [n]: COMPAT [=y] && BINFMT_ELF [=n] Selected by [y]:
- COMPAT [=y] && SPARC64 [=y]
--- arch/sparc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/Kconfig +1 -1
@@ -562,7 +562,7 @@ config COMPAT bool depends on SPARC64 default y - select COMPAT_BINFMT_ELF + select COMPAT_BINFMT_ELF if BINFMT_ELF select HAVE_UID16 select ARCH_WANT_OLD_COMPAT_IPC select COMPAT_OLD_SIGACTION
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 74/134 misc: eeprom_93xx46: Fix module alias to enable module autoprobe
In reply to Greg Kroah-HartmanFrom: Aswath Govindraju <[email protected]>
[ Upstream commit 13613a2246bf531f5fc04e8e62e8f21a3d39bf1c ]
Fix module autoprobe by correcting module alias to match the string from /sys/class/.../spi1.0/modalias content.
--- drivers/misc/eeprom/eeprom_93xx46.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/eeprom/eeprom_93xx46.c +1 -1
@@ -532,4 +532,4 @@ module_spi_driver(eeprom_93xx46_driver);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Driver for 93xx46 EEPROMs" );MODULE_AUTHOR ("Anatolij Gustschin <[email protected]>" ); -MODULE_ALIAS ("spi:93xx46" ); +MODULE_ALIAS ("spi:eeprom-93xx46" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 75/134 misc: eeprom_93xx46: Add module alias to avoid breaking support for non device tree users
In reply to Greg Kroah-HartmanFrom: Aswath Govindraju <[email protected]>
[ Upstream commit 4540b9fbd8ebb21bb3735796d300a1589ee5fbf2 ]
Module alias "spi:93xx46" is used by non device tree users like drivers/misc/eeprom/digsy_mtc_eeprom.c and removing it will break support for them.
Fix this by adding back the module alias "spi:93xx46".
--- drivers/misc/eeprom/eeprom_93xx46.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/eeprom/eeprom_93xx46.c +1 -0
@@ -532,4 +532,5 @@ module_spi_driver(eeprom_93xx46_driver);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("Driver for 93xx46 EEPROMs" );MODULE_AUTHOR ("Anatolij Gustschin <[email protected]>" ); +MODULE_ALIAS ("spi:93xx46" );MODULE_ALIAS ("spi:eeprom-93xx46" );
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 76/134 pwm: rockchip: rockchip_pwm_probe(): Remove superfluous clk_unprepare()
In reply to Greg Kroah-HartmanFrom: Simon South <[email protected]>
[ Upstream commit d5d8d675865ccddfe4da26c85f22c55cec663bf2 ]
If rockchip_pwm_probe() fails to register a PWM device it calls clk_unprepare() for the device's PWM clock, without having first disabled the clock and before jumping to an error handler that also unprepares it. This is likely to produce warnings from the kernel about the clock being unprepared when it is still enabled, and then being unprepared when it has already been unprepared.
Prevent these warnings by removing this unnecessary call to clk_unprepare().
--- drivers/pwm/pwm-rockchip.c | 1 - 1 file changed, 1 deletion(-)
drivers/pwm/pwm-rockchip.c +0 -1
@@ -366,7 +366,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev) ret =pwmchip_add (&pc->chip);if (ret <0 ) { -clk_unprepare (pc->clk);dev_err (&pdev->dev,"pwmchip_add() failed: %d\n" , ret); }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 77/134 VMCI: Use set_page_dirty_lock() when unregistering guest memory
In reply to Greg Kroah-HartmanFrom: Jorgen Hansen <[email protected]>
[ Upstream commit 5a16c535409f8dcb7568e20737309e3027ae3e49 ]
When the VMCI host support releases guest memory in the case where the VM was killed, the pinned guest pages aren't locked. Use set_page_dirty_lock() instead of set_page_dirty().
Testing done: Killed VM while having an active VMCI based vSocket connection and observed warning from ext4. With this fix, no warning was observed. Ran various vSocket tests without issues.
--- drivers/misc/vmw_vmci/vmci_queue_pair.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/vmw_vmci/vmci_queue_pair.c +1 -1
@@ -732,7 +732,7 @@ static void qp_release_pages(struct page **pages,for (i =0 ; i < num_pages; i++) {if (dirty) -set_page_dirty (pages[i]); +set_page_dirty_lock (pages[i]);put_page (pages[i]); pages[i] =NULL ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 78/134 PCI: Align checking of syscall user config accessors
In reply to Greg Kroah-HartmanFrom: Heiner Kallweit <[email protected]>
[ Upstream commit ef9e4005cbaf022c6251263aa27836acccaef65d ]
After 34e3207205ef ("PCI: handle positive error codes"), pci_user_read_config_*() and pci_user_write_config_*() return 0 or negative errno values, not PCIBIOS_* values like PCIBIOS_SUCCESSFUL or PCIBIOS_BAD_REGISTER_NUMBER.
Remove comparisons with PCIBIOS_SUCCESSFUL and check only for non-zero. It happens that PCIBIOS_SUCCESSFUL is zero, so this is not a functional change, but it aligns this code with the user accessors.
--- drivers/pci/syscall.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/syscall.c +5 -5
@@ -21,7 +21,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,u16 word;u32 dword;long err; -long cfg_ret; +int cfg_ret;if (!capable (CAP_SYS_ADMIN ))return -EPERM ;
@@ -47,7 +47,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, } err = -EIO ; -if (cfg_ret !=PCIBIOS_SUCCESSFUL ) +if (cfg_ret) goto error;switch (len) {
@@ -105,7 +105,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,if (err)break ; err =pci_user_write_config_byte (dev, off, byte); -if (err !=PCIBIOS_SUCCESSFUL ) +if (err) err = -EIO ;break ;
@@ -114,7 +114,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,if (err)break ; err =pci_user_write_config_word (dev, off, word); -if (err !=PCIBIOS_SUCCESSFUL ) +if (err) err = -EIO ;break ;
@@ -123,7 +123,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,if (err)break ; err =pci_user_write_config_dword (dev, off, dword); -if (err !=PCIBIOS_SUCCESSFUL ) +if (err) err = -EIO ;break ;
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 79/134 drm/msm/dsi: Correct io_start for MSM8994 (20nm PHY)
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 33a7808ce1aea6e2edc1af25db25928137940c02 ]
The previous registers were *almost* correct, but instead of PHYs, they were pointing at DSI PLLs, resulting in the PHY id autodetection failing miserably.
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c +1 -1
@@ -146,7 +146,7 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = { .enable = dsi_20nm_phy_enable, .disable = dsi_20nm_phy_disable, }, - .io_start = { 0xfd998300, 0xfd9a0300 }, + .io_start = { 0xfd998500, 0xfd9a0500 }, .num_dsi_phy = 2, };
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 80/134 i40e: Fix flow for IPv6 next header (extension header)
In reply to Greg Kroah-HartmanFrom: Slawomir Laba <[email protected]>
[ Upstream commit 92c6058024e87087cf1b99b0389d67c0a886360e ]
When a packet contains an IPv6 header with next header which is an extension header and not a protocol one, the kernel function skb_transport_header called with such sk_buff will return a pointer to the extension header and not to the TCP one.
The above explained call caused a problem with packet processing for skb with encapsulation for tunnel with I40E_TX_CTX_EXT_IP_IPV6. The extension header was not skipped at all.
The ipv6_skip_exthdr function does check if next header of the IPV6 header is an extension header and doesn't modify the l4_proto pointer if it points to a protocol header value so its safe to omit the comparison of exthdr and l4.hdr pointers. The ipv6_skip_exthdr can return value -1. This means that the skipping process failed and there is something wrong with the packet so it will be dropped.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +6 -3
@@ -2452,13 +2452,16 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags, l4_proto = ip.v4->protocol; }else if (*tx_flags &I40E_TX_FLAGS_IPV6 ) { +int ret; + tunnel |=I40E_TX_CTX_EXT_IP_IPV6 ; exthdr = ip.hdr +sizeof (*ip.v6); l4_proto = ip.v6->nexthdr; -if (l4.hdr != exthdr) -ipv6_skip_exthdr (skb, exthdr - skb->data, - &l4_proto, &frag_off); + ret =ipv6_skip_exthdr (skb, exthdr - skb->data, + &l4_proto, &frag_off); +if (ret <0 ) +return -1 ; }/* define outer transport */
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 81/134 Take mmap lock in cacheflush syscall
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
[ Upstream commit c26958cb5a0d9053d1358258827638773f3d36ed ]
We need to take the mmap lock around find_vma() and subsequent use of the VMA. Otherwise, we can race with concurrent operations like munmap(), which can lead to use-after-free accesses to freed VMAs.
--- arch/nios2/kernel/sys_nios2.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
arch/nios2/kernel/sys_nios2.c +9 -2
@@ -22,6 +22,7 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, unsigned int op) {struct vm_area_struct *vma; +struct mm_struct *mm = current->mm;if (len ==0 )return 0 ;
@@ -34,16 +35,22 @@ asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len,if (addr + len < addr)return -EFAULT ; +if (mmap_read_lock_killable (mm)) +return -EINTR ; +/* * Verify that the specified address region actually belongs * to this process. */ - vma =find_vma (current->mm, addr); -if (vma ==NULL || addr < vma->vm_start || addr + len > vma->vm_end) + vma =find_vma (mm, addr); +if (vma ==NULL || addr < vma->vm_start || addr + len > vma->vm_end) { +mmap_read_unlock (mm);return -EFAULT ; + }flush_cache_range (vma, addr, addr + len); +mmap_read_unlock (mm);return 0 ; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 82/134 net/mlx4_core: Add missed mlx4_free_cmd_mailbox()
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 8eb65fda4a6dbd59cd5de24b106a10b6ee0d2176 ]
mlx4_do_mirror_rule() forgets to call mlx4_free_cmd_mailbox() to free the memory region allocated by mlx4_alloc_cmd_mailbox() before an exit.
Add the missed call to fix it.
--- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +1 -0
@@ -4948,6 +4948,7 @@ static int mlx4_do_mirror_rule(struct mlx4_dev *dev, struct res_fs_rule *fs_ruleif (!fs_rule->mirr_mbox) {mlx4_err (dev,"rule mirroring mailbox is null\n" ); +mlx4_free_cmd_mailbox (dev, mailbox);return -EINVAL ; }memcpy (mailbox->buf, fs_rule->mirr_mbox, fs_rule->mirr_mbox_size);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 83/134 ocfs2: fix a use after free on error
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c57d117f2b2f2a19b570c36f2819ef8d8210af20 ]
The error handling in this function frees "reg" but it is still on the "o2hb_all_regions" list so it will lead to a use after freew. Joseph Qi points out that we need to clear the bit in the "o2hb_region_bitmap" as well
--- fs/ocfs2/cluster/heartbeat.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
fs/ocfs2/cluster/heartbeat.c +7 -1
@@ -2155,7 +2155,7 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g o2hb_nego_timeout_handler, reg, NULL, ®->hr_handler_list);if (ret) - goto free; + goto remove_item; ret = o2net_register_handler(O2HB_NEGO_APPROVE_MSG, reg->hr_key, sizeof(struct o2hb_nego_msg),
@@ -2174,6 +2174,12 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g unregister_handler:o2net_unregister_handler_list (®->hr_handler_list); +remove_item: +spin_lock (&o2hb_live_lock); +list_del (®->hr_all_item); +if (o2hb_global_heartbeat_active ()) +clear_bit (reg->hr_region_num, o2hb_region_bitmap); +spin_unlock (&o2hb_live_lock); free:kfree (reg);return ERR_PTR (ret);
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 84/134 mm/memory.c: fix potential pte_unmap_unlock pte error
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 90a3e375d324b2255b83e3dd29e99e2b05d82aaf ]
Since commit 42e4089c7890 ("x86/speculation/l1tf: Disallow non privileged high MMIO PROT_NONE mappings"), when the first pfn modify is not allowed, we would break the loop with pte unchanged. Then the wrong pte - 1 would be passed to pte_unmap_unlock.
Andi said:
"While the fix is correct, I'm not sure if it actually is a real bug.
Is there any architecture that would do something else than unlocking the underlying page? If it's just the underlying page then it should be always the same page, so no bug"
--- mm/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/memory.c +3 -3
@@ -1687,11 +1687,11 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd, unsigned long addr, unsigned long end, unsigned long pfn, pgprot_t prot) { - pte_t *pte; + pte_t *pte, *mapped_pte;spinlock_t *ptl;int err =0 ; - pte =pte_alloc_map_lock (mm, pmd, addr, &ptl); + mapped_pte = pte =pte_alloc_map_lock (mm, pmd, addr, &ptl);if (!pte)return -ENOMEM ;arch_enter_lazy_mmu_mode ();
@@ -1705,7 +1705,7 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd, pfn++; }while (pte++, addr +=PAGE_SIZE , addr != end);arch_leave_lazy_mmu_mode (); -pte_unmap_unlock (pte -1 , ptl); +pte_unmap_unlock (mapped_pte, ptl);return err; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 85/134 mm/hugetlb: fix potential double free in hugetlb_register_node() error path
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit cc2205a67dec5a700227a693fc113441e73e4641 ]
In hugetlb_sysfs_add_hstate(), we would do kobject_put() on hstate_kobjs when failed to create sysfs group but forget to set hstate_kobjs to NULL. Then in hugetlb_register_node() error path, we may free it again via hugetlb_unregister_node().
--- mm/hugetlb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/hugetlb.c +3 -1
@@ -2618,8 +2618,10 @@ static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent,return -ENOMEM ; retval =sysfs_create_group (hstate_kobjs[hi], hstate_attr_group); -if (retval) +if (retval) {kobject_put (hstate_kobjs[hi]); + hstate_kobjs[hi] =NULL ; + }return retval; }
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 86/134 arm64: Add missing ISB after invalidating TLB in __primary_switch
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 9d41053e8dc115c92b8002c3db5f545d7602498b ]
Although there has been a bit of back and forth on the subject, it appears that invalidating TLBs requires an ISB instruction when FEAT_ETS is not implemented by the CPU.
Quoted 1 line
From the bible:
| In an implementation that does not implement FEAT_ETS, a TLB | maintenance instruction executed by a PE, PEx, can complete at any | time after it is issued, but is only guaranteed to be finished for a | PE, PEx, after the execution of DSB by the PEx followed by a Context | synchronization event
Add the missing ISB in __primary_switch, just in case.
--- arch/arm64/kernel/head.S | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kernel/head.S +1 -0
@@ -846,6 +846,7 @@ __primary_switch: tlbi vmalle1 // Remove any stale TLB entries dsb nsh + isb msr sctlr_el1, x19 // re-enable the MMU isb
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 87/134 i2c: brcmstb: Fix brcmstd_send_i2c_cmd condition
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit a1858ce0cfe31368b23ba55794e409fb57ced4a4 ]
The brcmstb_send_i2c_cmd currently has a condition that is (CMD_RD || CMD_WR) which always evaluates to true, while the obvious fix is to test whether the cmd variable passed as parameter holds one of these two values.
--- drivers/i2c/busses/i2c-brcmstb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-brcmstb.c +1 -1
@@ -318,7 +318,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev, goto cmd_out; } -if ((CMD_RD ||CMD_WR ) && +if ((cmd ==CMD_RD || cmd ==CMD_WR ) &&bsc_readl (dev, iic_enable) &BSC_IIC_EN_NOACK_MASK ) { rc = -EREMOTEIO ; dev_dbg(dev->device, "controller received NOACK intr for %s\n",
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 88/134 scsi: bnx2fc: Fix Kconfig warning & CNIC build errors
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit eefb816acb0162e94a85a857f3a55148f671d5a5 ]
CNIC depends on MMU, but since 'select' does not follow any dependency chains, SCSI_BNX2X_FCOE also needs to depend on MMU, so that erroneous configs are not generated, which cause build errors in cnic.
WARNING: unmet direct dependencies detected for CNIC
Depends on [n]: NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_BROADCOM [=y] && PCI [=y] && (IPV6 [=n] || IPV6 [=n]=n) && MMU [=n] Selected by [y]:
- SCSI_BNX2X_FCOE [=y] && SCSI_LOWLEVEL [=y] && SCSI [=y] && PCI [=y] && (IPV6 [=n] || IPV6 [=n]=n) && LIBFC [=y] && LIBFCOE [=y]
riscv64-linux-ld: drivers/net/ethernet/broadcom/cnic.o: in function `.L154':
cnic.c:(.text+0x1094): undefined reference to `uio_event_notify'
riscv64-linux-ld: cnic.c:(.text+0x10bc): undefined reference to `uio_event_notify'
riscv64-linux-ld: drivers/net/ethernet/broadcom/cnic.o: in function `.L1442':
cnic.c:(.text+0x96a8): undefined reference to `__uio_register_device'
riscv64-linux-ld: drivers/net/ethernet/broadcom/cnic.o: in function `.L0 ':
cnic.c:(.text.unlikely+0x68): undefined reference to `uio_unregister_device'
--- drivers/scsi/bnx2fc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/bnx2fc/Kconfig +1 -0
@@ -4,6 +4,7 @@ config SCSI_BNX2X_FCOE depends on (IPV6 || IPV6=n) depends on LIBFC depends on LIBFCOE + depends on MMU select NETDEVICES select ETHERNET select NET_VENDOR_BROADCOM
Signature · 1 line
2.27.0
Greg Kroah-Hartman
maintainerPATCH 89/134 blk-settings: align max_sectors on "logical_block_size" boundary
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 97f433c3601a24d3513d06f575a389a2ca4e11e4 upstream.
We get I/O errors when we run md-raid1 on the top of dm-integrity on the top of ramdisk.
device-mapper: integrity: Bio not aligned on 8 sectors: 0xff00, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0xff00, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0xffff, 0x1
device-mapper: integrity: Bio not aligned on 8 sectors: 0xffff, 0x1
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8048, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8147, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8246, 0xff
device-mapper: integrity: Bio not aligned on 8 sectors: 0x8345, 0xbb
The ramdisk device has logical_block_size 512 and max_sectors 255. The dm-integrity device uses logical_block_size 4096 and it doesn't affect the "max_sectors" value - thus, it inherits 255 from the ramdisk. So, we have a device with max_sectors not aligned on logical_block_size.
The md-raid device sees that the underlying leg has max_sectors 255 and it will split the bios on 255-sector boundary, making the bios unaligned on logical_block_size.
In order to fix the bug, we round down max_sectors to logical_block_size.
--- block/blk-settings.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
block/blk-settings.c +12 -0
@@ -494,6 +494,14 @@ void blk_queue_stack_limits(struct reque }EXPORT_SYMBOL (blk_queue_stack_limits); +static unsigned int blk_round_down_sectors (unsigned int sectors,unsigned int lbs) +{ + sectors =round_down (sectors, lbs >>SECTOR_SHIFT ); +if (sectors <PAGE_SIZE >>SECTOR_SHIFT ) + sectors =PAGE_SIZE >>SECTOR_SHIFT ; +return sectors; +} +/** * blk_stack_limits - adjust queue_limits for stacked devices * @t: the stacking driver limits (top device)
@@ -606,6 +614,10 @@ int blk_stack_limits(struct queue_limits ret =-1 ; } + t->max_sectors =blk_round_down_sectors (t->max_sectors, t->logical_block_size); + t->max_hw_sectors =blk_round_down_sectors (t->max_hw_sectors, t->logical_block_size); + t->max_dev_sectors =blk_round_down_sectors (t->max_dev_sectors, t->logical_block_size); +/* Discard alignment and granularity */ if (b->discard_granularity) { alignment =queue_limit_discard_alignment (b, start);
Greg Kroah-Hartman
maintainerPATCH 90/134 ACPI: configfs: add missing check after configfs_register_default_group()
In reply to Greg Kroah-HartmanFrom: Qinglang Miao <[email protected]>
commit 67e40054de86aae520ddc2a072d7f6951812a14f upstream.
A list_add corruption is reported by Hulk Robot like this:
==============list_add corruption.
Call Trace: link_obj+0xc0/0x1c0 link_group+0x21/0x140 configfs_register_subsystem+0xdb/0x380 acpi_configfs_init+0x25/0x1000 [acpi_configfs] do_one_initcall+0x149/0x820 do_init_module+0x1ef/0x720 load_module+0x35c8/0x4380 __do_sys_finit_module+0x10d/0x1a0 do_syscall_64+0x34/0x80
It's because of the missing check after configfs_register_default_group, where configfs_unregister_subsystem should be called once failure.
--- drivers/acpi/acpi_configfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/acpi_configfs.c +6 -1
@@ -251,7 +251,12 @@ static int __init acpi_configfs_init(voi acpi_table_group =configfs_register_default_group (root,"table" , &acpi_tables_type); -return PTR_ERR_OR_ZERO (acpi_table_group); +if (IS_ERR (acpi_table_group)) { +configfs_unregister_subsystem (&acpi_configfs); +return PTR_ERR (acpi_table_group); + } + +return 0 ; }module_init (acpi_configfs_init);
Greg Kroah-Hartman
maintainerPATCH 91/134 Input: raydium_ts_i2c - do not send zero length
In reply to Greg Kroah-HartmanFrom: jeffrey.lin <[email protected]>
commit fafd320ae51b9c72d371585b2501f86640ea7b7d upstream.
Add default write command package to prevent i2c quirk error of zero data length as Raydium touch firmware update is executed.
--- drivers/input/touchscreen/raydium_i2c_ts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/input/touchscreen/raydium_i2c_ts.c +2 -1
@@ -419,6 +419,7 @@ static int raydium_i2c_write_object(stru enum raydium_bl_ack state) {int error; +static const u8 cmd[] = {0xFF ,0x39 }; error =raydium_i2c_send (client,RM_CMD_BOOT_WRT , data, len);if (error) {
@@ -427,7 +428,7 @@ static int raydium_i2c_write_object(strureturn error; } - error =raydium_i2c_send (client,RM_CMD_BOOT_ACK ,NULL ,0 ); + error =raydium_i2c_send (client,RM_CMD_BOOT_ACK , cmd,sizeof (cmd));if (error) {dev_err (&client->dev,"Ack obj command failed: %d\n" , error);return error;
Greg Kroah-Hartman
maintainerPATCH 92/134 Input: xpad - add support for PowerA Enhanced Wired Controller for Xbox Series X|S
In reply to Greg Kroah-HartmanFrom: Olivier Crête <[email protected]>
commit 42ffcd1dba1796bcda386eb6f260df9fc23c90af upstream.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -322,6 +322,7 @@ static const struct xpad_device { { 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 }, { 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 }, { 0x20d6, 0x2001, "BDA Xbox Series X Wired Controller", 0, XTYPE_XBOXONE }, + { 0x20d6, 0x2009, "PowerA Enhanced Wired Controller for Xbox Series X|S", 0, XTYPE_XBOXONE }, { 0x20d6, 0x281f, "PowerA Wired Controller For Xbox 360", 0, XTYPE_XBOX360 }, { 0x2e24, 0x0652, "Hyperkin Duke X-Box One pad", 0, XTYPE_XBOXONE }, { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
Greg Kroah-Hartman
maintainerPATCH 93/134 Input: joydev - prevent potential read overflow in ioctl
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 182d679b2298d62bf42bb14b12a8067b8e17b617 upstream.
The problem here is that "len" might be less than "joydev->nabs" so the loops which verfy abspam[i] and keypam[] might read beyond the buffer.
--- drivers/input/joydev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/input/joydev.c +5 -2
@@ -448,7 +448,7 @@ static int joydev_handle_JSIOCSAXMAP(strif (IS_ERR (abspam))return PTR_ERR (abspam); -for (i =0 ; i < joydev->nabs; i++) { +for (i =0 ; i < len && i < joydev->nabs; i++) {if (abspam[i] >ABS_MAX ) { retval = -EINVAL ; goto out;
@@ -472,6 +472,9 @@ static int joydev_handle_JSIOCSBTNMAP(stint i;int retval =0 ; +if (len %sizeof (*keypam)) +return -EINVAL ; + len =min (len,sizeof (joydev->keypam));/* Validate the map. */
@@ -479,7 +482,7 @@ static int joydev_handle_JSIOCSBTNMAP(stif (IS_ERR (keypam))return PTR_ERR (keypam); -for (i =0 ; i < joydev->nkey; i++) { +for (i =0 ; i < (len /2 ) && i < joydev->nkey; i++) {if (keypam[i] >KEY_MAX || keypam[i] <BTN_MISC ) { retval = -EINVAL ; goto out;
Greg Kroah-Hartman
maintainerPATCH 94/134 Input: i8042 - add ASUS Zenbook Flip to noselftest list
In reply to Greg Kroah-HartmanFrom: Marcos Paulo de Souza <[email protected]>
commit b5d6e7ab7fe7d186878142e9fc1a05e4c3b65eb9 upstream.
After commit 77b425399f6d ("Input: i8042 - use chassis info to skip selftest on Asus laptops"), all modern Asus laptops have the i8042 selftest disabled. It has done by using chassys type "10" (laptop).
The Asus Zenbook Flip suffers from similar suspend/resume issues, but it _sometimes_ work and sometimes it doesn't. Setting noselftest makes it work reliably. In this case, we need to add chassis type "31" (convertible) in order to avoid selftest in this device.
--- drivers/input/serio/i8042-x86ia64io.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/input/serio/i8042-x86ia64io.h +4 -0
@@ -579,6 +579,10 @@ static const struct dmi_system_id i8042_ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"), }, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */ + }, }, { } };
Greg Kroah-Hartman
maintainerPATCH 95/134 USB: serial: option: update interface mapping for ZTE P685M
In reply to Greg Kroah-HartmanFrom: Lech Perczak <[email protected]>
commit 6420a569504e212d618d4a4736e2c59ed80a8478 upstream.
This patch prepares for qmi_wwan driver support for the device. Previously "option" driver mapped itself to interfaces 0 and 3 (matching ff/ff/ff), while interface 3 is in fact a QMI port. Interfaces 1 and 2 (matching ff/00/00) expose AT commands, and weren't supported previously at all.
Without this patch, a possible conflict would exist if device ID was added to qmi_wwan driver for interface 3.
Update and simplify device ID to match interfaces 0-2 directly, to expose QCDM (0), PCUI (1), and modem (2) ports and avoid conflict with QMI (3), and ADB (4).
The modem is used inside ZTE MF283+ router and carriers identify it as such.
Interface mapping is:
0: QCDM, 1: AT (PCUI), 2: AT (Modem), 3: QMI, 4: ADB
T: Bus=02 Lev=02 Prnt=02 Port=05 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 D: Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=19d2 ProdID=1275 Rev=f0.00 S: Manufacturer=ZTE,Incorporated S: Product=ZTE Technologies MSM S: SerialNumber=P685M510ZTED0000CP&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&0 C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan E: Ad=87(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
--- drivers/usb/serial/option.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +2 -1
@@ -1551,7 +1551,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1274, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1275, 0xff, 0xff, 0xff) }, + { USB_DEVICE(ZTE_VENDOR_ID, 0x1275), /* ZTE P685M */ + .driver_info = RSVD(3) | RSVD(4) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1276, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1277, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1278, 0xff, 0xff, 0xff) },
Greg Kroah-Hartman
maintainerPATCH 96/134 usb: musb: Fix runtime PM race in musb_queue_resume_work
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit 0eaa1a3714db34a59ce121de5733c3909c529463 upstream.
musb_queue_resume_work() would call the provided callback if the runtime PM status was 'active'. Otherwise, it would enqueue the request if the hardware was still suspended (musb->is_runtime_suspended is true).
This causes a race with the runtime PM handlers, as it is possible to be in the case where the runtime PM status is not yet 'active', but the hardware has been awaken (PM resume function has been called).
When hitting the race, the resume work was not enqueued, which probably triggered other bugs further down the stack. For instance, a telnet connection on Ingenic SoCs would result in a 50/50 chance of a segmentation fault somewhere in the musb code.
Rework the code so that either we call the callback directly if (musb->is_runtime_suspended == 0), or enqueue the query otherwise.
--- drivers/usb/musb/musb_core.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
drivers/usb/musb/musb_core.c +17 -14
@@ -2097,32 +2097,35 @@ int musb_queue_resume_work(struct musb * {struct musb_pending_work *w;unsigned long flags; +bool is_suspended;int error;if (WARN_ON (!callback))return -EINVAL ; -if (pm_runtime_active (musb->controller)) -return callback (musb, data); +spin_lock_irqsave (&musb->list_lock, flags); + is_suspended = musb->is_runtime_suspended; - w =devm_kzalloc (musb->controller,sizeof (*w),GFP_ATOMIC ); -if (!w) -return -ENOMEM ; +if (is_suspended) { + w =devm_kzalloc (musb->controller,sizeof (*w),GFP_ATOMIC ); +if (!w) { + error = -ENOMEM ; + goto out_unlock; + } + + w->callback = callback; + w->data = data; - w->callback = callback; - w->data = data; -spin_lock_irqsave (&musb->list_lock, flags); -if (musb->is_runtime_suspended) {list_add_tail (&w->node, &musb->pending_list); error =0 ; - }else { -dev_err (musb->controller,"could not add resume work %p\n" , - callback); -devm_kfree (musb->controller, w); - error = -EINPROGRESS ; } + +out_unlock:spin_unlock_irqrestore (&musb->list_lock, flags); +if (!is_suspended) + error =callback (musb, data); +return error; }EXPORT_SYMBOL_GPL (musb_queue_resume_work);
Greg Kroah-Hartman
maintainerPATCH 97/134 USB: serial: mos7840: fix error code in mos7840_write()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit a70aa7dc60099bbdcbd6faca42a915d80f31161e upstream.
This should return -ENOMEM instead of 0 if the kmalloc() fails.
--- drivers/usb/serial/mos7840.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/mos7840.c +3 -1
@@ -1362,8 +1362,10 @@ static int mos7840_write(struct tty_struif (urb->transfer_buffer ==NULL ) { urb->transfer_buffer =kmalloc (URB_TRANSFER_BUFFER_SIZE ,GFP_ATOMIC ); -if (!urb->transfer_buffer) +if (!urb->transfer_buffer) { + bytes_sent = -ENOMEM ; goto exit; + } } transfer_size =min (count,URB_TRANSFER_BUFFER_SIZE );
Greg Kroah-Hartman
maintainerPATCH 98/134 USB: serial: mos7720: fix error code in mos7720_write()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit fea7372cbc40869876df0f045e367f6f97a1666c upstream.
This code should return -ENOMEM if the kmalloc() fails but instead it returns success.
--- drivers/usb/serial/mos7720.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/serial/mos7720.c +3 -1
@@ -1239,8 +1239,10 @@ static int mos7720_write(struct tty_struif (urb->transfer_buffer ==NULL ) { urb->transfer_buffer =kmalloc (URB_TRANSFER_BUFFER_SIZE ,GFP_ATOMIC ); -if (!urb->transfer_buffer) +if (!urb->transfer_buffer) { + bytes_sent = -ENOMEM ; goto exit; + } } transfer_size =min (count,URB_TRANSFER_BUFFER_SIZE );
Greg Kroah-Hartman
maintainerPATCH 99/134 usb: dwc3: gadget: Fix setting of DEPCFG.bInterval_m1
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit a1679af85b2ae35a2b78ad04c18bb069c37330cc upstream.
Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it must be set to 0 when the controller operates in full-speed. See the programming guide for DEPCFG command section 3.2.2.1 (v3.30a).
--- drivers/usb/dwc3/gadget.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +11 -1
@@ -528,7 +528,17 @@ static int dwc3_gadget_set_ep_config(str params.param0 |=DWC3_DEPCFG_FIFO_NUMBER (dep->number >>1 );if (desc->bInterval) { - params.param1 |=DWC3_DEPCFG_BINTERVAL_M1 (desc->bInterval -1 ); +u8 bInterval_m1; + +/* +* Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it +* must be set to 0 when the controller operates in full-speed. +*/ + bInterval_m1 =min_t (u8, desc->bInterval -1 ,13 ); +if (dwc->gadget.speed ==USB_SPEED_FULL ) + bInterval_m1 =0 ; + + params.param1 |=DWC3_DEPCFG_BINTERVAL_M1 (bInterval_m1); dep->interval =1 << (desc->bInterval -1 ); }
Greg Kroah-Hartman
maintainerPATCH 100/134 usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt
In reply to Greg Kroah-HartmanFrom: Thinh Nguyen <[email protected]>
commit 4b049f55ed95cd889bcdb3034fd75e1f01852b38 upstream.
The dep->interval captures the number of frames/microframes per interval from bInterval. Fullspeed interrupt endpoint bInterval is the number of frames per interval and not 2^(bInterval - 1). So fix it here. This change is only for debugging purpose and should not affect the interrupt endpoint operation.
--- drivers/usb/dwc3/gadget.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/dwc3/gadget.c +6 -1
@@ -538,8 +538,13 @@ static int dwc3_gadget_set_ep_config(strif (dwc->gadget.speed ==USB_SPEED_FULL ) bInterval_m1 =0 ; +if (usb_endpoint_type (desc) ==USB_ENDPOINT_XFER_INT && + dwc->gadget.speed ==USB_SPEED_FULL ) + dep->interval = desc->bInterval; +else + dep->interval =1 << (desc->bInterval -1 ); + params.param1 |=DWC3_DEPCFG_BINTERVAL_M1 (bInterval_m1); - dep->interval =1 << (desc->bInterval -1 ); }return dwc3_send_gadget_ep_cmd (dep,DWC3_DEPCMD_SETEPCONFIG , ¶ms);
Greg Kroah-Hartman
maintainerPATCH 101/134 KEYS: trusted: Fix migratable=1 failing
In reply to Greg Kroah-HartmanFrom: Jarkko Sakkinen <[email protected]>
commit 8da7520c80468c48f981f0b81fc1be6599e3b0ad upstream.
Consider the following transcript:
$ keyctl add trusted kmk "new 32 blobauth=helloworld keyhandle=80000000 migratable=1" @u add_key: Invalid argument
The documentation has the following description:
migratable= 0|1 indicating permission to reseal to new PCR values,
default 1 (resealing allowed)
The consequence is that "migratable=1" should succeed. Fix this by allowing this condition to pass instead of return -EINVAL.
[*] Documentation/security/keys/trusted-encrypted.rst
--- security/keys/trusted.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/trusted.c +1 -1
@@ -797,7 +797,7 @@ static int getoptions(char *c, struct trcase Opt_migratable:if (*args[0 ].from =='0' ) pay->migratable =0 ; -else +else if (*args[0 ].from !='1' )return -EINVAL ;break ;case Opt_pcrlock:
Greg Kroah-Hartman
maintainerPATCH 102/134 btrfs: abort the transaction if we fail to inc ref in btrfs_copy_root
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 867ed321f90d06aaba84e2c91de51cd3038825ef upstream.
While testing my error handling patches, I added a error injection site at btrfs_inc_extent_ref, to validate the error handling I added was doing the correct thing. However I hit a pretty ugly corruption while doing this check, with the following error injection stack trace:
btrfs_inc_extent_ref
btrfs_copy_root
create_reloc_root
btrfs_init_reloc_root
btrfs_record_root_in_trans
btrfs_start_transaction
btrfs_update_inode
btrfs_update_time
touch_atime
file_accessed
btrfs_file_mmap
This is because we do not catch the error from btrfs_inc_extent_ref, which in practice would be ENOMEM, which means we lose the extent references for a root that has already been allocated and inserted, which is the problem. Fix this by aborting the transaction if we fail to do the reference modification.
--- fs/btrfs/ctree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/btrfs/ctree.c +3 -2
@@ -279,9 +279,10 @@ int btrfs_copy_root(struct btrfs_trans_h ret =btrfs_inc_ref (trans, root, cow,1 ); else ret =btrfs_inc_ref (trans, root, cow,0 ); - -if (ret) +if (ret) { +btrfs_abort_transaction (trans, ret);return ret; + }btrfs_mark_buffer_dirty (cow); *cow_ret = cow;
Greg Kroah-Hartman
maintainerPATCH 103/134 btrfs: fix reloc root leak with 0 ref reloc roots on recovery
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit c78a10aebb275c38d0cfccae129a803fe622e305 upstream.
When recovering a relocation, if we run into a reloc root that has 0 refs we simply add it to the reloc_control->reloc_roots list, and then clean it up later. The problem with this is __del_reloc_root() doesn't do anything if the root isn't in the radix tree, which in this case it won't be because we never call __add_reloc_root() on the reloc_root.
This exit condition simply isn't correct really. During normal operation we can remove ourselves from the rb tree and then we're meant to clean up later at merge_reloc_roots() time, and this happens correctly. During recovery we're depending on free_reloc_roots() to drop our references, but we're short-circuiting.
Fix this by continuing to check if we're on the list and dropping ourselves from the reloc_control root list and dropping our reference appropriately. Change the corresponding BUG_ON() to an ASSERT() that does the correct thing if we aren't in the rb tree.
--- fs/btrfs/relocation.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/btrfs/relocation.c +1 -3
@@ -1335,9 +1335,7 @@ static void __del_reloc_root(struct btrfRB_CLEAR_NODE (&node->rb_node); }spin_unlock (&rc->reloc_root_tree.lock); -if (!node) -return ; -BUG_ON ((struct btrfs_root *)node->data != root); +ASSERT (!node || (struct btrfs_root *)node->data == root); }spin_lock (&root->fs_info->trans_lock);
Greg Kroah-Hartman
maintainerPATCH 104/134 btrfs: fix extent buffer leak on failure to copy root
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 72c9925f87c8b74f36f8e75a4cd93d964538d3ca upstream.
At btrfs_copy_root(), if the call to btrfs_inc_ref() fails we end up returning without unlocking and releasing our reference on the extent buffer named "cow" we previously allocated with btrfs_alloc_tree_block().
So fix that by unlocking the extent buffer and dropping our reference on it before returning.
--- fs/btrfs/ctree.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/ctree.c +2 -0
@@ -280,6 +280,8 @@ int btrfs_copy_root(struct btrfs_trans_helse ret =btrfs_inc_ref (trans, root, cow,0 );if (ret) { +btrfs_tree_unlock (cow); +free_extent_buffer (cow);btrfs_abort_transaction (trans, ret);return ret; }
Greg Kroah-Hartman
maintainerPATCH 105/134 seccomp: Add missing return in non-void function
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
commit 04b38d012556199ba4c31195940160e0c44c64f0 upstream.
We don't actually care about the value, since the kernel will panic before that; but a value should nonetheless be returned, otherwise the compiler will complain.
--- kernel/seccomp.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/seccomp.c +2 -0
@@ -669,6 +669,8 @@ static int __seccomp_filter(int this_sys const bool recheck_after_trace) {BUG (); + +return -1 ; }#endif
Greg Kroah-Hartman
maintainerPATCH 106/134 drivers/misc/vmw_vmci: restrict too big queue size in qp_host_alloc_queue
In reply to Greg Kroah-HartmanFrom: Sabyrzhan Tasbolatov <[email protected]>
commit 2fd10bcf0310b9525b2af9e1f7aa9ddd87c3772e upstream.
syzbot found WARNING in qp_broker_alloc[1] in qp_host_alloc_queue() when num_pages is 0x100001, giving queue_size + queue_page_size bigger than KMALLOC_MAX_SIZE for kzalloc(), resulting order >= MAX_ORDER condition.
queue_size + queue_page_size=0x8000d8, where KMALLOC_MAX_SIZE=0x400000.
[1]
Call Trace: alloc_pages include/linux/gfp.h:547 [inline] kmalloc_order+0x40/0x130 mm/slab_common.c:837 kmalloc_order_trace+0x15/0x70 mm/slab_common.c:853 kmalloc_large include/linux/slab.h:481 [inline] __kmalloc+0x257/0x330 mm/slub.c:3959 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:682 [inline] qp_host_alloc_queue drivers/misc/vmw_vmci/vmci_queue_pair.c:540 [inline] qp_broker_create drivers/misc/vmw_vmci/vmci_queue_pair.c:1351 [inline] qp_broker_alloc+0x936/0x2740 drivers/misc/vmw_vmci/vmci_queue_pair.c:1739
--- drivers/misc/vmw_vmci/vmci_queue_pair.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/misc/vmw_vmci/vmci_queue_pair.c +3 -0
@@ -639,6 +639,9 @@ static struct vmci_queue *qp_host_alloc_ queue_page_size = num_pages *sizeof (*queue->kernel_if->u.h.page); +if (queue_size + queue_page_size >KMALLOC_MAX_SIZE ) +return NULL ; + queue =kzalloc (queue_size + queue_page_size,GFP_KERNEL );if (queue) { queue->q_header =NULL ;
Greg Kroah-Hartman
maintainerPATCH 107/134 staging: rtl8188eu: Add Edimax EW-7811UN V2 to device table
In reply to Greg Kroah-HartmanFrom: Martin Kaiser <[email protected]>
commit 7a8d2f1908a59003e55ef8691d09efb7fbc51625 upstream.
The Edimax EW-7811UN V2 uses an RTL8188EU chipset and works with this driver.
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -49,6 +49,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ {USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ + {USB_DEVICE(0x7392, 0xb811)}, /* Edimax EW-7811UN V2 */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 108/134 x86/reboot: Force all cpus to exit VMX root if VMX is supported
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit ed72736183c45a413a8d6974dd04be90f514cb6b upstream.
Force all CPUs to do VMXOFF (via NMI shootdown) during an emergency reboot if VMX is _supported_, as VMX being off on the current CPU does not prevent other CPUs from being in VMX root (post-VMXON). This fixes a bug where a crash/panic reboot could leave other CPUs in VMX root and prevent them from being woken via INIT-SIPI-SIPI in the new kernel.
Message-Id: <[email protected]>
--- arch/x86/kernel/reboot.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-)
arch/x86/kernel/reboot.c +10 -19
@@ -539,29 +539,20 @@ static void emergency_vmx_disable_all(volocal_irq_disable ();/* -* We need to disable VMX on all CPUs before rebooting, otherwise -* we risk hanging up the machine, because the CPU ignore INIT -* signals when VMX is enabled. +* Disable VMX on all CPUs before rebooting, otherwise we risk hanging +* the machine, because the CPU blocks INIT when it's in VMX root. * -* We can't take any locks and we may be on an inconsistent -* state, so we use NMIs as IPIs to tell the other CPUs to disable -* VMX and halt. +* We can't take any locks and we may be on an inconsistent state, so +* use NMIs as IPIs to tell the other CPUs to exit VMX root and halt. * -* For safety, we will avoid running the nmi_shootdown_cpus() -* stuff unnecessarily, but we don't have a way to check -* if other CPUs have VMX enabled. So we will call it only if the -* CPU we are running on has VMX enabled. -* -* We will miss cases where VMX is not enabled on all CPUs. This -* shouldn't do much harm because KVM always enable VMX on all -* CPUs anyway. But we can miss it on the small window where KVM -* is still enabling VMX. +* Do the NMI shootdown even if VMX if off on _this_ CPU, as that +* doesn't prevent a different CPU from being in VMX root operation. */ -if (cpu_has_vmx () &&cpu_vmx_enabled ()) { -/* Disable VMX on this CPU. */ -cpu_vmxoff (); +if (cpu_has_vmx ()) { +/* Safely force _this_ CPU out of VMX root operation. */ +__cpu_emergency_vmxoff (); -/* Halt and disable VMX on the other CPUs */ +/* Halt and exit VMX root operation on the other CPUs. */ nmi_shootdown_cpus (vmxoff_nmi); }
Greg Kroah-Hartman
maintainerPATCH 109/134 floppy: reintroduce O_NDELAY fix
In reply to Greg Kroah-HartmanFrom: Jiri Kosina <[email protected]>
commit 8a0c014cd20516ade9654fc13b51345ec58e7be8 upstream.
This issue was originally fixed in 09954bad4 ("floppy: refactor open() flags handling").
The fix as a side-effect, however, introduce issue for open(O_ACCMODE) that is being used for ioctl-only open. I wrote a fix for that, but instead of it being merged, full revert of 09954bad4 was performed, re-introducing the O_NDELAY / O_NONBLOCK issue, and it strikes again.
This is a forward-port of the original fix to current codebase; the original submission had the changelog below:
====
Commit 09954bad4 ("floppy: refactor open() flags handling"), as a side-effect, causes open(/dev/fdX, O_ACCMODE) to fail. It turns out that this is being used setfdprm userspace for ioctl-only open().
Reintroduce back the original behavior wrt !(FMODE_READ|FMODE_WRITE) modes, while still keeping the original O_NDELAY bug fixed.
--- drivers/block/floppy.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/block/floppy.c +14 -13
@@ -4067,21 +4067,22 @@ static int floppy_open(struct block_deviif (UFDCS ->rawcmd ==1 )UFDCS ->rawcmd =2 ; -if (!(mode &FMODE_NDELAY )) { -if (mode & (FMODE_READ |FMODE_WRITE )) { -UDRS ->last_checked =0 ; -clear_bit (FD_OPEN_SHOULD_FAIL_BIT , &UDRS ->flags); -check_disk_change (bdev); -if (test_bit (FD_DISK_CHANGED_BIT , &UDRS ->flags)) - goto out; -if (test_bit (FD_OPEN_SHOULD_FAIL_BIT , &UDRS ->flags)) - goto out; - } - res = -EROFS ; -if ((mode &FMODE_WRITE ) && - !test_bit (FD_DISK_WRITABLE_BIT , &UDRS ->flags)) +if (mode & (FMODE_READ |FMODE_WRITE )) { +UDRS ->last_checked =0 ; +clear_bit (FD_OPEN_SHOULD_FAIL_BIT , &UDRS ->flags); +check_disk_change (bdev); +if (test_bit (FD_DISK_CHANGED_BIT , &UDRS ->flags)) + goto out; +if (test_bit (FD_OPEN_SHOULD_FAIL_BIT , &UDRS ->flags)) goto out; } + + res = -EROFS ; + +if ((mode &FMODE_WRITE ) && + !test_bit (FD_DISK_WRITABLE_BIT , &UDRS ->flags)) + goto out; +mutex_unlock (&open_lock);mutex_unlock (&floppy_mutex);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 110/134 mtd: spi-nor: hisi-sfc: Put child node np on error path
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
commit fe6653460ee7a7dbe0cd5fd322992af862ce5ab0 upstream.
Put the child node np when it fails to get or register device.
--- drivers/mtd/spi-nor/hisi-sfc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/hisi-sfc.c +3 -1
@@ -393,8 +393,10 @@ static int hisi_spi_nor_register_all(strfor_each_available_child_of_node (dev->of_node, np) { ret =hisi_spi_nor_register (np, host); -if (ret) +if (ret) { +of_node_put (np); goto fail; + }if (host->num_chip ==HIFMC_MAX_CHIP_NUM ) {dev_warn (dev,"Flash device number exceeds the maximum chipselect number\n" );
Greg Kroah-Hartman
maintainerPATCH 111/134 mm: hugetlb: fix a race between freeing and dissolving the page
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
commit 7ffddd499ba6122b1a07828f023d1d67629aa017 upstream
There is a race condition between __free_huge_page() and dissolve_free_huge_page().
CPU0: CPU1:
// page_count(page) == 1
put_page(page)
__free_huge_page(page)
dissolve_free_huge_page(page)
spin_lock(&hugetlb_lock)
// PageHuge(page) && !page_count(page)
update_and_free_page(page)
// page is freed to the buddy
spin_unlock(&hugetlb_lock)
spin_lock(&hugetlb_lock)
clear_page_huge_active(page)
enqueue_huge_page(page)
// It is wrong, the page is already freed
spin_unlock(&hugetlb_lock)The race window is between put_page() and dissolve_free_huge_page().
We should make sure that the page is already on the free list when it is dissolved.
As a result __free_huge_page would corrupt page(s) already in the buddy allocator.
--- mm/hugetlb.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
mm/hugetlb.c +39 -0
@@ -66,6 +66,21 @@ DEFINE_SPINLOCK(hugetlb_lock);static int num_fault_mutexes;struct mutex *hugetlb_fault_mutex_table____cacheline_aligned_in_smp ; +static inline bool PageHugeFreed (struct page *head) +{ +return page_private (head +4 ) ==-1UL ; +} + +static inline void SetPageHugeFreed (struct page *head) +{ +set_page_private (head +4 ,-1UL ); +} + +static inline void ClearPageHugeFreed (struct page *head) +{ +set_page_private (head +4 ,0 ); +} +/* Forward declaration */ static int hugetlb_acct_memory (struct hstate *h,long delta);
@@ -863,6 +878,7 @@ static void enqueue_huge_page(struct hstlist_move (&page->lru, &h->hugepage_freelists[nid]); h->free_huge_pages++; h->free_huge_pages_node[nid]++; +SetPageHugeFreed (page); }static struct page *dequeue_huge_page_node (struct hstate *h,int nid)
@@ -880,6 +896,7 @@ static struct page *dequeue_huge_page_noreturn NULL ;list_move (&page->lru, &h->hugepage_activelist);set_page_refcounted (page); +ClearPageHugeFreed (page); h->free_huge_pages--; h->free_huge_pages_node[nid]--;return page;
@@ -1292,6 +1309,7 @@ static void prep_new_huge_page(struct hsset_hugetlb_cgroup (page,NULL ); h->nr_huge_pages++; h->nr_huge_pages_node[nid]++; +ClearPageHugeFreed (page);spin_unlock (&hugetlb_lock);put_page (page);/* free it into the hugepage allocator */ }
@@ -1455,6 +1473,7 @@ static int dissolve_free_huge_page(struc {int rc =0 ; +retry:spin_lock (&hugetlb_lock);if (PageHuge (page) && !page_count (page)) {struct page *head =compound_head (page);
@@ -1464,6 +1483,26 @@ static int dissolve_free_huge_page(struc rc = -EBUSY ; goto out; } + +/* +* We should make sure that the page is already on the free list +* when it is dissolved. +*/ +if (unlikely (!PageHugeFreed (head))) { +spin_unlock (&hugetlb_lock); +cond_resched (); + +/* +* Theoretically, we should return -EBUSY when we +* encounter this race. In fact, we have a chance +* to successfully dissolve the page if we do a +* retry. Because the race window is quite small. +* If we seize this opportunity, it is an optimization +* for increasing the success rate of dissolving page. +*/ + goto retry; + } +list_del (&head->lru); h->free_huge_pages--; h->free_huge_pages_node[nid]--;
Greg Kroah-Hartman
maintainerPATCH 112/134 usb: renesas_usbhs: Clear pipe running flag in usbhs_pkt_pop()
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
commit 9917f0e3cdba7b9f1a23f70e3f70b1a106be54a8 upstream
Should clear the pipe running flag in usbhs_pkt_pop(). Otherwise, we cannot use this pipe after dequeue was called while the pipe was running.
--- drivers/usb/renesas_usbhs/fifo.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/renesas_usbhs/fifo.c +2 -0
@@ -140,6 +140,8 @@ struct usbhs_pkt *usbhs_pkt_pop(struct uusbhsf_dma_unmap (pkt); } +usbhs_pipe_running (pipe,0 ); +__usbhsf_pkt_del (pkt); }
Greg Kroah-Hartman
maintainerPATCH 113/134 libnvdimm/dimm: Avoid race between probe and available_slots_show()
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
commit 7018c897c2f243d4b5f1b94bc6b4831a7eab80fb upstream
Richard reports that the following test:
(while true; do
cat /sys/bus/nd/devices/nmem*/available_slots 2>&1 > /dev/null
done) &
while true; do
for i in $(seq 0 4); do
echo nmem$i > /sys/bus/nd/drivers/nvdimm/bind
done
for i in $(seq 0 4); do
echo nmem$i > /sys/bus/nd/drivers/nvdimm/unbind
done
done
...fails with a crash signature like:
divide error: 0000 [#1] SMP KASAN PTI
RIP: 0010:nd_label_nfree+0x134/0x1a0 [libnvdimm]
[..]
Call Trace:
available_slots_show+0x4e/0x120 [libnvdimm]
dev_attr_show+0x42/0x80
? memset+0x20/0x40
sysfs_kf_seq_show+0x218/0x410The root cause is that available_slots_show() consults driver-data, but fails to synchronize against device-unbind setting up a TOCTOU race to access uninitialized memory.
Validate driver-data under the device-lock.
--- drivers/nvdimm/dimm_devs.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/nvdimm/dimm_devs.c +15 -3
@@ -317,16 +317,16 @@ static ssize_t state_show(struct device }static DEVICE_ATTR_RO (state); -static ssize_t available_slots_show (struct device *dev, -struct device_attribute *attr,char *buf) +static ssize_t __available_slots_show (struct nvdimm_drvdata *ndd,char *buf) { -struct nvdimm_drvdata *ndd =dev_get_drvdata (dev); +struct device *dev;ssize_t rc;u32 nfree;if (!ndd)return -ENXIO ; + dev = ndd->dev;nvdimm_bus_lock (dev); nfree =nd_label_nfree (ndd);if (nfree -1 > nfree) {
@@ -338,6 +338,18 @@ static ssize_t available_slots_show(strunvdimm_bus_unlock (dev);return rc; } + +static ssize_t available_slots_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +ssize_t rc; + +device_lock (dev); + rc =__available_slots_show (dev_get_drvdata (dev), buf); +device_unlock (dev); + +return rc; +}static DEVICE_ATTR_RO (available_slots);static struct attribute *nvdimm_attributes[] = {
Greg Kroah-Hartman
maintainerPATCH 114/134 module: Ignore _GLOBAL_OFFSET_TABLE_ when warning for undefined symbols
In reply to Greg Kroah-HartmanFrom: Fangrui Song <[email protected]>
commit ebfac7b778fac8b0e8e92ec91d0b055f046b4604 upstream.
clang-12 -fno-pic (since
https://github.com/llvm/llvm-project/commit/a084c0388e2a59b9556f2de0083333232da3f1d6)
can emit call __stack_chk_fail@PLT instead of call __stack_chk_fail on x86. The two forms should have identical behaviors on x86-64 but the former causes GNU as<2.37 to produce an unreferenced undefined symbol _GLOBAL_OFFSET_TABLE_.
(On x86-32, there is an R_386_PC32 vs R_386_PLT32 difference but the linker behavior is identical as far as Linux kernel is concerned.)
Simply ignore _GLOBAL_OFFSET_TABLE_ for now, like what scripts/mod/modpost.c:ignore_undef_symbol does. This also fixes the problem for gcc/clang -fpie and -fpic, which may emit call foo@PLT for external function calls on x86.
Note: ld -z defs and dynamic loaders do not error for unreferenced undefined symbols so the module loader is reading too much. If we ever need to ignore more symbols, the code should be refactored to ignore unreferenced symbols.
--- kernel/module.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
kernel/module.c +19 -2
@@ -2209,6 +2209,21 @@ static int verify_export_symbols(structreturn 0 ; } +static bool ignore_undef_symbol (Elf_Half emachine,const char *name) +{ +/* +* On x86, PIC code and Clang non-PIC code may have call foo@PLT. GNU as +* before 2.37 produces an unreferenced _GLOBAL_OFFSET_TABLE_ on x86-64. +* i386 has a similar problem but may not deserve a fix. +* +* If we ever have to ignore many symbols, consider refactoring the code to +* only warn if referenced by a relocation. +*/ +if (emachine ==EM_386 || emachine ==EM_X86_64 ) +return !strcmp (name,"_GLOBAL_OFFSET_TABLE_" ); +return false; +} +/* Change all symbols so that st_value encodes the pointer directly. */ static int simplify_symbols (struct module *mod,const struct load_info *info) {
@@ -2254,8 +2269,10 @@ static int simplify_symbols(struct modulbreak ; } -/* Ok if weak. */ -if (!ksym &&ELF_ST_BIND (sym[i].st_info) ==STB_WEAK ) +/* Ok if weak or ignored. */ +if (!ksym && + (ELF_ST_BIND (sym[i].st_info) ==STB_WEAK || +ignore_undef_symbol (info->hdr->e_machine, name)))break ; pr_warn("%s: Unknown symbol %s (err %li)\n",
Greg Kroah-Hartman
maintainerPATCH 115/134 mmc: sdhci-esdhc-imx: fix kernel panic when remove module
In reply to Greg Kroah-HartmanFrom: Frank Li <[email protected]>
commit a56f44138a2c57047f1ea94ea121af31c595132b upstream.
In sdhci_esdhc_imx_remove() the SDHCI_INT_STATUS in read. Under some circumstances, this may be done while the device is runtime suspended, triggering the below splat.
Fix the problem by adding a pm_runtime_get_sync(), before reading the register, which will turn on clocks etc making the device accessible again.
[ 1811.323148] mmc1: card aaaa removed [ 1811.347483] Internal error: synchronous external abort: 96000210 [#1] PREEMPT SMP [ 1811.354988] Modules linked in: sdhci_esdhc_imx(-) sdhci_pltfm sdhci cqhci mmc_block mmc_core [last unloaded: mmc_core] [ 1811.365726] CPU: 0 PID: 3464 Comm: rmmod Not tainted 5.10.1-sd-99871-g53835a2e8186 #5 [ 1811.373559] Hardware name: Freescale i.MX8DXL EVK (DT) [ 1811.378705] pstate: 60000005 (nZCv daif -PAN -UAO -TCO BTYPE=--) [ 1811.384723] pc : sdhci_esdhc_imx_remove+0x28/0x15c [sdhci_esdhc_imx] [ 1811.391090] lr : platform_drv_remove+0x2c/0x50 [ 1811.395536] sp : ffff800012c7bcb0 [ 1811.398855] x29: ffff800012c7bcb0 x28: ffff00002c72b900 [ 1811.404181] x27: 0000000000000000 x26: 0000000000000000 [ 1811.409497] x25: 0000000000000000 x24: 0000000000000000 [ 1811.414814] x23: ffff0000042b3890 x22: ffff800009127120 [ 1811.420131] x21: ffff00002c4c9580 x20: ffff0000042d0810 [ 1811.425456] x19: ffff0000042d0800 x18: 0000000000000020 [ 1811.430773] x17: 0000000000000000 x16: 0000000000000000 [ 1811.436089] x15: 0000000000000004 x14: ffff000004019c10 [ 1811.441406] x13: 0000000000000000 x12: 0000000000000020 [ 1811.446723] x11: 0101010101010101 x10: 7f7f7f7f7f7f7f7f [ 1811.452040] x9 : fefefeff6364626d x8 : 7f7f7f7f7f7f7f7f [ 1811.457356] x7 : 78725e6473607372 x6 : 0000000080808080 [ 1811.462673] x5 : 0000000000000000 x4 : 0000000000000000 [ 1811.467990] x3 : ffff800011ac1cb0 x2 : 0000000000000000 [ 1811.473307] x1 : ffff8000091214d4 x0 : ffff8000133a0030 [ 1811.478624] Call trace: [ 1811.481081] sdhci_esdhc_imx_remove+0x28/0x15c [sdhci_esdhc_imx] [ 1811.487098] platform_drv_remove+0x2c/0x50 [ 1811.491198] __device_release_driver+0x188/0x230 [ 1811.495818] driver_detach+0xc0/0x14c [ 1811.499487] bus_remove_driver+0x5c/0xb0 [ 1811.503413] driver_unregister+0x30/0x60 [ 1811.507341] platform_driver_unregister+0x14/0x20 [ 1811.512048] sdhci_esdhc_imx_driver_exit+0x1c/0x3a8 [sdhci_esdhc_imx] [ 1811.518495] __arm64_sys_delete_module+0x19c/0x230 [ 1811.523291] el0_svc_common.constprop.0+0x78/0x1a0 [ 1811.528086] do_el0_svc+0x24/0x90 [ 1811.531405] el0_svc+0x14/0x20 [ 1811.534461] el0_sync_handler+0x1a4/0x1b0 [ 1811.538474] el0_sync+0x174/0x180 [ 1811.541801] Code: a9025bf5 f9403e95 f9400ea0 9100c000 (b9400000) [ 1811.547902] ---[ end trace 3fb1a3bd48ff7be5 ]---
--- drivers/mmc/host/sdhci-esdhc-imx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-esdhc-imx.c +2 -1
@@ -1301,9 +1301,10 @@ static int sdhci_esdhc_imx_remove(structstruct sdhci_host *host =platform_get_drvdata (pdev);struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct pltfm_imx_data *imx_data =sdhci_pltfm_priv (pltfm_host); -int dead = (readl (host->ioaddr +SDHCI_INT_STATUS ) ==0xffffffff ); +int dead;pm_runtime_get_sync (&pdev->dev); + dead = (readl (host->ioaddr +SDHCI_INT_STATUS ) ==0xffffffff );pm_runtime_disable (&pdev->dev);pm_runtime_put_noidle (&pdev->dev);
Greg Kroah-Hartman
maintainerPATCH 116/134 gpio: pcf857x: Fix missing first interrupt
In reply to Greg Kroah-HartmanFrom: Maxim Kiselev <[email protected]>
commit a8002a35935aaefcd6a42ad3289f62bab947f2ca upstream.
If no n_latch value will be provided at driver probe then all pins will be used as an input:
gpio->out = ~n_latch;
In that case initial state for all pins is "one":
gpio->status = gpio->out;
So if pcf857x IRQ happens with change pin value from "zero" to "one" then we miss it, because of "one" from IRQ and "one" from initial state leaves corresponding pin unchanged:
change = (gpio->status ^ status) & gpio->irq_enabled;
The right solution will be to read actual state at driver probe.
--- drivers/gpio/gpio-pcf857x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-pcf857x.c +1 -1
@@ -370,7 +370,7 @@ static int pcf857x_probe(struct i2c_clie* reset state. Otherwise it flags pins to be driven low. */ gpio->out = ~n_latch; - gpio->status = gpio->out; + gpio->status = gpio->read (gpio->client); status =devm_gpiochip_add_data (&client->dev, &gpio->chip, gpio);if (status <0 )
Greg Kroah-Hartman
maintainerPATCH 117/134 f2fs: fix out-of-repair __setattr_copy()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
commit 2562515f0ad7342bde6456602c491b64c63fe950 upstream.
__setattr_copy() was copied from setattr_copy() in fs/attr.c, there is two missing patches doesn't cover this inner function, fix it.
Commit 7fa294c8991c ("userns: Allow chown and setgid preservation") Commit 23adbe12ef7d ("fs,userns: Change inode_capable to capable_wrt_inode_uidgid")
--- fs/f2fs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/file.c +2 -1
@@ -682,7 +682,8 @@ static void __setattr_copy(struct inodeif (ia_valid &ATTR_MODE ) {umode_t mode = attr->ia_mode; -if (!in_group_p (inode->i_gid) && !capable (CAP_FSETID )) +if (!in_group_p (inode->i_gid) && + !capable_wrt_inode_uidgid (inode,CAP_FSETID )) mode &= ~S_ISGID ;set_acl_inode (inode, mode); }
Greg Kroah-Hartman
maintainerPATCH 118/134 sparc32: fix a user-triggerable oops in clear_user()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 7780918b36489f0b2f9a3749d7be00c2ceaec513 upstream.
Back in 2.1.29 the clear_user() guts (__bzero()) had been merged with memset(). Unfortunately, while all exception handlers had been copied, one of the exception table entries got lost. As the result, clear_user() starting at 128*n bytes before the end of page and spanning between 8 and 127 bytes into the next page would oops when the second page is unmapped. It's trivial to reproduce - all it takes is
main()
{
int fd = open("/dev/zero", O_RDONLY);
char *p = mmap(NULL, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANON, -1, 0);
munmap(p + 8192, 8192);
read(fd, p + 8192 - 128, 192);
}which had been oopsing since March 1997. Says something about the quality of test coverage... ;-/ And while today sparc32 port is nearly dead, back in '97 it had been very much alive; in fact, sparc64 had only been in mainline for 3 months by that point...
--- arch/sparc/lib/memset.S | 1 + 1 file changed, 1 insertion(+)
arch/sparc/lib/memset.S +1 -0
@@ -140,6 +140,7 @@ __bzero: ZERO_LAST_BLOCKS(%o0, 0x48, %g2) ZERO_LAST_BLOCKS(%o0, 0x08, %g2) 13: + EXT(12b, 13b, 21f) be 8f andcc %o1, 4, %g0
Greg Kroah-Hartman
maintainerPATCH 119/134 gfs2: Dont skip dlm unlock if glock has an lvb
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
commit 78178ca844f0eb88f21f31c7fde969384be4c901 upstream.
Patch fb6791d100d1 was designed to allow gfs2 to unmount quicker by skipping the step where it tells dlm to unlock glocks in EX with lvbs. This was done because when gfs2 unmounts a file system, it destroys the dlm lockspace shortly after it destroys the glocks so it doesn't need to unlock them all: the unlock is implied when the lockspace is destroyed by dlm.
However, that patch introduced a use-after-free in dlm: as part of its normal dlm_recoverd process, it can call ls_recovery to recover dead locks. In so doing, it can call recover_rsbs which calls recover_lvb for any mastered rsbs. Func recover_lvb runs through the list of lkbs queued to the given rsb (if the glock is cached but unlocked, it will still be queued to the lkb, but in NL--Unlocked--mode) and if it has an lvb, copies it to the rsb, thus trying to preserve the lkb. However, when gfs2 skips the dlm unlock step, it frees the glock and its lvb, which means dlm's function recover_lvb references the now freed lvb pointer, copying the freed lvb memory to the rsb.
This patch changes the check in gdlm_put_lock so that it calls dlm_unlock for all glocks that contain an lvb pointer.
--- fs/gfs2/lock_dlm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
fs/gfs2/lock_dlm.c +2 -6
@@ -284,7 +284,6 @@ static void gdlm_put_lock(struct gfs2_gl {struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;struct lm_lockstruct *ls = &sdp->sd_lockstruct; -int lvb_needs_unlock =0 ;int error;if (gl->gl_lksb.sb_lkid ==0 ) {
@@ -297,13 +296,10 @@ static void gdlm_put_lock(struct gfs2_glgfs2_sbstats_inc (gl,GFS2_LKS_DCOUNT );gfs2_update_request_times (gl); -/* don't want to skip dlm_unlock writing the lvb when lock is ex */ - -if (gl->gl_lksb.sb_lvbptr && (gl->gl_state ==LM_ST_EXCLUSIVE )) - lvb_needs_unlock =1 ; +/* don't want to skip dlm_unlock writing the lvb when lock has one */ if (test_bit (SDF_SKIP_DLM_UNLOCK , &sdp->sd_flags) && - !lvb_needs_unlock) { + !gl->gl_lksb.sb_lvbptr) {gfs2_glock_free (gl);return ; }
Greg Kroah-Hartman
maintainerPATCH 120/134 dm era: Recover committed writeset after crash
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit de89afc1e40fdfa5f8b666e5d07c43d21a1d3be0 upstream.
Following a system crash, dm-era fails to recover the committed writeset for the current era, leading to lost writes. That is, we lose the information about what blocks were written during the affected era.
dm-era assumes that the writeset of the current era is archived when the device is suspended. So, when resuming the device, it just moves on to the next era, ignoring the committed writeset.
This assumption holds when the device is properly shut down. But, when the system crashes, the code that suspends the target never runs, so the writeset for the current era is not archived.
There are three issues that cause the committed writeset to get lost:
1. dm-era doesn't load the committed writeset when opening the metadata
2. The code that resizes the metadata wipes the information about the committed writeset (assuming it was loaded at step 1)
3. era_preresume() starts a new era, without taking into account that the current era might not have been archived, due to a system crash.
To fix this:
1. Load the committed writeset when opening the metadata
2. Fix the code that resizes the metadata to make sure it doesn't wipe the loaded writeset
3. Fix era_preresume() to check for a loaded writeset and archive it, before starting a new era.
--- drivers/md/dm-era-target.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/md/dm-era-target.c +9 -8
@@ -70,8 +70,6 @@ static size_t bitset_size(unsigned nr_bi*/ static int writeset_alloc (struct writeset *ws,dm_block_t nr_blocks) { - ws->md.nr_bits = nr_blocks; - ws->md.root =INVALID_WRITESET_ROOT ; ws->bits =vzalloc (bitset_size (nr_blocks));if (!ws->bits) {DMERR ("%s: couldn't allocate in memory bitset" , __func__);
@@ -84,12 +82,14 @@ static int writeset_alloc(struct writese/* * Wipes the in-core bitset, and creates a new on disk bitset. */ -static int writeset_init (struct dm_disk_bitset *info,struct writeset *ws) +static int writeset_init (struct dm_disk_bitset *info,struct writeset *ws, +dm_block_t nr_blocks) {int r; -memset (ws->bits,0 ,bitset_size (ws->md.nr_bits)); +memset (ws->bits,0 ,bitset_size (nr_blocks)); + ws->md.nr_bits = nr_blocks; r =setup_on_disk_bitset (info, ws->md.nr_bits, &ws->md.root);if (r) {DMERR ("%s: setup_on_disk_bitset failed" , __func__);
@@ -579,6 +579,7 @@ static int open_metadata(struct era_meta md->nr_blocks =le32_to_cpu (disk->nr_blocks); md->current_era =le32_to_cpu (disk->current_era); +ws_unpack (&disk->current_writeset, &md->current_writeset->md); md->writeset_tree_root =le64_to_cpu (disk->writeset_tree_root); md->era_array_root =le64_to_cpu (disk->era_array_root); md->metadata_snap =le64_to_cpu (disk->metadata_snap);
@@ -871,7 +872,6 @@ static int metadata_era_archive(struct e }ws_pack (&md->current_writeset->md, &value); - md->current_writeset->md.root =INVALID_WRITESET_ROOT ; keys[0 ] = md->current_era;__dm_bless_for_disk (&value);
@@ -883,6 +883,7 @@ static int metadata_era_archive(struct ereturn r; } + md->current_writeset->md.root =INVALID_WRITESET_ROOT ; md->archived_writesets = true;return 0 ;
@@ -899,7 +900,7 @@ static int metadata_new_era(struct era_mint r;struct writeset *new_writeset =next_writeset (md); - r =writeset_init (&md->bitset_info, new_writeset); + r =writeset_init (&md->bitset_info, new_writeset, md->nr_blocks);if (r) {DMERR ("%s: writeset_init failed" , __func__);return r;
@@ -952,7 +953,7 @@ static int metadata_commit(struct era_meint r;struct dm_block *sblock; -if (md->current_writeset->md.root !=SUPERBLOCK_LOCATION ) { +if (md->current_writeset->md.root !=INVALID_WRITESET_ROOT ) { r =dm_bitset_flush (&md->bitset_info, md->current_writeset->md.root, &md->current_writeset->md.root);if (r) {
@@ -1582,7 +1583,7 @@ static int era_preresume(struct dm_targestart_worker (era); - r =in_worker0 (era, metadata_new_era); + r =in_worker0 (era, metadata_era_rollover);if (r) {DMERR ("%s: metadata_era_rollover failed" , __func__);return r;
Greg Kroah-Hartman
maintainerPATCH 121/134 dm era: Verify the data block size hasnt changed
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit c8e846ff93d5eaa5384f6f325a1687ac5921aade upstream.
dm-era doesn't support changing the data block size of existing devices, so check explicitly that the requested block size for a new target matches the one stored in the metadata.
--- drivers/md/dm-era-target.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/md/dm-era-target.c +9 -1
@@ -564,6 +564,15 @@ static int open_metadata(struct era_meta } disk =dm_block_data (sblock); + +/* Verify the data block size hasn't changed */ +if (le32_to_cpu (disk->data_block_size) != md->block_size) { +DMERR ("changing the data block size (from %u to %llu) is not supported" , +le32_to_cpu (disk->data_block_size), md->block_size); + r = -EINVAL ; + goto bad; + } + r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION, disk->metadata_space_map_root, sizeof(disk->metadata_space_map_root),
@@ -575,7 +584,6 @@ static int open_metadata(struct era_metasetup_infos (md); - md->block_size =le32_to_cpu (disk->data_block_size); md->nr_blocks =le32_to_cpu (disk->nr_blocks); md->current_era =le32_to_cpu (disk->current_era);
Greg Kroah-Hartman
maintainerPATCH 122/134 dm era: Fix bitset memory leaks
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit 904e6b266619c2da5c58b5dce14ae30629e39645 upstream.
Deallocate the memory allocated for the in-core bitsets when destroying the target and in error paths.
--- drivers/md/dm-era-target.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/md/dm-era-target.c +6 -0
@@ -46,6 +46,7 @@ struct writeset {static void writeset_free (struct writeset *ws) {vfree (ws->bits); + ws->bits =NULL ; } static int setup_on_disk_bitset(struct dm_disk_bitset *info,
@@ -812,6 +813,8 @@ static struct era_metadata *metadata_opestatic void metadata_close (struct era_metadata *md) { +writeset_free (&md->writesets[0 ]); +writeset_free (&md->writesets[1 ]);destroy_persistent_data_objects (md);kfree (md); }
@@ -849,6 +852,7 @@ static int metadata_resize(struct era_me r =writeset_alloc (&md->writesets[1 ], *new_size);if (r) {DMERR ("%s: writeset_alloc failed for writeset 1" , __func__); +writeset_free (&md->writesets[0 ]);return r; }
@@ -859,6 +863,8 @@ static int metadata_resize(struct era_me &value, &md->era_array_root);if (r) {DMERR ("%s: dm_array_resize failed" , __func__); +writeset_free (&md->writesets[0 ]); +writeset_free (&md->writesets[1 ]);return r; }
Greg Kroah-Hartman
maintainerPATCH 123/134 dm era: Use correct value size in equality function of writeset tree
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit 64f2d15afe7b336aafebdcd14cc835ecf856df4b upstream.
Fix the writeset tree equality test function to use the right value size when comparing two btree values.
--- drivers/md/dm-era-target.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-era-target.c +1 -1
@@ -389,7 +389,7 @@ static void ws_dec(void *context, conststatic int ws_eq (void *context,const void *value1,const void *value2) { -return !memcmp (value1, value2,sizeof (struct writeset_metadata )); +return !memcmp (value1, value2,sizeof (struct writeset_disk )); }/*----------------------------------------------------------------*/
Greg Kroah-Hartman
maintainerPATCH 124/134 dm era: Reinitialize bitset cache before digesting a new writeset
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit 2524933307fd0036d5c32357c693c021ab09a0b0 upstream.
In case of devices with at most 64 blocks, the digestion of consecutive eras uses the writeset of the first era as the writeset of all eras to digest, leading to lost writes. That is, we lose the information about what blocks were written during the affected eras.
The digestion code uses a dm_disk_bitset object to access the archived writesets. This structure includes a one word (64-bit) cache to reduce the number of array lookups.
This structure is initialized only once, in metadata_digest_start(), when we kick off digestion.
But, when we insert a new writeset into the writeset tree, before the digestion of the previous writeset is done, or equivalently when there are multiple writesets in the writeset tree to digest, then all these writesets are digested using the same cache and the cache is not re-initialized when moving from one writeset to the next.
For devices with more than 64 blocks, i.e., the size of the cache, the cache is indirectly invalidated when we move to a next set of blocks, so we avoid the bug.
But for devices with at most 64 blocks we end up using the same cached data for digesting all archived writesets, i.e., the cache is loaded when digesting the first writeset and it never gets reloaded, until the digestion is done.
As a result, the writeset of the first era to digest is used as the writeset of all the following archived eras, leading to lost writes.
Fix this by reinitializing the dm_disk_bitset structure, and thus invalidating the cache, every time the digestion code starts digesting a new writeset.
--- drivers/md/dm-era-target.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/md/dm-era-target.c +6 -6
@@ -757,6 +757,12 @@ static int metadata_digest_lookup_writesws_unpack (&disk, &d->writeset); d->value =cpu_to_le32 (key); +/* +* We initialise another bitset info to avoid any caching side effects +* with the previous one. +*/ +dm_disk_bitset_init (md->tm, &d->info); + d->nr_bits =min (d->writeset.nr_bits, md->nr_blocks); d->current_bit =0 ; d->step = metadata_digest_transcribe_writeset;
@@ -770,12 +776,6 @@ static int metadata_digest_start(structreturn 0 ;memset (d,0 ,sizeof (*d)); - -/* -* We initialise another bitset info to avoid any caching side -* effects with the previous one. -*/ -dm_disk_bitset_init (md->tm, &d->info); d->step = metadata_digest_lookup_writeset;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 125/134 dm era: only resize metadata in preresume
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit cca2c6aebe86f68103a8615074b3578e854b5016 upstream.
Metadata resize shouldn't happen in the ctr. The ctr loads a temporary (inactive) table that will only become active upon resume. That is why resize should always be done in terms of resume. Otherwise a load (ctr) whose inactive table never becomes active will incorrectly resize the metadata.
Also, perform the resize directly in preresume, instead of using the worker to do it.
The worker might run other metadata operations, e.g., it could start digestion, before resizing the metadata. These operations will end up using the old size.
This could lead to errors, like:
device-mapper: era: metadata_digest_transcribe_writeset: dm_array_set_value failed
device-mapper: era: process_old_eras: digest step failed, stopping digestion
The reason of the above error is that the worker started the digestion of the archived writeset using the old, larger size.
As a result, metadata_digest_transcribe_writeset tried to write beyond the end of the era array.
--- drivers/md/dm-era-target.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/md/dm-era-target.c +10 -11
@@ -1502,15 +1502,6 @@ static int era_ctr(struct dm_target *ti, } era->md = md; - era->nr_blocks =calc_nr_blocks (era); - - r =metadata_resize (era->md, &era->nr_blocks); -if (r) { - ti->error ="couldn't resize metadata" ; -era_destroy (era); -return -ENOMEM ; - } - era->wq =alloc_ordered_workqueue ("dm-" DM_MSG_PREFIX ,WQ_MEM_RECLAIM );if (!era->wq) { ti->error ="could not create workqueue for metadata object" ;
@@ -1588,9 +1579,17 @@ static int era_preresume(struct dm_targedm_block_t new_size =calc_nr_blocks (era);if (era->nr_blocks != new_size) { - r =in_worker1 (era, metadata_resize, &new_size); -if (r) + r =metadata_resize (era->md, &new_size); +if (r) { +DMERR ("%s: metadata_resize failed" , __func__); +return r; + } + + r =metadata_commit (era->md); +if (r) { +DMERR ("%s: metadata_commit failed" , __func__);return r; + } era->nr_blocks = new_size; }
Greg Kroah-Hartman
maintainerPATCH 126/134 futex: Fix OWNER_DEAD fixup
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit a97cb0e7b3f4c6297fd857055ae8e895f402f501 upstream.
Both Geert and DaveJ reported that the recent futex commit:
c1e2f0eaf015 ("futex: Avoid violating the 10th rule of futex")
introduced a problem with setting OWNER_DEAD. We set the bit on an uninitialized variable and then entirely optimize it away as a dead-store.
Move the setting of the bit to where it is more useful.
--- kernel/futex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/futex.c +3 -3
@@ -2424,9 +2424,6 @@ static int __fixup_pi_state_owner(u32 __int err =0 ; oldowner = pi_state->owner; -/* Owner died? */ -if (!pi_state->owner) - newtid |=FUTEX_OWNER_DIED ;/* * We are here because either:
@@ -2484,6 +2481,9 @@ retry: } newtid =task_pid_vnr (newowner) |FUTEX_WAITERS ; +/* Owner died? */ +if (!pi_state->owner) + newtid |=FUTEX_OWNER_DIED ;if (get_futex_value_locked (&uval, uaddr)) goto handle_fault;
Greg Kroah-Hartman
maintainerPATCH 127/134 futex: fix dead code in attach_to_pi_owner()
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
The handle_exit_race() function is defined in commit 9c3f39860367
("futex: Cure exit race"), which never returns -EBUSY. This results
in a small piece of dead code in the attach_to_pi_owner() function:
int ret = handle_exit_race(uaddr, uval, p); /* Never return -EBUSY */ ... if (ret == -EBUSY) *exiting = p; /* dead code */
The return value -EBUSY is added to handle_exit_race() in upsteam commit ac31c7ff8624409 ("futex: Provide distinct return value when owner is exiting"). This commit was incorporated into v4.9.255, before the function handle_exit_race() was introduced, whitout Modify handle_exit_race().
To fix dead code, extract the change of handle_exit_race() from commit ac31c7ff8624409 ("futex: Provide distinct return value when owner
is exiting"), re-incorporated.
Lee writes:
This commit takes the remaining functional snippet of:
ac31c7ff8624409 ("futex: Provide distinct return value when owner is exiting")
... and is the correct fix for this issue.
--- kernel/futex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/futex.c +3 -3
@@ -1207,11 +1207,11 @@ static int handle_exit_race(u32 __user *u32 uval2;/* -* If the futex exit state is not yet FUTEX_STATE_DEAD, wait -* for it to finish. +* If the futex exit state is not yet FUTEX_STATE_DEAD, tell the +* caller that the alleged owner is busy. */ if (tsk && tsk->futex_state !=FUTEX_STATE_DEAD ) -return -EAGAIN ; +return -EBUSY ;/* * Reread the user space value to handle the following situation:
Greg Kroah-Hartman
maintainerPATCH 128/134 icmp: introduce helper for natd source address in network device context
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit 0b41713b606694257b90d61ba7e2712d8457648b upstream.
This introduces a helper function to be called only by network drivers that wraps calls to icmp[v6]_send in a conntrack transformation, in case NAT has been used. We don't want to pollute the non-driver path, though, so we introduce this as a helper to be called by places that actually make use of this, as suggested by Florian.
--- include/linux/icmpv6.h | 6 ++++++ include/net/icmp.h | 6 ++++++ net/ipv4/icmp.c | 33 +++++++++++++++++++++++++++++++++ net/ipv6/ip6_icmp.c | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+)
include/linux/icmpv6.h +6 -0
@@ -30,6 +30,12 @@ static inline void icmpv6_send(struct sk }#endif +#if IS_ENABLED (CONFIG_NF_NAT ) +void icmpv6_ndo_send (struct sk_buff *skb_in,u8 type,u8 code,__u32 info); +#else +#define icmpv6_ndo_send icmpv6_send +#endif +extern int icmpv6_init (void );extern int icmpv6_err_convert (u8 type,u8 code,int *err);
include/net/icmp.h +6 -0
@@ -47,6 +47,12 @@ static inline void icmp_send(struct sk_b__icmp_send (skb_in, type, code, info, &IPCB (skb_in)->opt); } +#if IS_ENABLED (CONFIG_NF_NAT ) +void icmp_ndo_send (struct sk_buff *skb_in,int type,int code,__be32 info); +#else +#define icmp_ndo_send icmp_send +#endif +int icmp_rcv (struct sk_buff *skb);void icmp_err (struct sk_buff *skb,u32 info);int icmp_init (void );
net/ipv4/icmp.c +33 -0
@@ -738,6 +738,39 @@ out:; }EXPORT_SYMBOL (__icmp_send); +#if IS_ENABLED (CONFIG_NF_NAT ) +#include <net/netfilter/nf_conntrack.h> +void icmp_ndo_send (struct sk_buff *skb_in,int type,int code,__be32 info) +{ +struct sk_buff *cloned_skb =NULL ; +enum ip_conntrack_info ctinfo; +struct nf_conn *ct; +__be32 orig_ip; + + ct =nf_ct_get (skb_in, &ctinfo); +if (!ct || !(ct->status &IPS_SRC_NAT )) { +icmp_send (skb_in, type, code, info); +return ; + } + +if (skb_shared (skb_in)) + skb_in = cloned_skb =skb_clone (skb_in,GFP_ATOMIC ); + +if (unlikely (!skb_in ||skb_network_header (skb_in) < skb_in->head || + (skb_network_header (skb_in) +sizeof (struct iphdr )) > +skb_tail_pointer (skb_in) ||skb_ensure_writable (skb_in, +skb_network_offset (skb_in) +sizeof (struct iphdr )))) + goto out; + + orig_ip =ip_hdr (skb_in)->saddr; +ip_hdr (skb_in)->saddr = ct->tuplehash[0 ].tuple.src.u3.ip; +icmp_send (skb_in, type, code, info); +ip_hdr (skb_in)->saddr = orig_ip; +out: +consume_skb (cloned_skb); +} +EXPORT_SYMBOL (icmp_ndo_send); +#endif static void icmp_socket_deliver (struct sk_buff *skb,u32 info) {
net/ipv6/ip6_icmp.c +34 -0
@@ -44,4 +44,38 @@ out:rcu_read_unlock (); }EXPORT_SYMBOL (icmpv6_send); + +#if IS_ENABLED (CONFIG_NF_NAT ) +#include <net/netfilter/nf_conntrack.h> +void icmpv6_ndo_send (struct sk_buff *skb_in,u8 type,u8 code,__u32 info) +{ +struct sk_buff *cloned_skb =NULL ; +enum ip_conntrack_info ctinfo; +struct in6_addr orig_ip; +struct nf_conn *ct; + + ct =nf_ct_get (skb_in, &ctinfo); +if (!ct || !(ct->status &IPS_SRC_NAT )) { +icmpv6_send (skb_in, type, code, info); +return ; + } + +if (skb_shared (skb_in)) + skb_in = cloned_skb =skb_clone (skb_in,GFP_ATOMIC ); + +if (unlikely (!skb_in ||skb_network_header (skb_in) < skb_in->head || + (skb_network_header (skb_in) +sizeof (struct ipv6hdr )) > +skb_tail_pointer (skb_in) ||skb_ensure_writable (skb_in, +skb_network_offset (skb_in) +sizeof (struct ipv6hdr )))) + goto out; + + orig_ip =ipv6_hdr (skb_in)->saddr; +ipv6_hdr (skb_in)->saddr = ct->tuplehash[0 ].tuple.src.u3.in6; +icmpv6_send (skb_in, type, code, info); +ipv6_hdr (skb_in)->saddr = orig_ip; +out: +consume_skb (cloned_skb); +} +EXPORT_SYMBOL (icmpv6_ndo_send); +#endif #endif
Greg Kroah-Hartman
maintainerPATCH 129/134 gtp: use icmp_ndo_send helper
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit e0fce6f945a26d4e953a147fe7ca11410322c9fe upstream.
Because gtp is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly.
--- drivers/net/gtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/gtp.c +2 -2
@@ -560,8 +560,8 @@ static int gtp_build_skb_ip4(struct sk_b mtu < ntohs(iph->tot_len)) {netdev_dbg (dev,"packet too big, fragmentation needed\n" );memset (IPCB (skb),0 ,sizeof (*IPCB (skb))); -icmp_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , -htonl (mtu)); +icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , +htonl (mtu)); goto err_rt; }
Greg Kroah-Hartman
maintainerPATCH 130/134 sunvnet: use icmp_ndo_send helper
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit 67c9a7e1e3ac491b5df018803639addc36f154ba upstream.
Because sunvnet is calling icmp from network device context, it should use the ndo helper so that the rate limiting applies correctly. While we're at it, doing the additional route lookup before calling icmp_ndo_send is superfluous, since this is the job of the icmp code in the first place.
--- drivers/net/ethernet/sun/sunvnet_common.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)
drivers/net/ethernet/sun/sunvnet_common.c +4 -20
@@ -1263,28 +1263,12 @@ int sunvnet_start_xmit_common(struct sk_if (vio_version_after_eq (&port->vio,1 ,3 )) localmtu -=VLAN_HLEN ; -if (skb->protocol ==htons (ETH_P_IP )) { -struct flowi4 fl4; -struct rtable *rt =NULL ; - -memset (&fl4,0 ,sizeof (fl4)); - fl4.flowi4_oif = dev->ifindex; - fl4.flowi4_tos =RT_TOS (ip_hdr (skb)->tos); - fl4.daddr =ip_hdr (skb)->daddr; - fl4.saddr =ip_hdr (skb)->saddr; - - rt =ip_route_output_key (dev_net (dev), &fl4); -rcu_read_unlock (); -if (!IS_ERR (rt)) { -skb_dst_set (skb, &rt->dst); -icmp_send (skb,ICMP_DEST_UNREACH , -ICMP_FRAG_NEEDED , -htonl (localmtu)); - } - } +if (skb->protocol ==htons (ETH_P_IP )) +icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED , +htonl (localmtu));#if IS_ENABLED (CONFIG_IPV6 ) else if (skb->protocol == htons(ETH_P_IPV6)) - icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu); + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);#endif goto out_dropped; }
Greg Kroah-Hartman
maintainerPATCH 131/134 ipv6: icmp6: avoid indirect call for icmpv6_send()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit cc7a21b6fbd945f8d8f61422ccd27203c1fafeb7 upstream.
If IPv6 is builtin, we do not need an expensive indirect call to reach icmp6_send().
v2: put inline keyword before the type to avoid sparse warnings.
--- include/linux/icmpv6.h | 22 +++++++++++++++++++++- net/ipv6/icmp.c | 5 +++-- net/ipv6/ip6_icmp.c | 10 +++++----- 3 files changed, 29 insertions(+), 8 deletions(-)
include/linux/icmpv6.h +21 -1
@@ -12,12 +12,32 @@ static inline struct icmp6hdr *icmp6_hdr#include <linux/netdevice.h> #if IS_ENABLED (CONFIG_IPV6 ) -extern void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info);typedef void ip6_icmp_send_t (struct sk_buff *skb,u8 type,u8 code,__u32 info,const struct in6_addr *force_saddr); +#if IS_BUILTIN (CONFIG_IPV6 ) +void icmp6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, +const struct in6_addr *force_saddr); +static inline void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info) +{ +icmp6_send (skb, type, code, info,NULL ); +} +static inline int inet6_register_icmp_sender (ip6_icmp_send_t *fn) +{ +BUILD_BUG_ON (fn != icmp6_send); +return 0 ; +} +static inline int inet6_unregister_icmp_sender (ip6_icmp_send_t *fn) +{ +BUILD_BUG_ON (fn != icmp6_send); +return 0 ; +} +#else +extern void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info);extern int inet6_register_icmp_sender (ip6_icmp_send_t *fn);extern int inet6_unregister_icmp_sender (ip6_icmp_send_t *fn); +#endif +int ip6_err_gen_icmpv6_unreach (struct sk_buff *skb,int nhs,int type,unsigned int data_len);
net/ipv6/icmp.c +3 -2
@@ -388,8 +388,8 @@ relookup_failed:/* * Send an ICMP message in response to a packet in error */ -static void icmp6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, -const struct in6_addr *force_saddr) +void icmp6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, +const struct in6_addr *force_saddr) {struct net *net =dev_net (skb->dev);struct inet6_dev *idev =NULL ;
@@ -559,6 +559,7 @@ void icmpv6_param_prob(struct sk_buff *sicmp6_send (skb,ICMPV6_PARAMPROB , code, pos,NULL );kfree_skb (skb); } +EXPORT_SYMBOL (icmp6_send);/* Generate icmpv6 with type/code ICMPV6_DEST_UNREACH/ICMPV6_ADDR_UNREACH * if sufficient data bytes are available
net/ipv6/ip6_icmp.c +5 -5
@@ -8,6 +8,8 @@#if IS_ENABLED (CONFIG_IPV6 ) +#if !IS_BUILTIN (CONFIG_IPV6 ) +static ip6_icmp_send_t __rcu *ip6_icmp_send;int inet6_register_icmp_sender (ip6_icmp_send_t *fn)
@@ -36,14 +38,12 @@ void icmpv6_send(struct sk_buff *skb, u8rcu_read_lock (); send =rcu_dereference (ip6_icmp_send); - -if (!send) - goto out; -send (skb, type, code, info,NULL ); -out: +if (send) +send (skb, type, code, info,NULL ); rcu_read_unlock(); }EXPORT_SYMBOL (icmpv6_send); +#endif #if IS_ENABLED (CONFIG_NF_NAT )#include <net/netfilter/nf_conntrack.h>
Greg Kroah-Hartman
maintainerPATCH 132/134 ipv6: silence compilation warning for non-IPV6 builds
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
commit 1faba27f11c8da244e793546a1b35a9b1da8208e upstream.
The W=1 compilation of allmodconfig generates the following warning:
net/ipv6/icmp.c:448:6: warning: no previous prototype for 'icmp6_send' [-Wmissing-prototypes]
448 | void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
| ^~~~~~~~~~
Fix it by providing function declaration for builds with ipv6 as a module.
--- include/linux/icmpv6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/icmpv6.h +1 -1
@@ -15,9 +15,9 @@ static inline struct icmp6hdr *icmp6_hdrtypedef void ip6_icmp_send_t (struct sk_buff *skb,u8 type,u8 code,__u32 info,const struct in6_addr *force_saddr); -#if IS_BUILTIN (CONFIG_IPV6 )void icmp6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info,const struct in6_addr *force_saddr); +#if IS_BUILTIN (CONFIG_IPV6 )static inline void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info) {icmp6_send (skb, type, code, info,NULL );
Greg Kroah-Hartman
maintainerPATCH 133/134 net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
commit ee576c47db60432c37e54b1e2b43a8ca6d3a8dca upstream.
The icmp{,v6}_send functions make all sorts of use of skb->cb, casting it with IPCB or IP6CB, assuming the skb to have come directly from the inet layer. But when the packet comes from the ndo layer, especially when forwarded, there's no telling what might be in skb->cb at that point. As a result, the icmp sending code risks reading bogus memory contents, which can result in nasty stack overflows such as this one reported by a user:
panic+0x108/0x2ea
__stack_chk_fail+0x14/0x20
__icmp_send+0x5bd/0x5c0
icmp_ndo_send+0x148/0x160In icmp_send, skb->cb is cast with IPCB and an ip_options struct is read from it. The optlen parameter there is of particular note, as it can induce writes beyond bounds. There are quite a few ways that can happen in __ip_options_echo. For example:
// sptr/skb are attacker-controlled skb bytes
sptr = skb_network_header(skb);
// dptr/dopt points to stack memory allocated by __icmp_send
dptr = dopt->__data;
// sopt is the corrupt skb->cb in question
if (sopt->rr) {
optlen = sptr[sopt->rr+1]; // corrupt skb->cb + skb->data
soffset = sptr[sopt->rr+2]; // corrupt skb->cb + skb->data
// this now writes potentially attacker-controlled data, over
// flowing the stack:
memcpy(dptr, sptr+sopt->rr, optlen);
}In the icmpv6_send case, the story is similar, but not as dire, as only IP6CB(skb)->iif and IP6CB(skb)->dsthao are used. The dsthao case is worse than the iif case, but it is passed to ipv6_find_tlv, which does a bit of bounds checking on the value.
This is easy to simulate by doing a memset(skb->cb, 0x41, sizeof(skb->cb)); before calling icmp{,v6}_ndo_send, and it's only by good fortune and the rarity of icmp sending from that context that we've avoided reports like this until now. For example, in KASAN:
BUG: KASAN: stack-out-of-bounds in __ip_options_echo+0xa0e/0x12b0
Write of size 38 at addr ffff888006f1f80e by task ping/89
CPU: 2 PID: 89 Comm: ping Not tainted 5.10.0-rc7-debug+ #5
Call Trace:
dump_stack+0x9a/0xcc
print_address_description.constprop.0+0x1a/0x160
__kasan_report.cold+0x20/0x38
kasan_report+0x32/0x40
check_memory_region+0x145/0x1a0
memcpy+0x39/0x60
__ip_options_echo+0xa0e/0x12b0
__icmp_send+0x744/0x1700Actually, out of the 4 drivers that do this, only gtp zeroed the cb for the v4 case, while the rest did not. So this commit actually removes the gtp-specific zeroing, while putting the code where it belongs in the shared infrastructure of icmp{,v6}_ndo_send.
This commit fixes the issue by passing an empty IPCB or IP6CB along to the functions that actually do the work. For the icmp_send, this was already trivial, thanks to __icmp_send providing the plumbing function. For icmpv6_send, this required a tiny bit of refactoring to make it behave like the v4 case, after which it was straight forward.
--- drivers/net/gtp.c | 1 - include/linux/icmpv6.h | 26 ++++++++++++++++++++------ include/linux/ipv6.h | 2 +- include/net/icmp.h | 6 +++++- net/ipv4/icmp.c | 5 +++-- net/ipv6/icmp.c | 16 ++++++++-------- net/ipv6/ip6_icmp.c | 12 +++++++----- 7 files changed, 44 insertions(+), 24 deletions(-)
drivers/net/gtp.c +0 -1
@@ -559,7 +559,6 @@ static int gtp_build_skb_ip4(struct sk_bif (!skb_is_gso (skb) && (iph->frag_off &htons (IP_DF )) && mtu <ntohs (iph->tot_len)) {netdev_dbg (dev,"packet too big, fragmentation needed\n" ); -memset (IPCB (skb),0 ,sizeof (*IPCB (skb)));icmp_ndo_send (skb,ICMP_DEST_UNREACH ,ICMP_FRAG_NEEDED ,htonl (mtu)); goto err_rt;
include/linux/icmpv6.h +20 -6
@@ -2,6 +2,7 @@#define _LINUX_ICMPV6_H#include <linux/skbuff.h> +#include <linux/ipv6.h> #include <uapi/linux/icmpv6.h> static inline struct icmp6hdr *icmp6_hdr (const struct sk_buff *skb)
@@ -14,13 +15,16 @@ static inline struct icmp6hdr *icmp6_hdr #if IS_ENABLED(CONFIG_IPV6) typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info, - const struct in6_addr *force_saddr); + const struct in6_addr *force_saddr, + const struct inet6_skb_parm *parm); void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, - const struct in6_addr *force_saddr); + const struct in6_addr *force_saddr, + const struct inet6_skb_parm *parm); #if IS_BUILTIN(CONFIG_IPV6) -static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) +static inline void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, + const struct inet6_skb_parm *parm) { - icmp6_send(skb, type, code, info, NULL); + icmp6_send(skb, type, code, info, NULL, parm); } static inline int inet6_register_icmp_sender(ip6_icmp_send_t *fn) {
@@ -33,11 +37,17 @@ static inline int inet6_unregister_icmp_ return 0; }#else -extern void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info); +extern void __icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, +const struct inet6_skb_parm *parm);extern int inet6_register_icmp_sender (ip6_icmp_send_t *fn);extern int inet6_unregister_icmp_sender (ip6_icmp_send_t *fn);#endif +static inline void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info) +{ +__icmpv6_send (skb, type, code, info,IP6CB (skb)); +} +int ip6_err_gen_icmpv6_unreach (struct sk_buff *skb,int nhs,int type,unsigned int data_len);
@@ -53,7 +63,11 @@ static inline void icmpv6_send(struct sk#if IS_ENABLED (CONFIG_NF_NAT )void icmpv6_ndo_send (struct sk_buff *skb_in,u8 type,u8 code,__u32 info);#else -#define icmpv6_ndo_send icmpv6_send +static inline void icmpv6_ndo_send (struct sk_buff *skb_in,u8 type,u8 code,__u32 info) +{ +struct inet6_skb_parm parm = {0 }; +__icmpv6_send (skb_in, type, code, info, &parm); +}#endif extern int icmpv6_init (void );
include/linux/ipv6.h +1 -1
@@ -2,6 +2,7 @@#define _IPV6_H#include <uapi/linux/ipv6.h> +#include <uapi/linux/icmpv6.h> #define ipv6_optlen (p) (((p)->hdrlen+1) << 3)#define ipv6_authlen (p) (((p)->hdrlen+2) << 2)
@@ -73,7 +74,6 @@ struct ipv6_params {__s32 autoconf; };extern struct ipv6_params ipv6_defaults; -#include <linux/icmpv6.h> #include <linux/tcp.h> #include <linux/udp.h>
include/net/icmp.h +5 -1
@@ -50,7 +50,11 @@ static inline void icmp_send(struct sk_b#if IS_ENABLED (CONFIG_NF_NAT )void icmp_ndo_send (struct sk_buff *skb_in,int type,int code,__be32 info);#else -#define icmp_ndo_send icmp_send +static inline void icmp_ndo_send (struct sk_buff *skb_in,int type,int code,__be32 info) +{ +struct ip_options opts = {0 }; +__icmp_send (skb_in, type, code, info, &opts); +}#endif int icmp_rcv (struct sk_buff *skb);
net/ipv4/icmp.c +3 -2
@@ -743,13 +743,14 @@ EXPORT_SYMBOL(__icmp_send);void icmp_ndo_send (struct sk_buff *skb_in,int type,int code,__be32 info) {struct sk_buff *cloned_skb =NULL ; +struct ip_options opts = {0 };enum ip_conntrack_info ctinfo;struct nf_conn *ct;__be32 orig_ip; ct =nf_ct_get (skb_in, &ctinfo);if (!ct || !(ct->status &IPS_SRC_NAT )) { -icmp_send (skb_in, type, code, info); +__icmp_send (skb_in, type, code, info, &opts);return ; }
@@ -764,7 +765,7 @@ void icmp_ndo_send(struct sk_buff *skb_i orig_ip =ip_hdr (skb_in)->saddr;ip_hdr (skb_in)->saddr = ct->tuplehash[0 ].tuple.src.u3.ip; -icmp_send (skb_in, type, code, info); +__icmp_send (skb_in, type, code, info, &opts);ip_hdr (skb_in)->saddr = orig_ip; out:consume_skb (cloned_skb);
net/ipv6/icmp.c +8 -8
@@ -298,10 +298,9 @@ static int icmpv6_getfrag(void *from, ch }#if IS_ENABLED (CONFIG_IPV6_MIP6 ) -static void mip6_addr_swap (struct sk_buff *skb) +static void mip6_addr_swap (struct sk_buff *skb,const struct inet6_skb_parm *opt) {struct ipv6hdr *iph =ipv6_hdr (skb); -struct inet6_skb_parm *opt =IP6CB (skb);struct ipv6_destopt_hao *hao;struct in6_addr tmp;int off;
@@ -318,7 +317,7 @@ static void mip6_addr_swap(struct sk_buf } }#else -static inline void mip6_addr_swap (struct sk_buff *skb) {} +static inline void mip6_addr_swap (struct sk_buff *skb,const struct inet6_skb_parm *opt) {}#endif static struct dst_entry *icmpv6_route_lookup(struct net *net,
@@ -389,7 +388,8 @@ relookup_failed:* Send an ICMP message in response to a packet in error */ void icmp6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, -const struct in6_addr *force_saddr) +const struct in6_addr *force_saddr, +const struct inet6_skb_parm *parm) {struct net *net =dev_net (skb->dev);struct inet6_dev *idev =NULL ;
@@ -473,7 +473,7 @@ void icmp6_send(struct sk_buff *skb, u8return ; } -mip6_addr_swap (skb); +mip6_addr_swap (skb, parm);memset (&fl6,0 ,sizeof (fl6)); fl6.flowi6_proto =IPPROTO_ICMPV6 ;
@@ -556,7 +556,7 @@ out:*/ void icmpv6_param_prob (struct sk_buff *skb,u8 code,int pos) { -icmp6_send (skb,ICMPV6_PARAMPROB , code, pos,NULL ); +icmp6_send (skb,ICMPV6_PARAMPROB , code, pos,NULL ,IP6CB (skb));kfree_skb (skb); }EXPORT_SYMBOL (icmp6_send);
@@ -613,10 +613,10 @@ int ip6_err_gen_icmpv6_unreach(struct sk }if (type ==ICMP_TIME_EXCEEDED )icmp6_send (skb2,ICMPV6_TIME_EXCEED ,ICMPV6_EXC_HOPLIMIT , - info, &temp_saddr); + info, &temp_saddr,IP6CB (skb2));else icmp6_send (skb2,ICMPV6_DEST_UNREACH ,ICMPV6_ADDR_UNREACH , - info, &temp_saddr); + info, &temp_saddr,IP6CB (skb2));if (rt)ip6_rt_put (rt);
net/ipv6/ip6_icmp.c +7 -5
@@ -32,23 +32,25 @@ int inet6_unregister_icmp_sender(ip6_icm }EXPORT_SYMBOL (inet6_unregister_icmp_sender); -void icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info) +void __icmpv6_send (struct sk_buff *skb,u8 type,u8 code,__u32 info, +const struct inet6_skb_parm *parm) {ip6_icmp_send_t *send;rcu_read_lock (); send =rcu_dereference (ip6_icmp_send);if (send) -send (skb, type, code, info,NULL ); +send (skb, type, code, info,NULL , parm);rcu_read_unlock (); } -EXPORT_SYMBOL (icmpv6_send); +EXPORT_SYMBOL (__icmpv6_send);#endif #if IS_ENABLED (CONFIG_NF_NAT )#include <net/netfilter/nf_conntrack.h> void icmpv6_ndo_send (struct sk_buff *skb_in,u8 type,u8 code,__u32 info) { +struct inet6_skb_parm parm = {0 };struct sk_buff *cloned_skb =NULL ;enum ip_conntrack_info ctinfo;struct in6_addr orig_ip;
@@ -56,7 +58,7 @@ void icmpv6_ndo_send(struct sk_buff *skb ct =nf_ct_get (skb_in, &ctinfo);if (!ct || !(ct->status &IPS_SRC_NAT )) { -icmpv6_send (skb_in, type, code, info); +__icmpv6_send (skb_in, type, code, info, &parm);return ; }
@@ -71,7 +73,7 @@ void icmpv6_ndo_send(struct sk_buff *skb orig_ip =ipv6_hdr (skb_in)->saddr;ipv6_hdr (skb_in)->saddr = ct->tuplehash[0 ].tuple.src.u3.in6; -icmpv6_send (skb_in, type, code, info); +__icmpv6_send (skb_in, type, code, info, &parm);ipv6_hdr (skb_in)->saddr = orig_ip; out:consume_skb (cloned_skb);
Greg Kroah-Hartman
maintainerPATCH 134/134 dm era: Update in-core bitset after committing the metadata
In reply to Greg Kroah-HartmanFrom: Nikos Tsironis <[email protected]>
commit 2099b145d77c1d53f5711f029c37cc537897cee6 upstream.
In case of a system crash, dm-era might fail to mark blocks as written in its metadata, although the corresponding writes to these blocks were passed down to the origin device and completed successfully.
Consider the following sequence of events:
1. We write to a block that has not been yet written in the current era
2. era_map() checks the in-core bitmap for the current era and sees that the block is not marked as written.
3. The write is deferred for submission after the metadata have been updated and committed.
4. The worker thread processes the deferred write (process_deferred_bios()) and marks the block as written in the in-core bitmap, **before** committing the metadata.
5. The worker thread starts committing the metadata.
6. We do more writes that map to the same block as the write of step (1)
7. era_map() checks the in-core bitmap and sees that the block is marked as written, **although the metadata have not been committed yet**.
8. These writes are passed down to the origin device immediately and the device reports them as completed.
9. The system crashes, e.g., power failure, before the commit from step
(5) finishes.
When the system recovers and we query the dm-era target for the list of written blocks it doesn't report the aforementioned block as written, although the writes of step (6) completed successfully.
The issue is that era_map() decides whether to defer or not a write based on non committed information. The root cause of the bug is that we update the in-core bitmap, **before** committing the metadata.
Fix this by updating the in-core bitmap **after** successfully committing the metadata.
--- drivers/md/dm-era-target.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/md/dm-era-target.c +19 -6
@@ -134,7 +134,7 @@ static int writeset_test_and_set(struct {int r; -if (!test_and_set_bit (block, ws->bits)) { +if (!test_bit (block, ws->bits)) { r =dm_bitset_set_bit (info, ws->md.root, block, &ws->md.root);if (r) {/* FIXME: fail mode */
@@ -1242,8 +1242,10 @@ static void process_deferred_bios(structint r;struct bio_list deferred_bios, marked_bios;struct bio *bio; +struct blk_plug plug;bool commit_needed = false;bool failed = false; +struct writeset *ws = era->md->current_writeset;bio_list_init (&deferred_bios);bio_list_init (&marked_bios);
@@ -1253,9 +1255,11 @@ static void process_deferred_bios(structbio_list_init (&era->deferred_bios);spin_unlock (&era->deferred_lock); +if (bio_list_empty (&deferred_bios)) +return ; +while ((bio =bio_list_pop (&deferred_bios))) { - r =writeset_test_and_set (&era->md->bitset_info, - era->md->current_writeset, + r =writeset_test_and_set (&era->md->bitset_info, ws,get_block (era, bio));if (r <0 ) {/*
@@ -1263,7 +1267,6 @@ static void process_deferred_bios(struct* FIXME: finish. */ failed = true; - }else if (r ==0 ) commit_needed = true;
@@ -1279,9 +1282,19 @@ static void process_deferred_bios(structif (failed)while ((bio =bio_list_pop (&marked_bios)))bio_io_error (bio); -else -while ((bio =bio_list_pop (&marked_bios))) +else { +blk_start_plug (&plug); +while ((bio =bio_list_pop (&marked_bios))) { +/* +* Only update the in-core writeset if the on-disk one +* was updated too. +*/ +if (commit_needed) +set_bit (get_block (era, bio), ws->bits);generic_make_request (bio); + } +blk_finish_plug (&plug); + } }static void process_rpc_calls (struct era *era)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.259 release. There are 134 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, 03 Mar 2021 16:09:49 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.259-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels:
Thanks!
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.259 release. There are 134 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, 03 Mar 2021 16:09:49 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.259-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.259 release. There are 134 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, 03 Mar 2021 16:09:49 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.259-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.9:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
30 tests: 30 pass, 0 failLinux version: 4.9.259-rc1-g5d97ed0c85ad
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Jon