4.14.161-stable review
Subsystems (11)
Greg Kroah-Hartman
maintainercover 4.14.161-stable review
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +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.14.161-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.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.161-rc1
Mike Christie <[email protected]>
nbd: fix shutdown and recv work deadlock v2
Yangbo Lu <[email protected]>
mmc: sdhci-of-esdhc: fix P2020 errata handling
Faiz Abbas <[email protected]>
mmc: sdhci: Update the tuning failed messages to pr_debug level
Rasmus Villemoes <[email protected]>
mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add erratum A-009204 support"
Christophe Leroy <[email protected]>
powerpc/irq: fix stack overflow verification
Yazen Ghannam <[email protected]>
x86/MCE/AMD: Allow Reserved types to be overwritten in smca_banks[]
Konstantin Khlebnikov <[email protected]>
x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure()
Will Deacon <[email protected]>
KVM: arm64: Ensure 'params' is initialised when looking up sys register
Dan Carpenter <[email protected]>
ext4: unlock on error in ext4_expand_extra_isize()
Jan Kara <[email protected]>
ext4: check for directory entries too close to block end
Jan Kara <[email protected]>
ext4: fix ext4_empty_dir() for directories with holes
Ian Abbott <[email protected]>
staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value
Hans de Goede <[email protected]>
platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
Alexander Shishkin <[email protected]>
intel_th: pci: Add Elkhart Lake SOC support
Alexander Shishkin <[email protected]>
intel_th: pci: Add Comet Lake PCH-V support
Erkka Talvitie <[email protected]>
USB: EHCI: Do not return -EPIPE when hub is disconnected
Suwan Kim <[email protected]>
usbip: Fix error path of vhci_recv_ret_submit()
Suwan Kim <[email protected]>
usbip: Fix receive error in vhci-hcd when using scatter-gather
Josef Bacik <[email protected]>
btrfs: abort transaction after failed inode updates in create_subvol
Dan Carpenter <[email protected]>
btrfs: return error pointer from alloc_test_extent_buffer
Sven Schnelle <[email protected]>
s390/ftrace: fix endless recursion in function_graph tracer
Guenter Roeck <[email protected]>
usb: xhci: Fix build warning seen with CONFIG_PM=n
Chaotian Jing <[email protected]>
mmc: mediatek: fix CMD_TA to 2 for MT8173 HS200/HS400 mode
Faiz Abbas <[email protected]>
Revert "mmc: sdhci: Fix incorrect switch to HS mode"
Omar Sandoval <[email protected]>
btrfs: don't prematurely free work in scrub_missing_raid56_worker()
Omar Sandoval <[email protected]>
btrfs: don't prematurely free work in reada_start_machine_worker()
Russell King <[email protected]>
net: phy: initialise phydev speed and duplex sanely
Mike Rapoport <[email protected]>
mips: fix build when "48 bits virtual memory" is enabled
Hewenliang <[email protected]>
libtraceevent: Fix memory leakage in copy_filter_type
Michael Ellerman <[email protected]>
crypto: vmx - Avoid weird build failures
Thomas Pedersen <[email protected]>
mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
Corentin Labbe <[email protected]>
crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c
Herbert Xu <[email protected]>
crypto: sun4i-ss - Fix 64-bit size_t warnings
Andy Shevchenko <[email protected]>
fbtft: Make sure string is NULL terminated
Johannes Berg <[email protected]>
iwlwifi: check kasprintf() return value
Adrian Hunter <[email protected]>
x86/insn: Add some Intel instructions to the opcode map
Chuhong Yuan <[email protected]>
spi: st-ssc4: add missed pm_runtime_disable
Omar Sandoval <[email protected]>
btrfs: don't prematurely free work in run_ordered_work()
Omar Sandoval <[email protected]>
btrfs: don't prematurely free work in end_workqueue_fn()
Eugeniu Rosca <[email protected]>
mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests
Ard Biesheuvel <[email protected]>
crypto: virtio - deal with unsupported input sizes
Chuhong Yuan <[email protected]>
spi: tegra20-slink: add missed clk_unprepare
Wang Xuerui <[email protected]>
iwlwifi: mvm: fix unaligned read of rx_pkt_status
Lianbo Jiang <[email protected]>
x86/crash: Add a forward declaration of struct kimage
Viresh Kumar <[email protected]>
cpufreq: Register drivers only after CPU devices have been registered
Sudip Mukherjee <[email protected]>
parport: load lowlevel driver if ports not found
Ilya Leoshkevich <[email protected]>
s390/disassembler: don't hide instruction addresses
Yu-Hsuan Hsu <[email protected]>
ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
Ben Zhang <[email protected]>
ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile
Chuhong Yuan <[email protected]>
spi: pxa2xx: Add missed security checks
Robert Richter <[email protected]>
EDAC/ghes: Fix grain calculation
Chuhong Yuan <[email protected]>
media: si470x-i2c: add missed operations in remove
Mike Isely <[email protected]>
media: pvrusb2: Fix oops on tear-down when radio support is not present
Andrew Jeffery <[email protected]>
fsi: core: Fix small accesses and unaligned offsets via sysfs
Miaoqing Pan <[email protected]>
ath10k: fix get invalid tx rate for Mesh metric
Masami Hiramatsu <[email protected]>
perf probe: Filter out instances except for inlined subroutine and subprogram
Masami Hiramatsu <[email protected]>
perf probe: Skip end-of-sequence and non statement lines
Masami Hiramatsu <[email protected]>
perf probe: Fix to show calling lines of inlined functions
Masami Hiramatsu <[email protected]>
perf probe: Return a better scope DIE if there is no best scope
Masami Hiramatsu <[email protected]>
perf probe: Skip overlapped location on searching variables
Ian Rogers <[email protected]>
perf parse: If pmu configuration fails free terms
Pan Bian <[email protected]>
drm/amdgpu: fix potential double drop fence reference
Masami Hiramatsu <[email protected]>
perf probe: Fix to probe a function which has no entry pc
James Clark <[email protected]>
libsubcmd: Use -O0 with DEBUG=1
Masami Hiramatsu <[email protected]>
perf probe: Fix to show inlined function callsite without entry_pc
Masami Hiramatsu <[email protected]>
perf probe: Fix to show ranges of variables in functions without entry_pc
Masami Hiramatsu <[email protected]>
perf probe: Fix to probe an inline function which has no entry pc
Masami Hiramatsu <[email protected]>
perf probe: Walk function lines in lexical blocks
Masami Hiramatsu <[email protected]>
perf probe: Fix to list probe event with correct line number
Masami Hiramatsu <[email protected]>
perf probe: Fix to find range-only function instance
Ping-Ke Shih <[email protected]>
rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt()
Takashi Iwai <[email protected]>
ALSA: timer: Limit max amount of slave instances
Pan Bian <[email protected]>
spi: img-spfi: fix potential double release
Manish Chopra <[email protected]>
bnx2x: Fix PF-VF communication over multi-cos queues.
Marcel Holtmann <[email protected]>
rfkill: allocate static minor
Vandana BN <[email protected]>
media: v4l2-core: fix touch support in v4l_g_fmt
Kangjie Lu <[email protected]>
media: rcar_drif: fix a memory disclosure
Manjunath Patil <[email protected]>
ixgbe: protect TX timestamping from API misuse
Ben Dooks (Codethink) <[email protected]>
pinctrl: amd: fix __iomem annotation in amd_gpio_irq_handler()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: Fix advertising duplicated flags
Alexandru Ardelean <[email protected]>
iio: dln2-adc: fix iio_triggered_buffer_postenable() position
Geert Uytterhoeven <[email protected]>
pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B
Darrick J. Wong <[email protected]>
loop: fix no-unmap write-zeroes request behavior
John Garry <[email protected]>
libata: Ensure ata_port probe has completed before detach
Gerald Schaefer <[email protected]>
s390/mm: add mm_pxd_folded() checks to pxd_free()
Heiko Carstens <[email protected]>
s390/time: ensure get_clock_monotonic() returns monotonic values
Stephan Gerhold <[email protected]>
phy: qcom-usb-hs: Fix extcon double register after power cycle
Mao Wenan <[email protected]>
net: dsa: LAN9303: select REGMAP when LAN9303 enable
Thierry Reding <[email protected]>
gpu: host1x: Allocate gather copy for host1x
Michal Kalderon <[email protected]>
RDMA/qedr: Fix memory leak in user qp and mr
Grygorii Strashko <[email protected]>
net: phy: dp83867: enable robust auto-mdix
Yunfeng Ye <[email protected]>
arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill()
Thomas Gleixner <[email protected]>
x86/ioapic: Prevent inconsistent state when moving an interrupt
Chris Chiu <[email protected]>
rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot
Kangjie Lu <[email protected]>
drm/gma500: fix memory disclosures due to uninitialized bytes
Benjamin Berg <[email protected]>
x86/mce: Lower throttling MCE messages' priority to warning
Mattijs Korpershoek <[email protected]>
Bluetooth: hci_core: fix init for HCI_USER_CHANNEL
Ben Dooks (Codethink) <[email protected]>
Bluetooth: missed cpu_to_le16 conversion in hci_init4_req
Miquel Raynal <[email protected]>
iio: adc: max1027: Reset the device at probe time
Ingo Rohloff <[email protected]>
usb: usbfs: Suppress problematic bind and unbind uevents.
Jin Yao <[email protected]>
perf report: Add warning when libunwind not compiled in
Leo Yan <[email protected]>
perf test: Report failure for mmap events
Daniel Kurtz <[email protected]>
drm/bridge: dw-hdmi: Restore audio when setting a mode
Sami Tolvanen <[email protected]>
x86/mm: Use the correct function type for native_set_fixmap()
Stephan Gerhold <[email protected]>
extcon: sm5502: Reset registers during initialization
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: fix a v4l2-compliance failure about invalid sizeimage
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: ensure buffers are cleaned up properly in abort cases
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: Make sure YUYV is set as default format
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: fix a v4l2-compliance failure about frame sequence number
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format
Benoit Parrot <[email protected]>
media: ti-vpe: vpe: Fix Motion Vector vpdma stride
Christophe JAILLET <[email protected]>
media: cx88: Fix some error handling path in 'cx8800_initdev()'
Navid Emamdoost <[email protected]>
mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
Bart Van Assche <[email protected]>
block: Fix writeback throttling W=1 compiler warnings
Daniel T. Lee <[email protected]>
samples: pktgen: fix proc_cmd command result check logic
Matthias Kaehlcke <[email protected]>
drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller
Hans Verkuil <[email protected]>
media: cec-funcs.h: add status_req checks
Yang Yingliang <[email protected]>
media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()
Yizhuo <[email protected]>
regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe()
Tony Lindgren <[email protected]>
hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled
Veeraiyan Chidambaram <[email protected]>
usb: renesas_usbhs: add suspend event support in gadget mode
Ivan Khoronzhuk <[email protected]>
selftests/bpf: Correct path to include msg + path
Will Deacon <[email protected]>
pinctrl: devicetree: Avoid taking direct reference to device name string
Ben Greear <[email protected]>
ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq
Loic Poulain <[email protected]>
media: venus: core: Fix msm8996 frequency table
Nathan Chancellor <[email protected]>
tools/power/cpupower: Fix initializer override in hsw_ext_cstates
Janusz Krzysztofik <[email protected]>
media: ov6650: Fix stored crop rectangle not in sync with hardware
Janusz Krzysztofik <[email protected]>
media: ov6650: Fix stored frame format not in sync with hardware
Benoit Parrot <[email protected]>
media: i2c: ov2659: Fix missing 720p register config
Janusz Krzysztofik <[email protected]>
media: ov6650: Fix crop rectangle alignment not passed back
Benoit Parrot <[email protected]>
media: i2c: ov2659: fix s_stream return value
Benoit Parrot <[email protected]>
media: am437x-vpfe: Setting STD to current value is not an error
Max Gurtovoy <[email protected]>
IB/iser: bound protection_sg size by data_sg size
Allen Pais <[email protected]>
libertas: fix a potential NULL pointer dereference
Navid Emamdoost <[email protected]>
rtlwifi: prevent memory leak in rtl_usb_probe
Connor Kuehl <[email protected]>
staging: rtl8188eu: fix possible null dereference
Navid Emamdoost <[email protected]>
staging: rtl8192u: fix multiple memory leaks on error path
Lukasz Majewski <[email protected]>
spi: Add call to spi_slave_abort() function when spidev driver is released
Krzysztof Wilczynski <[email protected]>
iio: light: bh1750: Resolve compiler warning and make code more readable
Brian Masney <[email protected]>
drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings
Sean Paul <[email protected]>
drm: mst: Fix query_payload ack reply struct
Takashi Iwai <[email protected]>
ALSA: hda/ca0132 - Avoid endless loop
Takashi Iwai <[email protected]>
ALSA: hda/ca0132 - Keep power on during processing DSP response
Takashi Iwai <[email protected]>
ALSA: pcm: Avoid possible info leaks from PCM stream buffers
Filipe Manana <[email protected]>
Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues
Josef Bacik <[email protected]>
btrfs: handle ENOENT in btrfs_uuid_tree_iterate
Josef Bacik <[email protected]>
btrfs: do not leak reloc root if we fail to read the fs root
Josef Bacik <[email protected]>
btrfs: skip log replay on orphaned roots
Josef Bacik <[email protected]>
btrfs: do not call synchronize_srcu() in inode_tree_del
Josef Bacik <[email protected]>
btrfs: don't double lock the subvol_sem for rename exchange
Xin Long <[email protected]>
sctp: fully initialize v4 addr in some functions
Manish Chopra <[email protected]>
qede: Fix multicast mac configuration
Cristian Birsan <[email protected]>
net: usb: lan78xx: Fix suspend/resume PHY register access error
Ben Hutchings <[email protected]>
net: qlogic: Fix error paths in ql_alloc_large_buffers()
Jia-Ju Bai <[email protected]>
net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive()
Jiangfeng Xiao <[email protected]>
net: hisilicon: Fix a BUG trigered by wrong bytes_compl
Geert Uytterhoeven <[email protected]>
net: dst: Force 4-byte alignment of dst_metrics
Russell King <[email protected]>
mod_devicetable: fix PHY module format
Chuhong Yuan <[email protected]>
fjes: fix missed check in fjes_acpi_add
Mao Wenan <[email protected]>
af_packet: set defaule value for tmo
-------------
Diffstat:
Makefile | 4 +- arch/arm64/kernel/psci.c | 15 +++--- arch/arm64/kvm/sys_regs.c | 5 +- arch/mips/include/asm/pgtable-64.h | 9 +++- arch/powerpc/kernel/irq.c | 4 +- arch/s390/include/asm/pgalloc.h | 16 ++++++- arch/s390/include/asm/timex.h | 16 ++++--- arch/s390/kernel/dis.c | 13 ++--- arch/sh/include/cpu-sh4/cpu/sh7734.h | 2 +- arch/x86/include/asm/crash.h | 2 + arch/x86/include/asm/fixmap.h | 2 +- arch/x86/kernel/apic/io_apic.c | 9 ++-- arch/x86/kernel/cpu/mcheck/mce_amd.c | 4 +- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- arch/x86/lib/x86-opcode-map.txt | 18 ++++--- arch/x86/mm/pgtable.c | 4 +- drivers/ata/libata-core.c | 3 ++ drivers/block/loop.c | 26 ++++++---- drivers/block/nbd.c | 6 +-- drivers/char/hw_random/omap3-rom-rng.c | 3 +- drivers/cpufreq/cpufreq.c | 7 +++ drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 22 +++++---- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 12 ++--- drivers/crypto/virtio/virtio_crypto_algs.c | 12 ++++- drivers/crypto/vmx/Makefile | 6 +-- drivers/edac/ghes_edac.c | 10 +++- drivers/extcon/extcon-sm5502.c | 4 ++ drivers/extcon/extcon-sm5502.h | 2 + drivers/fsi/fsi-core.c | 31 ++++++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 + drivers/gpu/drm/bridge/analogix-anx78xx.c | 8 +++- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 + drivers/gpu/host1x/job.c | 11 +++-- drivers/hwtracing/intel_th/pci.c | 10 ++++ drivers/iio/adc/dln2-adc.c | 20 +++++--- drivers/iio/adc/max1027.c | 8 ++++ drivers/iio/light/bh1750.c | 4 +- drivers/infiniband/hw/qedr/verbs.c | 12 ++++- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + drivers/media/i2c/ov2659.c | 18 +++++-- drivers/media/i2c/ov6650.c | 42 ++++++++-------- drivers/media/pci/cx88/cx88-video.c | 11 +++-- drivers/media/platform/am437x/am437x-vpfe.c | 4 ++ drivers/media/platform/qcom/venus/core.c | 9 ++-- drivers/media/platform/rcar_drif.c | 1 + drivers/media/platform/ti-vpe/vpdma.h | 1 + drivers/media/platform/ti-vpe/vpe.c | 52 ++++++++++++++------ drivers/media/radio/si470x/radio-si470x-i2c.c | 2 + drivers/media/usb/b2c2/flexcop-usb.c | 8 +++- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 9 +++- drivers/media/v4l2-core/v4l2-ioctl.c | 33 +++++++------ drivers/mmc/host/mtk-sd.c | 3 ++ drivers/mmc/host/sdhci-of-esdhc.c | 7 +-- drivers/mmc/host/sdhci.c | 8 ++-- drivers/mmc/host/tmio_mmc_core.c | 2 +- drivers/net/dsa/Kconfig | 1 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 16 +++++-- drivers/net/ethernet/hisilicon/hip04_eth.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +- drivers/net/ethernet/qlogic/qede/qede_filter.c | 2 +- drivers/net/ethernet/qlogic/qla3xxx.c | 8 ++-- drivers/net/fjes/fjes_main.c | 3 ++ drivers/net/phy/dp83867.c | 15 ++++-- drivers/net/phy/phy_device.c | 4 +- drivers/net/usb/lan78xx.c | 1 + drivers/net/wireless/ath/ath10k/mac.c | 22 ++++----- drivers/net/wireless/ath/ath10k/txrx.c | 2 + drivers/net/wireless/intel/iwlwifi/dvm/led.c | 3 ++ drivers/net/wireless/intel/iwlwifi/mvm/led.c | 3 ++ drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 3 +- drivers/net/wireless/marvell/libertas/if_sdio.c | 5 ++ drivers/net/wireless/marvell/mwifiex/pcie.c | 5 +- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++ .../net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 2 + drivers/net/wireless/realtek/rtlwifi/usb.c | 5 +- drivers/parport/share.c | 21 ++++++++ drivers/phy/qualcomm/phy-qcom-usb-hs.c | 7 ++- drivers/pinctrl/devicetree.c | 25 ++++++++-- drivers/pinctrl/pinctrl-amd.c | 3 +- drivers/pinctrl/sh-pfc/pfc-sh7734.c | 4 +- drivers/platform/x86/hp-wmi.c | 2 +- drivers/regulator/max8907-regulator.c | 15 ++++-- drivers/spi/spi-img-spfi.c | 2 + drivers/spi/spi-pxa2xx.c | 6 +++ drivers/spi/spi-st-ssc4.c | 3 ++ drivers/spi/spi-tegra20-slink.c | 5 +- drivers/spi/spidev.c | 3 ++ drivers/staging/comedi/drivers/gsc_hpdi.c | 10 ++++ drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 +- drivers/staging/rtl8192u/r8192U_core.c | 17 +++++-- drivers/usb/core/devio.c | 15 +++++- drivers/usb/host/ehci-q.c | 13 ++++- drivers/usb/host/xhci-pci.c | 2 +- drivers/usb/renesas_usbhs/common.h | 3 +- drivers/usb/renesas_usbhs/mod_gadget.c | 12 +++-- drivers/usb/usbip/usbip_common.c | 3 ++ drivers/usb/usbip/vhci_rx.c | 13 +++-- fs/btrfs/async-thread.c | 56 +++++++++++++++++----- fs/btrfs/ctree.c | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/extent_io.c | 6 ++- fs/btrfs/inode.c | 12 ++--- fs/btrfs/ioctl.c | 10 +++- fs/btrfs/reada.c | 10 ++-- fs/btrfs/relocation.c | 1 + fs/btrfs/scrub.c | 3 +- fs/btrfs/tests/free-space-tree-tests.c | 6 +-- fs/btrfs/tests/qgroup-tests.c | 4 +- fs/btrfs/tree-log.c | 23 ++++++++- fs/btrfs/uuid-tree.c | 2 + fs/ext4/dir.c | 5 ++ fs/ext4/inode.c | 4 +- fs/ext4/namei.c | 32 +++++++------ include/drm/drm_dp_mst_helper.h | 2 +- include/linux/miscdevice.h | 1 + include/linux/mod_devicetable.h | 4 +- include/net/dst.h | 2 +- include/trace/events/wbt.h | 12 +++-- include/uapi/linux/cec-funcs.h | 6 ++- net/bluetooth/hci_core.c | 13 +++-- net/bluetooth/hci_request.c | 9 ++++ net/mac80211/status.c | 3 +- net/nfc/nci/uart.c | 2 +- net/packet/af_packet.c | 3 +- net/rfkill/core.c | 9 +++- net/sctp/protocol.c | 5 ++ samples/bpf/cgroup_helpers.c | 2 +- samples/pktgen/functions.sh | 17 ++++--- sound/core/pcm_native.c | 4 ++ sound/core/timer.c | 10 ++++ sound/pci/hda/patch_ca0132.c | 7 ++- sound/soc/codecs/rt5677.c | 1 + .../soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 3 ++ tools/lib/subcmd/Makefile | 4 +- tools/lib/traceevent/parse-filter.c | 9 +++- tools/objtool/arch/x86/lib/x86-opcode-map.txt | 18 ++++--- tools/perf/builtin-report.c | 7 +++ tools/perf/tests/task-exit.c | 1 + tools/perf/util/dwarf-aux.c | 56 +++++++++++++++++----- tools/perf/util/parse-events.c | 9 +++- tools/perf/util/probe-finder.c | 45 +++++++++++++++-- .../cpupower/utils/idle_monitor/hsw_ext_idle.c | 1 - 146 files changed, 959 insertions(+), 353 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/161 af_packet: set defaule value for tmo
From: Mao Wenan <[email protected]>
[ Upstream commit b43d1f9f7067c6759b1051e8ecb84e82cef569fe ]
There is softlockup when using TPACKET_V3:
...
NMI watchdog: BUG: soft lockup - CPU#2 stuck for 60010ms! (__irq_svc) from [<c0558a0c>] (_raw_spin_unlock_irqrestore+0x44/0x54) (_raw_spin_unlock_irqrestore) from [<c027b7e8>] (mod_timer+0x210/0x25c) (mod_timer) from [<c0549c30>] (prb_retire_rx_blk_timer_expired+0x68/0x11c) (prb_retire_rx_blk_timer_expired) from [<c027a7ac>] (call_timer_fn+0x90/0x17c)
(call_timer_fn) from [<c027ab6c>] (run_timer_softirq+0x2d4/0x2fc) (run_timer_softirq) from [<c021eaf4>] (__do_softirq+0x218/0x318) (__do_softirq) from [<c021eea0>] (irq_exit+0x88/0xac) (irq_exit) from [<c0240130>] (msa_irq_exit+0x11c/0x1d4) (msa_irq_exit) from [<c0209cf0>] (handle_IPI+0x650/0x7f4) (handle_IPI) from [<c02015bc>] (gic_handle_irq+0x108/0x118) (gic_handle_irq) from [<c0558ee4>] (__irq_usr+0x44/0x5c)
...
If __ethtool_get_link_ksettings() is failed in prb_calc_retire_blk_tmo(), msec and tmo will be zero, so tov_in_jiffies is zero and the timer expire for retire_blk_timer is turn to mod_timer(&pkc->retire_blk_timer, jiffies + 0),
which will trigger cpu usage of softirq is 100%.
--- net/packet/af_packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/packet/af_packet.c +2 -1
@@ -593,7 +593,8 @@ static int prb_calc_retire_blk_tmo(struc msec =1 ; div = ecmd.base.speed /1000 ; } - } + }else +return DEFAULT_PRB_RETIRE_TOV ; mbits = (blk_size_in_bytes *8 ) / (1024 *1024 );
Greg Kroah-Hartman
maintainerPATCH 2/161 fjes: fix missed check in fjes_acpi_add
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit a288f105a03a7e0e629a8da2b31f34ebf0343ee2 ]
fjes_acpi_add() misses a check for platform_device_register_simple(). Add a check to fix it.
--- drivers/net/fjes/fjes_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/fjes/fjes_main.c +3 -0
@@ -181,6 +181,9 @@ static int fjes_acpi_add(struct acpi_dev/* create platform_device */ plat_dev =platform_device_register_simple (DRV_NAME ,0 , fjes_resource,ARRAY_SIZE (fjes_resource)); +if (IS_ERR (plat_dev)) +return PTR_ERR (plat_dev); + device->driver_data = plat_dev;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 3/161 mod_devicetable: fix PHY module format
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit d2ed49cf6c13e379c5819aa5ac20e1f9674ebc89 ]
When a PHY is probed, if the top bit is set, we end up requesting a module with the string "mdio:-10101110000000100101000101010001" - the top bit is printed to a signed -1 value. This leads to the module not being loaded.
Fix the module format string and the macro generating the values for it to ensure that we only print unsigned types and the top bit is always 0/1. We correctly end up with "mdio:10101110000000100101000101010001".
--- include/linux/mod_devicetable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/mod_devicetable.h +2 -2
@@ -519,9 +519,9 @@ struct platform_device_id {#define MDIO_NAME_SIZE 32#define MDIO_MODULE_PREFIX "mdio:" -#define MDIO_ID_FMT "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" +#define MDIO_ID_FMT "%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u%u"#define MDIO_ID_ARGS (_id) \ - (_id)>>31, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ + ((_id)>>31) & 1, ((_id)>>30) & 1, ((_id)>>29) & 1, ((_id)>>28) & 1, \ ((_id)>>27) & 1, ((_id)>>26) & 1, ((_id)>>25) & 1, ((_id)>>24) & 1, \ ((_id)>>23) & 1, ((_id)>>22) & 1, ((_id)>>21) & 1, ((_id)>>20) & 1, \ ((_id)>>19) & 1, ((_id)>>18) & 1, ((_id)>>17) & 1, ((_id)>>16) & 1, \
Greg Kroah-Hartman
maintainerPATCH 4/161 net: dst: Force 4-byte alignment of dst_metrics
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 258a980d1ec23e2c786e9536a7dd260bea74bae6 ]
When storing a pointer to a dst_metrics structure in dst_entry._metrics, two flags are added in the least significant bits of the pointer value. Hence this assumes all pointers to dst_metrics structures have at least 4-byte alignment.
However, on m68k, the minimum alignment of 32-bit values is 2 bytes, not 4 bytes. Hence in some kernel builds, dst_default_metrics may be only 2-byte aligned, leading to obscure boot warnings like:
WARNING: CPU: 0 PID: 7 at lib/refcount.c:28 refcount_warn_saturate+0x44/0x9a
refcount_t: underflow; use-after-free.
Modules linked in:
CPU: 0 PID: 7 Comm: ksoftirqd/0 Tainted: G W 5.5.0-rc2-atari-01448-g114a1a1038af891d-dirty #261
Stack from 10835e6c:
10835e6c 0038134f 00023fa6 00394b0f 0000001c 00000009 00321560 00023fea
00394b0f 0000001c 001a70f8 00000009 00000000 10835eb4 00000001 00000000
04208040 0000000a 00394b4a 10835ed4 00043aa8 001a70f8 00394b0f 0000001c
00000009 00394b4a 0026aba8 003215a4 00000003 00000000 0026d5a8 00000001
003215a4 003a4361 003238d6 000001f0 00000000 003215a4 10aa3b00 00025e84
003ddb00 10834000 002416a8 10aa3b00 00000000 00000080 000aa038 0004854a
Call Trace: [<00023fa6>] __warn+0xb2/0xb4
[<00023fea>] warn_slowpath_fmt+0x42/0x64
[<001a70f8>] refcount_warn_saturate+0x44/0x9a
[<00043aa8>] printk+0x0/0x18
[<001a70f8>] refcount_warn_saturate+0x44/0x9a
[<0026aba8>] refcount_sub_and_test.constprop.73+0x38/0x3e
[<0026d5a8>] ipv4_dst_destroy+0x5e/0x7e
[<00025e84>] __local_bh_enable_ip+0x0/0x8e
[<002416a8>] dst_destroy+0x40/0xaeFix this by forcing 4-byte alignment of all dst_metrics structures.
--- include/net/dst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/dst.h +1 -1
@@ -110,7 +110,7 @@ struct dst_entry {struct dst_metrics {u32 metrics[RTAX_MAX ];refcount_t refcnt; -}; +}__aligned(4) ;/* Low pointer bits contain DST_METRICS_FLAGS */ extern const struct dst_metrics dst_default_metrics;u32 *dst_cow_metrics_generic (struct dst_entry *dst,unsigned long old);
Greg Kroah-Hartman
maintainerPATCH 5/161 net: hisilicon: Fix a BUG trigered by wrong bytes_compl
In reply to Greg Kroah-HartmanFrom: Jiangfeng Xiao <[email protected]>
[ Upstream commit 90b3b339364c76baa2436445401ea9ade040c216 ]
When doing stress test, we get the following trace:
kernel BUG at lib/dynamic_queue_limits.c:26!
Internal error: Oops - BUG: 0 [#1] SMP ARM Modules linked in: hip04_eth CPU: 0 PID: 2003 Comm: tDblStackPcap0 Tainted: G O L 4.4.197 #1 Hardware name: Hisilicon A15 task: c3637668 task.stack: de3bc000 PC is at dql_completed+0x18/0x154 LR is at hip04_tx_reclaim+0x110/0x174 [hip04_eth] pc : [<c041abfc>] lr : [<bf0003a8>] psr: 800f0313
sp : de3bdc2c ip : 00000000 fp : c020fb10
r10: 00000000 r9 : c39b4224 r8 : 00000001
r7 : 00000046 r6 : c39b4000 r5 : 0078f392 r4 : 0078f392 r3 : 00000047 r2 : 00000000 r1 : 00000046 r0 : df5d5c80
Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 32c5387d Table: 1e189b80 DAC: 55555555 Process tDblStackPcap0 (pid: 2003, stack limit = 0xde3bc190)
Stack: (0xde3bdc2c to 0xde3be000) [<c041abfc>] (dql_completed) from [<bf0003a8>] (hip04_tx_reclaim+0x110/0x174 [hip04_eth]) [<bf0003a8>] (hip04_tx_reclaim [hip04_eth]) from [<bf0012c0>] (hip04_rx_poll+0x20/0x388 [hip04_eth]) [<bf0012c0>] (hip04_rx_poll [hip04_eth]) from [<c04c8d9c>] (net_rx_action+0x120/0x374) [<c04c8d9c>] (net_rx_action) from [<c021eaf4>] (__do_softirq+0x218/0x318) [<c021eaf4>] (__do_softirq) from [<c021eea0>] (irq_exit+0x88/0xac) [<c021eea0>] (irq_exit) from [<c0240130>] (msa_irq_exit+0x11c/0x1d4) [<c0240130>] (msa_irq_exit) from [<c0267ba8>] (__handle_domain_irq+0x110/0x148) [<c0267ba8>] (__handle_domain_irq) from [<c0201588>] (gic_handle_irq+0xd4/0x118) [<c0201588>] (gic_handle_irq) from [<c0558360>] (__irq_svc+0x40/0x58) Exception stack(0xde3bdde0 to 0xde3bde28)
dde0: 00000000 00008001 c3637668 00000000 00000000 a00f0213 dd3627a0 c0af6380
de00: c086d380 a00f0213 c0a22a50 de3bde6c 00000002 de3bde30 c0558138 c055813c
de20: 600f0213 ffffffff
[<c0558360>] (__irq_svc) from [<c055813c>] (_raw_spin_unlock_irqrestore+0x44/0x54)
Kernel panic - not syncing: Fatal exception in interrupt
Pre-modification code:
int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) {
[...]
[1] priv->tx_head = TX_NEXT(tx_head);
[2] count++;
[3] netdev_sent_queue(ndev, skb->len);
[...]
}
An rx interrupt occurs if hip04_mac_start_xmit just executes to the line 2, tx_head has been updated, but corresponding 'skb->len' has not been added to dql_queue.
And then hip04_mac_interrupt->__napi_schedule->hip04_rx_poll->hip04_tx_reclaim
In hip04_tx_reclaim, because tx_head has been updated, bytes_compl will plus an additional "skb-> len"
which has not been added to dql_queue. And then
trigger the BUG_ON(bytes_compl > num_queued - dql->num_completed).
To solve the problem described above, we put
"netdev_sent_queue(ndev, skb->len);"
before
"priv->tx_head = TX_NEXT(tx_head);"
--- drivers/net/ethernet/hisilicon/hip04_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/hisilicon/hip04_eth.c +1 -1
@@ -456,9 +456,9 @@ hip04_mac_start_xmit(struct sk_buff *skbskb_tx_timestamp (skb);hip04_set_xmit_desc (priv, phys); - priv->tx_head =TX_NEXT (tx_head); count++;netdev_sent_queue (ndev, skb->len); + priv->tx_head =TX_NEXT (tx_head); stats->tx_bytes += skb->len; stats->tx_packets++;
Greg Kroah-Hartman
maintainerPATCH 6/161 net: nfc: nci: fix a possible sleep-in-atomic-context bug in nci_uart_tty_receive()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit b7ac893652cafadcf669f78452329727e4e255cc ]
The kernel may sleep while holding a spinlock.
The function call path (from bottom to top) in Linux 4.19 is:
net/nfc/nci/uart.c, 349:
nci_skb_alloc in nci_uart_default_recv_bufnet/nfc/nci/uart.c, 255:
(FUNC_PTR)nci_uart_default_recv_buf in nci_uart_tty_receivenet/nfc/nci/uart.c, 254:
spin_lock in nci_uart_tty_receive
nci_skb_alloc(GFP_KERNEL) can sleep at runtime. (FUNC_PTR) means a function pointer is called.
To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC for nci_skb_alloc().
This bug is found by a static analysis tool STCheck written by myself.
--- net/nfc/nci/uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/nfc/nci/uart.c +1 -1
@@ -348,7 +348,7 @@ static int nci_uart_default_recv_buf(str nu->rx_packet_len =-1 ; nu->rx_skb =nci_skb_alloc (nu->ndev,NCI_MAX_PACKET_SIZE , -GFP_KERNEL ); +GFP_ATOMIC );if (!nu->rx_skb)return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 7/161 net: qlogic: Fix error paths in ql_alloc_large_buffers()
In reply to Greg Kroah-HartmanFrom: Ben Hutchings <[email protected]>
[ Upstream commit cad46039e4c99812db067c8ac22a864960e7acc4 ]
ql_alloc_large_buffers() has the usual RX buffer allocation loop where it allocates skbs and maps them for DMA. It also treats failure as a fatal error.
There are (at least) three bugs in the error paths:
1. ql_free_large_buffers() assumes that the lrg_buf[] entry for the first buffer that couldn't be allocated will have .skb == NULL. But the qla_buf[] array is not zero-initialised.
2. ql_free_large_buffers() DMA-unmaps all skbs in lrg_buf[]. This is incorrect for the last allocated skb, if DMA mapping failed.
3. Commit 1acb8f2a7a9f ("net: qlogic: Fix memory leak in ql_alloc_large_buffers") added a direct call to dev_kfree_skb_any() after the skb is recorded in lrg_buf[], so ql_free_large_buffers() will double-free it.
The bugs are somewhat inter-twined, so fix them all at once:
* Clear each entry in qla_buf[] before attempting to allocate an skb for it. This goes half-way to fixing bug 1.
* Set the .skb field only after the skb is DMA-mapped. This fixes the rest.
--- drivers/net/ethernet/qlogic/qla3xxx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/qlogic/qla3xxx.c +4 -4
@@ -2756,6 +2756,9 @@ static int ql_alloc_large_buffers(structint err;for (i =0 ; i < qdev->num_large_buffers; i++) { + lrg_buf_cb = &qdev->lrg_buf[i]; +memset (lrg_buf_cb,0 ,sizeof (struct ql_rcv_buf_cb )); + skb =netdev_alloc_skb (qdev->ndev, qdev->lrg_buffer_len);if (unlikely (!skb)) {
@@ -2766,11 +2769,7 @@ static int ql_alloc_large_buffers(structql_free_large_buffers (qdev);return -ENOMEM ; }else { - - lrg_buf_cb = &qdev->lrg_buf[i]; -memset (lrg_buf_cb,0 ,sizeof (struct ql_rcv_buf_cb )); lrg_buf_cb->index = i; - lrg_buf_cb->skb = skb;/* * We save some space to copy the ethhdr from first * buffer
@@ -2792,6 +2791,7 @@ static int ql_alloc_large_buffers(structreturn -ENOMEM ; } + lrg_buf_cb->skb = skb;dma_unmap_addr_set (lrg_buf_cb, mapaddr, map); dma_unmap_len_set(lrg_buf_cb, maplen, qdev->lrg_buffer_len -
Greg Kroah-Hartman
maintainerPATCH 8/161 net: usb: lan78xx: Fix suspend/resume PHY register access error
In reply to Greg Kroah-HartmanFrom: Cristian Birsan <[email protected]>
[ Upstream commit 20032b63586ac6c28c936dff696981159913a13f ]
Lan78xx driver accesses the PHY registers through MDIO bus over USB connection. When performing a suspend/resume, the PHY registers can be accessed before the USB connection is resumed. This will generate an error and will prevent the device to resume correctly.
This patch adds the dependency between the MDIO bus and USB device to allow correct handling of suspend/resume.
--- drivers/net/usb/lan78xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/lan78xx.c +1 -0
@@ -1765,6 +1765,7 @@ static int lan78xx_mdio_init(struct lan7 dev->mdiobus->read = lan78xx_mdiobus_read; dev->mdiobus->write = lan78xx_mdiobus_write; dev->mdiobus->name ="lan78xx-mdiobus" ; + dev->mdiobus->parent = &dev->udev->dev;snprintf (dev->mdiobus->id,MII_BUS_ID_SIZE ,"usb-%03d:%03d" , dev->udev->bus->busnum, dev->udev->devnum);
Greg Kroah-Hartman
maintainerPATCH 9/161 qede: Fix multicast mac configuration
In reply to Greg Kroah-HartmanFrom: Manish Chopra <[email protected]>
[ Upstream commit 0af67e49b018e7280a4227bfe7b6005bc9d3e442 ]
Driver doesn't accommodate the configuration for max number of multicast mac addresses, in such particular case it leaves the device with improper/invalid multicast configuration state, causing connectivity issues (in lacp bonding like scenarios).
--- drivers/net/ethernet/qlogic/qede/qede_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qede/qede_filter.c +1 -1
@@ -1181,7 +1181,7 @@ qede_configure_mcast_filtering(struct nenetif_addr_lock_bh (ndev); mc_count =netdev_mc_count (ndev); -if (mc_count <64 ) { +if (mc_count <=64 ) {netdev_for_each_mc_addr (ha, ndev) {ether_addr_copy (temp, ha->addr); temp +=ETH_ALEN ;
Greg Kroah-Hartman
maintainerPATCH 10/161 sctp: fully initialize v4 addr in some functions
In reply to Greg Kroah-HartmanFrom: Xin Long <[email protected]>
[ Upstream commit b6f3320b1d5267e7b583a6d0c88dda518101740c ]
Syzbot found a crash:
BUG: KMSAN: uninit-value in crc32_body lib/crc32.c:112 [inline]
BUG: KMSAN: uninit-value in crc32_le_generic lib/crc32.c:179 [inline]
BUG: KMSAN: uninit-value in __crc32c_le_base+0x4fa/0xd30 lib/crc32.c:202
Call Trace:
crc32_body lib/crc32.c:112 [inline]
crc32_le_generic lib/crc32.c:179 [inline]
__crc32c_le_base+0x4fa/0xd30 lib/crc32.c:202
chksum_update+0xb2/0x110 crypto/crc32c_generic.c:90
crypto_shash_update+0x4c5/0x530 crypto/shash.c:107
crc32c+0x150/0x220 lib/libcrc32c.c:47
sctp_csum_update+0x89/0xa0 include/net/sctp/checksum.h:36
__skb_checksum+0x1297/0x12a0 net/core/skbuff.c:2640
sctp_compute_cksum include/net/sctp/checksum.h:59 [inline]
sctp_packet_pack net/sctp/output.c:528 [inline]
sctp_packet_transmit+0x40fb/0x4250 net/sctp/output.c:597
sctp_outq_flush_transports net/sctp/outqueue.c:1146 [inline]
sctp_outq_flush+0x1823/0x5d80 net/sctp/outqueue.c:1194
sctp_outq_uncork+0xd0/0xf0 net/sctp/outqueue.c:757
sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1781 [inline]
sctp_side_effects net/sctp/sm_sideeffect.c:1184 [inline]
sctp_do_sm+0x8fe1/0x9720 net/sctp/sm_sideeffect.c:1155
sctp_primitive_REQUESTHEARTBEAT+0x175/0x1a0 net/sctp/primitive.c:185
sctp_apply_peer_addr_params+0x212/0x1d40 net/sctp/socket.c:2433
sctp_setsockopt_peer_addr_params net/sctp/socket.c:2686 [inline]
sctp_setsockopt+0x189bb/0x19090 net/sctp/socket.c:4672The issue was caused by transport->ipaddr set with uninit addr param, which was passed by:
sctp_transport_init net/sctp/transport.c:47 [inline] sctp_transport_new+0x248/0xa00 net/sctp/transport.c:100 sctp_assoc_add_peer+0x5ba/0x2030 net/sctp/associola.c:611 sctp_process_param net/sctp/sm_make_chunk.c:2524 [inline]
where 'addr' is set by sctp_v4_from_addr_param(), and it doesn't initialize the padding of addr->v4.
Later when calling sctp_make_heartbeat(), hbinfo.daddr(=transport->ipaddr) will become the part of skb, and the issue occurs.
This patch is to fix it by initializing the padding of addr->v4 in sctp_v4_from_addr_param(), as well as other functions that do the similar thing, and these functions shouldn't trust that the caller initializes the memory, as Marcelo suggested.
--- net/sctp/protocol.c | 5 +++++ 1 file changed, 5 insertions(+)
net/sctp/protocol.c +5 -0
@@ -253,6 +253,7 @@ static void sctp_v4_from_skb(union sctp_ sa->sin_port = sh->dest; sa->sin_addr.s_addr =ip_hdr (skb)->daddr; } +memset (sa->sin_zero,0 ,sizeof (sa->sin_zero)); }/* Initialize an sctp_addr from a socket. */
@@ -261,6 +262,7 @@ static void sctp_v4_from_sk(union sctp_a addr->v4.sin_family =AF_INET ; addr->v4.sin_port =0 ; addr->v4.sin_addr.s_addr =inet_sk (sk)->inet_rcv_saddr; +memset (addr->v4.sin_zero,0 ,sizeof (addr->v4.sin_zero)); }/* Initialize sk->sk_rcv_saddr from sctp_addr. */
@@ -283,6 +285,7 @@ static void sctp_v4_from_addr_param(unio addr->v4.sin_family =AF_INET ; addr->v4.sin_port = port; addr->v4.sin_addr.s_addr = param->v4.addr.s_addr; +memset (addr->v4.sin_zero,0 ,sizeof (addr->v4.sin_zero)); }/* Initialize an address parameter from a sctp_addr and return the length
@@ -307,6 +310,7 @@ static void sctp_v4_dst_saddr(union sctp saddr->v4.sin_family =AF_INET ; saddr->v4.sin_port = port; saddr->v4.sin_addr.s_addr = fl4->saddr; +memset (saddr->v4.sin_zero,0 ,sizeof (saddr->v4.sin_zero)); }/* Compare two addresses exactly. */
@@ -329,6 +333,7 @@ static void sctp_v4_inaddr_any(union sct addr->v4.sin_family =AF_INET ; addr->v4.sin_addr.s_addr =htonl (INADDR_ANY ); addr->v4.sin_port = port; +memset (addr->v4.sin_zero,0 ,sizeof (addr->v4.sin_zero)); }/* Is this a wildcard address? */
Greg Kroah-Hartman
maintainerPATCH 11/161 btrfs: dont double lock the subvol_sem for rename exchange
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 943eb3bf25f4a7b745dd799e031be276aa104d82 upstream.
If we're rename exchanging two subvols we'll try to lock this lock twice, which is bad. Just lock once if either of the ino's are subvols.
--- fs/btrfs/inode.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +4 -6
@@ -9820,9 +9820,8 @@ static int btrfs_rename_exchange(structreturn -EXDEV ;/* close the race window with snapshot create/destroy ioctl */ -if (old_ino ==BTRFS_FIRST_FREE_OBJECTID ) -down_read (&fs_info->subvol_sem); -if (new_ino ==BTRFS_FIRST_FREE_OBJECTID ) +if (old_ino ==BTRFS_FIRST_FREE_OBJECTID || + new_ino ==BTRFS_FIRST_FREE_OBJECTID )down_read (&fs_info->subvol_sem);/*
@@ -10014,9 +10013,8 @@ out_fail: ret2 =btrfs_end_transaction (trans); ret = ret ? ret : ret2; out_notrans: -if (new_ino ==BTRFS_FIRST_FREE_OBJECTID ) -up_read (&fs_info->subvol_sem); -if (old_ino ==BTRFS_FIRST_FREE_OBJECTID ) +if (new_ino ==BTRFS_FIRST_FREE_OBJECTID || + old_ino ==BTRFS_FIRST_FREE_OBJECTID )up_read (&fs_info->subvol_sem);return ret;
Greg Kroah-Hartman
maintainerPATCH 12/161 btrfs: do not call synchronize_srcu() in inode_tree_del
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit f72ff01df9cf5db25c76674cac16605992d15467 upstream.
Testing with the new fsstress uncovered a pretty nasty deadlock with lookup and snapshot deletion.
Process A
unlink
-> final iput
-> inode_tree_del
-> synchronize_srcu(subvol_srcu)
Process Bbtrfs_lookup <- srcu_read_lock() acquired here
-> btrfs_iget
-> find inode that has I_FREEING set
-> __wait_on_freeing_inode()We're holding the srcu_read_lock() while doing the iget in order to make sure our fs root doesn't go away, and then we are waiting for the inode to finish freeing. However because the free'ing process is doing a synchronize_srcu() we deadlock.
Fix this by dropping the synchronize_srcu() in inode_tree_del(). We don't need people to stop accessing the fs root at this point, we're only adding our empty root to the dead roots list.
A larger much more invasive fix is forthcoming to address how we deal with fs roots, but this fixes the immediate problem.
--- fs/btrfs/inode.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/inode.c +0 -2
@@ -5729,7 +5729,6 @@ static void inode_tree_add(struct inodestatic void inode_tree_del (struct inode *inode) { -struct btrfs_fs_info *fs_info =btrfs_sb (inode->i_sb);struct btrfs_root *root =BTRFS_I (inode)->root;int empty =0 ;
@@ -5742,7 +5741,6 @@ static void inode_tree_del(struct inodespin_unlock (&root->inode_lock);if (empty &&btrfs_root_refs (&root->root_item) ==0 ) { -synchronize_srcu (&fs_info->subvol_srcu);spin_lock (&root->inode_lock); empty =RB_EMPTY_ROOT (&root->inode_tree);spin_unlock (&root->inode_lock);
Greg Kroah-Hartman
maintainerPATCH 13/161 btrfs: skip log replay on orphaned roots
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 9bc574de590510eff899c3ca8dbaf013566b5efe upstream.
My fsstress modifications coupled with generic/475 uncovered a failure to mount and replay the log if we hit a orphaned root. We do not want to replay the log for an orphan root, but it's completely legitimate to have an orphaned root with a log attached. Fix this by simply skipping replaying the log. We still need to pin it's root node so that we do not overwrite it while replaying other logs, as we re-read the log root at every stage of the replay.
--- fs/btrfs/tree-log.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
fs/btrfs/tree-log.c +21 -2
@@ -6018,9 +6018,28 @@ again: wc.replay_dest =btrfs_read_fs_root_no_name (fs_info, &tmp_key);if (IS_ERR (wc.replay_dest)) { ret =PTR_ERR (wc.replay_dest); + +/* +* We didn't find the subvol, likely because it was +* deleted. This is ok, simply skip this log and go to +* the next one. +* +* We need to exclude the root because we can't have +* other log replays overwriting this log as we'll read +* it back in a few more times. This will keep our +* block from being modified, and we'll just bail for +* each subsequent pass. +*/ +if (ret == -ENOENT ) + ret =btrfs_pin_extent_for_log_replay (fs_info, + log->node->start, + log->node->len);free_extent_buffer (log->node);free_extent_buffer (log->commit_root);kfree (log); + +if (!ret) + goto next;btrfs_handle_fs_error (fs_info, ret,"Couldn't read target root for tree log recovery." ); goto error;
@@ -6052,7 +6071,6 @@ again: &root->highest_objectid); } - key.offset = found_key.offset -1 ; wc.replay_dest->log_root =NULL ;free_extent_buffer (log->node);free_extent_buffer (log->commit_root);
@@ -6060,9 +6078,10 @@ again:if (ret) goto error; - +next:if (found_key.offset ==0 )break ; + key.offset = found_key.offset -1 ; }btrfs_release_path (path);
Greg Kroah-Hartman
maintainerPATCH 14/161 btrfs: do not leak reloc root if we fail to read the fs root
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit ca1aa2818a53875cfdd175fb5e9a2984e997cce9 upstream.
If we fail to read the fs root corresponding with a reloc root we'll just break out and free the reloc roots. But we remove our current reloc_root from this list higher up, which means we'll leak this reloc_root. Fix this by adding ourselves back to the reloc_roots list so we are properly cleaned up.
--- fs/btrfs/relocation.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/relocation.c +1 -0
@@ -4587,6 +4587,7 @@ int btrfs_recover_relocation(struct btrf fs_root =read_fs_root (fs_info, reloc_root->root_key.offset);if (IS_ERR (fs_root)) { err =PTR_ERR (fs_root); +list_add_tail (&reloc_root->root_list, &reloc_roots); goto out_free; }
Greg Kroah-Hartman
maintainerPATCH 15/161 btrfs: handle ENOENT in btrfs_uuid_tree_iterate
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
commit 714cd3e8cba6841220dce9063a7388a81de03825 upstream.
If we get an -ENOENT back from btrfs_uuid_iter_rem when iterating the uuid tree we'll just continue and do btrfs_next_item(). However we've done a btrfs_release_path() at this point and no longer have a valid path. So increment the key and go back and do a normal search.
--- fs/btrfs/uuid-tree.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/uuid-tree.c +2 -0
@@ -336,6 +336,8 @@ again_search_slot: }if (ret <0 && ret != -ENOENT ) goto out; + key.offset++; + goto again_search_slot; } item_size -=sizeof (subid_le); offset +=sizeof (subid_le);
Greg Kroah-Hartman
maintainerPATCH 16/161 Btrfs: fix removal logic of the tree mod log that leads to use-after-free issues
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 6609fee8897ac475378388238456c84298bff802 upstream.
When a tree mod log user no longer needs to use the tree it calls btrfs_put_tree_mod_seq() to remove itself from the list of users and delete all no longer used elements of the tree's red black tree, which should be all elements with a sequence number less then our equals to the caller's sequence number. However the logic is broken because it can delete and free elements from the red black tree that have a sequence number greater then the caller's sequence number:
1) At a point in time we have sequence numbers 1, 2, 3 and 4 in the tree mod log;
2) The task which got assigned the sequence number 1 calls btrfs_put_tree_mod_seq();
3) Sequence number 1 is deleted from the list of sequence numbers;
4) The current minimum sequence number is computed to be the sequence number 2;
5) A task using sequence number 2 is at tree_mod_log_rewind() and gets a pointer to one of its elements from the red black tree through a call to tree_mod_log_search();
6) The task with sequence number 1 iterates the red black tree of tree modification elements and deletes (and frees) all elements with a sequence number less then or equals to 2 (the computed minimum sequence number) - it ends up only leaving elements with sequence numbers of 3 and 4;
7) The task with sequence number 2 now uses the pointer to its element, already freed by the other task, at __tree_mod_log_rewind(), resulting in a use-after-free issue. When CONFIG_DEBUG_PAGEALLOC=y it produces a trace like the following:
[16804.546854] general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC PTI [16804.547451] CPU: 0 PID: 28257 Comm: pool Tainted: G W 5.4.0-rc8-btrfs-next-51 #1 [16804.548059] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-0-ga698c8995f-prebuilt.qemu.org 04/01/2014 [16804.548666] RIP: 0010:rb_next+0x16/0x50 (...) [16804.550581] RSP: 0018:ffffb948418ef9b0 EFLAGS: 00010202 [16804.551227] RAX: 6b6b6b6b6b6b6b6b RBX: ffff90e0247f6600 RCX: 6b6b6b6b6b6b6b6b [16804.551873] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff90e0247f6600 [16804.552504] RBP: ffff90dffe0d4688 R08: 0000000000000001 R09: 0000000000000000 [16804.553136] R10: ffff90dffa4a0040 R11: 0000000000000000 R12: 000000000000002e [16804.553768] R13: ffff90e0247f6600 R14: 0000000000001663 R15: ffff90dff77862b8 [16804.554399] FS: 00007f4b197ae700(0000) GS:ffff90e036a00000(0000) knlGS:0000000000000000 [16804.555039] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [16804.555683] CR2: 00007f4b10022000 CR3: 00000002060e2004 CR4: 00000000003606f0 [16804.556336] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [16804.556968] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [16804.557583] Call Trace: [16804.558207] __tree_mod_log_rewind+0xbf/0x280 [btrfs] [16804.558835] btrfs_search_old_slot+0x105/0xd00 [btrfs] [16804.559468] resolve_indirect_refs+0x1eb/0xc70 [btrfs] [16804.560087] ? free_extent_buffer.part.19+0x5a/0xc0 [btrfs] [16804.560700] find_parent_nodes+0x388/0x1120 [btrfs] [16804.561310] btrfs_check_shared+0x115/0x1c0 [btrfs] [16804.561916] ? extent_fiemap+0x59d/0x6d0 [btrfs] [16804.562518] extent_fiemap+0x59d/0x6d0 [btrfs] [16804.563112] ? __might_fault+0x11/0x90 [16804.563706] do_vfs_ioctl+0x45a/0x700 [16804.564299] ksys_ioctl+0x70/0x80 [16804.564885] ? trace_hardirqs_off_thunk+0x1a/0x20 [16804.565461] __x64_sys_ioctl+0x16/0x20 [16804.566020] do_syscall_64+0x5c/0x250 [16804.566580] entry_SYSCALL_64_after_hwframe+0x49/0xbe [16804.567153] RIP: 0033:0x7f4b1ba2add7 (...) [16804.568907] RSP: 002b:00007f4b197adc88 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [16804.569513] RAX: ffffffffffffffda RBX: 00007f4b100210d8 RCX: 00007f4b1ba2add7 [16804.570133] RDX: 00007f4b100210d8 RSI: 00000000c020660b RDI: 0000000000000003 [16804.570726] RBP: 000055de05a6cfe0 R08: 0000000000000000 R09: 00007f4b197add44 [16804.571314] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f4b197add48 [16804.571905] R13: 00007f4b197add40 R14: 00007f4b100210d0 R15: 00007f4b197add50 (...) [16804.575623] ---[ end trace 87317359aad4ba50 ]---
Fix this by making btrfs_put_tree_mod_seq() skip deletion of elements that have a sequence number equals to the computed minimum sequence number, and not just elements with a sequence number greater then that minimum.
--- fs/btrfs/ctree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/ctree.c +1 -1
@@ -427,7 +427,7 @@ void btrfs_put_tree_mod_seq(struct btrfsfor (node =rb_first (tm_root); node; node = next) { next =rb_next (node); tm = rb_entry(node, struct tree_mod_elem, node); -if (tm->seq > min_seq) +if (tm->seq >= min_seq)continue ;rb_erase (node, tm_root);kfree (tm);
Greg Kroah-Hartman
maintainerPATCH 17/161 ALSA: pcm: Avoid possible info leaks from PCM stream buffers
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit add9d56d7b3781532208afbff5509d7382fb6efe upstream.
The current PCM code doesn't initialize explicitly the buffers allocated for PCM streams, hence it might leak some uninitialized kernel data or previous stream contents by mmapping or reading the buffer before actually starting the stream.
Since this is a common problem, this patch simply adds the clearance of the buffer data at hw_params callback. Although this does only zero-clear no matter which format is used, which doesn't mean the silence for some formats, but it should be OK because the intention is just to clear the previous data on the buffer.
--- sound/core/pcm_native.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/core/pcm_native.c +4 -0
@@ -720,6 +720,10 @@ static int snd_pcm_hw_params(struct snd_while (runtime->boundary *2 <=LONG_MAX - runtime->buffer_size) runtime->boundary *=2 ; +/* clear the buffer for avoiding possible kernel info leaks */ +if (runtime->dma_area && !substream->ops->copy_user) +memset (runtime->dma_area,0 , runtime->dma_bytes); +snd_pcm_timer_resolution_change (substream);snd_pcm_set_state (substream,SNDRV_PCM_STATE_SETUP );
Greg Kroah-Hartman
maintainerPATCH 18/161 ALSA: hda/ca0132 - Keep power on during processing DSP response
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 377bc0cfabce0244632dada19060839ced4e6949 upstream.
We need to keep power on while processing the DSP response via unsol event. Each snd_hda_codec_read() call does the power management, so it should work normally, but still it's safer to keep the power up for the whole function.
--- sound/pci/hda/patch_ca0132.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_ca0132.c +2 -0
@@ -4424,12 +4424,14 @@ static void ca0132_process_dsp_response(struct ca0132_spec *spec = codec->spec;codec_dbg (codec,"ca0132_process_dsp_response\n" ); +snd_hda_power_up_pm (codec);if (spec->wait_scp) {if (dspio_get_response_data (codec) >=0 ) spec->wait_scp =0 ; }dspio_clear_response_queue (codec); +snd_hda_power_down_pm (codec); }static void hp_callback (struct hda_codec *codec,struct hda_jack_callback *cb)
Greg Kroah-Hartman
maintainerPATCH 19/161 ALSA: hda/ca0132 - Avoid endless loop
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit cb04fc3b6b076f67d228a0b7d096c69ad486c09c upstream.
Introduce a timeout to dspio_clear_response_queue() so that it won't be caught in an endless loop even if the hardware doesn't respond properly.
--- sound/pci/hda/patch_ca0132.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/patch_ca0132.c +3 -2
@@ -1300,13 +1300,14 @@ struct scp_msg {static void dspio_clear_response_queue (struct hda_codec *codec) { +unsigned long timeout = jiffies +msecs_to_jiffies (1000 );unsigned int dummy =0 ; -int status =-1 ; +int status;/* clear all from the response queue */ do { status =dspio_read (codec, &dummy); - }while (status ==0 ); + }while (status ==0 &&time_before (jiffies, timeout)); }static int dspio_get_response_data (struct hda_codec *codec)
Greg Kroah-Hartman
maintainerPATCH 20/161 drm: mst: Fix query_payload ack reply struct
In reply to Greg Kroah-HartmanFrom: Sean Paul <[email protected]>
[ Upstream commit 268de6530aa18fe5773062367fd119f0045f6e88 ]
Spec says[1] Allocated_PBN is 16 bits
[1]- DisplayPort 1.2 Spec, Section 2.11.9.8, Table 2-98
--- include/drm/drm_dp_mst_helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/drm/drm_dp_mst_helper.h +1 -1
@@ -313,7 +313,7 @@ struct drm_dp_resource_status_notify {struct drm_dp_query_payload_ack_reply {u8 port_number; -u8 allocated_pbn; +u16 allocated_pbn; };struct drm_dp_sideband_msg_req_body {
Signature · 8 lines
2.20.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Greg Kroah-Hartman
maintainerPATCH 21/161 drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings
In reply to Greg Kroah-HartmanFrom: Brian Masney <[email protected]>
[ Upstream commit 2708e876272d89bbbff811d12834adbeef85f022 ]
Silence two warning messages that occur due to -EPROBE_DEFER errors to help cleanup the system boot log.
--- drivers/gpu/drm/bridge/analogix-anx78xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/analogix-anx78xx.c +6 -2
@@ -725,7 +725,9 @@ static int anx78xx_init_pdata(struct anx78xx *anx78xx)/* 1.0V digital core power regulator */ pdata->dvdd10 =devm_regulator_get (dev,"dvdd10" );if (IS_ERR (pdata->dvdd10)) { -DRM_ERROR ("DVDD10 regulator not found\n" ); +if (PTR_ERR (pdata->dvdd10) != -EPROBE_DEFER ) +DRM_ERROR ("DVDD10 regulator not found\n" ); +return PTR_ERR (pdata->dvdd10); }
@@ -1344,7 +1346,9 @@ static int anx78xx_i2c_probe(struct i2c_client *client, err =anx78xx_init_pdata (anx78xx);if (err) { -DRM_ERROR ("Failed to initialize pdata: %d\n" , err); +if (err != -EPROBE_DEFER ) +DRM_ERROR ("Failed to initialize pdata: %d\n" , err); +return err; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 22/161 iio: light: bh1750: Resolve compiler warning and make code more readable
In reply to Greg Kroah-HartmanFrom: Krzysztof Wilczynski <[email protected]>
[ Upstream commit f552fde983d378e7339f9ea74a25f918563bf0d3 ]
Separate the declaration of struct bh1750_chip_info from definition of bh1750_chip_info_tbl[] in a single statement as it makes the code hard to read, and with the extra newline it makes it look as if the bh1750_chip_info_tbl[] had no explicit type.
This change also resolves the following compiler warning about the unusual position of the static keyword that can be seen when building with warnings enabled (W=1):
drivers/iio/light/bh1750.c:64:1: warning:
‘static’ is not at beginning of declaration [-Wold-style-declaration]
Related to commit 3a11fbb037a1 ("iio: light: add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors").
--- drivers/iio/light/bh1750.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/bh1750.c +2 -2
@@ -62,9 +62,9 @@ struct bh1750_chip_info {u16 int_time_low_mask;u16 int_time_high_mask; -} +}; -static const bh1750_chip_info_tbl[] = { +static const struct bh1750_chip_info bh1750_chip_info_tbl[] = { [BH1710 ] = {140 ,1022 ,300 ,400 ,250000000 ,2 ,0x001F ,0x03E0 }, [BH1721 ] = {140 ,1020 ,300 ,400 ,250000000 ,2 ,0x0010 ,0x03E0 }, [BH1750 ] = {31 ,254 ,69 ,1740 ,57500000 ,1 ,0x001F ,0x00E0 },
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 23/161 spi: Add call to spi_slave_abort() function when spidev driver is released
In reply to Greg Kroah-HartmanFrom: Lukasz Majewski <[email protected]>
[ Upstream commit 9f918a728cf86b2757b6a7025e1f46824bfe3155 ]
This change is necessary for spidev devices (e.g. /dev/spidev3.0) working in the slave mode (like NXP's dspi driver for Vybrid SoC).
When SPI HW works in this mode - the master is responsible for providing CS and CLK signals. However, when some fault happens - like for example distortion on SPI lines - the SPI Linux driver needs a chance to recover from this abnormal situation and prepare itself for next (correct) transmission.
This change doesn't pose any threat on drivers working in master mode as spi_slave_abort() function checks if SPI slave mode is supported.
--- drivers/spi/spidev.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spidev.c +3 -0
@@ -634,6 +634,9 @@ static int spidev_release(struct inode *inode, struct file *filp)if (dofree)kfree (spidev); } +#ifdef CONFIG_SPI_SLAVE +spi_slave_abort (spidev->spi); +#endif mutex_unlock (&device_list_lock);return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 24/161 staging: rtl8192u: fix multiple memory leaks on error path
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit ca312438cf176a16d4b89350cade8789ba8d7133 ]
In rtl8192_tx on error handling path allocated urbs and also skb should be released.
--- drivers/staging/rtl8192u/r8192U_core.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/staging/rtl8192u/r8192U_core.c +12 -5
@@ -1506,7 +1506,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) (tx_fwinfo_819x_usb *)(skb->data +USB_HWDESC_HEADER_LEN );struct usb_device *udev = priv->udev;int pend; -int status; +int status, rt =-1 ;struct urb *tx_urb =NULL , *tx_urb_zero =NULL ;unsigned int idx_pipe;
@@ -1650,8 +1650,10 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) }if (bSend0Byte) { tx_urb_zero =usb_alloc_urb (0 ,GFP_ATOMIC ); -if (!tx_urb_zero) -return -ENOMEM ; +if (!tx_urb_zero) { + rt = -ENOMEM ; + goto error; + }usb_fill_bulk_urb (tx_urb_zero, udev,usb_sndbulkpipe (udev, idx_pipe), &zero,0 , tx_zero_isr, dev);
@@ -1661,7 +1663,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb)"Error TX URB for zero byte %d, error %d" ,atomic_read (&priv->tx_pending[tcb_desc->queue_index]), status); -return -1 ; + goto error; } }netif_trans_update (dev);
@@ -1672,7 +1674,12 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb)RT_TRACE (COMP_ERR ,"Error TX URB %d, error %d" ,atomic_read (&priv->tx_pending[tcb_desc->queue_index]), status); -return -1 ; + +error: +dev_kfree_skb_any (skb); +usb_free_urb (tx_urb); +usb_free_urb (tx_urb_zero); +return rt; }static short rtl8192_usb_initendpoints (struct net_device *dev)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 25/161 staging: rtl8188eu: fix possible null dereference
In reply to Greg Kroah-HartmanFrom: Connor Kuehl <[email protected]>
[ Upstream commit 228241944a48113470d3c3b46c88ba7fbe0a274b ]
Inside a nested 'else' block at the beginning of this function is a call that assigns 'psta' to the return value of 'rtw_get_stainfo()'. If 'rtw_get_stainfo()' returns NULL and the flow of control reaches the 'else if' where 'psta' is dereferenced, then we will dereference a NULL pointer.
Fix this by checking if 'psta' is not NULL before reading its 'psta->qos_option' data member.
Addresses-Coverity: ("Dereference null return value")
--- drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8188eu/core/rtw_xmit.c +2 -2
@@ -805,7 +805,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrmemcpy (pwlanhdr->addr2,get_bssid (pmlmepriv),ETH_ALEN );memcpy (pwlanhdr->addr3, pattrib->src,ETH_ALEN ); -if (psta->qos_option) +if (psta && psta->qos_option) qos_option = true; }else if (check_fwstate (pmlmepriv,WIFI_ADHOC_STATE ) ||check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE )) {
@@ -813,7 +813,7 @@ s32 rtw_make_wlanhdr(struct adapter *padapter, u8 *hdr, struct pkt_attrib *pattrmemcpy (pwlanhdr->addr2, pattrib->src,ETH_ALEN );memcpy (pwlanhdr->addr3,get_bssid (pmlmepriv),ETH_ALEN ); -if (psta->qos_option) +if (psta && psta->qos_option) qos_option = true; }else {RT_TRACE (_module_rtl871x_xmit_c_, _drv_err_, ("fw_state:%x is not allowed to xmit frame\n" ,get_fwstate (pmlmepriv)));
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 26/161 rtlwifi: prevent memory leak in rtl_usb_probe
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit 3f93616951138a598d930dcaec40f2bfd9ce43bb ]
In rtl_usb_probe if allocation for usb_data fails the allocated hw should be released. In addition the allocated rtlpriv->usb_data should be released on error handling path.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +4 -1
@@ -1068,8 +1068,10 @@ int rtl_usb_probe(struct usb_interface *intf, rtlpriv->hw = hw; rtlpriv->usb_data =kzalloc (RTL_USB_MAX_RX_COUNT *sizeof (u32),GFP_KERNEL ); -if (!rtlpriv->usb_data) +if (!rtlpriv->usb_data) { +ieee80211_free_hw (hw);return -ENOMEM ; + }/* this spin lock must be initialized early */ spin_lock_init (&rtlpriv->locks.usb_lock);
@@ -1130,6 +1132,7 @@ error_out2:_rtl_usb_io_handler_release (hw);usb_put_dev (udev);complete (&rtlpriv->firmware_loading_complete); +kfree (rtlpriv->usb_data);return -ENODEV ; }EXPORT_SYMBOL (rtl_usb_probe);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 27/161 libertas: fix a potential NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Allen Pais <[email protected]>
[ Upstream commit 7da413a18583baaf35dd4a8eb414fa410367d7f2 ]
alloc_workqueue is not checked for errors and as a result, a potential NULL dereference could occur.
--- drivers/net/wireless/marvell/libertas/if_sdio.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/marvell/libertas/if_sdio.c +5 -0
@@ -1183,6 +1183,10 @@ static int if_sdio_probe(struct sdio_func *func,spin_lock_init (&card->lock); card->workqueue =alloc_workqueue ("libertas_sdio" ,WQ_MEM_RECLAIM ,0 ); +if (unlikely (!card->workqueue)) { + ret = -ENOMEM ; + goto err_queue; + }INIT_WORK (&card->packet_worker, if_sdio_host_to_card_worker);init_waitqueue_head (&card->pwron_waitq);
@@ -1234,6 +1238,7 @@ err_activate_card:lbs_remove_card (priv); free:destroy_workqueue (card->workqueue); +err_queue:while (card->packets) { packet = card->packets; card->packets = card->packets->next;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 28/161 IB/iser: bound protection_sg size by data_sg size
In reply to Greg Kroah-HartmanFrom: Max Gurtovoy <[email protected]>
[ Upstream commit 7718cf03c3ce4b6ebd90107643ccd01c952a1fce ]
In case we don't set the sg_prot_tablesize, the scsi layer assign the default size (65535 entries). We should limit this size since we should take into consideration the underlaying device capability. This cap is considered when calculating the sg_tablesize. Otherwise, for example, we can get that /sys/block/sdb/queue/max_segments is 128 and /sys/block/sdb/queue/max_integrity_segments is 65535.
--- drivers/infiniband/ulp/iser/iscsi_iser.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/ulp/iser/iscsi_iser.c +1 -0
@@ -648,6 +648,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep,if (ib_conn->pi_support) {u32 sig_caps = ib_conn->device->ib_device->attrs.sig_prot_cap; + shost->sg_prot_tablesize = shost->sg_tablesize;scsi_host_set_prot (shost,iser_dif_prot_caps (sig_caps));scsi_host_set_guard (shost,SHOST_DIX_GUARD_IP |SHOST_DIX_GUARD_CRC );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 29/161 media: am437x-vpfe: Setting STD to current value is not an error
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 13aa21cfe92ce9ebb51824029d89f19c33f81419 ]
VIDIOC_S_STD should not return an error if the value is identical to the current one.
This error was highlighted by the v4l2-compliance test.
--- drivers/media/platform/am437x/am437x-vpfe.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/platform/am437x/am437x-vpfe.c +4 -0
@@ -1848,6 +1848,10 @@ static int vpfe_s_std(struct file *file, void *priv, v4l2_std_id std_id)if (!(sdinfo->inputs[0 ].capabilities &V4L2_IN_CAP_STD ))return -ENODATA ; +/* if trying to set the same std then nothing to do */ +if (vpfe_standards[vpfe->std_index].std_id == std_id) +return 0 ; +/* If streaming is started, return error */ if (vb2_is_busy (&vpfe->buffer_queue)) {vpfe_err (vpfe,"%s device busy\n" , __func__);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 30/161 media: i2c: ov2659: fix s_stream return value
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 85c4043f1d403c222d481dfc91846227d66663fb ]
In ov2659_s_stream() return value for invoked function should be checked and propagated.
--- drivers/media/i2c/ov2659.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/media/i2c/ov2659.c +9 -5
@@ -1203,11 +1203,15 @@ static int ov2659_s_stream(struct v4l2_subdev *sd, int on) goto unlock; } -ov2659_set_pixel_clock (ov2659); -ov2659_set_frame_size (ov2659); -ov2659_set_format (ov2659); -ov2659_set_streaming (ov2659,1 ); - ov2659->streaming = on; + ret =ov2659_set_pixel_clock (ov2659); +if (!ret) + ret =ov2659_set_frame_size (ov2659); +if (!ret) + ret =ov2659_set_format (ov2659); +if (!ret) { +ov2659_set_streaming (ov2659,1 ); + ov2659->streaming = on; + } unlock:mutex_unlock (&ov2659->lock);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 31/161 media: ov6650: Fix crop rectangle alignment not passed back
In reply to Greg Kroah-HartmanFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 7b188d6ba27a131e7934a51a14ece331c0491f18 ]
Commit 4f996594ceaf ("[media] v4l2: make vidioc_s_crop const") introduced a writable copy of constified user requested crop rectangle in order to be able to perform hardware alignments on it. Later on, commit 10d5509c8d50 ("[media] v4l2: remove g/s_crop from video ops") replaced s_crop() video operation using that const argument with set_selection() pad operation which had a corresponding argument not constified, however the original behavior of the driver was not restored. Since that time, any hardware alignment applied on a user requested crop rectangle is not passed back to the user calling .set_selection() as it should be.
Fix the issue by dropping the copy and replacing all references to it with references to the crop rectangle embedded in the user argument.
--- drivers/media/i2c/ov6650.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/media/i2c/ov6650.c +15 -16
@@ -469,38 +469,37 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, {struct i2c_client *client =v4l2_get_subdevdata (sd);struct ov6650 *priv =to_ov6650 (client); -struct v4l2_rect rect = sel->r;int ret;if (sel->which !=V4L2_SUBDEV_FORMAT_ACTIVE || sel->target !=V4L2_SEL_TGT_CROP )return -EINVAL ; -v4l_bound_align_image (&rect.width,2 ,W_CIF ,1 , - &rect.height,2 ,H_CIF ,1 ,0 ); -v4l_bound_align_image (&rect.left,DEF_HSTRT <<1 , - (DEF_HSTRT <<1 ) +W_CIF - (__s32 )rect.width,1 , - &rect.top,DEF_VSTRT <<1 , - (DEF_VSTRT <<1 ) +H_CIF - (__s32 )rect.height,1 , -0 ); +v4l_bound_align_image (&sel->r.width,2 ,W_CIF ,1 , + &sel->r.height,2 ,H_CIF ,1 ,0 ); +v4l_bound_align_image (&sel->r.left,DEF_HSTRT <<1 , + (DEF_HSTRT <<1 ) +W_CIF - (__s32 )sel->r.width,1 , + &sel->r.top,DEF_VSTRT <<1 , + (DEF_VSTRT <<1 ) +H_CIF - (__s32 )sel->r.height, +1 ,0 ); - ret =ov6650_reg_write (client,REG_HSTRT , rect.left >>1 ); + ret =ov6650_reg_write (client,REG_HSTRT , sel->r.left >>1 );if (!ret) { - priv->rect.left = rect.left; + priv->rect.left = sel->r.left; ret =ov6650_reg_write (client,REG_HSTOP , - (rect.left + rect.width) >>1 ); + (sel->r.left + sel->r.width) >>1 ); }if (!ret) { - priv->rect.width = rect.width; - ret =ov6650_reg_write (client,REG_VSTRT , rect.top >>1 ); + priv->rect.width = sel->r.width; + ret =ov6650_reg_write (client,REG_VSTRT , sel->r.top >>1 ); }if (!ret) { - priv->rect.top = rect.top; + priv->rect.top = sel->r.top; ret =ov6650_reg_write (client,REG_VSTOP , - (rect.top + rect.height) >>1 ); + (sel->r.top + sel->r.height) >>1 ); }if (!ret) - priv->rect.height = rect.height; + priv->rect.height = sel->r.height;return ret; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 32/161 media: i2c: ov2659: Fix missing 720p register config
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 9d669fbfca20e6035ead814e55d9ef1a6b500540 ]
The initial registers sequence is only loaded at probe time. Afterward only the resolution and format specific register are modified. Care must be taken to make sure registers modified by one resolution setting are reverted back when another resolution is programmed.
This was not done properly for the 720p case.
--- drivers/media/i2c/ov2659.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/i2c/ov2659.c +4 -0
@@ -419,10 +419,14 @@ static struct sensor_register ov2659_720p[] = { { REG_TIMING_YINC, 0x11 }, { REG_TIMING_VERT_FORMAT, 0x80 }, { REG_TIMING_HORIZ_FORMAT, 0x00 }, + { 0x370a, 0x12 }, { 0x3a03, 0xe8 }, { 0x3a09, 0x6f }, { 0x3a0b, 0x5d }, { 0x3a15, 0x9a }, + { REG_VFIFO_READ_START_H, 0x00 }, + { REG_VFIFO_READ_START_L, 0x80 }, + { REG_ISP_CTRL02, 0x00 }, { REG_NULL, 0x00 }, };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 33/161 media: ov6650: Fix stored frame format not in sync with hardware
In reply to Greg Kroah-HartmanFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 3143b459de4cdcce67b36827476c966e93c1cf01 ]
The driver stores frame format settings supposed to be in line with hardware state in a device private structure. Since the driver initial submission, those settings are updated before they are actually applied on hardware. If an error occurs on device update, the stored settings my not reflect hardware state anymore and consecutive calls to .get_fmt() may return incorrect information. That in turn may affect ability of a bridge device to use correct DMA transfer settings if such incorrect informmation on active frame format returned by .get_fmt() is used.
Assuming a failed device update means its state hasn't changed, update frame format related settings stored in the device private structure only after they are successfully applied so the stored values always reflect hardware state as closely as possible.
--- drivers/media/i2c/ov6650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/i2c/ov6650.c +6 -3
@@ -613,7 +613,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)dev_err (&client->dev,"Pixel format not handled: 0x%x\n" , code);return -EINVAL ; } - priv->code = code;if (code ==MEDIA_BUS_FMT_Y8_1X8 || code ==MEDIA_BUS_FMT_SBGGR8_1X8 ) {
@@ -639,7 +638,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)dev_dbg (&client->dev,"max resolution: CIF\n" ); coma_mask |=COMA_QCIF ; } - priv->half_scale = half_scale; clkrc = CLKRC_12MHz; mclk =12000000 ;
@@ -657,8 +655,13 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) ret =ov6650_reg_rmw (client,REG_COMA , coma_set, coma_mask);if (!ret) ret =ov6650_reg_write (client,REG_CLKRC , clkrc); -if (!ret) +if (!ret) { + priv->half_scale = half_scale; + ret =ov6650_reg_rmw (client,REG_COML , coml_set, coml_mask); + } +if (!ret) + priv->code = code;if (!ret) { mf->colorspace = priv->colorspace;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 34/161 media: ov6650: Fix stored crop rectangle not in sync with hardware
In reply to Greg Kroah-HartmanFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 1463b371aff0682c70141f7521db13cc4bbf3016 ]
The driver stores crop rectangle settings supposed to be in line with hardware state in a device private structure. Since the driver initial submission, crop rectangle width and height settings are not updated correctly when rectangle offset settings are applied on hardware. If an error occurs while the device is updated, the stored settings my no longer reflect hardware state and consecutive calls to .get_selection() as well as .get/set_fmt() may return incorrect information. That in turn may affect ability of a bridge device to use correct DMA transfer settings if such incorrect informamtion on active frame format returned by .get/set_fmt() is used.
Assuming a failed update of the device means its actual settings haven't changed, update crop rectangle width and height settings stored in the device private structure correctly while the rectangle offset is successfully applied on hardware so the stored values always reflect actual hardware state to the extent possible.
--- drivers/media/i2c/ov6650.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov6650.c +2 -0
@@ -485,6 +485,7 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, ret =ov6650_reg_write (client,REG_HSTRT , sel->r.left >>1 );if (!ret) { + priv->rect.width += priv->rect.left - sel->r.left; priv->rect.left = sel->r.left; ret =ov6650_reg_write (client,REG_HSTOP , (sel->r.left + sel->r.width) >>1 );
@@ -494,6 +495,7 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, ret =ov6650_reg_write (client,REG_VSTRT , sel->r.top >>1 ); }if (!ret) { + priv->rect.height += priv->rect.top - sel->r.top; priv->rect.top = sel->r.top; ret =ov6650_reg_write (client,REG_VSTOP , (sel->r.top + sel->r.height) >>1 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 35/161 tools/power/cpupower: Fix initializer override in hsw_ext_cstates
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 7e5705c635ecfccde559ebbbe1eaf05b5cc60529 ]
When building cpupower with clang, the following warning appears:
utils/idle_monitor/hsw_ext_idle.c:42:16: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
.desc = N_("Processor Package C2"),
^~~~~~~~~~~~~~~~~~~~~~
./utils/helpers/helpers.h:25:33: note: expanded from macro 'N_'
#define N_(String) gettext_noop(String)
^~~~~~
./utils/helpers/helpers.h:23:30: note: expanded from macro
'gettext_noop'
#define gettext_noop(String) String
^~~~~~
utils/idle_monitor/hsw_ext_idle.c:41:16: note: previous initialization
is here
.desc = N_("Processor Package C9"),
^~~~~~~~~~~~~~~~~~~~~~
./utils/helpers/helpers.h:25:33: note: expanded from macro 'N_'
#define N_(String) gettext_noop(String)
^~~~~~
./utils/helpers/helpers.h:23:30: note: expanded from macro
'gettext_noop'
#define gettext_noop(String) String
^~~~~~1 warning generated.
This appears to be a copy and paste or merge mistake because the name and id fields both have PC9 in them, not PC2. Remove the second assignment to fix the warning.
--- tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c | 1 - 1 file changed, 1 deletion(-)
tools/power/cpupower/utils/idle_monitor/hsw_ext_idle.c +0 -1
@@ -40,7 +40,6 @@ static cstate_t hsw_ext_cstates[HSW_EXT_CSTATE_COUNT] = { { .name = "PC9", .desc = N_("Processor Package C9"), - .desc = N_("Processor Package C2"), .id = PC9, .range = RANGE_PACKAGE, .get_count_percent = hsw_ext_get_count_percent,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 36/161 media: venus: core: Fix msm8996 frequency table
In reply to Greg Kroah-HartmanFrom: Loic Poulain <[email protected]>
[ Upstream commit c690435ed07901737e5c007a65ec59f53b33eb71 ]
In downstream driver, there are two frequency tables defined, one for the encoder and one for the decoder:
/* Encoders /
<972000 490000000 0x55555555>, / 4k UHD @ 30 /
<489600 320000000 0x55555555>, / 1080p @ 60 /
<244800 150000000 0x55555555>, / 1080p @ 30 /
<108000 75000000 0x55555555>, / 720p @ 30 */
/* Decoders /
<1944000 490000000 0xffffffff>, / 4k UHD @ 60 /
< 972000 320000000 0xffffffff>, / 4k UHD @ 30 /
< 489600 150000000 0xffffffff>, / 1080p @ 60 /
< 244800 75000000 0xffffffff>; / 1080p @ 30 */
It shows that encoder always needs a higher clock than decoder.
In current venus driver, the unified frequency table is aligned with the downstream decoder table which causes performance issues in encoding scenarios. Fix that by aligning frequency table on worst case (encoding).
--- drivers/media/platform/qcom/venus/core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/venus/core.c +5 -4
@@ -345,10 +345,11 @@ static const struct venus_resources msm8916_res = { };static const struct freq_tbl msm8996_freq_table[] = { - {1944000 ,490000000 },/* 4k UHD @ 60 */ - {972000 ,320000000 },/* 4k UHD @ 30 */ - {489600 ,150000000 },/* 1080p @ 60 */ - {244800 ,75000000 },/* 1080p @ 30 */ + {1944000 ,520000000 },/* 4k UHD @ 60 (decode only) */ + {972000 ,520000000 },/* 4k UHD @ 30 */ + {489600 ,346666667 },/* 1080p @ 60 */ + {244800 ,150000000 },/* 1080p @ 30 */ + {108000 ,75000000 },/* 720p @ 30 */ };static const struct reg_val msm8996_reg_preset[] = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 37/161 ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq
In reply to Greg Kroah-HartmanFrom: Ben Greear <[email protected]>
[ Upstream commit cc6df017e55764ffef9819dd9554053182535ffd ]
Offchannel management frames were failing:
[18099.253732] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18102.293686] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18105.333653] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18108.373712] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3780 [18111.413687] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e36c0 [18114.453726] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3f00 [18117.493773] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e36c0 [18120.533631] ath10k_pci 0000:01:00.0: timed out waiting for offchannel skb cf0e3f00
This bug appears to have been added between 4.0 (which works for us), and 4.4, which does not work.
I think this is because the tx-offchannel logic gets in a loop when ath10k_mac_tx_frm_has_freq(ar) is false, so pkt is never actually sent to the firmware for transmit.
This patch fixes the problem on 4.9 for me, and now HS20 clients can work again with my firmware.
Antonio: tested with 10.4-3.5.3-00057 on QCA4019 and QCA9888
--- drivers/net/wireless/ath/ath10k/mac.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +11 -11
@@ -3627,7 +3627,7 @@ static int ath10k_mac_tx(struct ath10k *ar,struct ieee80211_vif *vif, enum ath10k_hw_txrx_mode txmode, enum ath10k_mac_tx_path txpath, - struct sk_buff *skb) + struct sk_buff *skb, bool noque_offchan) { struct ieee80211_hw *hw = ar->hw;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);
@@ -3655,10 +3655,10 @@ static int ath10k_mac_tx(struct ath10k *ar, } } -if (info->flags &IEEE80211_TX_CTL_TX_OFFCHAN ) { +if (!noque_offchan && info->flags &IEEE80211_TX_CTL_TX_OFFCHAN ) {if (!ath10k_mac_tx_frm_has_freq (ar)) { -ath10k_dbg (ar,ATH10K_DBG_MAC ,"queued offchannel skb %pK\n" , - skb); +ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac queued offchannel skb %pK len %d\n" , + skb, skb->len);skb_queue_tail (&ar->offchan_tx_queue, skb);ieee80211_queue_work (hw, &ar->offchan_tx_work);
@@ -3720,8 +3720,8 @@ void ath10k_offchan_tx_work(struct work_struct *work)mutex_lock (&ar->conf_mutex); -ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac offchannel skb %pK\n" , - skb); +ath10k_dbg (ar,ATH10K_DBG_MAC ,"mac offchannel skb %pK len %d\n" , + skb, skb->len); hdr = (struct ieee80211_hdr *)skb->data; peer_addr =ieee80211_get_DA (hdr);
@@ -3767,7 +3767,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) txmode =ath10k_mac_tx_h_get_txmode (ar, vif, sta, skb); txpath =ath10k_mac_tx_h_get_txpath (ar, skb, txmode); - ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb); + ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb, true);if (ret) {ath10k_warn (ar,"failed to transmit offchannel frame: %d\n" , ret);
@@ -3777,8 +3777,8 @@ void ath10k_offchan_tx_work(struct work_struct *work) time_left =wait_for_completion_timeout (&ar->offchan_tx_completed,3 *HZ );if (time_left ==0 ) -ath10k_warn (ar,"timed out waiting for offchannel skb %pK\n" , - skb); +ath10k_warn (ar,"timed out waiting for offchannel skb %pK, len: %d\n" , + skb, skb->len);if (!peer && tmp_peer_created) { ret =ath10k_peer_delete (ar, vdev_id, peer_addr);
@@ -3957,7 +3957,7 @@ int ath10k_mac_tx_push_txq(struct ieee80211_hw *hw,spin_unlock_bh (&ar->htt.tx_lock); } - ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb); + ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb, false);if (unlikely (ret)) {ath10k_warn (ar,"failed to push frame: %d\n" , ret);
@@ -4239,7 +4239,7 @@ static void ath10k_mac_op_tx(struct ieee80211_hw *hw,spin_unlock_bh (&ar->htt.tx_lock); } - ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb); + ret =ath10k_mac_tx (ar, vif, txmode, txpath, skb, false);if (ret) {ath10k_warn (ar,"failed to transmit frame: %d\n" , ret);if (is_htt) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 38/161 pinctrl: devicetree: Avoid taking direct reference to device name string
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
[ Upstream commit be4c60b563edee3712d392aaeb0943a768df7023 ]
When populating the pinctrl mapping table entries for a device, the 'dev_name' field for each entry is initialised to point directly at the string returned by 'dev_name()' for the device and subsequently used by 'create_pinctrl()' when looking up the mappings for the device being probed.
This is unreliable in the presence of calls to 'dev_set_name()', which may reallocate the device name string leaving the pinctrl mappings with a dangling reference. This then leads to a use-after-free every time the name is dereferenced by a device probe:
| BUG: KASAN: invalid-access in strcmp+0x20/0x64 | Read of size 1 at addr 13ffffc153494b00 by task modprobe/590 | Pointer tag: [13], memory tag: [fe] | | Call trace: | __kasan_report+0x16c/0x1dc | kasan_report+0x10/0x18 | check_memory_region | __hwasan_load1_noabort+0x4c/0x54 | strcmp+0x20/0x64 | create_pinctrl+0x18c/0x7f4 | pinctrl_get+0x90/0x114 | devm_pinctrl_get+0x44/0x98 | pinctrl_bind_pins+0x5c/0x450 | really_probe+0x1c8/0x9a4 | driver_probe_device+0x120/0x1d8
Follow the example of sysfs, and duplicate the device name string before stashing it away in the pinctrl mapping entries.
--- drivers/pinctrl/devicetree.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/pinctrl/devicetree.c +20 -5
@@ -40,6 +40,13 @@ struct pinctrl_dt_map {static void dt_free_map (struct pinctrl_dev *pctldev,struct pinctrl_map *map,unsigned num_maps) { +int i; + +for (i =0 ; i < num_maps; ++i) { +kfree_const (map[i].dev_name); + map[i].dev_name =NULL ; + } +if (pctldev) {const struct pinctrl_ops *ops = pctldev->desc->pctlops;if (ops->dt_free_map)
@@ -74,7 +81,13 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,/* Initialize common mapping table entry fields */ for (i =0 ; i < num_maps; i++) { - map[i].dev_name =dev_name (p->dev); +const char *devname; + + devname =kstrdup_const (dev_name (p->dev),GFP_KERNEL ); +if (!devname) + goto err_free_map; + + map[i].dev_name = devname; map[i].name = statename;if (pctldev) map[i].ctrl_dev_name =dev_name (pctldev->dev);
@@ -82,10 +95,8 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,/* Remember the converted mapping table entries */ dt_map =kzalloc (sizeof (*dt_map),GFP_KERNEL ); -if (!dt_map) { -dt_free_map (pctldev, map, num_maps); -return -ENOMEM ; - } +if (!dt_map) + goto err_free_map; dt_map->pctldev = pctldev; dt_map->map = map;
@@ -93,6 +104,10 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,list_add_tail (&dt_map->node, &p->dt_maps);return pinctrl_register_map (map, num_maps, false); + +err_free_map: +dt_free_map (pctldev, map, num_maps); +return -ENOMEM ; }struct pinctrl_dev *of_pinctrl_get (struct device_node *np)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 39/161 selftests/bpf: Correct path to include msg + path
In reply to Greg Kroah-HartmanFrom: Ivan Khoronzhuk <[email protected]>
[ Upstream commit c588146378962786ddeec817f7736a53298a7b01 ]
The "path" buf is supposed to contain path + printf msg up to 24 bytes. It will be cut anyway, but compiler generates truncation warns like:
" samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c: In function ‘setup_cgroup_environment’:samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:34:
warning: ‘/cgroup.controllers’ directive output may be truncated writing 19 bytes into a region of size between 1 and 4097 [-Wformat-truncation=]
snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); ^~~~~~~~~~~~~~~~~~~
samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:52:2:
note: ‘snprintf’ output between 20 and 4116 bytes into a destination of size 4097snprintf(path, sizeof(path), "%s/cgroup.controllers", cgroup_path); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:34:
warning: ‘/cgroup.subtree_control’ directive output may be truncated writing 23 bytes into a region of size between 1 and 4097 [-Wformat-truncation=]
snprintf(path, sizeof(path), "%s/cgroup.subtree_control",
^~~~~~~~~~~~~~~~~~~~~~~
cgroup_path); samples/bpf/../../tools/testing/selftests/bpf/cgroup_helpers.c:72:2:
note: ‘snprintf’ output between 24 and 4120 bytes into a destination of size 4097snprintf(path, sizeof(path), "%s/cgroup.subtree_control", cgroup_path);
"
In order to avoid warns, lets decrease buf size for cgroup workdir on 24 bytes with assumption to include also "/cgroup.subtree_control" to the address. The cut will never happen anyway.
--- samples/bpf/cgroup_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
samples/bpf/cgroup_helpers.c +1 -1
@@ -43,7 +43,7 @@*/ int setup_cgroup_environment (void ) { -char cgroup_workdir[PATH_MAX +1 ]; +char cgroup_workdir[PATH_MAX -24 ];format_cgroup_path (cgroup_workdir,"" );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 40/161 usb: renesas_usbhs: add suspend event support in gadget mode
In reply to Greg Kroah-HartmanFrom: Veeraiyan Chidambaram <[email protected]>
[ Upstream commit 39abcc84846bbc0538f13c190b6a9c7e36890cd2 ]
When R-Car Gen3 USB 2.0 is in Gadget mode, if host is detached an interrupt will be generated and Suspended state bit is set in interrupt status register. Interrupt handler will call driver->suspend(composite_suspend) if suspended state bit is set. composite_suspend will call ffs_func_suspend which will post FUNCTIONFS_SUSPEND and will be consumed by user space application via /dev/ep0.
To be able to detect host detach, extend the DVSQ_MASK to cover the Suspended bit of the DVSQ[2:0] bitfield from the Interrupt Status Register 0 (INTSTS0) register and perform appropriate action in the DVST interrupt handler (usbhsg_irq_dev_state).
Without this commit, disconnection of the phone from R-Car-H3 ES2.0 Salvator-X CN9 port is not recognized and reverse role switch does not happen. If phone is connected again it does not enumerate.
With this commit, disconnection will be recognized and reverse role switch will happen by a user space application. If phone is connected again it will enumerate properly and will become visible in the output of 'lsusb'.
--- drivers/usb/renesas_usbhs/common.h | 3 ++- drivers/usb/renesas_usbhs/mod_gadget.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/usb/renesas_usbhs/common.h +2 -1
@@ -163,11 +163,12 @@ struct usbhs_priv;#define VBSTS (1 << 7)/* VBUS_0 and VBUSIN_0 Input Status */ #define VALID (1 << 3)/* USB Request Receive */ -#define DVSQ_MASK (0x3 << 4)/* Device State */ +#define DVSQ_MASK (0x7 << 4)/* Device State */ #define POWER_STATE (0 << 4)#define DEFAULT_STATE (1 << 4)#define ADDRESS_STATE (2 << 4)#define CONFIGURATION_STATE (3 << 4) +#define SUSPENDED_STATE (4 << 4)#define CTSQ_MASK (0x7)/* Control Transfer Stage */ #define IDLE_SETUP_STAGE 0/* Idle stage or setup stage */
drivers/usb/renesas_usbhs/mod_gadget.c +9 -3
@@ -465,12 +465,18 @@ static int usbhsg_irq_dev_state(struct usbhs_priv *priv, {struct usbhsg_gpriv *gpriv =usbhsg_priv_to_gpriv (priv);struct device *dev =usbhsg_gpriv_to_dev (gpriv); +int state =usbhs_status_get_device_state (irq_state); gpriv->gadget.speed =usbhs_bus_get_speed (priv); -dev_dbg (dev,"state = %x : speed : %d\n" , -usbhs_status_get_device_state (irq_state), - gpriv->gadget.speed); +dev_dbg (dev,"state = %x : speed : %d\n" , state, gpriv->gadget.speed); + +if (gpriv->gadget.speed !=USB_SPEED_UNKNOWN && + (state &SUSPENDED_STATE )) { +if (gpriv->driver && gpriv->driver->suspend) + gpriv->driver->suspend (&gpriv->gadget); +usb_gadget_set_state (&gpriv->gadget,USB_STATE_SUSPENDED ); + }return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 41/161 hwrng: omap3-rom - Call clk_disable_unprepare() on exit only if not idled
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit eaecce12f5f0d2c35d278e41e1bc4522393861ab ]
When unloading omap3-rom-rng, we'll get the following:
WARNING: CPU: 0 PID: 100 at drivers/clk/clk.c:948 clk_core_disable
This is because the clock may be already disabled by omap3_rom_rng_idle(). Let's fix the issue by checking for rng_idle on exit.
--- drivers/char/hw_random/omap3-rom-rng.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/hw_random/omap3-rom-rng.c +2 -1
@@ -121,7 +121,8 @@ static int omap3_rom_rng_remove(struct platform_device *pdev) {cancel_delayed_work_sync (&idle_work);hwrng_unregister (&omap3_rom_rng_ops); -clk_disable_unprepare (rng_clk); +if (!rng_idle) +clk_disable_unprepare (rng_clk);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 42/161 regulator: max8907: Fix the usage of uninitialized variable in max8907_regulator_probe()
In reply to Greg Kroah-HartmanFrom: Yizhuo <[email protected]>
[ Upstream commit 472b39c3d1bba0616eb0e9a8fa3ad0f56927c7d7 ]
Inside function max8907_regulator_probe(), variable val could be uninitialized if regmap_read() fails. However, val is used later in the if statement to decide the content written to "pmic", which is potentially unsafe.
--- drivers/regulator/max8907-regulator.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/regulator/max8907-regulator.c +12 -3
@@ -299,7 +299,10 @@ static int max8907_regulator_probe(struct platform_device *pdev)memcpy (pmic->desc, max8907_regulators,sizeof (pmic->desc));/* Backwards compatibility with MAX8907B; SD1 uses different voltages */ -regmap_read (max8907->regmap_gen,MAX8907_REG_II2RR , &val); + ret =regmap_read (max8907->regmap_gen,MAX8907_REG_II2RR , &val); +if (ret) +return ret; +if ((val &MAX8907_II2RR_VERSION_MASK ) ==MAX8907_II2RR_VERSION_REV_B ) { pmic->desc[MAX8907_SD1 ].min_uV =637500 ;
@@ -336,14 +339,20 @@ static int max8907_regulator_probe(struct platform_device *pdev) }if (pmic->desc[i].ops == &max8907_ldo_ops) { -regmap_read (config.regmap, pmic->desc[i].enable_reg, + ret =regmap_read (config.regmap, pmic->desc[i].enable_reg, &val); +if (ret) +return ret; +if ((val &MAX8907_MASK_LDO_SEQ ) !=MAX8907_MASK_LDO_SEQ ) pmic->desc[i].ops = &max8907_ldo_hwctl_ops; }else if (pmic->desc[i].ops == &max8907_out5v_ops) { -regmap_read (config.regmap, pmic->desc[i].enable_reg, + ret =regmap_read (config.regmap, pmic->desc[i].enable_reg, &val); +if (ret) +return ret; +if ((val & (MAX8907_MASK_OUT5V_VINEN |MAX8907_MASK_OUT5V_ENSRC )) !=MAX8907_MASK_OUT5V_ENSRC )
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 43/161 media: flexcop-usb: fix NULL-ptr deref in flexcop_usb_transfer_init()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 649cd16c438f51d4cd777e71ca1f47f6e0c5e65d ]
If usb_set_interface() failed, iface->cur_altsetting will not be assigned and it will be used in flexcop_usb_transfer_init() It may lead a NULL pointer dereference.
Check usb_set_interface() return value in flexcop_usb_init() and return failed to avoid using this NULL pointer.
--- drivers/media/usb/b2c2/flexcop-usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/usb/b2c2/flexcop-usb.c +7 -1
@@ -503,7 +503,13 @@ urb_error:static int flexcop_usb_init (struct flexcop_usb *fc_usb) {/* use the alternate setting with the larges buffer */ -usb_set_interface (fc_usb->udev,0 ,1 ); +int ret =usb_set_interface (fc_usb->udev,0 ,1 ); + +if (ret) { +err ("set interface failed." ); +return ret; + } +switch (fc_usb->udev->speed) {case USB_SPEED_LOW :err ("cannot handle USB speed because it is too slow." );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 44/161 media: cec-funcs.h: add status_req checks
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 9b211f9c5a0b67afc435b86f75d78273b97db1c5 ]
The CEC_MSG_GIVE_DECK_STATUS and CEC_MSG_GIVE_TUNER_DEVICE_STATUS commands both have a status_req argument: ON, OFF, ONCE. If ON or ONCE, then the follower will reply with a STATUS message. Either once or whenever the status changes (status_req == ON).
If status_req == OFF, then it will stop sending continuous status updates, but the follower will *not* send a STATUS message in that case.
This means that if status_req == OFF, then msg->reply should be 0 as well since no reply is expected in that case.
--- include/uapi/linux/cec-funcs.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/uapi/linux/cec-funcs.h +4 -2
@@ -952,7 +952,8 @@ static inline void cec_msg_give_deck_status(struct cec_msg *msg, msg->len =3 ; msg->msg[1 ] =CEC_MSG_GIVE_DECK_STATUS ; msg->msg[2 ] = status_req; - msg->reply = reply ?CEC_MSG_DECK_STATUS :0 ; + msg->reply = (reply && status_req !=CEC_OP_STATUS_REQ_OFF ) ? +CEC_MSG_DECK_STATUS :0 ; } static inline void cec_ops_give_deck_status(const struct cec_msg *msg,
@@ -1056,7 +1057,8 @@ static inline void cec_msg_give_tuner_device_status(struct cec_msg *msg, msg->len =3 ; msg->msg[1 ] =CEC_MSG_GIVE_TUNER_DEVICE_STATUS ; msg->msg[2 ] = status_req; - msg->reply = reply ?CEC_MSG_TUNER_DEVICE_STATUS :0 ; + msg->reply = (reply && status_req !=CEC_OP_STATUS_REQ_OFF ) ? +CEC_MSG_TUNER_DEVICE_STATUS :0 ; } static inline void cec_ops_give_tuner_device_status(const struct cec_msg *msg,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 45/161 drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller
In reply to Greg Kroah-HartmanFrom: Matthias Kaehlcke <[email protected]>
[ Upstream commit bee447e224b2645911c5d06e35dc90d8433fcef6 ]
The DDC/CI protocol involves sending a multi-byte request to the display via I2C, which is typically followed by a multi-byte response. The internal I2C controller only allows single byte reads/writes or reads of 8 sequential bytes, hence DDC/CI is not supported when the internal I2C controller is used. The I2C transfers complete without errors, however the data in the response is garbage. Abort transfers to/from slave address 0x37 (DDC) with -EOPNOTSUPP, to make it evident that the communication is failing.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +10 -0
@@ -39,6 +39,7 @@#include <media/cec-notifier.h> +#define DDC_CI_ADDR 0x37#define DDC_SEGMENT_ADDR 0x30#define HDMI_EDID_LEN 512
@@ -320,6 +321,15 @@ static int dw_hdmi_i2c_xfer(struct i2c_adapter *adap,u8 addr = msgs[0 ].addr;int i, ret =0 ; +if (addr ==DDC_CI_ADDR ) +/* +* The internal I2C controller does not support the multi-byte +* read and write operations needed for DDC/CI. +* TOFIX: Blacklist the DDC/CI address until we filter out +* unsupported I2C operations. +*/ +return -EOPNOTSUPP ; +dev_dbg (hdmi->dev,"xfer: num: %d, addr: %#x\n" , num, addr);for (i =0 ; i < num; i++) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 46/161 samples: pktgen: fix proc_cmd command result check logic
In reply to Greg Kroah-HartmanFrom: Daniel T. Lee <[email protected]>
[ Upstream commit 3cad8f911575191fb3b81d8ed0e061e30f922223 ]
Currently, proc_cmd is used to dispatch command to 'pg_ctrl', 'pg_thread', 'pg_set'. proc_cmd is designed to check command result with grep the "Result:", but this might fail since this string is only shown in 'pg_thread' and 'pg_set'.
This commit fixes this logic by grep-ing the "Result:" string only when the command is not for 'pg_ctrl'.
For clarity of an execution flow, 'errexit' flag has been set.
To cleanup pktgen on exit, trap has been added for EXIT signal.
--- samples/pktgen/functions.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
samples/pktgen/functions.sh +11 -6
@@ -5,6 +5,8 @@ # Author: Jesper Dangaaard Brouer # License: GPL +set -o errexit + ## -- General shell logging cmds -- function err() { local exitcode=$1
@@ -58,6 +60,7 @@ function pg_set() { function proc_cmd() { local result local proc_file=$1 + local status=0 # after shift, the remaining args are contained in $@ shift local proc_ctrl=${PROC_DIR}/$proc_file
@@ -73,13 +76,13 @@ function proc_cmd() { echo "cmd: $@ > $proc_ctrl" fi # Quoting of "$@" is important for space expansion - echo "$@" > "$proc_ctrl" - local status=$? + echo "$@" > "$proc_ctrl" || status=$? - result=$(grep "Result: OK:" $proc_ctrl) - # Due to pgctrl, cannot use exit code $? from grep - if [[ "$result" == "" ]]; then - grep "Result:" $proc_ctrl >&2 + if [[ "$proc_file" != "pgctrl" ]]; then + result=$(grep "Result: OK:" $proc_ctrl) || true + if [[ "$result" == "" ]]; then + grep "Result:" $proc_ctrl >&2 + fi fi if (( $status != 0 )); then err 5 "Write error($status) occurred cmd: \"$@ > $proc_ctrl\""
@@ -105,6 +108,8 @@ function pgset() { fi } +[[ $EUID -eq 0 ]] && trap 'pg_ctrl "reset"' EXIT + ## -- General shell tricks -- function root_check_run_with_sudo() {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 47/161 block: Fix writeback throttling W=1 compiler warnings
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 1d200e9d6f635ae894993a7d0f1b9e0b6e522e3b ]
Fix the following compiler warnings:
In file included from ./include/linux/bitmap.h:9,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/processor.h:21,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:38,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:78,
from ./include/linux/spinlock.h:51,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:6,
from ./include/linux/mm.h:10,
from ./include/linux/bvec.h:13,
from ./include/linux/blk_types.h:10,
from block/blk-wbt.c:23:
In function 'strncpy',
inlined from 'perf_trace_wbt_stat' at ./include/trace/events/wbt.h:15:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'perf_trace_wbt_lat' at ./include/trace/events/wbt.h:58:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'perf_trace_wbt_step' at ./include/trace/events/wbt.h:87:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'perf_trace_wbt_timer' at ./include/trace/events/wbt.h:126:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'trace_event_raw_event_wbt_stat' at ./include/trace/events/wbt.h:15:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'trace_event_raw_event_wbt_lat' at ./include/trace/events/wbt.h:58:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'trace_event_raw_event_wbt_timer' at ./include/trace/events/wbt.h:126:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'strncpy',
inlined from 'trace_event_raw_event_wbt_step' at ./include/trace/events/wbt.h:87:1:
./include/linux/string.h:260:9: warning: '__builtin_strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
return __builtin_strncpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- include/trace/events/wbt.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
include/trace/events/wbt.h +8 -4
@@ -33,7 +33,8 @@ TRACE_EVENT(wbt_stat, ),TP_fast_assign ( - strncpy(__entry->name, dev_name(bdi->dev), 32); +strlcpy (__entry->name,dev_name (bdi->dev), + ARRAY_SIZE(__entry->name)); __entry->rmean = stat[0 ].mean; __entry->rmin = stat[0 ].min; __entry->rmax = stat[0 ].max;
@@ -67,7 +68,8 @@ TRACE_EVENT(wbt_lat, ),TP_fast_assign ( - strncpy(__entry->name, dev_name(bdi->dev), 32); +strlcpy (__entry->name,dev_name (bdi->dev), + ARRAY_SIZE(__entry->name)); __entry->lat =div_u64 (lat,1000 ); ),
@@ -103,7 +105,8 @@ TRACE_EVENT(wbt_step, ),TP_fast_assign ( - strncpy(__entry->name, dev_name(bdi->dev), 32); +strlcpy (__entry->name,dev_name (bdi->dev), + ARRAY_SIZE(__entry->name)); __entry->msg = msg; __entry->step = step; __entry->window =div_u64 (window,1000 );
@@ -138,7 +141,8 @@ TRACE_EVENT(wbt_timer, ),TP_fast_assign ( - strncpy(__entry->name, dev_name(bdi->dev), 32); +strlcpy (__entry->name,dev_name (bdi->dev), + ARRAY_SIZE(__entry->name)); __entry->status = status; __entry->step = step; __entry->inflight = inflight;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 48/161 mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
In reply to Greg Kroah-HartmanFrom: Navid Emamdoost <[email protected]>
[ Upstream commit d10dcb615c8e29d403a24d35f8310a7a53e3050c ]
In mwifiex_pcie_init_evt_ring, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release for skb and card->evtbd_ring_vbase is added.
--- drivers/net/wireless/marvell/mwifiex/pcie.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +4 -1
@@ -677,8 +677,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter)skb_put (skb,MAX_EVENT_SIZE );if (mwifiex_map_pci_memory (adapter, skb,MAX_EVENT_SIZE , -PCI_DMA_FROMDEVICE )) +PCI_DMA_FROMDEVICE )) { +kfree_skb (skb); +kfree (card->evtbd_ring_vbase);return -1 ; + } buf_pa =MWIFIEX_SKB_DMA_ADDR (skb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 49/161 media: cx88: Fix some error handling path in cx8800_initdev()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit e1444e9b0424c70def6352580762d660af50e03f ]
A call to 'pci_disable_device()' is missing in the error handling path. In some cases, a call to 'free_irq()' may also be missing.
Reorder the error handling path, add some new labels and fix the 2 issues mentionned above.
This way, the error handling path in more in line with 'cx8800_finidev()' (i.e. the remove function)
--- drivers/media/pci/cx88/cx88-video.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/media/pci/cx88/cx88-video.c +7 -4
@@ -1310,7 +1310,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, core =cx88_core_get (dev->pci);if (!core) { err = -EINVAL ; - goto fail_free; + goto fail_disable; } dev->core = core;
@@ -1356,7 +1356,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, cc->step, cc->default_value);if (!vc) { err = core->audio_hdl.error; - goto fail_core; + goto fail_irq; } vc->priv = (void *)cc; }
@@ -1370,7 +1370,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, cc->step, cc->default_value);if (!vc) { err = core->video_hdl.error; - goto fail_core; + goto fail_irq; } vc->priv = (void *)cc;if (vc->id ==V4L2_CID_CHROMA_AGC )
@@ -1533,11 +1533,14 @@ static int cx8800_initdev(struct pci_dev *pci_dev, fail_unreg:cx8800_unregister_video (dev); -free_irq (pci_dev->irq, dev);mutex_unlock (&core->lock); +fail_irq: +free_irq (pci_dev->irq, dev); fail_core: core->v4ldev =NULL ;cx88_core_put (core, dev->pci); +fail_disable: +pci_disable_device (pci_dev); fail_free:kfree (dev);return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 50/161 media: ti-vpe: vpe: Fix Motion Vector vpdma stride
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 102af9b9922f658f705a4b0deaccabac409131bf ]
commit 3dc2046ca78b ("[media] media: ti-vpe: vpe: allow use of user specified stride") and commit da4414eaed15 ("[media] media: ti-vpe: vpdma:
add support for user specified stride") resulted in the Motion Vector stride to be the same as the image stride.
This caused memory corruption in the output image as mentioned in commit 00db969964c8 ("[media] media: ti-vpe: vpe: Fix line stride for output motion vector").
--- drivers/media/platform/ti-vpe/vpe.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/media/platform/ti-vpe/vpe.c +13 -5
@@ -1044,11 +1044,14 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port)dma_addr_t dma_addr;u32 flags =0 ;u32 offset =0 ; +u32 stride;if (port ==VPE_PORT_MV_OUT ) { vpdma_fmt = &vpdma_misc_fmts[VPDMA_DATA_FMT_MV ]; dma_addr = ctx->mv_buf_dma[mv_buf_selector]; q_data = &ctx->q_data[Q_DATA_SRC ]; + stride =ALIGN ((q_data->width * vpdma_fmt->depth) >>3 , +VPDMA_STRIDE_ALIGN ); }else {/* to incorporate interleaved formats */ int plane = fmt->coplanar ? p_data->vb_part :0 ;
@@ -1075,6 +1078,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) }/* Apply the offset */ dma_addr += offset; + stride = q_data->bytesperline[VPE_LUMA ]; }if (q_data->flags &Q_DATA_FRAME_1D )
@@ -1086,7 +1090,7 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) MAX_W, MAX_H);vpdma_add_out_dtd (&ctx->desc_list, q_data->width, - q_data->bytesperline[VPE_LUMA ], &q_data->c_rect, + stride, &q_data->c_rect, vpdma_fmt, dma_addr,MAX_OUT_WIDTH_REG1 ,MAX_OUT_HEIGHT_REG1 , p_data->channel, flags); }
@@ -1105,10 +1109,13 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port)dma_addr_t dma_addr;u32 flags =0 ;u32 offset =0 ; +u32 stride;if (port ==VPE_PORT_MV_IN ) { vpdma_fmt = &vpdma_misc_fmts[VPDMA_DATA_FMT_MV ]; dma_addr = ctx->mv_buf_dma[mv_buf_selector]; + stride =ALIGN ((q_data->width * vpdma_fmt->depth) >>3 , +VPDMA_STRIDE_ALIGN ); }else {/* to incorporate interleaved formats */ int plane = fmt->coplanar ? p_data->vb_part :0 ;
@@ -1135,6 +1142,7 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) }/* Apply the offset */ dma_addr += offset; + stride = q_data->bytesperline[VPE_LUMA ];if (q_data->flags &Q_DATA_INTERLACED_SEQ_TB ) {/*
@@ -1170,10 +1178,10 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port)if (p_data->vb_part && fmt->fourcc ==V4L2_PIX_FMT_NV12 ) frame_height /=2 ; -vpdma_add_in_dtd (&ctx->desc_list, q_data->width, - q_data->bytesperline[VPE_LUMA ], &q_data->c_rect, - vpdma_fmt, dma_addr, p_data->channel, field, flags, frame_width, - frame_height,0 ,0 ); +vpdma_add_in_dtd (&ctx->desc_list, q_data->width, stride, + &q_data->c_rect, vpdma_fmt, dma_addr, + p_data->channel, field, flags, frame_width, + frame_height,0 ,0 ); }/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 51/161 media: ti-vpe: vpe: fix a v4l2-compliance warning about invalid pixel format
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 06bec72b250b2cb3ba96fa45c2b8e0fb83745517 ]
v4l2-compliance warns with this message:
warn: v4l2-test-formats.cpp(717): \
TRY_FMT cannot handle an invalid pixelformat.
warn: v4l2-test-formats.cpp(718): \
This may or may not be a problem. For more information see:
warn: v4l2-test-formats.cpp(719): \
http://www.mail-archive.com/[email protected]/msg56550.html
...
test VIDIOC_TRY_FMT: FAIL
We need to make sure that the returns a valid pixel format in all instance. Based on the v4l2 framework convention drivers must return a valid pixel format when the requested pixel format is either invalid or not supported.
--- drivers/media/platform/ti-vpe/vpe.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/media/platform/ti-vpe/vpe.c +9 -4
@@ -352,20 +352,25 @@ enum { };/* find our format description corresponding to the passed v4l2_format */ -static struct vpe_fmt *find_format (struct v4l2_format *f) +static struct vpe_fmt *__find_format (u32 fourcc) {struct vpe_fmt *fmt;unsigned int k;for (k =0 ; k <ARRAY_SIZE (vpe_formats); k++) { fmt = &vpe_formats[k]; -if (fmt->fourcc == f->fmt.pix.pixelformat) +if (fmt->fourcc == fourcc)return fmt; }return NULL ; } +static struct vpe_fmt *find_format (struct v4l2_format *f) +{ +return __find_format (f->fmt.pix.pixelformat); +} +/* * there is one vpe_dev structure in the driver, it is shared by * all instances.
@@ -1608,9 +1613,9 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,unsigned int stride =0 ;if (!fmt || !(fmt->types & type)) { -vpe_err (ctx->dev,"Fourcc format (0x%08x) invalid.\n" , +vpe_dbg (ctx->dev,"Fourcc format (0x%08x) invalid.\n" , pix->pixelformat); -return -EINVAL ; + fmt =__find_format (V4L2_PIX_FMT_YUYV ); } if (pix->field != V4L2_FIELD_NONE && pix->field != V4L2_FIELD_ALTERNATE
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 52/161 media: ti-vpe: vpe: fix a v4l2-compliance failure about frame sequence number
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 2444846c0dbfa4ead21b621e4300ec32c90fbf38 ]
v4l2-compliance fails with this message:
fail: v4l2-test-buffers.cpp(294): \ (int)g_sequence() < seq.last_seq + 1 fail: v4l2-test-buffers.cpp(740): \ buf.check(m2m_q, last_m2m_seq)
fail: v4l2-test-buffers.cpp(974): \
captureBufs(node, q, m2m_q, frame_count, true)
test MMAP: FAIL
The driver is failing to update the source frame sequence number in the vb2 buffer object. Only the destination frame sequence was being updated.
This is only a reporting issue if the user space app actually cares about the frame sequence number. But it is fixed nonetheless.
--- drivers/media/platform/ti-vpe/vpe.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/ti-vpe/vpe.c +1 -0
@@ -1448,6 +1448,7 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) d_vb->timecode = s_vb->timecode; d_vb->sequence = ctx->sequence; + s_vb->sequence = ctx->sequence; d_q_data = &ctx->q_data[Q_DATA_DST ];if (d_q_data->flags &Q_IS_INTERLACED ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 53/161 media: ti-vpe: vpe: Make sure YUYV is set as default format
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit e20b248051ca0f90d84b4d9378e4780bc31f16c6 ]
v4l2-compliance fails with this message:
fail: v4l2-test-formats.cpp(672): \ Video Capture Multiplanar: TRY_FMT(G_FMT) != G_FMT fail: v4l2-test-formats.cpp(672): \ Video Output Multiplanar: TRY_FMT(G_FMT) != G_FMT ...
test VIDIOC_TRY_FMT: FAIL
The default pixel format was setup as pointing to a specific offset in the vpe_formats table assuming it was pointing to the V4L2_PIX_FMT_YUYV entry. This became false after the addition on the NV21 format (see above commid-id)
So instead of hard-coding an offset which might change over time we need to use a lookup helper instead so we know the default will always be what we intended.
--- drivers/media/platform/ti-vpe/vpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/ti-vpe/vpe.c +1 -1
@@ -2322,7 +2322,7 @@ static int vpe_open(struct file *file)v4l2_ctrl_handler_setup (hdl); s_q_data = &ctx->q_data[Q_DATA_SRC ]; - s_q_data->fmt = &vpe_formats[2 ]; + s_q_data->fmt =__find_format (V4L2_PIX_FMT_YUYV ); s_q_data->width =1920 ; s_q_data->height =1080 ; s_q_data->nplanes =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 54/161 media: ti-vpe: vpe: fix a v4l2-compliance failure causing a kernel panic
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit a37980ac5be29b83da67bf7d571c6bd9f90f8e45 ]
v4l2-compliance fails with this message:
warn: v4l2-test-formats.cpp(717): \
TRY_FMT cannot handle an invalid pixelformat.
test VIDIOC_TRY_FMT: FAIL
This causes the following kernel panic:
Unable to handle kernel paging request at virtual address 56595561 pgd = ecd80e00 *pgd=00000000 Internal error: Oops: 205 [#1] PREEMPT SMP ARM ... CPU: 0 PID: 930 Comm: v4l2-compliance Not tainted \ 4.14.62-01715-gc8cd67f49a19 #1 Hardware name: Generic DRA72X (Flattened Device Tree)
task: ece44d80 task.stack: ecc6e000
PC is at __vpe_try_fmt+0x18c/0x2a8 [ti_vpe]
LR is at 0x8
Because the driver fails to properly check the 'num_planes' values for proper ranges it ends up accessing out of bound data causing the kernel panic.
Since this driver only handle single or dual plane pixel format, make sure the provided value does not exceed 2 planes.
--- drivers/media/platform/ti-vpe/vpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/ti-vpe/vpe.c +1 -1
@@ -1663,7 +1663,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, &pix->height,MIN_H ,MAX_H ,H_ALIGN , S_ALIGN); -if (!pix->num_planes) +if (!pix->num_planes || pix->num_planes >2 ) pix->num_planes = fmt->coplanar ?2 :1 ;else if (pix->num_planes >1 && !fmt->coplanar) pix->num_planes =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 55/161 media: ti-vpe: vpe: ensure buffers are cleaned up properly in abort cases
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit cf6acb73b050e98b5cc435fae0e8ae0157520410 ]
v4l2-compliance fails with this message:
fail: v4l2-test-buffers.cpp(691): ret == 0
fail: v4l2-test-buffers.cpp(974): captureBufs(node, q, m2m_q,frame_count, true)
test MMAP: FAIL
This caused the following Kernel Warning:
WARNING: CPU: 0 PID: 961 at drivers/media/v4l2-core/videobuf2-core.c:1658 __vb2_queue_cancel+0x174/0x1d8 ... CPU: 0 PID: 961 Comm: v4l2-compliance Not tainted 4.14.62-01720-g20ecd717e87a #6 Hardware name: Generic DRA72X (Flattened Device Tree) Backtrace: [<c020b5bc>] (dump_backtrace) from [<c020b8a0>] (show_stack+0x18/0x1c) r7:00000009 r6:60070013 r5:00000000 r4:c1053824 [<c020b888>] (show_stack) from [<c09232e8>] (dump_stack+0x90/0xa4) [<c0923258>] (dump_stack) from [<c022b740>] (__warn+0xec/0x104) r7:00000009 r6:c0c0ad50 r5:00000000 r4:00000000 [<c022b654>] (__warn) from [<c022b810>] (warn_slowpath_null+0x28/0x30) r9:00000008 r8:00000000 r7:eced4808 r6:edbc9bac r5:eced4844
r4:eced4808
[<c022b7e8>] (warn_slowpath_null) from [<c0726f48>] (__vb2_queue_cancel+0x174/0x1d8)
[<c0726dd4>] (__vb2_queue_cancel) from [<c0727648>] (vb2_core_queue_release+0x20/0x40)
r10:ecc7bd70 r9:00000008 r8:00000000 r7:edb73010 r6:edbc9bac
r5:eced4844
r4:eced4808 r3:00000004
[<c0727628>] (vb2_core_queue_release) from [<c0729528>] (vb2_queue_release+0x10/0x14)
r5:edbc9810 r4:eced4800
[<c0729518>] (vb2_queue_release) from [<c0724d08>] (v4l2_m2m_ctx_release+0x1c/0x30)
[<c0724cec>] (v4l2_m2m_ctx_release) from [<bf0e8f28>] (vpe_release+0x74/0xb0 [ti_vpe])
r5:edbc9810 r4:ed67a400
[<bf0e8eb4>] (vpe_release [ti_vpe]) from [<c070fccc>] (v4l2_release+0x3c/0x80)
r7:edb73010 r6:ed176aa0 r5:edbc9868 r4:ed5119c0
[<c070fc90>] (v4l2_release) from [<c033cf1c>] (__fput+0x8c/0x1dc)
r5:ecc7bd70 r4:ed5119c0
[<c033ce90>] (__fput) from [<c033d0cc>] (____fput+0x10/0x14)
r10:00000000 r9:ed5119c0 r8:ece392d0 r7:c1059544 r6:ece38d80
r5:ece392b4
r4:00000000
[<c033d0bc>] (____fput) from [<c0246e00>] (task_work_run+0x98/0xb8) [<c0246d68>] (task_work_run) from [<c022f1d8>] (do_exit+0x170/0xa80)
r9:ece351fc r8:00000000 r7:ecde3f58 r6:ffffe000 r5:ece351c0
r4:ece38d80
[<c022f068>] (do_exit) from [<c022fb6c>] (do_group_exit+0x48/0xc4)
r7:000000f8
[<c022fb24>] (do_group_exit) from [<c022fc00>] (__wake_up_parent+0x0/0x28)
r7:000000f8 r6:b6c6a798 r5:00000001 r4:00000001
[<c022fbe8>] (SyS_exit_group) from [<c0207c80>] (ret_fast_syscall+0x0/0x4c)
These warnings are caused by buffers which not properly cleaned up/release during an abort use case.
In the abort cases the VPDMA desc buffers would still be mapped and the in-flight VB2 buffers would not be released properly causing a kernel warning from being generated by the videobuf2-core level.
--- drivers/media/platform/ti-vpe/vpe.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/media/platform/ti-vpe/vpe.c +9 -3
@@ -1435,9 +1435,6 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data)/* the previous dst mv buffer becomes the next src mv buffer */ ctx->src_mv_buf_selector = !ctx->src_mv_buf_selector; -if (ctx->aborting) - goto finished; - s_vb = ctx->src_vbs[0 ]; d_vb = ctx->dst_vb;
@@ -1502,6 +1499,9 @@ static irqreturn_t vpe_irq(int irq_vpe, void *data) ctx->src_vbs[0 ] =NULL ; ctx->dst_vb =NULL ; +if (ctx->aborting) + goto finished; + ctx->bufs_completed++;if (ctx->bufs_completed < ctx->bufs_per_job &&job_ready (ctx)) {device_run (ctx);
@@ -2400,6 +2400,12 @@ static int vpe_release(struct file *file)mutex_lock (&dev->dev_mutex);free_mv_buffers (ctx); + +vpdma_unmap_desc_buf (dev->vpdma, &ctx->desc_list.buf); +vpdma_unmap_desc_buf (dev->vpdma, &ctx->mmr_adb); +vpdma_unmap_desc_buf (dev->vpdma, &ctx->sc_coeff_h); +vpdma_unmap_desc_buf (dev->vpdma, &ctx->sc_coeff_v); +vpdma_free_desc_list (&ctx->desc_list);vpdma_free_desc_buf (&ctx->mmr_adb);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 56/161 media: ti-vpe: vpe: fix a v4l2-compliance failure about invalid sizeimage
In reply to Greg Kroah-HartmanFrom: Benoit Parrot <[email protected]>
[ Upstream commit 0bac73adea4df8d34048b38f6ff24dc3e73e90b6 ]
v4l2-compliance fails with this message:
fail: v4l2-test-formats.cpp(463): !pfmt.sizeimage
fail: v4l2-test-formats.cpp(736): \ Video Capture Multiplanar is valid, \ but TRY_FMT failed to return a format
test VIDIOC_TRY_FMT: FAIL
This failure is causd by the driver failing to handle out range 'bytesperline' values from user space applications.
VPDMA hardware is limited to 64k line stride (16 bytes aligned, so 65520 bytes). So make sure the provided or calculated 'bytesperline' is smaller than the maximum value.
--- drivers/media/platform/ti-vpe/vpdma.h | 1 + drivers/media/platform/ti-vpe/vpe.c | 4 ++++ 2 files changed, 5 insertions(+)
drivers/media/platform/ti-vpe/vpdma.h +1 -0
@@ -60,6 +60,7 @@ struct vpdma_data_format {* line stride of source and dest * buffers should be 16 byte aligned */ +#define VPDMA_MAX_STRIDE 65520/* Max line stride 16 byte aligned */ #define VPDMA_DTD_DESC_SIZE 32/* 8 words */ #define VPDMA_CFD_CTD_DESC_SIZE 16/* 4 words */
drivers/media/platform/ti-vpe/vpe.c +4 -0
@@ -1702,6 +1702,10 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f,if (stride > plane_fmt->bytesperline) plane_fmt->bytesperline = stride; + plane_fmt->bytesperline =clamp_t (u32, plane_fmt->bytesperline, + stride, +VPDMA_MAX_STRIDE ); + plane_fmt->bytesperline =ALIGN (plane_fmt->bytesperline,VPDMA_STRIDE_ALIGN );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 57/161 extcon: sm5502: Reset registers during initialization
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 6942635032cfd3e003e980d2dfa4e6323a3ce145 ]
On some devices (e.g. Samsung Galaxy A5 (2015)), the bootloader seems to keep interrupts enabled for SM5502 when booting Linux. Changing the cable state (i.e. plugging in a cable) - until the driver is loaded - will therefore produce an interrupt that is never read.
In this situation, the cable state will be stuck forever on the initial state because SM5502 stops sending interrupts. This can be avoided by clearing those pending interrupts after the driver has been loaded.
One way to do this is to reset all registers to default state by writing to SM5502_REG_RESET. This ensures that we start from a clean state, with all interrupts disabled.
--- drivers/extcon/extcon-sm5502.c | 4 ++++ drivers/extcon/extcon-sm5502.h | 2 ++ 2 files changed, 6 insertions(+)
drivers/extcon/extcon-sm5502.c +4 -0
@@ -69,6 +69,10 @@ struct sm5502_muic_info {/* Default value of SM5502 register to bring up MUIC device. */ static struct reg_data sm5502_reg_data[] = { { + .reg =SM5502_REG_RESET , + .val =SM5502_REG_RESET_MASK , + .invert = true, + }, { .reg =SM5502_REG_CONTROL , .val =SM5502_REG_CONTROL_MASK_INT_MASK , .invert = false,
drivers/extcon/extcon-sm5502.h +2 -0
@@ -241,6 +241,8 @@ enum sm5502_reg {#define DM_DP_SWITCH_UART ((DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DP_SHIFT) \ | (DM_DP_CON_SWITCH_UART <<SM5502_REG_MANUAL_SW1_DM_SHIFT)) +#define SM5502_REG_RESET_MASK (0x1) +/* SM5502 Interrupts */ enum sm5502_irq {/* INT1 */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 58/161 x86/mm: Use the correct function type for native_set_fixmap()
In reply to Greg Kroah-HartmanFrom: Sami Tolvanen <[email protected]>
[ Upstream commit f53e2cd0b8ab7d9e390414470bdbd830f660133f ]
We call native_set_fixmap indirectly through the function pointer struct pv_mmu_ops::set_fixmap, which expects the first parameter to be 'unsigned' instead of 'enum fixed_addresses'. This patch changes the function type for native_set_fixmap to match the pointer, which fixes indirect call mismatches with Control-Flow Integrity (CFI) checking.
--- arch/x86/include/asm/fixmap.h | 2 +- arch/x86/mm/pgtable.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/include/asm/fixmap.h +1 -1
@@ -159,7 +159,7 @@ extern pte_t *kmap_pte;extern pte_t *pkmap_page_table;void __native_set_fixmap (enum fixed_addresses idx,pte_t pte); -void native_set_fixmap (enum fixed_addresses idx, +void native_set_fixmap (unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags);#ifndef CONFIG_PARAVIRT
arch/x86/mm/pgtable.c +2 -2
@@ -590,8 +590,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte) fixmaps_set++; } -void native_set_fixmap (enum fixed_addresses idx,phys_addr_t phys, -pgprot_t flags) +void native_set_fixmap (unsigned /* enum fixed_addresses */ idx, +phys_addr_t phys,pgprot_t flags) {__native_set_fixmap (idx,pfn_pte (phys >>PAGE_SHIFT , flags)); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 59/161 drm/bridge: dw-hdmi: Restore audio when setting a mode
In reply to Greg Kroah-HartmanFrom: Daniel Kurtz <[email protected]>
[ Upstream commit fadfee3f9d8f114435a8a3e9f83a227600d89de7 ]
When setting a new display mode, dw_hdmi_setup() calls dw_hdmi_enable_video_path(), which disables all hdmi clocks, including the audio clock.
We should only (re-)enable the audio clock if audio was already enabled when setting the new mode.
Without this patch, on RK3288, there will be HDMI audio on some monitors if i2s was played to headphone when the monitor was plugged. ACER H277HU and ASUS PB278 are two of the monitors showing this issue.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
@@ -1743,7 +1743,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)/* HDMI Initialization Step E - Configure audio */ hdmi_clk_regenerator_update_pixel_clock (hdmi); -hdmi_enable_audio_clk (hdmi, true); +hdmi_enable_audio_clk (hdmi, hdmi->audio_enable); }/* not for DVI mode */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 60/161 perf test: Report failure for mmap events
In reply to Greg Kroah-HartmanFrom: Leo Yan <[email protected]>
[ Upstream commit 6add129c5d9210ada25217abc130df0b7096ee02 ]
When fail to mmap events in task exit case, it misses to set 'err' to -1; thus the testing will not report failure for it.
This patch sets 'err' to -1 when fails to mmap events, thus Perf tool can report correct result.
--- tools/perf/tests/task-exit.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/tests/task-exit.c +1 -0
@@ -104,6 +104,7 @@ int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unusedif (perf_evlist__mmap (evlist,128 , true) <0 ) {pr_debug ("failed to mmap events: %d (%s)\n" , errno,str_error_r (errno, sbuf,sizeof (sbuf))); + err =-1 ; goto out_delete_evlist; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 61/161 perf report: Add warning when libunwind not compiled in
In reply to Greg Kroah-HartmanFrom: Jin Yao <[email protected]>
[ Upstream commit 800d3f561659b5436f8c57e7c26dd1f6928b5615 ]
We received a user report that call-graph DWARF mode was enabled in 'perf record' but 'perf report' didn't unwind the callstack correctly. The reason was, libunwind was not compiled in.
We can use 'perf -vv' to check the compiled libraries but it would be valuable to report a warning to user directly (especially valuable for a perf newbie).
The warning is:
Warning:
Please install libunwind development packages during the perf build.
Both TUI and stdio are supported.
--- tools/perf/builtin-report.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/builtin-report.c +7 -0
@@ -342,6 +342,13 @@ static int report__setup_sample_type(struct report *rep) PERF_SAMPLE_BRANCH_ANY)) rep->nonany_branch_mode = true; +#ifndef HAVE_LIBUNWIND_SUPPORT +if (dwarf_callchain_users) { +ui__warning ("Please install libunwind development packages " +"during the perf build.\n" ); + } +#endif +return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 62/161 usb: usbfs: Suppress problematic bind and unbind uevents.
In reply to Greg Kroah-HartmanFrom: Ingo Rohloff <[email protected]>
[ Upstream commit abb0b3d96a1f9407dd66831ae33985a386d4200d ]
commit 1455cf8dbfd0 ("driver core: emit uevents when device is bound to a driver") added bind and unbind uevents when a driver is bound or unbound to a physical device.
For USB devices which are handled via the generic usbfs layer (via libusb for example), this is problematic:
Each time a user space program calls
ioctl(usb_fd, USBDEVFS_CLAIMINTERFACE, &usb_intf_nr);
and then later
ioctl(usb_fd, USBDEVFS_RELEASEINTERFACE, &usb_intf_nr);
The kernel will now produce a bind or unbind event, which does not really contain any useful information.
This allows a user space program to run a DoS attack against programs which listen to uevents (in particular systemd/eudev/upowerd):
A malicious user space program just has to call in a tight loop
ioctl(usb_fd, USBDEVFS_CLAIMINTERFACE, &usb_intf_nr); ioctl(usb_fd, USBDEVFS_RELEASEINTERFACE, &usb_intf_nr);
With this loop the malicious user space program floods the kernel and all programs listening to uevents with tons of bind and unbind events.
This patch suppresses uevents for ioctls USBDEVFS_CLAIMINTERFACE and USBDEVFS_RELEASEINTERFACE.
--- drivers/usb/core/devio.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/usb/core/devio.c +14 -1
@@ -755,8 +755,15 @@ static int claimintf(struct usb_dev_state *ps, unsigned int ifnum) intf =usb_ifnum_to_if (dev, ifnum);if (!intf) err = -ENOENT ; -else +else { +unsigned int old_suppress; + +/* suppress uevents while claiming interface */ + old_suppress =dev_get_uevent_suppress (&intf->dev); +dev_set_uevent_suppress (&intf->dev,1 ); err =usb_driver_claim_interface (&usbfs_driver, intf, ps); +dev_set_uevent_suppress (&intf->dev, old_suppress); + }if (err ==0 )set_bit (ifnum, &ps->ifclaimed);return err;
@@ -776,7 +783,13 @@ static int releaseintf(struct usb_dev_state *ps, unsigned int ifnum)if (!intf) err = -ENOENT ;else if (test_and_clear_bit (ifnum, &ps->ifclaimed)) { +unsigned int old_suppress; + +/* suppress uevents while releasing interface */ + old_suppress =dev_get_uevent_suppress (&intf->dev); +dev_set_uevent_suppress (&intf->dev,1 );usb_driver_release_interface (&usbfs_driver, intf); +dev_set_uevent_suppress (&intf->dev, old_suppress); err =0 ; }return err;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 63/161 iio: adc: max1027: Reset the device at probe time
In reply to Greg Kroah-HartmanFrom: Miquel Raynal <[email protected]>
[ Upstream commit db033831b4f5589f9fcbadb837614a7c4eac0308 ]
All the registers are configured by the driver, let's reset the chip at probe time, avoiding any conflict with a possible earlier configuration.
--- drivers/iio/adc/max1027.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iio/adc/max1027.c +8 -0
@@ -462,6 +462,14 @@ static int max1027_probe(struct spi_device *spi) goto fail_dev_register; } +/* Internal reset */ + st->reg =MAX1027_RST_REG ; + ret =spi_write (st->spi, &st->reg,1 ); +if (ret <0 ) { +dev_err (&indio_dev->dev,"Failed to reset the ADC\n" ); +return ret; + } +/* Disable averaging */ st->reg =MAX1027_AVG_REG ; ret =spi_write (st->spi, &st->reg,1 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 64/161 Bluetooth: missed cpu_to_le16 conversion in hci_init4_req
In reply to Greg Kroah-HartmanFrom: Ben Dooks (Codethink) <[email protected]>
[ Upstream commit 727ea61a5028f8ac96f75ab34cb1b56e63fd9227 ]
It looks like in hci_init4_req() the request is being initialised from cpu-endian data but the packet is specified to be little-endian. This causes an warning from sparse due to __le16 to u16 conversion.
Fix this by using cpu_to_le16() on the two fields in the packet.
net/bluetooth/hci_core.c:845:27: warning: incorrect type in assignment (different base types)net/bluetooth/hci_core.c:845:27: expected restricted __le16 [usertype] tx_lennet/bluetooth/hci_core.c:845:27: got unsigned short [usertype] le_max_tx_lennet/bluetooth/hci_core.c:846:28: warning: incorrect type in assignment (different base types)net/bluetooth/hci_core.c:846:28: expected restricted __le16 [usertype] tx_timenet/bluetooth/hci_core.c:846:28: got unsigned short [usertype] le_max_tx_time
--- net/bluetooth/hci_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +2 -2
@@ -802,8 +802,8 @@ static int hci_init4_req(struct hci_request *req, unsigned long opt)if (hdev->le_features[0 ] &HCI_LE_DATA_LEN_EXT ) {struct hci_cp_le_write_def_data_len cp; - cp.tx_len = hdev->le_max_tx_len; - cp.tx_time = hdev->le_max_tx_time; + cp.tx_len =cpu_to_le16 (hdev->le_max_tx_len); + cp.tx_time =cpu_to_le16 (hdev->le_max_tx_time);hci_req_add (req,HCI_OP_LE_WRITE_DEF_DATA_LEN ,sizeof (cp), &cp); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 65/161 Bluetooth: hci_core: fix init for HCI_USER_CHANNEL
In reply to Greg Kroah-HartmanFrom: Mattijs Korpershoek <[email protected]>
[ Upstream commit eb8c101e28496888a0dcfe16ab86a1bee369e820 ]
During the setup() stage, HCI device drivers expect the chip to acknowledge its setup() completion via vendor specific frames.
If userspace opens() such HCI device in HCI_USER_CHANNEL [1] mode, the vendor specific frames are never tranmitted to the driver, as they are filtered in hci_rx_work().
Allow HCI devices which operate in HCI_USER_CHANNEL mode to receive frames if the HCI device is is HCI_INIT state.
[1] https://www.spinics.net/lists/linux-bluetooth/msg37345.html
--- net/bluetooth/hci_core.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/bluetooth/hci_core.c +8 -1
@@ -4215,7 +4215,14 @@ static void hci_rx_work(struct work_struct *work)hci_send_to_sock (hdev, skb); } -if (hci_dev_test_flag (hdev,HCI_USER_CHANNEL )) { +/* If the device has been opened in HCI_USER_CHANNEL, +* the userspace has exclusive access to device. +* When device is HCI_INIT, we still need to process +* the data packets to the driver in order +* to complete its setup(). +*/ +if (hci_dev_test_flag (hdev,HCI_USER_CHANNEL ) && + !test_bit (HCI_INIT , &hdev->flags)) {kfree_skb (skb);continue ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 66/161 x86/mce: Lower throttling MCE messages priority to warning
In reply to Greg Kroah-HartmanFrom: Benjamin Berg <[email protected]>
[ Upstream commit 9c3bafaa1fd88e4dd2dba3735a1f1abb0f2c7bb7 ]
On modern CPUs it is quite normal that the temperature limits are reached and the CPU is throttled. In fact, often the thermal design is not sufficient to cool the CPU at full load and limits can quickly be reached when a burst in load happens. This will even happen with technologies like RAPL limitting the long term power consumption of the package.
Also, these limits are "softer", as Srinivas explains:
"CPU temperature doesn't have to hit max(TjMax) to get these warnings. OEMs ha[ve] an ability to program a threshold where a thermal interrupt can be generated. In some systems the offset is 20C+ (Read only value).
In recent systems, there is another offset on top of it which can be programmed by OS, once some agent can adjust power limits dynamically. By default this is set to low by the firmware, which I guess the prime motivation of Benjamin to submit the patch."
So these messages do not usually indicate a hardware issue (e.g. insufficient cooling). Log them as warnings to avoid confusion about their severity.
[ bp: Massage commit mesage. ]
--- arch/x86/kernel/cpu/mcheck/therm_throt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/therm_throt.c +1 -1
@@ -185,7 +185,7 @@ static void therm_throt_process(bool new_event, int event, int level)/* if we just entered the thermal event */ if (new_event) {if (event ==THERMAL_THROTTLING_EVENT ) -pr_crit ("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n" , +pr_warn ("CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n" , this_cpu, level ==CORE_LEVEL ?"Core" :"Package" , state->count);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 67/161 drm/gma500: fix memory disclosures due to uninitialized bytes
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit ec3b7b6eb8c90b52f61adff11b6db7a8db34de19 ]
"clock" may be copied to "best_clock". Initializing best_clock is not sufficient. The fix initializes clock as well to avoid memory disclosures and informaiton leaks.
--- drivers/gpu/drm/gma500/oaktrail_crtc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/gma500/oaktrail_crtc.c +2 -0
@@ -139,6 +139,7 @@ static bool mrst_sdvo_find_best_pll(const struct gma_limit_t *limit,s32 freq_error, min_error =100000 ;memset (best_clock,0 ,sizeof (*best_clock)); +memset (&clock,0 ,sizeof (clock));for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { for (clock.n = limit->n.min; clock.n <= limit->n.max;
@@ -195,6 +196,7 @@ static bool mrst_lvds_find_best_pll(const struct gma_limit_t *limit,int err = target;memset (best_clock,0 ,sizeof (*best_clock)); +memset (&clock,0 ,sizeof (clock));for (clock.m = limit->m.min; clock.m <= limit->m.max; clock.m++) { for (clock.p1 = limit->p1.min; clock.p1 <= limit->p1.max;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 68/161 rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot
In reply to Greg Kroah-HartmanFrom: Chris Chiu <[email protected]>
[ Upstream commit 0eeb91ade90ce06d2fa1e2fcb55e3316b64c203c ]
The RTL8723BU has problems connecting to AP after each warm reboot. Sometimes it returns no scan result, and in most cases, it fails the authentication for unknown reason. However, it works totally fine after cold reboot.
Compare the value of register SYS_CR and SYS_CLK_MAC_CLK_ENABLE for cold reboot and warm reboot, the registers imply that the MAC is already powered and thus some procedures are skipped during driver initialization. Double checked the vendor driver, it reads the SYS_CR and SYS_CLK_MAC_CLK_ENABLE also but doesn't skip any during initialization based on them. This commit only tells the RTL8723BU to do full initialization without checking MAC status.
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 +++ 3 files changed, 5 insertions(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +1 -0
@@ -1349,6 +1349,7 @@ struct rtl8xxxu_fileops { u8 has_s0s1:1; u8 has_tx_report:1; u8 gen2_thermal_meter:1; + u8 needs_full_init:1;u32 adda_1t_init;u32 adda_1t_path_on;u32 adda_2t_path_on_a;
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +1 -0
@@ -1673,6 +1673,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = { .has_s0s1 = 1, .has_tx_report = 1, .gen2_thermal_meter = 1, + .needs_full_init = 1, .adda_1t_init = 0x01c00014, .adda_1t_path_on = 0x01c00014, .adda_2t_path_on_a = 0x01c00014,
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +3 -0
@@ -3905,6 +3905,9 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)else macpower = true; +if (fops->needs_full_init) + macpower = false; + ret = fops->power_on (priv);if (ret <0 ) {dev_warn (dev,"%s: Failed power on\n" , __func__);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 69/161 x86/ioapic: Prevent inconsistent state when moving an interrupt
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit df4393424af3fbdcd5c404077176082a8ce459c4 ]
There is an issue with threaded interrupts which are marked ONESHOT and using the fasteoi handler:
if (IS_ONESHOT())
mask_irq();
....
cond_unmask_eoi_irq()
chip->irq_eoi();
if (setaffinity_pending) {
mask_ioapic();
...
move_affinity();
unmask_ioapic();
}So if setaffinity is pending the interrupt will be moved and then unconditionally unmasked at the ioapic level, which is wrong in two aspects:
1) It should be kept masked up to the point where the threaded handler finished.
2) The physical chip state and the software masked state are inconsistent
Guard both the mask and the unmask with a check for the software masked state. If the line is marked masked then the ioapic line is also masked, so both mask_ioapic() and unmask_ioapic() can be skipped safely.
--- arch/x86/kernel/apic/io_apic.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/x86/kernel/apic/io_apic.c +6 -3
@@ -1690,9 +1690,10 @@ static bool io_apic_level_ack_pending(struct mp_chip_data *data)static inline bool ioapic_irqd_mask (struct irq_data *data) { -/* If we are moving the irq we need to mask it */ +/* If we are moving the IRQ we need to mask it */ if (unlikely (irqd_is_setaffinity_pending (data))) { -mask_ioapic_irq (data); +if (!irqd_irq_masked (data)) +mask_ioapic_irq (data);return true; }return false;
@@ -1729,7 +1730,9 @@ static inline void ioapic_irqd_unmask(struct irq_data *data, bool masked)*/ if (!io_apic_level_ack_pending (data->chip_data))irq_move_masked_irq (data); - unmask_ioapic_irq(data); +/* If the IRQ is masked in the core, leave it: */ +if (!irqd_irq_masked (data)) + unmask_ioapic_irq(data); } }#else
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 70/161 arm64: psci: Reduce the waiting time for cpu_psci_cpu_kill()
In reply to Greg Kroah-HartmanFrom: Yunfeng Ye <[email protected]>
[ Upstream commit bfcef4ab1d7ee8921bc322109b1692036cc6cbe0 ]
In cases like suspend-to-disk and suspend-to-ram, a large number of CPU cores need to be shut down. At present, the CPU hotplug operation is serialised, and the CPU cores can only be shut down one by one. In this process, if PSCI affinity_info() does not return LEVEL_OFF quickly, cpu_psci_cpu_kill() needs to wait for 10ms. If hundreds of CPU cores need to be shut down, it will take a long time.
Normally, there is no need to wait 10ms in cpu_psci_cpu_kill(). So change the wait interval from 10 ms to max 1 ms and use usleep_range() instead of msleep() for more accurate timer.
In addition, reducing the time interval will increase the messages output, so remove the "Retry ..." message, instead, track time and output to the the sucessful message.
--- arch/arm64/kernel/psci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
arch/arm64/kernel/psci.c +9 -6
@@ -84,7 +84,8 @@ static void cpu_psci_cpu_die(unsigned int cpu)static int cpu_psci_cpu_kill (unsigned int cpu) { -int err, i; +int err; +unsigned long start, end;if (!psci_ops.affinity_info)return 0 ;
@@ -94,16 +95,18 @@ static int cpu_psci_cpu_kill(unsigned int cpu)* while it is dying. So, try again a few times. */ -for (i =0 ; i <10 ; i++) { + start = jiffies; + end = start +msecs_to_jiffies (100 ); +do { err = psci_ops.affinity_info (cpu_logical_map (cpu),0 );if (err ==PSCI_0_2_AFFINITY_LEVEL_OFF ) { -pr_info ("CPU%d killed.\n" , cpu); +pr_info ("CPU%d killed (polled %d ms)\n" , cpu, +jiffies_to_msecs (jiffies - start));return 0 ; } -msleep (10 ); -pr_info ("Retrying again to check for CPU kill\n" ); - } +usleep_range (100 ,1000 ); + }while (time_before (jiffies, end));pr_warn ("CPU%d may not have shut down cleanly (AFFINITY_INFO reports %d)\n" , cpu, err);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 71/161 net: phy: dp83867: enable robust auto-mdix
In reply to Greg Kroah-HartmanFrom: Grygorii Strashko <[email protected]>
[ Upstream commit 5a7f08c2abb0efc9d17aff2fc75d6d3b85e622e4 ]
The link detection timeouts can be observed (or link might not be detected at all) when dp83867 PHY is configured in manual mode (speed/duplex).
CFG3[9] Robust Auto-MDIX option allows to significantly improve link detection in case dp83867 is configured in manual mode and reduce link detection time.
As per DM: "If link partners are configured to operational modes that are not supported by normal Auto MDI/MDIX mode (like Auto-Neg versus Force 100Base-TX or Force 100Base-TX versus Force 100Base-TX), this Robust Auto MDI/MDIX mode allows MDI/MDIX resolution and prevents deadlock."
Hence, enable this option by default as there are no known reasons not to do so.
--- drivers/net/phy/dp83867.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/phy/dp83867.c +10 -5
@@ -84,6 +84,10 @@#define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX 0x0#define DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN 0x1f +/* CFG3 bits */ +#define DP83867_CFG3_INT_OE BIT(7) +#define DP83867_CFG3_ROBUST_AUTO_MDIX BIT(9) +/* CFG4 bits */ #define DP83867_CFG4_PORT_MIRROR_EN BIT(0)
@@ -320,12 +324,13 @@ static int dp83867_config_init(struct phy_device *phydev)return ret; } + val =phy_read (phydev,DP83867_CFG3 );/* Enable Interrupt output INT_OE in CFG3 register */ -if (phy_interrupt_is_valid (phydev)) { - val =phy_read (phydev,DP83867_CFG3 ); - val |=BIT (7 ); -phy_write (phydev,DP83867_CFG3 , val); - } +if (phy_interrupt_is_valid (phydev)) + val |=DP83867_CFG3_INT_OE ; + + val |=DP83867_CFG3_ROBUST_AUTO_MDIX ; +phy_write (phydev,DP83867_CFG3 , val);if (dp83867->port_mirroring !=DP83867_PORT_MIRROING_KEEP )dp83867_config_port_mirroring (phydev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 72/161 RDMA/qedr: Fix memory leak in user qp and mr
In reply to Greg Kroah-HartmanFrom: Michal Kalderon <[email protected]>
[ Upstream commit 24e412c1e00ebfe73619e6b88cbc26c2c7d41b85 ]
User QPs pbl's weren't freed properly.
MR pbls weren't freed properly.
--- drivers/infiniband/hw/qedr/verbs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +10 -2
@@ -1343,6 +1343,14 @@ static void qedr_cleanup_user(struct qedr_dev *dev, struct qedr_qp *qp)if (qp->urq.umem)ib_umem_release (qp->urq.umem); qp->urq.umem =NULL ; + +if (rdma_protocol_roce (&dev->ibdev,1 )) { +qedr_free_pbl (dev, &qp->usq.pbl_info, qp->usq.pbl_tbl); +qedr_free_pbl (dev, &qp->urq.pbl_info, qp->urq.pbl_tbl); + }else { +kfree (qp->usq.pbl_tbl); +kfree (qp->urq.pbl_tbl); + } } static int qedr_create_user_qp(struct qedr_dev *dev,
@@ -2331,8 +2339,8 @@ int qedr_dereg_mr(struct ib_mr *ib_mr) dev->ops->rdma_free_tid (dev->rdma_ctx, mr->hw_mr.itid); -if ((mr->type !=QEDR_MR_DMA ) && (mr->type !=QEDR_MR_FRMR )) -qedr_free_pbl (dev, &mr->info.pbl_info, mr->info.pbl_table); +if (mr->type !=QEDR_MR_DMA ) +free_mr_info (dev, &mr->info);/* it could be user registered memory. */ if (mr->umem)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 73/161 gpu: host1x: Allocate gather copy for host1x
In reply to Greg Kroah-HartmanFrom: Thierry Reding <[email protected]>
[ Upstream commit b78e70c04c149299bd210759d7c7af7c86b89ca8 ]
Currently when the gather buffers are copied, they are copied to a buffer that is allocated for the host1x client that wants to execute the command streams in the buffers. However, the gather buffers will be read by the host1x device, which causes SMMU faults if the DMA API is backed by an IOMMU.
Fix this by allocating the gather buffer copy for the host1x device, which makes sure that it will be mapped into the host1x's IOVA space if the DMA API is backed by an IOMMU.
--- drivers/gpu/host1x/job.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/host1x/job.c +6 -5
@@ -545,7 +545,8 @@ out:return err; } -static inline int copy_gathers (struct host1x_job *job,struct device *dev) +static inline int copy_gathers (struct device *host,struct host1x_job *job, +struct device *dev) {struct host1x_firewall fw;size_t size =0 ;
@@ -570,12 +571,12 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)* Try a non-blocking allocation from a higher priority pools first, * as awaiting for the allocation here is a major performance hit. */ - job->gather_copy_mapped =dma_alloc_wc (dev, size, &job->gather_copy, + job->gather_copy_mapped =dma_alloc_wc (host, size, &job->gather_copy,GFP_NOWAIT );/* the higher priority allocation failed, try the generic-blocking */ if (!job->gather_copy_mapped) - job->gather_copy_mapped =dma_alloc_wc (dev, size, + job->gather_copy_mapped =dma_alloc_wc (host, size, &job->gather_copy,GFP_KERNEL );if (!job->gather_copy_mapped)
@@ -636,7 +637,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev) goto out;if (IS_ENABLED (CONFIG_TEGRA_HOST1X_FIREWALL )) { - err =copy_gathers (job, dev); + err =copy_gathers (host->dev, job, dev);if (err) goto out; }
@@ -701,7 +702,7 @@ void host1x_job_unpin(struct host1x_job *job) job->num_unpins =0 ;if (job->gather_copy_size) -dma_free_wc (job->channel->dev, job->gather_copy_size, +dma_free_wc (host->dev, job->gather_copy_size, job->gather_copy_mapped, job->gather_copy); }EXPORT_SYMBOL (host1x_job_unpin);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 74/161 net: dsa: LAN9303: select REGMAP when LAN9303 enable
In reply to Greg Kroah-HartmanFrom: Mao Wenan <[email protected]>
[ Upstream commit b6989d248a2d13f02895bae1a9321b3bbccc0283 ]
When NET_DSA_SMSC_LAN9303=y and NET_DSA_SMSC_LAN9303_MDIO=y, below errors can be seen:drivers/net/dsa/lan9303_mdio.c:87:23: error: REGMAP_ENDIAN_LITTLE undeclared here (not in a function)
.reg_format_endian = REGMAP_ENDIAN_LITTLE,drivers/net/dsa/lan9303_mdio.c:93:3: error: const struct regmap_config has no member named reg_read
.reg_read = lan9303_mdio_read,
It should select REGMAP in config NET_DSA_SMSC_LAN9303.
--- drivers/net/dsa/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/Kconfig +1 -0
@@ -55,6 +55,7 @@ config NET_DSA_QCA8K config NET_DSA_SMSC_LAN9303 tristate select NET_DSA_TAG_LAN9303 + select REGMAP ---help--- This enables support for the SMSC/Microchip LAN9303 3 port ethernet switch chips.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 75/161 phy: qcom-usb-hs: Fix extcon double register after power cycle
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 64f86b9978449ff05bfa6c64b4c5439e21e9c80b ]
Commit f0b5c2c96370 ("phy: qcom-usb-hs: Replace the extcon API") switched from extcon_register_notifier() to the resource-managed API, i.e. devm_extcon_register_notifier().
This is problematic in this case, because the extcon notifier is dynamically registered/unregistered whenever the PHY is powered on/off. The resource-managed API does not unregister the notifier until the driver is removed, so as soon as the PHY is power cycled, attempting to register the notifier again results in:
double register detected WARNING: CPU: 1 PID: 182 at kernel/notifier.c:26 notifier_chain_register+0x74/0xa0 Call trace: ... extcon_register_notifier+0x74/0xb8 devm_extcon_register_notifier+0x54/0xb8 qcom_usb_hs_phy_power_on+0x1fc/0x208 ...
... and USB stops working after plugging the cable out and in another time.
The easiest way to fix this is to make a partial revert of commit f0b5c2c96370 ("phy: qcom-usb-hs: Replace the extcon API") and avoid using the resource-managed API in this case.
--- drivers/phy/qualcomm/phy-qcom-usb-hs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/phy/qualcomm/phy-qcom-usb-hs.c +5 -2
@@ -159,8 +159,8 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)/* setup initial state */ qcom_usb_hs_phy_vbus_notifier (&uphy->vbus_notify, state, uphy->vbus_edev); - ret =devm_extcon_register_notifier (&ulpi->dev, uphy->vbus_edev, -EXTCON_USB , &uphy->vbus_notify); + ret =extcon_register_notifier (uphy->vbus_edev,EXTCON_USB , + &uphy->vbus_notify);if (ret) goto err_ulpi; }
@@ -181,6 +181,9 @@ static int qcom_usb_hs_phy_power_off(struct phy *phy) {struct qcom_usb_hs_phy *uphy =phy_get_drvdata (phy); +if (uphy->vbus_edev) +extcon_unregister_notifier (uphy->vbus_edev,EXTCON_USB , + &uphy->vbus_notify);regulator_disable (uphy->v3p3);regulator_disable (uphy->v1p8);clk_disable_unprepare (uphy->sleep_clk);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 76/161 s390/time: ensure get_clock_monotonic() returns monotonic values
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 011620688a71f2f1fe9901dbc2479a7c01053196 ]
The current implementation of get_clock_monotonic() leaves it up to the caller to call the function with preemption disabled. The only core kernel caller (sched_clock) however does not disable preemption.
In order to make sure that all callers of this function see monotonic values handle disabling preemption within the function itself.
--- arch/s390/include/asm/timex.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/s390/include/asm/timex.h +10 -6
@@ -10,8 +10,9 @@#ifndef _ASM_S390_TIMEX_H#define _ASM_S390_TIMEX_H -#include <asm/lowcore.h> +#include <linux/preempt.h> #include <linux/time64.h> +#include <asm/lowcore.h> /* The value of the TOD clock for 1.1.1970. */ #define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
@@ -186,15 +187,18 @@ extern unsigned char tod_clock_base[16] __aligned(8);/** * get_clock_monotonic - returns current time in clock rate units * -* The caller must ensure that preemption is disabled. * The clock and tod_clock_base get changed via stop_machine. -* Therefore preemption must be disabled when calling this -* function, otherwise the returned value is not guaranteed to -* be monotonic. +* Therefore preemption must be disabled, otherwise the returned +* value is not guaranteed to be monotonic. */ static inline unsigned long long get_tod_clock_monotonic (void ) { -return get_tod_clock () - *(unsigned long long *) &tod_clock_base[1 ]; +unsigned long long tod; + +preempt_disable (); + tod =get_tod_clock () - *(unsigned long long *) &tod_clock_base[1 ]; +preempt_enable (); +return tod; }/**
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 77/161 s390/mm: add mm_pxd_folded() checks to pxd_free()
In reply to Greg Kroah-HartmanFrom: Gerald Schaefer <[email protected]>
[ Upstream commit 2416cefc504ba8ae9b17e3e6b40afc72708f96be ]
Unlike pxd_free_tlb(), the pxd_free() functions do not check for folded page tables. This is not an issue so far, as those functions will actually never be called, since no code will reach them when page tables are folded.
In order to avoid future issues, and to make the s390 code more similar to other architectures, add mm_pxd_folded() checks, similar to how it is done in pxd_free_tlb().
This was found by testing a patch from from Anshuman Khandual, which is currently discussed on LKML ("mm/debug: Add tests validating architecture page table helpers").
--- arch/s390/include/asm/pgalloc.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
arch/s390/include/asm/pgalloc.h +14 -2
@@ -70,7 +70,12 @@ static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long address)crst_table_init (table, _REGION2_ENTRY_EMPTY);return (p4d_t *) table; } -#define p4d_free (mm, p4d) crst_table_free(mm, (unsigned long *) p4d) + +static inline void p4d_free (struct mm_struct *mm,p4d_t *p4d) +{ +if (!mm_p4d_folded (mm)) +crst_table_free (mm, (unsigned long *) p4d); +}static inline pud_t *pud_alloc_one (struct mm_struct *mm,unsigned long address) {
@@ -79,7 +84,12 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)crst_table_init (table, _REGION3_ENTRY_EMPTY);return (pud_t *) table; } -#define pud_free (mm, pud) crst_table_free(mm, (unsigned long *) pud) + +static inline void pud_free (struct mm_struct *mm,pud_t *pud) +{ +if (!mm_pud_folded (mm)) +crst_table_free (mm, (unsigned long *) pud); +}static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long vmaddr) {
@@ -97,6 +107,8 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)static inline void pmd_free (struct mm_struct *mm,pmd_t *pmd) { +if (mm_pmd_folded (mm)) +return ;pgtable_pmd_page_dtor (virt_to_page (pmd));crst_table_free (mm, (unsigned long *) pmd); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 78/161 libata: Ensure ata_port probe has completed before detach
In reply to Greg Kroah-HartmanFrom: John Garry <[email protected]>
[ Upstream commit 130f4caf145c3562108b245a576db30b916199d2 ]
With CONFIG_DEBUG_TEST_DRIVER_REMOVE set, we may find the following WARN:
[ 23.452574] ------------[ cut here ]------------ [ 23.457190] WARNING: CPU: 59 PID: 1 at drivers/ata/libata-core.c:6676 ata_host_detach+0x15c/0x168 [ 23.466047] Modules linked in: [ 23.469092] CPU: 59 PID: 1 Comm: swapper/0 Not tainted 5.4.0-rc1-00010-g5b83fd27752b-dirty #296 [ 23.477776] Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI RC0 - V1.16.01 03/15/2019 [ 23.486286] pstate: a0c00009 (NzCv daif +PAN +UAO) [ 23.491065] pc : ata_host_detach+0x15c/0x168 [ 23.495322] lr : ata_host_detach+0x88/0x168 [ 23.499491] sp : ffff800011cabb50 [ 23.502792] x29: ffff800011cabb50 x28: 0000000000000007 [ 23.508091] x27: ffff80001137f068 x26: ffff8000112c0c28 [ 23.513390] x25: 0000000000003848 x24: ffff0023ea185300 [ 23.518689] x23: 0000000000000001 x22: 00000000000014c0 [ 23.523987] x21: 0000000000013740 x20: ffff0023bdc20000 [ 23.529286] x19: 0000000000000000 x18: 0000000000000004 [ 23.534584] x17: 0000000000000001 x16: 00000000000000f0 [ 23.539883] x15: ffff0023eac13790 x14: ffff0023eb76c408 [ 23.545181] x13: 0000000000000000 x12: ffff0023eac13790 [ 23.550480] x11: ffff0023eb76c228 x10: 0000000000000000 [ 23.555779] x9 : ffff0023eac13798 x8 : 0000000040000000 [ 23.561077] x7 : 0000000000000002 x6 : 0000000000000001 [ 23.566376] x5 : 0000000000000002 x4 : 0000000000000000 [ 23.571674] x3 : ffff0023bf08a0bc x2 : 0000000000000000 [ 23.576972] x1 : 3099674201f72700 x0 : 0000000000400284 [ 23.582272] Call trace: [ 23.584706] ata_host_detach+0x15c/0x168 [ 23.588616] ata_pci_remove_one+0x10/0x18 [ 23.592615] ahci_remove_one+0x20/0x40 [ 23.596356] pci_device_remove+0x3c/0xe0 [ 23.600267] really_probe+0xdc/0x3e0 [ 23.603830] driver_probe_device+0x58/0x100 [ 23.608000] device_driver_attach+0x6c/0x90 [ 23.612169] __driver_attach+0x84/0xc8 [ 23.615908] bus_for_each_dev+0x74/0xc8 [ 23.619730] driver_attach+0x20/0x28 [ 23.623292] bus_add_driver+0x148/0x1f0 [ 23.627115] driver_register+0x60/0x110 [ 23.630938] __pci_register_driver+0x40/0x48 [ 23.635199] ahci_pci_driver_init+0x20/0x28 [ 23.639372] do_one_initcall+0x5c/0x1b0 [ 23.643199] kernel_init_freeable+0x1a4/0x24c [ 23.647546] kernel_init+0x10/0x108 [ 23.651023] ret_from_fork+0x10/0x18 [ 23.654590] ---[ end trace 634a14b675b71c13 ]---
With KASAN also enabled, we may also get many use-after-free reports.
The issue is that when CONFIG_DEBUG_TEST_DRIVER_REMOVE is set, we may attempt to detach the ata_port before it has been probed.
This is because the ata_ports are async probed, meaning that there is no guarantee that the ata_port has probed prior to detach. When the ata_port does probe in this scenario, we get all sorts of issues as the detach may have already happened.
Fix by ensuring synchronisation with async_synchronize_full(). We could alternatively use the cookie returned from the ata_port probe async_schedule() call, but that means managing the cookie, so more complicated.
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -6676,6 +6676,9 @@ void ata_host_detach(struct ata_host *host) {int i; +/* Ensure ata_port probe has completed */ +async_synchronize_full (); +for (i =0 ; i < host->n_ports; i++)ata_port_detach (host->ports[i]);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 79/161 loop: fix no-unmap write-zeroes request behavior
In reply to Greg Kroah-HartmanFrom: Darrick J. Wong <[email protected]>
[ Upstream commit efcfec579f6139528c9e6925eca2bc4a36da65c6 ]
Currently, if the loop device receives a WRITE_ZEROES request, it asks the underlying filesystem to punch out the range. This behavior is correct if unmapping is allowed. However, a NOUNMAP request means that the caller doesn't want us to free the storage backing the range, so punching out the range is incorrect behavior.
To satisfy a NOUNMAP | WRITE_ZEROES request, loop should ask the underlying filesystem to FALLOC_FL_ZERO_RANGE, which is (according to the fallocate documentation) required to ensure that the entire range is backed by real storage, which suffices for our purposes.
--- drivers/block/loop.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/block/loop.c +18 -8
@@ -414,18 +414,20 @@ out_free_page:return ret; } -static int lo_discard (struct loop_device *lo,struct request *rq,loff_t pos) +static int lo_fallocate (struct loop_device *lo,struct request *rq,loff_t pos, +int mode) {/* -* We use punch hole to reclaim the free space used by the -* image a.k.a. discard. However we do not support discard if -* encryption is enabled, because it may give an attacker -* useful information. +* We use fallocate to manipulate the space mappings used by the image +* a.k.a. discard/zerorange. However we do not support this if +* encryption is enabled, because it may give an attacker useful +* information. */ struct file *file = lo->lo_backing_file; -int mode =FALLOC_FL_PUNCH_HOLE |FALLOC_FL_KEEP_SIZE ;int ret; + mode |=FALLOC_FL_KEEP_SIZE ; +if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) { ret = -EOPNOTSUPP ; goto out;
@@ -565,9 +567,17 @@ static int do_req_filebacked(struct loop_device *lo, struct request *rq)switch (req_op (rq)) {case REQ_OP_FLUSH :return lo_req_flush (lo, rq); -case REQ_OP_DISCARD :case REQ_OP_WRITE_ZEROES : -return lo_discard (lo, rq, pos); +/* +* If the caller doesn't want deallocation, call zeroout to +* write zeroes the range. Otherwise, punch them out. +*/ +return lo_fallocate (lo, rq, pos, + (rq->cmd_flags &REQ_NOUNMAP ) ? +FALLOC_FL_ZERO_RANGE : +FALLOC_FL_PUNCH_HOLE ); +case REQ_OP_DISCARD : +return lo_fallocate (lo, rq, pos,FALLOC_FL_PUNCH_HOLE );case REQ_OP_WRITE :if (lo->transfer)return lo_write_transfer (lo, rq, pos);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 80/161 pinctrl: sh-pfc: sh7734: Fix duplicate TCLK1_B
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 884caadad128efad8e00c1cdc3177bc8912ee8ec ]
The definitions for bit field [19:18] of the Peripheral Function Select Register 3 were accidentally copied from bit field [20], leading to duplicates for the TCLK1_B function, and missing TCLK0, CAN_CLK_B, and ET0_ETXD4 functions.
Fix this by adding the missing GPIO_FN_CAN_CLK_B and GPIO_FN_ET0_ETXD4 enum values, and correcting the functions.
--- arch/sh/include/cpu-sh4/cpu/sh7734.h | 2 +- drivers/pinctrl/sh-pfc/pfc-sh7734.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/sh/include/cpu-sh4/cpu/sh7734.h +1 -1
@@ -134,7 +134,7 @@ enum {GPIO_FN_EX_WAIT1 ,GPIO_FN_SD1_DAT0_A ,GPIO_FN_DREQ2 ,GPIO_FN_CAN1_TX_C ,GPIO_FN_ET0_LINK_C ,GPIO_FN_ET0_ETXD5_A ,GPIO_FN_EX_WAIT0 ,GPIO_FN_TCLK1_B , -GPIO_FN_RD_WR ,GPIO_FN_TCLK0 , +GPIO_FN_RD_WR ,GPIO_FN_TCLK0 ,GPIO_FN_CAN_CLK_B ,GPIO_FN_ET0_ETXD4 ,GPIO_FN_EX_CS5 ,GPIO_FN_SD1_CMD_A ,GPIO_FN_ATADIR ,GPIO_FN_QSSL_B ,GPIO_FN_ET0_ETXD3_A , GPIO_FN_EX_CS4, GPIO_FN_SD1_WP_A, GPIO_FN_ATAWR, GPIO_FN_QMI_QIO1_B,
drivers/pinctrl/sh-pfc/pfc-sh7734.c +2 -2
@@ -1453,7 +1453,7 @@ static const struct pinmux_func pinmux_func_gpios[] = {GPIO_FN (ET0_ETXD2_A ),GPIO_FN (EX_CS5 ),GPIO_FN (SD1_CMD_A ),GPIO_FN (ATADIR ),GPIO_FN (QSSL_B ),GPIO_FN (ET0_ETXD3_A ), -GPIO_FN (RD_WR ),GPIO_FN (TCLK1_B ), +GPIO_FN (RD_WR ),GPIO_FN (TCLK0 ),GPIO_FN (CAN_CLK_B ),GPIO_FN (ET0_ETXD4 ),GPIO_FN (EX_WAIT0 ),GPIO_FN (TCLK1_B ),GPIO_FN (EX_WAIT1 ),GPIO_FN (SD1_DAT0_A ),GPIO_FN (DREQ2 ), GPIO_FN(CAN1_TX_C), GPIO_FN(ET0_LINK_C), GPIO_FN(ET0_ETXD5_A),
@@ -1949,7 +1949,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {/* IP3_20 [1] */ FN_EX_WAIT0 ,FN_TCLK1_B ,/* IP3_19_18 [2] */ -FN_RD_WR ,FN_TCLK1_B ,0 ,0 , +FN_RD_WR ,FN_TCLK0 ,FN_CAN_CLK_B ,FN_ET0_ETXD4 ,/* IP3_17_15 [3] */ FN_EX_CS5 ,FN_SD1_CMD_A ,FN_ATADIR ,FN_QSSL_B , FN_ET0_ETXD3_A, 0, 0, 0,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 81/161 iio: dln2-adc: fix iio_triggered_buffer_postenable() position
In reply to Greg Kroah-HartmanFrom: Alexandru Ardelean <[email protected]>
[ Upstream commit a7bddfe2dfce1d8859422124abe1964e0ecd386e ]
The iio_triggered_buffer_postenable() hook should be called first to attach the poll function. The iio_triggered_buffer_predisable() hook is called last (as is it should).
This change moves iio_triggered_buffer_postenable() to be called first. It adds iio_triggered_buffer_predisable() on the error paths of the postenable hook.
For the predisable hook, some code-paths have been changed to make sure that the iio_triggered_buffer_predisable() hook gets called in case there is an error before it.
--- drivers/iio/adc/dln2-adc.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/iio/adc/dln2-adc.c +14 -6
@@ -528,6 +528,10 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)u16 conflict;unsigned int trigger_chan; + ret =iio_triggered_buffer_postenable (indio_dev); +if (ret) +return ret; +mutex_lock (&dln2->mutex);/* Enable ADC */
@@ -541,6 +545,7 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev) (int)conflict); ret = -EBUSY ; } +iio_triggered_buffer_predisable (indio_dev);return ret; }
@@ -554,6 +559,7 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)mutex_unlock (&dln2->mutex);if (ret <0 ) {dev_dbg (&dln2->pdev->dev,"Problem in %s\n" , __func__); +iio_triggered_buffer_predisable (indio_dev);return ret; } }else {
@@ -561,12 +567,12 @@ static int dln2_adc_triggered_buffer_postenable(struct iio_dev *indio_dev)mutex_unlock (&dln2->mutex); } -return iio_triggered_buffer_postenable (indio_dev); +return 0 ; }static int dln2_adc_triggered_buffer_predisable (struct iio_dev *indio_dev) { -int ret; +int ret, ret2;struct dln2_adc *dln2 =iio_priv (indio_dev);mutex_lock (&dln2->mutex);
@@ -581,12 +587,14 @@ static int dln2_adc_triggered_buffer_predisable(struct iio_dev *indio_dev) ret =dln2_adc_set_port_enabled (dln2, false,NULL );mutex_unlock (&dln2->mutex); -if (ret <0 ) { +if (ret <0 )dev_dbg (&dln2->pdev->dev,"Problem in %s\n" , __func__); -return ret; - } -return iio_triggered_buffer_predisable (indio_dev); + ret2 =iio_triggered_buffer_predisable (indio_dev); +if (ret ==0 ) + ret = ret2; + +return ret; }static const struct iio_buffer_setup_ops dln2_adc_buffer_setup_ops = {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 82/161 Bluetooth: Fix advertising duplicated flags
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 6012b9346d8959194c239fd60a62dfec98d43048 ]
Instances may have flags set as part of its data in which case the code should not attempt to add it again otherwise it can cause duplication:
< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 35
Handle: 0x00
Operation: Complete extended advertising data (0x03)
Fragment preference: Minimize fragmentation (0x01)
Data length: 0x06
Flags: 0x04
BR/EDR Not Supported
Flags: 0x06
LE General Discoverable Mode
BR/EDR Not Supported--- net/bluetooth/hci_request.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/bluetooth/hci_request.c +9 -0
@@ -1095,6 +1095,14 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) instance_flags =get_adv_instance_flags (hdev, instance); +/* If instance already has the flags set skip adding it once +* again. +*/ +if (adv_instance &&eir_get_data (adv_instance->adv_data, + adv_instance->adv_data_len,EIR_FLAGS , +NULL )) + goto skip_flags; +/* The Add Advertising command allows userspace to set both the general * and limited discoverable flags. */
@@ -1127,6 +1135,7 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr) } } +skip_flags:if (adv_instance) {memcpy (ptr, adv_instance->adv_data, adv_instance->adv_data_len);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 83/161 pinctrl: amd: fix __iomem annotation in amd_gpio_irq_handler()
In reply to Greg Kroah-HartmanFrom: Ben Dooks (Codethink) <[email protected]>
[ Upstream commit 10ff58aa3c2e2a093b6ad615a7e3d8bb0dc613e5 ]
The regs pointer in amd_gpio_irq_handler() should have __iomem on it, so add that to fix the following sparse warnings:
drivers/pinctrl/pinctrl-amd.c:555:14: warning: incorrect type in assignment (different address spaces)drivers/pinctrl/pinctrl-amd.c:555:14: expected unsigned int [usertype] *regsdrivers/pinctrl/pinctrl-amd.c:555:14: got void [noderef] <asn:2> *basedrivers/pinctrl/pinctrl-amd.c:563:34: warning: incorrect type in argument 1 (different address spaces)drivers/pinctrl/pinctrl-amd.c:563:34: expected void const volatile [noderef] <asn:2> *addrdrivers/pinctrl/pinctrl-amd.c:563:34: got unsigned int [usertype] *drivers/pinctrl/pinctrl-amd.c:580:34: warning: incorrect type in argument 1 (different address spaces)drivers/pinctrl/pinctrl-amd.c:580:34: expected void const volatile [noderef] <asn:2> *addrdrivers/pinctrl/pinctrl-amd.c:580:34: got unsigned int [usertype] *drivers/pinctrl/pinctrl-amd.c:587:25: warning: incorrect type in argument 2 (different address spaces)drivers/pinctrl/pinctrl-amd.c:587:25: expected void volatile [noderef] <asn:2> *addrdrivers/pinctrl/pinctrl-amd.c:587:25: got unsigned int [usertype] *
--- drivers/pinctrl/pinctrl-amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-amd.c +2 -1
@@ -509,7 +509,8 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)irqreturn_t ret =IRQ_NONE ;unsigned int i, irqnr;unsigned long flags; -u32 *regs, regval; +u32 __iomem *regs; +u32 regval;u64 status, mask;/* Read the wake status */
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 84/161 ixgbe: protect TX timestamping from API misuse
In reply to Greg Kroah-HartmanFrom: Manjunath Patil <[email protected]>
[ Upstream commit 07066d9dc3d2326fbad8f7b0cb0120cff7b7dedb ]
HW timestamping can only be requested for a packet if the NIC is first setup via ioctl(SIOCSHWTSTAMP). If this step was skipped, then the ixgbe driver still allowed TX packets to request HW timestamping. In this situation, we see 'clearing Tx Timestamp hang' noise in the log.
Fix this by checking that the NIC is configured for HW TX timestamping before accepting a HW TX timestamping request.
Similar-to:
commit 26bd4e2db06b ("igb: protect TX timestamping from API misuse") commit 0a6f2f05a2f5 ("igb: Fix a test with HWTSTAMP_TX_ON")
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
@@ -8379,7 +8379,8 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,if (unlikely (skb_shinfo (skb)->tx_flags &SKBTX_HW_TSTAMP ) && adapter->ptp_clock) { -if (!test_and_set_bit_lock (__IXGBE_PTP_TX_IN_PROGRESS, +if (adapter->tstamp_config.tx_type ==HWTSTAMP_TX_ON && + !test_and_set_bit_lock (__IXGBE_PTP_TX_IN_PROGRESS, &adapter->state)) {skb_shinfo (skb)->tx_flags |=SKBTX_IN_PROGRESS ; tx_flags |=IXGBE_TX_FLAGS_TSTAMP ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 85/161 media: rcar_drif: fix a memory disclosure
In reply to Greg Kroah-HartmanFrom: Kangjie Lu <[email protected]>
[ Upstream commit d39083234c60519724c6ed59509a2129fd2aed41 ]
"f->fmt.sdr.reserved" is uninitialized. As other peer drivers like msi2500 and airspy do, the fix initializes it to avoid memory disclosures.
--- drivers/media/platform/rcar_drif.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/rcar_drif.c +1 -0
@@ -915,6 +915,7 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv, {struct rcar_drif_sdr *sdr =video_drvdata (file); +memset (f->fmt.sdr.reserved,0 ,sizeof (f->fmt.sdr.reserved)); f->fmt.sdr.pixelformat = sdr->fmt->pixelformat; f->fmt.sdr.buffersize = sdr->fmt->buffersize;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 86/161 media: v4l2-core: fix touch support in v4l_g_fmt
In reply to Greg Kroah-HartmanFrom: Vandana BN <[email protected]>
[ Upstream commit 545b618cfb5cadacd00c25066b9a36540e5ca9e9 ]
v4l_s_fmt, for VFL_TYPE_TOUCH, sets unneeded members of the v4l2_pix_format structure to default values.This was missing in v4l_g_fmt, which would lead to failures in v4l2-compliance tests.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 33 +++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +18 -15
@@ -1363,10 +1363,26 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,return ret; } +static void v4l_pix_format_touch (struct v4l2_pix_format *p) +{ +/* +* The v4l2_pix_format structure contains fields that make no sense for +* touch. Set them to default values in this case. +*/ + + p->field =V4L2_FIELD_NONE ; + p->colorspace =V4L2_COLORSPACE_RAW ; + p->flags =0 ; + p->ycbcr_enc =0 ; + p->quantization =0 ; + p->xfer_func =0 ; +} +static int v4l_g_fmt (const struct v4l2_ioctl_ops *ops,struct file *file,void *fh,void *arg) {struct v4l2_format *p = arg; +struct video_device *vfd =video_devdata (file);int ret =check_fmt (file, p->type);if (ret)
@@ -1404,6 +1420,8 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, ret = ops->vidioc_g_fmt_vid_cap (file, fh, arg);/* just in case the driver zeroed it again */ p->fmt.pix.priv =V4L2_PIX_FMT_PRIV_MAGIC ; +if (vfd->vfl_type ==VFL_TYPE_TOUCH ) +v4l_pix_format_touch (&p->fmt.pix);return ret;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :return ops->vidioc_g_fmt_vid_cap_mplane (file, fh, arg);
@@ -1439,21 +1457,6 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,return -EINVAL ; } -static void v4l_pix_format_touch (struct v4l2_pix_format *p) -{ -/* -* The v4l2_pix_format structure contains fields that make no sense for -* touch. Set them to default values in this case. -*/ - - p->field =V4L2_FIELD_NONE ; - p->colorspace =V4L2_COLORSPACE_RAW ; - p->flags =0 ; - p->ycbcr_enc =0 ; - p->quantization =0 ; - p->xfer_func =0 ; -} -static int v4l_s_fmt (const struct v4l2_ioctl_ops *ops,struct file *file,void *fh,void *arg) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 87/161 rfkill: allocate static minor
In reply to Greg Kroah-HartmanFrom: Marcel Holtmann <[email protected]>
[ Upstream commit 8670b2b8b029a6650d133486be9d2ace146fd29a ]
udev has a feature of creating /dev/<node> device-nodes if it finds a devnode:<node> modalias. This allows for auto-loading of modules that provide the node. This requires to use a statically allocated minor number for misc character devices.
However, rfkill uses dynamic minor numbers and prevents auto-loading of the module. So allocate the next static misc minor number and use it for rfkill.
--- include/linux/miscdevice.h | 1 + net/rfkill/core.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/linux/miscdevice.h +1 -0
@@ -56,6 +56,7 @@#define UHID_MINOR 239#define USERIO_MINOR 240#define VHOST_VSOCK_MINOR 241 +#define RFKILL_MINOR 242#define MISC_DYNAMIC_MINOR 255struct device ;
net/rfkill/core.c +7 -2
@@ -1312,10 +1312,12 @@ static const struct file_operations rfkill_fops = { .llseek = no_llseek, }; +#define RFKILL_NAME "rfkill" +static struct miscdevice rfkill_miscdev = { - .name ="rfkill" , .fops = &rfkill_fops, - .minor =MISC_DYNAMIC_MINOR , + .name =RFKILL_NAME , + .minor =RFKILL_MINOR , };static int __init rfkill_init (void )
@@ -1367,3 +1369,6 @@ static void __exit rfkill_exit(void)class_unregister (&rfkill_class); }module_exit (rfkill_exit); + +MODULE_ALIAS_MISCDEV (RFKILL_MINOR ); +MODULE_ALIAS ("devname:" RFKILL_NAME );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 88/161 bnx2x: Fix PF-VF communication over multi-cos queues.
In reply to Greg Kroah-HartmanFrom: Manish Chopra <[email protected]>
[ Upstream commit dc5a3d79c345871439ffe72550b604fcde9770e1 ]
PF driver doesn't enable tx-switching for all cos queues/clients, which causes packets drop from PF to VF. Fix this by enabling tx-switching on all cos queues/clients.
--- .../net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +11 -5
@@ -2389,15 +2389,21 @@ static int bnx2x_set_pf_tx_switching(struct bnx2x *bp, bool enable)/* send the ramrod on all the queues of the PF */ for_each_eth_queue (bp, i) {struct bnx2x_fastpath *fp = &bp->fp[i]; +int tx_idx;/* Set the appropriate Queue object */ q_params.q_obj = &bnx2x_sp_obj (bp, fp).q_obj; -/* Update the Queue state */ - rc =bnx2x_queue_state_change (bp, &q_params); -if (rc) { -BNX2X_ERR ("Failed to configure Tx switching\n" ); -return rc; +for (tx_idx =FIRST_TX_COS_INDEX ; + tx_idx < fp->max_cos; tx_idx++) { + q_params.params.update.cid_index = tx_idx; + +/* Update the Queue state */ + rc =bnx2x_queue_state_change (bp, &q_params); +if (rc) { +BNX2X_ERR ("Failed to configure Tx switching\n" ); +return rc; + } } }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 89/161 spi: img-spfi: fix potential double release
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit e9a8ba9769a0e354341bc6cc01b98aadcea1dfe9 ]
The channels spfi->tx_ch and spfi->rx_ch are not set to NULL after they are released. As a result, they will be released again, either on the error handling branch in the same function or in the corresponding remove function, i.e. img_spfi_remove(). This patch fixes the bug by setting the two members to NULL.
--- drivers/spi/spi-img-spfi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-img-spfi.c +2 -0
@@ -673,6 +673,8 @@ static int img_spfi_probe(struct platform_device *pdev)dma_release_channel (spfi->tx_ch);if (spfi->rx_ch)dma_release_channel (spfi->rx_ch); + spfi->tx_ch =NULL ; + spfi->rx_ch =NULL ;dev_warn (spfi->dev,"Failed to get DMA channels, falling back to PIO mode\n" ); }else { master->dma_tx = spfi->tx_ch;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 90/161 ALSA: timer: Limit max amount of slave instances
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit fdea53fe5de532969a332d6e5e727f2ad8bf084d ]
The fuzzer tries to open the timer instances as much as possible, and this may cause a system hiccup easily. We've already introduced the cap for the max number of available instances for the h/w timers, and we should put such a limit also to the slave timers, too.
This patch introduces the limit to the multiple opened slave timers. The upper limit is hard-coded to 1000 for now, which should suffice for any practical usages up to now.
--- sound/core/timer.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/core/timer.c +10 -0
@@ -88,6 +88,9 @@ static LIST_HEAD(snd_timer_slave_list);/* lock for slave active lists */ static DEFINE_SPINLOCK (slave_active_lock); +#define MAX_SLAVE_INSTANCES 1000 +static int num_slaves; +static DEFINE_MUTEX (register_mutex);static int snd_timer_free (struct snd_timer *timer);
@@ -266,6 +269,10 @@ int snd_timer_open(struct snd_timer_instance **ti, err = -EINVAL ; goto unlock; } +if (num_slaves >=MAX_SLAVE_INSTANCES ) { + err = -EBUSY ; + goto unlock; + } timeri =snd_timer_instance_new (owner,NULL );if (!timeri) { err = -ENOMEM ;
@@ -275,6 +282,7 @@ int snd_timer_open(struct snd_timer_instance **ti, timeri->slave_id = tid->device; timeri->flags |=SNDRV_TIMER_IFLG_SLAVE ;list_add_tail (&timeri->open_list, &snd_timer_slave_list); + num_slaves++; err =snd_timer_check_slave (timeri);if (err <0 ) {snd_timer_close_locked (timeri, &card_dev_to_put);
@@ -364,6 +372,8 @@ static int snd_timer_close_locked(struct snd_timer_instance *timeri,struct snd_timer_instance *slave, *tmp;list_del (&timeri->open_list); +if (timeri->flags &SNDRV_TIMER_IFLG_SLAVE ) + num_slaves--;/* force to stop the timer */ snd_timer_stop (timeri);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 91/161 rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt()
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 5174f1e41074b5186608badc2e89441d021e8c08 ]
This leak was found by testing the EDIMAX EW-7612 on Raspberry Pi 3B+ with Linux 5.4-rc5 (multi_v7_defconfig + rtlwifi + kmemleak) and noticed a single memory leak during probe:
unreferenced object 0xec13ee40 (size 176):
comm "kworker/u8:1", pid 36, jiffies 4294939321 (age 5580.790s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<fc1bbb3e>] __netdev_alloc_skb+0x9c/0x164
[<863dfa6e>] rtl92c_set_fw_rsvdpagepkt+0x254/0x340 [rtl8192c_common]
[<9572be0d>] rtl92cu_set_hw_reg+0xf48/0xfa4 [rtl8192cu]
[<116df4d8>] rtl_op_bss_info_changed+0x234/0x96c [rtlwifi]
[<8933575f>] ieee80211_bss_info_change_notify+0xb8/0x264 [mac80211]
[<d4061e86>] ieee80211_assoc_success+0x934/0x1798 [mac80211]
[<e55adb56>] ieee80211_rx_mgmt_assoc_resp+0x174/0x314 [mac80211]
[<5974629e>] ieee80211_sta_rx_queued_mgmt+0x3f4/0x7f0 [mac80211]
[<d91091c6>] ieee80211_iface_work+0x208/0x318 [mac80211]
[<ac5fcae4>] process_one_work+0x22c/0x564
[<f5e6d3b6>] worker_thread+0x44/0x5d8
[<82c7b073>] kthread+0x150/0x154
[<b43e1b7d>] ret_from_fork+0x14/0x2c
[<794dff30>] 0x0It is because 8192cu doesn't implement usb_cmd_send_packet(), and this patch just frees the skb within the function to resolve memleak problem by now. Since 8192cu doesn't turn on fwctrl_lps that needs to download command packet for firmware via the function, applying this patch doesn't affect driver behavior.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192cu/hw.c +2 -0
@@ -1556,6 +1556,8 @@ static bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)* This is maybe necessary: * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); */ +dev_kfree_skb (skb); +return true; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 92/161 perf probe: Fix to find range-only function instance
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit b77afa1f810f37bd8a36cb1318178dfe2d7af6b6 ]
Fix die_is_func_instance() to find range-only function instance.
In some case, a function instance can be made without any low PC or entry PC, but only with address ranges by optimization. (e.g. cold text partially in "text.unlikely" section) To find such function instance, we have to check the range attribute too.
--- tools/perf/util/dwarf-aux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/util/dwarf-aux.c +5 -1
@@ -331,10 +331,14 @@ bool die_is_func_def(Dwarf_Die *dw_die)bool die_is_func_instance (Dwarf_Die *dw_die) {Dwarf_Addr tmp; +Dwarf_Attribute attr_mem;/* Actually gcc optimizes non-inline as like as inlined */ -return !dwarf_func_inline (dw_die) &&dwarf_entrypc (dw_die, &tmp) ==0 ; +return !dwarf_func_inline (dw_die) && + (dwarf_entrypc (dw_die, &tmp) ==0 || +dwarf_attr (dw_die, DW_AT_ranges, &attr_mem) !=NULL ); } +/** * die_get_data_member_location - Get the data-member offset * @mb_die: a DIE of a member of a data structure
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 93/161 perf probe: Fix to list probe event with correct line number
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 3895534dd78f0fd4d3f9e05ee52b9cdd444a743e ]
Since debuginfo__find_probe_point() uses dwarf_entrypc() for finding the entry address of the function on which a probe is, it will fail when the function DIE has only ranges attribute.
To fix this issue, use die_entrypc() instead of dwarf_entrypc().
Without this fix, perf probe -l shows incorrect offset:
# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask+18446744071579263632@work/linux/linux/kernel/cpu.c)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask+18446744071579263752@work/linux/linux/kernel/cpu.c)With this:
# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@work/linux/linux/kernel/cpu.c)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask:21@work/linux/linux/kernel/cpu.c)Committer testing:
Before:
[root@quaco ~]# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask+18446744071579765152@kernel/cpu.c)
[root@quaco ~]#
After:
[root@quaco ~]# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@kernel/cpu.c)
[root@quaco ~]#
--- tools/perf/util/probe-finder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/probe-finder.c +2 -2
@@ -1570,7 +1570,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,/* Get function entry information */ func = basefunc =dwarf_diename (&spdie);if (!func || -dwarf_entrypc (&spdie, &baseaddr) !=0 || +die_entrypc (&spdie, &baseaddr) !=0 ||dwarf_decl_line (&spdie, &baseline) !=0 ) { lineno =0 ; goto post;
@@ -1587,7 +1587,7 @@ int debuginfo__find_probe_point(struct debuginfo *dbg, unsigned long addr,while (die_find_top_inlinefunc (&spdie, (Dwarf_Addr )addr, &indie)) {/* There is an inline function */ -if (dwarf_entrypc (&indie, &_addr) ==0 && +if (die_entrypc (&indie, &_addr) ==0 && _addr == addr) {/* * addr is at an inline function entry.
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 94/161 perf probe: Walk function lines in lexical blocks
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit acb6a7047ac2146b723fef69ee1ab6b7143546bf ]
Since some inlined functions are in lexical blocks of given function, we have to recursively walk through the DIE tree. Without this fix, perf-probe -L can miss the inlined functions which is in a lexical block (like if (..) { func() } case.)
However, even though, to walk the lines in a given function, we don't need to follow the children DIE of inlined functions because those do not have any lines in the specified function.
We need to walk though whole trees only if we walk all lines in a given file, because an inlined function can include another inlined function in the same file.
--- tools/perf/util/dwarf-aux.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
tools/perf/util/dwarf-aux.c +9 -5
@@ -691,10 +691,9 @@ static int __die_walk_funclines_cb(Dwarf_Die *in_die, void *data)if (lw->retval !=0 )return DIE_FIND_CB_END ; } +if (!lw->recursive) +return DIE_FIND_CB_SIBLING ; } -if (!lw->recursive) -/* Don't need to search recursively */ -return DIE_FIND_CB_SIBLING ;if (addr) { fname =dwarf_decl_file (in_die);
@@ -741,6 +740,10 @@ static int __die_walk_culines_cb(Dwarf_Die *sp_die, void *data) {struct __line_walk_param *lw = data; +/* +* Since inlined function can include another inlined function in +* the same file, we need to walk in it recursively. +*/ lw->retval =__die_walk_funclines (sp_die, true, lw->callback, lw->data);if (lw->retval !=0 )return DWARF_CB_ABORT ;
@@ -830,8 +833,9 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)*/ if (rt_die != cu_die)/* -* Don't need walk functions recursively, because nested -* inlined functions don't have lines of the specified DIE. +* Don't need walk inlined functions recursively, because +* inner inlined functions don't have the lines of the +* specified function. */ ret =__die_walk_funclines (rt_die, false, callback, data);else {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 95/161 perf probe: Fix to probe an inline function which has no entry pc
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit eb6933b29d20bf2c3053883d409a53f462c1a3ac ]
Fix perf probe to probe an inlne function which has no entry pc or low pc but only has ranges attribute.
This seems very rare case, but I could find a few examples, as same as probe_point_search_cb(), use die_entrypc() to get the entry address in probe_point_inline_cb() too.
Without this patch:
# perf probe -D __amd_put_nb_event_constraints
Failed to get entry address of __amd_put_nb_event_constraints.
Probe point '__amd_put_nb_event_constraints' not found.
Error: Failed to add events.With this patch:
# perf probe -D __amd_put_nb_event_constraints p:probe/__amd_put_nb_event_constraints amd_put_event_constraints+43
Committer testing:
Before:
[root@quaco ~]# perf probe -D __amd_put_nb_event_constraints Failed to get entry address of __amd_put_nb_event_constraints. Probe point '__amd_put_nb_event_constraints' not found.
Error: Failed to add events.
[root@quaco ~]#
After:
[root@quaco ~]# perf probe -D __amd_put_nb_event_constraints p:probe/__amd_put_nb_event_constraints _text+33789 [root@quaco ~]#
--- tools/perf/util/probe-finder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
@@ -953,7 +953,7 @@ static int probe_point_inline_cb(Dwarf_Die *in_die, void *data) ret =find_probe_point_lazy (in_die, pf); else {/* Get probe address */ -if (dwarf_entrypc (in_die, &addr) !=0 ) { +if (die_entrypc (in_die, &addr) !=0 ) {pr_warning ("Failed to get entry address of %s.\n" ,dwarf_diename (in_die));return -ENOENT ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 96/161 perf probe: Fix to show ranges of variables in functions without entry_pc
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit af04dd2f8ebaa8fbd46f698714acbf43da14da45 ]
Fix to show ranges of variables (--range and --vars option) in functions which DIE has only ranges but no entry_pc attribute.
Without this fix:
# perf probe --range -V clear_tasks_mm_cpumask Available variables at clear_tasks_mm_cpumask @<clear_tasks_mm_cpumask+0> (No matched variables)
With this fix:
# perf probe --range -V clear_tasks_mm_cpumask Available variables at clear_tasks_mm_cpumask @<clear_tasks_mm_cpumask+0> [VAL] int cpu @<clear_tasks_mm_cpumask+[0-35,317-317,2052-2059]>
Committer testing:
Before:
[root@quaco ~]# perf probe --range -V clear_tasks_mm_cpumask
Available variables at clear_tasks_mm_cpumask
@<clear_tasks_mm_cpumask+0>
(No matched variables)
[root@quaco ~]#After:
[root@quaco ~]# perf probe --range -V clear_tasks_mm_cpumask
Available variables at clear_tasks_mm_cpumask
@<clear_tasks_mm_cpumask+0>
[VAL] int cpu @<clear_tasks_mm_cpumask+[0-23,23-105,105-106,106-106,1843-1850,1850-1862]>
[root@quaco ~]#Using it:
[root@quaco ~]# perf probe clear_tasks_mm_cpumask cpu Added new event:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask with cpu)
You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask -aR sleep 1
[root@quaco ~]# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@kernel/cpu.c with cpu)
[root@quaco ~]#
[root@quaco ~]# perf trace -e probe:*cpumask
^C[root@quaco ~]#
--- tools/perf/util/dwarf-aux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/dwarf-aux.c +2 -2
@@ -1010,7 +1010,7 @@ static int die_get_var_innermost_scope(Dwarf_Die *sp_die, Dwarf_Die *vr_die,bool first = true;const char *name; - ret =dwarf_entrypc (sp_die, &entry); + ret =die_entrypc (sp_die, &entry);if (ret)return ret;
@@ -1073,7 +1073,7 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf)bool first = true;const char *name; - ret =dwarf_entrypc (sp_die, &entry); + ret =die_entrypc (sp_die, &entry);if (ret)return ret;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 97/161 perf probe: Fix to show inlined function callsite without entry_pc
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 18e21eb671dc87a4f0546ba505a89ea93598a634 ]
Fix 'perf probe --line' option to show inlined function callsite lines even if the function DIE has only ranges.
Without this:
# perf probe -L amd_put_event_constraints
...
2 {
3 if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
__amd_put_nb_event_constraints(cpuc, event);
5 }With this patch:
# perf probe -L amd_put_event_constraints
...
2 {
3 if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
4 __amd_put_nb_event_constraints(cpuc, event);
5 }Committer testing:
Before:
[root@quaco ~]# perf probe -L amd_put_event_constraints
<amd_put_event_constraints@/usr/src/debug/kernel-5.2.fc30/linux-5.2.18-200.fc30.x86_64/arch/x86/events/amd/core.c:0>
0 static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
struct perf_event *event)
2 {
3 if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
__amd_put_nb_event_constraints(cpuc, event);
5 } PMU_FORMAT_ATTR(event, "config:0-7,32-35");
PMU_FORMAT_ATTR(umask, "config:8-15" );[root@quaco ~]#
After:
[root@quaco ~]# perf probe -L amd_put_event_constraints
<amd_put_event_constraints@/usr/src/debug/kernel-5.2.fc30/linux-5.2.18-200.fc30.x86_64/arch/x86/events/amd/core.c:0>
0 static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
struct perf_event *event)
2 {
3 if (amd_has_nb(cpuc) && amd_is_nb_event(&event->hw))
4 __amd_put_nb_event_constraints(cpuc, event);
5 } PMU_FORMAT_ATTR(event, "config:0-7,32-35");
PMU_FORMAT_ATTR(umask, "config:8-15" ); [root@quaco ~]# perf probe amd_put_event_constraints:4 Added new event:
probe:amd_put_event_constraints (on amd_put_event_constraints:4)
You can now use it in all perf tools, such as:
perf record -e probe:amd_put_event_constraints -aR sleep 1
[root@quaco ~]#
[root@quaco ~]# perf probe -l
probe:amd_put_event_constraints (on amd_put_event_constraints:4@arch/x86/events/amd/core.c) probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@kernel/cpu.c)
[root@quaco ~]#
Using it:
[root@quaco ~]# perf trace -e probe:*
^C[root@quaco ~]#
Ok, Intel system here... :-)
--- tools/perf/util/dwarf-aux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/dwarf-aux.c +1 -1
@@ -686,7 +686,7 @@ static int __die_walk_funclines_cb(Dwarf_Die *in_die, void *data)if (dwarf_tag (in_die) == DW_TAG_inlined_subroutine) { fname =die_get_call_file (in_die); lineno =die_get_call_lineno (in_die); -if (fname && lineno >0 &&dwarf_entrypc (in_die, &addr) ==0 ) { +if (fname && lineno >0 &&die_entrypc (in_die, &addr) ==0 ) { lw->retval = lw->callback (fname, lineno, addr, lw->data);if (lw->retval !=0 )return DIE_FIND_CB_END ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 98/161 libsubcmd: Use -O0 with DEBUG=1
In reply to Greg Kroah-HartmanFrom: James Clark <[email protected]>
[ Upstream commit 22bd8f1b5a1dd168ba4eba27cb17643a11012f5d ]
When a 'make DEBUG=1' build is done, the command parser is still built with -O6 and is hard to step through, fix it making it use -O0 in that case.
--- tools/lib/subcmd/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/subcmd/Makefile +3 -1
@@ -28,7 +28,9 @@ ifeq ($(DEBUG),0) endif endif -ifeq ($(CC_NO_CLANG), 0) +ifeq ($(DEBUG),1) + CFLAGS += -O0 +else ifeq ($(CC_NO_CLANG), 0) CFLAGS += -O3 else CFLAGS += -O6
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 99/161 perf probe: Fix to probe a function which has no entry pc
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 5d16dbcc311d91267ddb45c6da4f187be320ecee ]
Fix 'perf probe' to probe a function which has no entry pc or low pc but only has ranges attribute.
probe_point_search_cb() uses dwarf_entrypc() to get the probe address, but that doesn't work for the function DIE which has only ranges attribute. Use die_entrypc() instead.
Without this fix:
# perf probe -k ../build-x86_64/vmlinux -D clear_tasks_mm_cpumask:0
Probe point 'clear_tasks_mm_cpumask' not found.
Error: Failed to add events.With this:
# perf probe -k ../build-x86_64/vmlinux -D clear_tasks_mm_cpumask:0 p:probe/clear_tasks_mm_cpumask clear_tasks_mm_cpumask+0
Committer testing:
Before:
[root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 Probe point 'clear_tasks_mm_cpumask' not found.
Error: Failed to add events.
[root@quaco ~]#
After:
[root@quaco ~]# perf probe clear_tasks_mm_cpumask:0 Added new event:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask)
You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask -aR sleep 1
[root@quaco ~]#
Using it with 'perf trace':
[root@quaco ~]# perf trace -e probe:clear_tasks_mm_cpumask
Doesn't seem to be used in x86_64:
$ find . -name "*.c" | xargs grep clear_tasks_mm_cpumask ./kernel/cpu.c: * clear_tasks_mm_cpumask - Safely clear tasks' mm_cpumask for a CPU ./kernel/cpu.c:void clear_tasks_mm_cpumask(int cpu) ./arch/xtensa/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/csky/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/sh/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/arm/kernel/smp.c: clear_tasks_mm_cpumask(cpu); ./arch/powerpc/mm/nohash/mmu_context.c: clear_tasks_mm_cpumask(cpu); $ find . -name "*.h" | xargs grep clear_tasks_mm_cpumask ./include/linux/cpu.h:void clear_tasks_mm_cpumask(int cpu); $ find . -name "*.S" | xargs grep clear_tasks_mm_cpumask $
--- tools/perf/util/probe-finder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/probe-finder.c +1 -1
@@ -1005,7 +1005,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data) param->retval =find_probe_point_by_line (pf); }else if (die_is_func_instance (sp_die)) {/* Instances always have the entry address */ -dwarf_entrypc (sp_die, &pf->addr); +die_entrypc (sp_die, &pf->addr);/* But in some case the entry address is 0 */ if (pf->addr ==0 ) { pr_debug("%s has no entry PC. Skipped\n",
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 100/161 drm/amdgpu: fix potential double drop fence reference
In reply to Greg Kroah-HartmanFrom: Pan Bian <[email protected]>
[ Upstream commit 946ab8db6953535a3a88c957db8328beacdfed9d ]
The object fence is not set to NULL after its reference is dropped. As a result, its reference may be dropped again if error occurs after that, which may lead to a use after free bug. To avoid the issue, fence is explicitly set to NULL after dropping its reference.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_test.c +2 -0
@@ -125,6 +125,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (vram_obj, &vram_map);if (r) {
@@ -170,6 +171,7 @@ static void amdgpu_do_test_moves(struct amdgpu_device *adev) }dma_fence_put (fence); + fence =NULL ; r =amdgpu_bo_kmap (gtt_obj[i], >t_map);if (r) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 101/161 perf parse: If pmu configuration fails free terms
In reply to Greg Kroah-HartmanFrom: Ian Rogers <[email protected]>
[ Upstream commit 38f2c4226e6bc3e8c41c318242821ba5dc825aba ]
Avoid a memory leak when the configuration fails.
--- tools/perf/util/parse-events.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/util/parse-events.c +8 -1
@@ -1253,8 +1253,15 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state,if (get_config_terms (head_config, &config_terms))return -ENOMEM ; -if (perf_pmu__config (pmu, &attr, head_config, parse_state->error)) +if (perf_pmu__config (pmu, &attr, head_config, parse_state->error)) { +struct perf_evsel_config_term *pos, *tmp; + +list_for_each_entry_safe (pos, tmp, &config_terms, list) { +list_del_init (&pos->list); +free (pos); + }return -EINVAL ; + } evsel = __add_event(list, &parse_state->idx, &attr, get_config_name(head_config), pmu,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 102/161 perf probe: Skip overlapped location on searching variables
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit dee36a2abb67c175265d49b9a8c7dfa564463d9a ]
Since debuginfo__find_probes() callback function can be called with the location which already passed, the callback function must filter out such overlapped locations.
add_probe_trace_event() has already done it by commit 1a375ae7659a ("perf probe: Skip same probe address for a given line"), but add_available_vars() doesn't. Thus perf probe -v shows same address repeatedly as below:
# perf probe -V vfs_read:18
Available variables at vfs_read:18
@<vfs_read+217>
char* buf
loff_t* pos
ssize_t ret
struct file* file
@<vfs_read+217>
char* buf
loff_t* pos
ssize_t ret
struct file* file
@<vfs_read+226>
char* buf
loff_t* pos
ssize_t ret
struct file* fileWith this fix, perf probe -V shows it correctly:
# perf probe -V vfs_read:18
Available variables at vfs_read:18
@<vfs_read+217>
char* buf
loff_t* pos
ssize_t ret
struct file* file
@<vfs_read+226>
char* buf
loff_t* pos
ssize_t ret
struct file* file--- tools/perf/util/probe-finder.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
tools/perf/util/probe-finder.c +20 -0
@@ -1417,6 +1417,18 @@ error:return DIE_FIND_CB_END ; } +static bool available_var_finder_overlap (struct available_var_finder *af) +{ +int i; + +for (i =0 ; i < af->nvls; i++) { +if (af->pf.addr == af->vls[i].point.address) +return true; + } +return false; + +} +/* Add a found vars into available variables list */ static int add_available_vars (Dwarf_Die *sc_die,struct probe_finder *pf) {
@@ -1427,6 +1439,14 @@ static int add_available_vars(Dwarf_Die *sc_die, struct probe_finder *pf)Dwarf_Die die_mem;int ret; +/* +* For some reason (e.g. different column assigned to same address), +* this callback can be called with the address which already passed. +* Ignore it first. +*/ +if (available_var_finder_overlap (af)) +return 0 ; +/* Check number of tevs */ if (af->nvls == af->max_vls) {pr_warning ("Too many( > %d) probe point found.\n" , af->max_vls);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 103/161 perf probe: Return a better scope DIE if there is no best scope
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit c701636aeec4c173208697d68da6e4271125564b ]
Make find_best_scope() returns innermost DIE at given address if there is no best matched scope DIE. Since Gcc sometimes generates intuitively strange line info which is out of inlined function address range, we need this fixup.
Without this, sometimes perf probe failed to probe on a line inside an inlined function:
# perf probe -D ksys_open:3
Failed to find scope of probe point.
Error: Failed to add events.With this fix, 'perf probe' can probe it:
# perf probe -D ksys_open:3 p:probe/ksys_open _text+25707308 p:probe/ksys_open_1 _text+25710596 p:probe/ksys_open_2 _text+25711114 p:probe/ksys_open_3 _text+25711343 p:probe/ksys_open_4 _text+25714058 p:probe/ksys_open_5 _text+2819653 p:probe/ksys_open_6 _text+2819701
--- tools/perf/util/probe-finder.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tools/perf/util/probe-finder.c +16 -1
@@ -767,6 +767,16 @@ static int find_best_scope_cb(Dwarf_Die *fn_die, void *data)return 0 ; } +/* Return innermost DIE */ +static int find_inner_scope_cb (Dwarf_Die *fn_die,void *data) +{ +struct find_scope_param *fsp = data; + +memcpy (fsp->die_mem, fn_die,sizeof (Dwarf_Die)); + fsp->found = true; +return 1 ; +} +/* Find an appropriate scope fits to given conditions */ static Dwarf_Die *find_best_scope (struct probe_finder *pf,Dwarf_Die *die_mem) {
@@ -778,8 +788,13 @@ static Dwarf_Die *find_best_scope(struct probe_finder *pf, Dwarf_Die *die_mem) .die_mem = die_mem, .found = false, }; +int ret; -cu_walk_functions_at (&pf->cu_die, pf->addr, find_best_scope_cb, &fsp); + ret =cu_walk_functions_at (&pf->cu_die, pf->addr, find_best_scope_cb, + &fsp); +if (!ret && !fsp.found) +cu_walk_functions_at (&pf->cu_die, pf->addr, + find_inner_scope_cb, &fsp);return fsp.found ? die_mem :NULL ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 104/161 perf probe: Fix to show calling lines of inlined functions
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit 86c0bf8539e7f46d91bd105e55eda96e0064caef ]
Fix to show calling lines of inlined functions (where an inline function is called).
die_walk_lines() filtered out the lines inside inlined functions based on the address. However this also filtered out the lines which call those inlined functions from the target function.
To solve this issue, check the call_file and call_line attributes and do not filter out if it matches to the line information.
Without this fix, perf probe -L doesn't show some lines correctly. (don't see the lines after 17)
# perf probe -L vfs_read
<vfs_read@/home/mhiramat/ksrc/linux/fs/read_write.c:0>
0 ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
1 {
2 ssize_t ret; 4 if (!(file->f_mode & FMODE_READ))
return -EBADF;
6 if (!(file->f_mode & FMODE_CAN_READ))
return -EINVAL;
8 if (unlikely(!access_ok(buf, count)))
return -EFAULT;
11 ret = rw_verify_area(READ, file, pos, count);
12 if (!ret) {
13 if (count > MAX_RW_COUNT)
count = MAX_RW_COUNT;
15 ret = __vfs_read(file, buf, count, pos);
16 if (ret > 0) {
fsnotify_access(file);
add_rchar(current, ret);
}With this fix:
# perf probe -L vfs_read
<vfs_read@/home/mhiramat/ksrc/linux/fs/read_write.c:0>
0 ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
1 {
2 ssize_t ret; 4 if (!(file->f_mode & FMODE_READ))
return -EBADF;
6 if (!(file->f_mode & FMODE_CAN_READ))
return -EINVAL;
8 if (unlikely(!access_ok(buf, count)))
return -EFAULT;
11 ret = rw_verify_area(READ, file, pos, count);
12 if (!ret) {
13 if (count > MAX_RW_COUNT)
count = MAX_RW_COUNT;
15 ret = __vfs_read(file, buf, count, pos);
16 if (ret > 0) {
17 fsnotify_access(file);
18 add_rchar(current, ret);
}
20 inc_syscr(current);
}--- tools/perf/util/dwarf-aux.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/perf/util/dwarf-aux.c +9 -1
@@ -768,7 +768,7 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)Dwarf_Lines *lines;Dwarf_Line *line;Dwarf_Addr addr; -const char *fname, *decf =NULL ; +const char *fname, *decf =NULL , *inf =NULL ;int lineno, ret =0 ;int decl =0 , inl;Dwarf_Die die_mem, *cu_die;
@@ -812,13 +812,21 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)*/ if (!dwarf_haspc (rt_die, addr))continue ; +if (die_find_inlinefunc (rt_die, addr, &die_mem)) { +/* Call-site check */ + inf =die_get_call_file (&die_mem); +if ((inf && !strcmp (inf, decf)) && +die_get_call_lineno (&die_mem) == lineno) + goto found; +dwarf_decl_line (&die_mem, &inl);if (inl != decl || decf !=dwarf_decl_file (&die_mem))continue ; } } +found:/* Get source line */ fname =dwarf_linesrc (line,NULL ,NULL );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 105/161 perf probe: Skip end-of-sequence and non statement lines
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit f4d99bdfd124823a81878b44b5e8750b97f73902 ]
Skip end-of-sequence and non-statement lines while walking through lines list.
The "end-of-sequence" line information means:
"the current address is that of the first byte after the
end of a sequence of target machine instructions."
(DWARF version 4 spec 6.2.2)
This actually means out of scope and we can not probe on it.
On the other hand, the statement lines (is_stmt) means:
"the current instruction is a recommended breakpoint location.
A recommended breakpoint location is intended to “represent” a line, a statement and/or a semantically distinct subpart of a statement."
(DWARF version 4 spec 6.2.2)
So, non-statement line info also should be skipped.
These can reduce unneeded probe points and also avoid an error.
E.g. without this patch:
# perf probe -a "clear_tasks_mm_cpumask:1"
Added new events:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask:1)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask:1)
probe:clear_tasks_mm_cpumask_2 (on clear_tasks_mm_cpumask:1)
probe:clear_tasks_mm_cpumask_3 (on clear_tasks_mm_cpumask:1)
probe:clear_tasks_mm_cpumask_4 (on clear_tasks_mm_cpumask:1)You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask_4 -aR sleep 1
#
This puts 5 probes on one line, but acutally it's not inlined function. This is because there are many non statement instructions at the function prologue.
With this patch:
# perf probe -a "clear_tasks_mm_cpumask:1"
Added new event:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask:1)You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask -aR sleep 1
#
Now perf-probe skips unneeded addresses.
Committer testing:
Slightly different results, but similar:
Before:
# uname -a
Linux quaco 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
#
# perf probe -a "clear_tasks_mm_cpumask:1"
Added new events:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask:1)
probe:clear_tasks_mm_cpumask_1 (on clear_tasks_mm_cpumask:1)
probe:clear_tasks_mm_cpumask_2 (on clear_tasks_mm_cpumask:1)You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask_2 -aR sleep 1
#
After:
# perf probe -a "clear_tasks_mm_cpumask:1"
Added new event:
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask:1)You can now use it in all perf tools, such as:
perf record -e probe:clear_tasks_mm_cpumask -aR sleep 1
# perf probe -l
probe:clear_tasks_mm_cpumask (on clear_tasks_mm_cpumask@kernel/cpu.c)
#--- tools/perf/util/dwarf-aux.c | 7 +++++++ 1 file changed, 7 insertions(+)
tools/perf/util/dwarf-aux.c +7 -0
@@ -773,6 +773,7 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data)int decl =0 , inl;Dwarf_Die die_mem, *cu_die;size_t nlines, i; +bool flag;/* Get the CU die */ if (dwarf_tag (rt_die) != DW_TAG_compile_unit) {
@@ -803,6 +804,12 @@ int die_walk_lines(Dwarf_Die *rt_die, line_walk_callback_t callback, void *data) "Possible error in debuginfo.\n");continue ; } +/* Skip end-of-sequence */ +if (dwarf_lineendsequence (line, &flag) !=0 || flag) +continue ; +/* Skip Non statement line-info */ +if (dwarf_linebeginstatement (line, &flag) !=0 || !flag) +continue ;/* Filter lines based on address */ if (rt_die != cu_die) {/*
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 106/161 perf probe: Filter out instances except for inlined subroutine and subprogram
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
[ Upstream commit da6cb952a89efe24bb76c4971370d485737a2d85 ]
Filter out instances except for inlined_subroutine and subprogram DIE in die_walk_instances() and die_is_func_instance().
This fixes an issue that perf probe sets some probes on calling address instead of a target function itself.
When perf probe walks on instances of an abstruct origin (a kind of function prototype of inlined function), die_walk_instances() can also pass a GNU_call_site (a GNU extension for call site) to callback. Since it is not an inlined instance of target function, we have to filter out when searching a probe point.
Without this patch, perf probe sets probes on call site address too.This can happen on some function which is marked "inlined", but has actual symbol. (I'm not sure why GCC mark it "inlined"):
# perf probe -D vfs_read p:probe/vfs_read _text+2500017 p:probe/vfs_read_1 _text+2499468 p:probe/vfs_read_2 _text+2499563 p:probe/vfs_read_3 _text+2498876 p:probe/vfs_read_4 _text+2498512 p:probe/vfs_read_5 _text+2498627
With this patch:
Slightly different results, similar tho:
# perf probe -D vfs_read p:probe/vfs_read _text+2498512
Committer testing:
# uname -a Linux quaco 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Before:
# perf probe -D vfs_read p:probe/vfs_read _text+3131557 p:probe/vfs_read_1 _text+3130975 p:probe/vfs_read_2 _text+3131047 p:probe/vfs_read_3 _text+3130380 p:probe/vfs_read_4 _text+3130000 # uname -a Linux quaco 5.3.8-200.fc30.x86_64 #1 SMP Tue Oct 29 14:46:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux #
After:
# perf probe -D vfs_read p:probe/vfs_read _text+3130000 #
--- tools/perf/util/dwarf-aux.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
tools/perf/util/dwarf-aux.c +13 -6
@@ -325,18 +325,22 @@ bool die_is_func_def(Dwarf_Die *dw_die)* @dw_die: a DIE * * Ensure that this DIE is an instance (which has an entry address). -* This returns true if @dw_die is a function instance. If not, you need to -* call die_walk_instances() to find actual instances. +* This returns true if @dw_die is a function instance. If not, the @dw_die +* must be a prototype. You can use die_walk_instances() to find actual +* instances. **/ bool die_is_func_instance (Dwarf_Die *dw_die) {Dwarf_Addr tmp;Dwarf_Attribute attr_mem; +int tag =dwarf_tag (dw_die); -/* Actually gcc optimizes non-inline as like as inlined */ -return !dwarf_func_inline (dw_die) && - (dwarf_entrypc (dw_die, &tmp) ==0 || -dwarf_attr (dw_die, DW_AT_ranges, &attr_mem) !=NULL ); +if (tag != DW_TAG_subprogram && + tag != DW_TAG_inlined_subroutine) +return false; + +return dwarf_entrypc (dw_die, &tmp) ==0 || +dwarf_attr (dw_die, DW_AT_ranges, &attr_mem) !=NULL ; }/**
@@ -615,6 +619,9 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data)Dwarf_Die *origin;int tmp; +if (!die_is_func_instance (inst)) +return DIE_FIND_CB_CONTINUE ; + attr =dwarf_attr (inst, DW_AT_abstract_origin, &attr_mem);if (attr ==NULL )return DIE_FIND_CB_CONTINUE ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 107/161 ath10k: fix get invalid tx rate for Mesh metric
In reply to Greg Kroah-HartmanFrom: Miaoqing Pan <[email protected]>
[ Upstream commit 05a11003a56507023f18d3249a4d4d119c0a3e9c ]
ath10k does not provide transmit rate info per MSDU in tx completion, mark that as -1 so mac80211 will ignore the rates. This fixes mac80211 update Mesh link metric with invalid transmit rate info.
Tested HW: QCA9984
Tested FW: 10.4-3.9.0.2-00035
--- drivers/net/wireless/ath/ath10k/txrx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/ath/ath10k/txrx.c +2 -0
@@ -100,6 +100,8 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, info =IEEE80211_SKB_CB (msdu);memset (&info->status,0 ,sizeof (info->status)); + info->status.rates[0 ].idx =-1 ; +trace_ath10k_txrx_tx_unref (ar, tx_done->msdu_id);if (tx_done->status ==HTT_TX_COMPL_STATE_DISCARD ) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 108/161 fsi: core: Fix small accesses and unaligned offsets via sysfs
In reply to Greg Kroah-HartmanFrom: Andrew Jeffery <[email protected]>
[ Upstream commit 9f4c2b516b4f031e3cd0e45957f4150b3c1a083d ]
Subtracting the offset delta from four-byte alignment lead to wrapping of the requested length where count is less than off. Generalise the length handling to enable and optimise aligned access sizes for all offset and size combinations. The new formula produces the following results for given offset and count values:
offset count | length
--------------+-------
0 1 | 1
0 2 | 2
0 3 | 2
0 4 | 4
0 5 | 4
1 1 | 1
1 2 | 1
1 3 | 1
1 4 | 1
1 5 | 1
2 1 | 1
2 2 | 2
2 3 | 2
2 4 | 2
2 5 | 2
3 1 | 1
3 2 | 1
3 3 | 1
3 4 | 1
3 5 | 1
We might need something like this for the cfam chardevs as well, for example we don't currently implement any alignment restrictions / handling in the hardware master driver.
--- drivers/fsi/fsi-core.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
drivers/fsi/fsi-core.c +27 -4
@@ -419,6 +419,31 @@ static int fsi_slave_scan(struct fsi_slave *slave)return 0 ; } +static unsigned long aligned_access_size (size_t offset,size_t count) +{ +unsigned long offset_unit, count_unit; + +/* Criteria: +* +* 1. Access size must be less than or equal to the maximum access +* width or the highest power-of-two factor of offset +* 2. Access size must be less than or equal to the amount specified by +* count +* +* The access width is optimal if we can calculate 1 to be strictly +* equal while still satisfying 2. +*/ + +/* Find 1 by the bottom bit of offset (with a 4 byte access cap) */ + offset_unit =BIT (__builtin_ctzl (offset |4 )); + +/* Find 2 by the top bit of count */ + count_unit =BIT (8 *sizeof (unsigned long ) -1 -__builtin_clzl (count)); + +/* Constrain the maximum access width to the minimum of both criteria */ +return BIT (__builtin_ctzl (offset_unit | count_unit)); +} +static ssize_t fsi_slave_sysfs_raw_read (struct file *file,struct kobject *kobj,struct bin_attribute *attr,char *buf,loff_t off,size_t count)
@@ -434,8 +459,7 @@ static ssize_t fsi_slave_sysfs_raw_read(struct file *file,return -EINVAL ;for (total_len =0 ; total_len < count; total_len += read_len) { - read_len =min_t (size_t, count,4 ); - read_len -= off &0x3 ; + read_len =aligned_access_size (off, count - total_len); rc =fsi_slave_read (slave, off, buf + total_len, read_len);if (rc)
@@ -462,8 +486,7 @@ static ssize_t fsi_slave_sysfs_raw_write(struct file *file,return -EINVAL ;for (total_len =0 ; total_len < count; total_len += write_len) { - write_len =min_t (size_t, count,4 ); - write_len -= off &0x3 ; + write_len =aligned_access_size (off, count - total_len); rc =fsi_slave_write (slave, off, buf + total_len, write_len);if (rc)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 109/161 media: pvrusb2: Fix oops on tear-down when radio support is not present
In reply to Greg Kroah-HartmanFrom: Mike Isely <[email protected]>
[ Upstream commit 7f404ae9cf2a285f73b3c18ab9303d54b7a3d8e1 ]
In some device configurations there's no radio or radio support in the driver. That's OK, as the driver sets itself up accordingly. However on tear-down in these caes it's still trying to tear down radio related context when there isn't anything there, leading to dereferences through a null pointer and chaos follows.
How this bug survived unfixed for 11 years in the pvrusb2 driver is a mystery to me.
[hverkuil: fix two checkpatch warnings]
--- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +7 -2
@@ -915,8 +915,12 @@ static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)pvr2_v4l2_dev_disassociate_parent (vp->dev_video);pvr2_v4l2_dev_disassociate_parent (vp->dev_radio);if (!list_empty (&vp->dev_video->devbase.fh_list) || - !list_empty (&vp->dev_radio->devbase.fh_list)) + (vp->dev_radio && + !list_empty (&vp->dev_radio->devbase.fh_list))) { +pvr2_trace (PVR2_TRACE_STRUCT , +"pvr2_v4l2 internal_check exit-empty id=%p" , vp);return ; + }pvr2_v4l2_destroy_no_lock (vp); }
@@ -990,7 +994,8 @@ static int pvr2_v4l2_release(struct file *file)kfree (fhp);if (vp->channel.mc_head->disconnect_flag &&list_empty (&vp->dev_video->devbase.fh_list) && -list_empty (&vp->dev_radio->devbase.fh_list)) { + (!vp->dev_radio || +list_empty (&vp->dev_radio->devbase.fh_list))) {pvr2_v4l2_destroy_no_lock (vp); }return 0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 110/161 media: si470x-i2c: add missed operations in remove
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 2df200ab234a86836a8879a05a8007d6b884eb14 ]
The driver misses calling v4l2_ctrl_handler_free and v4l2_device_unregister in remove like what is done in probe failure. Add the calls to fix it.
--- drivers/media/radio/si470x/radio-si470x-i2c.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/radio/si470x/radio-si470x-i2c.c +2 -0
@@ -455,6 +455,8 @@ static int si470x_i2c_remove(struct i2c_client *client)video_unregister_device (&radio->videodev);kfree (radio); +v4l2_ctrl_handler_free (&radio->hdl); +v4l2_device_unregister (&radio->v4l2_dev);return 0 ; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 111/161 EDAC/ghes: Fix grain calculation
In reply to Greg Kroah-HartmanFrom: Robert Richter <[email protected]>
[ Upstream commit 7088e29e0423d3195e09079b4f849ec4837e5a75 ]
The current code to convert a physical address mask to a grain (defined as granularity in bytes) is:
e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK);
This is broken in several ways:
1) It calculates to wrong grain values. E.g., a physical address mask of ~0xfff should give a grain of 0x1000. Without considering PAGE_MASK, there is an off-by-one. Things are worse when also filtering it with ~PAGE_MASK. This will calculate to a grain with the upper bits set. In the example it even calculates to ~0.
2) The grain does not depend on and is unrelated to the kernel's page-size. The page-size only matters when unmapping memory in memory_failure(). Smaller grains are wrongly rounded up to the page-size, on architectures with a configurable page-size (e.g. arm64) this could round up to the even bigger page-size of the hypervisor.
Fix this with:
e->grain = ~mem_err->physical_addr_mask + 1;
The grain_bits are defined as:
grain = 1 << grain_bits;
Change also the grain_bits calculation accordingly, it is the same formula as in edac_mc.c now and the code can be unified.
The value in ->physical_addr_mask coming from firmware is assumed to be contiguous, but this is not sanity-checked. However, in case the mask is non-contiguous, a conversion to grain_bits effectively converts the grain bit mask to a power of 2 by rounding it up.
--- drivers/edac/ghes_edac.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/edac/ghes_edac.c +8 -2
@@ -187,6 +187,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev,/* Cleans the error report buffer */ memset (e,0 ,sizeof (*e)); e->error_count =1 ; + e->grain =1 ;strcpy (e->label,"unknown label" ); e->msg = pvt->msg; e->other_detail = pvt->other_detail;
@@ -282,7 +283,7 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev,/* Error grain */ if (mem_err->validation_bits &CPER_MEM_VALID_PA_MASK ) - e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK ); + e->grain = ~mem_err->physical_addr_mask +1 ;/* Memory error location, mapped on e->location */ p = e->location;
@@ -389,8 +390,13 @@ void ghes_edac_report_mem_error(struct ghes *ghes, int sev,if (p > pvt->other_detail) *(p -1 ) ='\0' ; +/* Sanity-check driver-supplied grain value. */ +if (WARN_ON_ONCE (!e->grain)) + e->grain =1 ; + + grain_bits =fls_long (e->grain -1 ); +/* Generate the trace event */ - grain_bits =fls_long (e->grain);snprintf (pvt->detail_location,sizeof (pvt->detail_location),"APEI location: %s %s" , e->location, e->other_detail); trace_mc_event(type, e->msg, e->label, e->error_count,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 112/161 spi: pxa2xx: Add missed security checks
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 5eb263ef08b5014cfc2539a838f39d2fd3531423 ]
pxa2xx_spi_init_pdata misses checks for devm_clk_get and platform_get_irq.
Add checks for them to fix the bugs.
Since ssp->clk and ssp->irq are used in probe, they are mandatory here. So we cannot use _optional() for devm_clk_get and platform_get_irq.
--- drivers/spi/spi-pxa2xx.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/spi/spi-pxa2xx.c +6 -0
@@ -1559,7 +1559,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) } ssp->clk =devm_clk_get (&pdev->dev,NULL ); +if (IS_ERR (ssp->clk)) +return NULL ; + ssp->irq =platform_get_irq (pdev,0 ); +if (ssp->irq <0 ) +return NULL ; + ssp->type = type; ssp->pdev = pdev; ssp->port_id =pxa2xx_spi_get_port_id (adev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 113/161 ASoC: rt5677: Mark reg RT5677_PWR_ANLG2 as volatile
In reply to Greg Kroah-HartmanFrom: Ben Zhang <[email protected]>
[ Upstream commit eabf424f7b60246c76dcb0ea6f1e83ef9abbeaa6 ]
The codec dies when RT5677_PWR_ANLG2(MX-64h) is set to 0xACE1 while it's streaming audio over SPI. The DSP firmware turns on PLL2 (MX-64 bit 8) when SPI streaming starts. However regmap does not believe that register can change by itself. When BST1 (bit 15) is turned on with regmap_update_bits(), it doesn't read the register first before write, so PLL2 power bit is cleared by accident.
Marking MX-64h as volatile in regmap solved the issue.
--- sound/soc/codecs/rt5677.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/rt5677.c +1 -0
@@ -297,6 +297,7 @@ static bool rt5677_volatile_register(struct device *dev, unsigned int reg)case RT5677_I2C_MASTER_CTRL7 :case RT5677_I2C_MASTER_CTRL8 :case RT5677_HAP_GENE_CTRL2 : +case RT5677_PWR_ANLG2 :/* Modified by DSP firmware */ case RT5677_PWR_DSP_ST :case RT5677_PRIV_DATA :case RT5677_ASRC_22 :
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 114/161 ASoC: Intel: kbl_rt5663_rt5514_max98927: Add dmic format constraint
In reply to Greg Kroah-HartmanFrom: Yu-Hsuan Hsu <[email protected]>
[ Upstream commit e2db787bdcb4f2722ecf410168f0583764634e45 ]
On KBL platform, the microphone is attached to external codec(rt5514) instead of PCH. However, TDM slot between PCH and codec is 16 bits only. In order to avoid setting wrong format, we should add a constraint to force to use 16 bits format forever.
--- sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +3 -0
@@ -422,6 +422,9 @@ static int kabylake_dmic_startup(struct snd_pcm_substream *substream)snd_pcm_hw_constraint_list (runtime,0 ,SNDRV_PCM_HW_PARAM_CHANNELS , dmic_constraints); + runtime->hw.formats =SNDRV_PCM_FMTBIT_S16_LE ; +snd_pcm_hw_constraint_msbits (runtime,0 ,16 ,16 ); +return snd_pcm_hw_constraint_list (substream->runtime,0 ,SNDRV_PCM_HW_PARAM_RATE , &constraints_rates); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 115/161 s390/disassembler: dont hide instruction addresses
In reply to Greg Kroah-HartmanFrom: Ilya Leoshkevich <[email protected]>
[ Upstream commit 544f1d62e3e6c6e6d17a5e56f6139208acb5ff46 ]
Due to kptr_restrict, JITted BPF code is now displayed like this:
000000000b6ed1b2: ebdff0800024 stmg %r13,%r15,128(%r15) 000000004cde2ba0: 41d0f040 la %r13,64(%r15) 00000000fbad41b0: a7fbffa0 aghi %r15,-96
Leaking kernel addresses to dmesg is not a concern in this case, because this happens only when JIT debugging is explicitly activated, which only root can do.
Use %px in this particular instance, and also to print an instruction address in show_code and PCREL (e.g. brasl) arguments in print_insn. While at present functionally equivalent to %016lx, %px is recommended by Documentation/core-api/printk-formats.rst for such cases.
--- arch/s390/kernel/dis.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/s390/kernel/dis.c +7 -6
@@ -1930,10 +1930,11 @@ static int print_insn(char *buffer, unsigned char *code, unsigned long addr) ptr +=sprintf (ptr,"%%c%i" , value); else if (operand->flags & OPERAND_VR) ptr += sprintf(ptr, "%%v%i", value); - else if (operand->flags & OPERAND_PCREL) - ptr += sprintf(ptr, "%lx", (signed int) value - + addr); - else if (operand->flags & OPERAND_SIGNED) + else if (operand->flags & OPERAND_PCREL) { +void *pcrel = (void *)((int )value + addr); + + ptr +=sprintf (ptr,"%px" , pcrel); + } else if (operand->flags & OPERAND_SIGNED) ptr += sprintf(ptr, "%i", value); else ptr += sprintf(ptr, "%u", value);
@@ -2005,7 +2006,7 @@ void show_code(struct pt_regs *regs)else *ptr++ =' ' ; addr = regs->psw.addr + start -32 ; - ptr +=sprintf (ptr,"%016lx: " , addr); + ptr +=sprintf (ptr,"%px: " , (void *)addr);if (start + opsize >= end)break ;for (i =0 ; i < opsize; i++)
@@ -2033,7 +2034,7 @@ void print_fn_code(unsigned char *code, unsigned long len) opsize =insn_length (*code);if (opsize > len)break ; - ptr +=sprintf (ptr,"%p: " , code); + ptr +=sprintf (ptr,"%px: " , code);for (i =0 ; i < opsize; i++) ptr +=sprintf (ptr,"%02x" , code[i]); *ptr++ ='\t' ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 116/161 parport: load lowlevel driver if ports not found
In reply to Greg Kroah-HartmanFrom: Sudip Mukherjee <[email protected]>
[ Upstream commit 231ec2f24dad18d021b361045bbd618ba62a274e ]
Usually all the distro will load the parport low level driver as part of their initialization. But we can get into a situation where all the parallel port drivers are built as module and we unload all the modules at a later time. Then if we just do "modprobe parport" it will only load the parport module and will not load the low level driver which will actually register the ports. So, check the bus if there is any parport registered, if not, load the low level driver.
We can get into the above situation with all distro but only Suse has setup the alias for "parport_lowlevel" and so it only works in Suse. Users of Debian based distro will need to load the lowlevel module manually.
--- drivers/parport/share.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/parport/share.c +21 -0
@@ -230,6 +230,18 @@ static int port_check(struct device *dev, void *dev_drv)return 0 ; } +/* +* Iterates through all the devices connected to the bus and return 1 +* if the device is a parallel port. +*/ + +static int port_detect (struct device *dev,void *dev_drv) +{ +if (is_parport (dev)) +return 1 ; +return 0 ; +} +/** * parport_register_driver - register a parallel port device driver * @drv: structure describing the driver
@@ -282,6 +294,15 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner,if (ret)return ret; +/* +* check if bus has any parallel port registered, if +* none is found then load the lowlevel driver. +*/ + ret =bus_for_each_dev (&parport_bus_type,NULL ,NULL , + port_detect); +if (!ret) +get_lowlevel_driver (); +mutex_lock (®istration_lock);if (drv->match_port) bus_for_each_dev(&parport_bus_type, NULL, drv,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 117/161 cpufreq: Register drivers only after CPU devices have been registered
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
[ Upstream commit 46770be0cf94149ca48be87719bda1d951066644 ]
The cpufreq core heavily depends on the availability of the struct device for CPUs and if they aren't available at the time cpufreq driver is registered, we will never succeed in making cpufreq work.
This happens due to following sequence of events:
- cpufreq_register_driver()
- subsys_interface_register()
- return 0; //successful registration of driver
... at a later point of time
- register_cpu();
- device_register();
- bus_probe_device();
- sif->add_dev();
- cpufreq_add_dev();
- get_cpu_device(); //FAILS
- per_cpu(cpu_sys_devices, num) = &cpu->dev; //used by get_cpu_device()
- return 0; //CPU registered successfully
Because the per-cpu variable cpu_sys_devices is set only after the CPU device is regsitered, cpufreq will never be able to get it when cpufreq_add_dev() is called.
This patch avoids this failure by making sure device structure of at least CPU0 is available when the cpufreq driver is registered, else return -EPROBE_DEFER.
--- drivers/cpufreq/cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/cpufreq.c +7 -0
@@ -2475,6 +2475,13 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)if (cpufreq_disabled ())return -ENODEV ; +/* +* The cpufreq core depends heavily on the availability of device +* structure, make sure they are available before proceeding further. +*/ +if (!get_cpu_device (0 )) +return -EPROBE_DEFER ; + if (!driver_data || !driver_data->verify || !driver_data->init || !(driver_data->setpolicy || driver_data->target_index || driver_data->target) ||
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 118/161 x86/crash: Add a forward declaration of struct kimage
In reply to Greg Kroah-HartmanFrom: Lianbo Jiang <[email protected]>
[ Upstream commit 112eee5d06007dae561f14458bde7f2a4879ef4e ]
Add a forward declaration of struct kimage to the crash.h header because future changes will invoke a crash-specific function from the realmode init path and the compiler will complain otherwise like this:
In file included from arch/x86/realmode/init.c:11:
./arch/x86/include/asm/crash.h:5:32: warning: ‘struct kimage’ declared inside\
parameter list will not be visible outside of this definition or declaration
5 | int crash_load_segments(struct kimage *image);
| ^~~~~~
./arch/x86/include/asm/crash.h:6:37: warning: ‘struct kimage’ declared inside\
parameter list will not be visible outside of this definition or declaration
6 | int crash_copy_backup_region(struct kimage *image);
| ^~~~~~ ./arch/x86/include/asm/crash.h:7:39: warning: ‘struct kimage’ declared inside\
parameter list will not be visible outside of this definition or declaration
7 | int crash_setup_memmap_entries(struct kimage *image,
|
[ bp: Rewrite the commit message. ]
--- arch/x86/include/asm/crash.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/crash.h +2 -0
@@ -2,6 +2,8 @@#ifndef _ASM_X86_CRASH_H#define _ASM_X86_CRASH_H +struct kimage ; +int crash_load_segments (struct kimage *image);int crash_copy_backup_region (struct kimage *image); int crash_setup_memmap_entries(struct kimage *image,
Signature · 9 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Greg Kroah-Hartman
maintainerPATCH 119/161 iwlwifi: mvm: fix unaligned read of rx_pkt_status
In reply to Greg Kroah-HartmanFrom: Wang Xuerui <[email protected]>
[ Upstream commit c5aaa8be29b25dfe1731e9a8b19fd91b7b789ee3 ]
This is present since the introduction of iwlmvm.
Example stack trace on MIPS:
[<ffffffffc0789328>] iwl_mvm_rx_rx_mpdu+0xa8/0xb88 [iwlmvm] [<ffffffffc0632b40>] iwl_pcie_rx_handle+0x420/0xc48 [iwlwifi]
Tested with a Wireless AC 7265 for ~6 months, confirmed to fix the problem. No other unaligned accesses are spotted yet.
--- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +2 -1
@@ -62,6 +62,7 @@* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#include <asm/unaligned.h> #include <linux/etherdevice.h> #include <linux/skbuff.h> #include "iwl-trans.h"
@@ -290,7 +291,7 @@ void iwl_mvm_rx_rx_mpdu(struct iwl_mvm *mvm, struct napi_struct *napi, rx_res = (struct iwl_rx_mpdu_res_start *)pkt->data; hdr = (struct ieee80211_hdr *)(pkt->data +sizeof (*rx_res)); len =le16_to_cpu (rx_res->byte_count); - rx_pkt_status =le32_to_cpup ((__le32 *) + rx_pkt_status =get_unaligned_le32 ((__le32 *) (pkt->data +sizeof (*rx_res) + len));/* Dont use dev_alloc_skb(), we'll have enough headroom once
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 120/161 spi: tegra20-slink: add missed clk_unprepare
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit 04358e40ba96d687c0811c21d9dede73f5244a98 ]
The driver misses calling clk_unprepare in probe failure and remove. Add the calls to fix it.
--- drivers/spi/spi-tegra20-slink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/spi/spi-tegra20-slink.c +4 -1
@@ -1078,7 +1078,7 @@ static int tegra_slink_probe(struct platform_device *pdev) ret =clk_enable (tspi->clk);if (ret <0 ) {dev_err (&pdev->dev,"Clock enable failed %d\n" , ret); - goto exit_free_master; + goto exit_clk_unprepare; } spi_irq =platform_get_irq (pdev,0 );
@@ -1151,6 +1151,8 @@ exit_free_irq:free_irq (spi_irq, tspi); exit_clk_disable:clk_disable (tspi->clk); +exit_clk_unprepare: +clk_unprepare (tspi->clk); exit_free_master:spi_master_put (master);return ret;
@@ -1164,6 +1166,7 @@ static int tegra_slink_remove(struct platform_device *pdev)free_irq (tspi->irq, tspi);clk_disable (tspi->clk); +clk_unprepare (tspi->clk);if (tspi->tx_dma_chan)tegra_slink_deinit_dma_param (tspi, false);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 121/161 crypto: virtio - deal with unsupported input sizes
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 19c5da7d4a2662e85ea67d2d81df57e038fde3ab ]
Return -EINVAL for input sizes that are not a multiple of the AES block size, since they are not supported by our CBC chaining mode.
While at it, remove the pr_err() that reports unsupported key sizes being used: we shouldn't spam the kernel log with that.
--- drivers/crypto/virtio/virtio_crypto_algs.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/crypto/virtio/virtio_crypto_algs.c +10 -2
@@ -110,8 +110,6 @@ virtio_crypto_alg_validate_key(int key_len, uint32_t *alg) *alg =VIRTIO_CRYPTO_CIPHER_AES_CBC ;break ;default : -pr_err ("virtio_crypto: Unsupported key length: %d\n" , - key_len);return -EINVAL ; }return 0 ;
@@ -485,6 +483,11 @@ static int virtio_crypto_ablkcipher_encrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
@@ -505,6 +508,11 @@ static int virtio_crypto_ablkcipher_decrypt(struct ablkcipher_request *req)/* Use the first data virtqueue as default */ struct data_queue *data_vq = &vcrypto->data_vq[0 ]; +if (!req->nbytes) +return 0 ; +if (req->nbytes %AES_BLOCK_SIZE ) +return -EINVAL ; + vc_req->dataq = data_vq; vc_req->alg_cb = virtio_crypto_dataq_sym_callback; vc_sym_req->ablkcipher_ctx = ctx;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 122/161 mmc: tmio: Add MMC_CAP_ERASE to allow erase/discard/trim requests
In reply to Greg Kroah-HartmanFrom: Eugeniu Rosca <[email protected]>
[ Upstream commit c91843463e9e821dc3b48fe37e3155fa38299f6e ]
Isolated initially to renesas_sdhi_internal_dmac [1], Ulf suggested adding MMC_CAP_ERASE to the TMIO mmc core:
On Fri, Nov 15, 2019 at 10:27:25AM +0100, Ulf Hansson wrote:
-- snip --
This test and due to the discussions with Wolfram and you in this thread, I would actually suggest that you enable MMC_CAP_ERASE for all tmio variants, rather than just for this particular one.
In other words, set the cap in tmio_mmc_host_probe() should be fine, as it seems none of the tmio variants supports HW busy detection at this point.
-- snip --
Testing on R-Car H3ULCB-KF doesn't reveal any issues (v5.4-rc7):
root@rcar-gen3:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk0 179:0 0 59.2G 0 disk <--- eMMC mmcblk0boot0 179:8 0 4M 1 disk mmcblk0boot1 179:16 0 4M 1 disk mmcblk1 179:24 0 30G 0 disk <--- SD card
root@rcar-gen3:~# time blkdiscard /dev/mmcblk0 real 0m8.659s user 0m0.001s sys 0m1.920s
root@rcar-gen3:~# time blkdiscard /dev/mmcblk1 real 0m1.176s user 0m0.001s sys 0m0.124s
[1] https://lore.kernel.org/linux-renesas-soc/[email protected]/
--- drivers/mmc/host/tmio_mmc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/tmio_mmc_core.c +1 -1
@@ -1220,7 +1220,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, _host->start_signal_voltage_switch; mmc->ops = &tmio_mmc_ops; - mmc->caps |=MMC_CAP_4_BIT_DATA | pdata->capabilities; + mmc->caps |=MMC_CAP_ERASE |MMC_CAP_4_BIT_DATA | pdata->capabilities; mmc->caps2 |= pdata->capabilities2; mmc->max_segs = pdata->max_segs ? :32 ; mmc->max_blk_size =512 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 123/161 btrfs: dont prematurely free work in end_workqueue_fn()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 9be490f1e15c34193b1aae17da58e14dd9f55a95 ]
Currently, end_workqueue_fn() frees the end_io_wq entry (which embeds the work item) and then calls bio_endio(). This is another potential instance of the bug in "btrfs: don't prematurely free work in run_ordered_work()".
In particular, the endio call may depend on other work items. For example, btrfs_end_dio_bio() can call btrfs_subio_endio_read() -> __btrfs_correct_data_nocsum() -> dio_read_error() -> submit_dio_repair_bio(), which submits a bio that is also completed through a end_workqueue_fn() work item. However, __btrfs_correct_data_nocsum() waits for the newly submitted bio to complete, thus it depends on another work item.
This example currently usually works because we use different workqueue helper functions for BTRFS_WQ_ENDIO_DATA and BTRFS_WQ_ENDIO_DIO_REPAIR. However, it may deadlock with stacked filesystems and is fragile overall. The proper fix is to free the work item at the very end of the work function, so let's do that.
--- fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/disk-io.c +1 -1
@@ -1679,8 +1679,8 @@ static void end_workqueue_fn(struct btrfs_work *work) bio->bi_status = end_io_wq->status; bio->bi_private = end_io_wq->private; bio->bi_end_io = end_io_wq->end_io; -kmem_cache_free (btrfs_end_io_wq_cache, end_io_wq);bio_endio (bio); +kmem_cache_free (btrfs_end_io_wq_cache, end_io_wq); }static int cleaner_kthread (void *arg)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 124/161 btrfs: dont prematurely free work in run_ordered_work()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit c495dcd6fbe1dce51811a76bb85b4675f6494938 ]
We hit the following very strange deadlock on a system with Btrfs on a loop device backed by another Btrfs filesystem:
1. The top (loop device) filesystem queues an async_cow work item from cow_file_range_async(). We'll call this work X.
2. Worker thread A starts work X (normal_work_helper()).
3. Worker thread A executes the ordered work for the top filesystem (run_ordered_work()).
4. Worker thread A finishes the ordered work for work X and frees X (work->ordered_free()).
5. Worker thread A executes another ordered work and gets blocked on I/O to the bottom filesystem (still in run_ordered_work()).
6. Meanwhile, the bottom filesystem allocates and queues an async_cow work item which happens to be the recently-freed X.
7. The workqueue code sees that X is already being executed by worker thread A, so it schedules X to be executed _after_ worker thread A finishes (see the find_worker_executing_work() call in process_one_work()).
Now, the top filesystem is waiting for I/O on the bottom filesystem, but the bottom filesystem is waiting for the top filesystem to finish, so we deadlock.
This happens because we are breaking the workqueue assumption that a work item cannot be recycled while it still depends on other work. Fix it by waiting to free the work item until we are done with all of the related ordered work.
P.S.:
One might ask why the workqueue code doesn't try to detect a recycled work item. It actually does try by checking whether the work item has the same work function (find_worker_executing_work()), but in our case the function is the same. This is the only key that the workqueue code has available to compare, short of adding an additional, layer-violating "custom key". Considering that we're the only ones that have ever hit this, we should just play by the rules.
Unfortunately, we haven't been able to create a minimal reproducer other than our full container setup using a compress-force=zstd filesystem on top of another compress-force=zstd filesystem.
--- fs/btrfs/async-thread.c | 56 ++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 12 deletions(-)
fs/btrfs/async-thread.c +44 -12
@@ -265,16 +265,17 @@ out: } } -static void run_ordered_work (struct __btrfs_workqueue *wq) +static void run_ordered_work (struct __btrfs_workqueue *wq, +struct btrfs_work *self) {struct list_head *list = &wq->ordered_list;struct btrfs_work *work;spinlock_t *lock = &wq->list_lock;unsigned long flags; +void *wtag; +bool free_self = false;while (1 ) { -void *wtag; -spin_lock_irqsave (lock, flags);if (list_empty (list))break ;
@@ -300,16 +301,47 @@ static void run_ordered_work(struct __btrfs_workqueue *wq)list_del (&work->ordered_list);spin_unlock_irqrestore (lock, flags); -/* -* We don't want to call the ordered free functions with the -* lock held though. Save the work as tag for the trace event, -* because the callback could free the structure. -*/ - wtag = work; - work->ordered_free (work); -trace_btrfs_all_work_done (wq->fs_info, wtag); +if (work == self) { +/* +* This is the work item that the worker is currently +* executing. +* +* The kernel workqueue code guarantees non-reentrancy +* of work items. I.e., if a work item with the same +* address and work function is queued twice, the second +* execution is blocked until the first one finishes. A +* work item may be freed and recycled with the same +* work function; the workqueue code assumes that the +* original work item cannot depend on the recycled work +* item in that case (see find_worker_executing_work()). +* +* Note that the work of one Btrfs filesystem may depend +* on the work of another Btrfs filesystem via, e.g., a +* loop device. Therefore, we must not allow the current +* work item to be recycled until we are really done, +* otherwise we break the above assumption and can +* deadlock. +*/ + free_self = true; + }else { +/* +* We don't want to call the ordered free functions with +* the lock held though. Save the work as tag for the +* trace event, because the callback could free the +* structure. +*/ + wtag = work; + work->ordered_free (work); +trace_btrfs_all_work_done (wq->fs_info, wtag); + } }spin_unlock_irqrestore (lock, flags); + +if (free_self) { + wtag = self; + self->ordered_free (self); +trace_btrfs_all_work_done (wq->fs_info, wtag); + } }static void normal_work_helper (struct btrfs_work *work)
@@ -337,7 +369,7 @@ static void normal_work_helper(struct btrfs_work *work) work->func (work);if (need_order) {set_bit (WORK_DONE_BIT , &work->flags); -run_ordered_work (wq); +run_ordered_work (wq, work); }if (!need_order)trace_btrfs_all_work_done (wq->fs_info, wtag);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 125/161 spi: st-ssc4: add missed pm_runtime_disable
In reply to Greg Kroah-HartmanFrom: Chuhong Yuan <[email protected]>
[ Upstream commit cd050abeba2a95fe5374eec28ad2244617bcbab6 ]
The driver forgets to call pm_runtime_disable in probe failure and remove.
Add the missed calls to fix it.
--- drivers/spi/spi-st-ssc4.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-st-ssc4.c +3 -0
@@ -385,6 +385,7 @@ static int spi_st_probe(struct platform_device *pdev)return 0 ; clk_disable: +pm_runtime_disable (&pdev->dev);clk_disable_unprepare (spi_st->clk); put_master:spi_master_put (master);
@@ -396,6 +397,8 @@ static int spi_st_remove(struct platform_device *pdev)struct spi_master *master =platform_get_drvdata (pdev);struct spi_st *spi_st =spi_master_get_devdata (master); +pm_runtime_disable (&pdev->dev); +clk_disable_unprepare (spi_st->clk);pinctrl_pm_select_sleep_state (&pdev->dev);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 126/161 x86/insn: Add some Intel instructions to the opcode map
In reply to Greg Kroah-HartmanFrom: Adrian Hunter <[email protected]>
[ Upstream commit b980be189c9badba50634671e2303e92bf28e35a ]
Add to the opcode map the following instructions:
cldemote
tpause
umonitor
umwait
movdiri
movdir64b
enqcmd
enqcmds
encls
enclu
enclv
pconfig
wbnoinvd
For information about the instructions, refer Intel SDM May 2019 (325462-070US) and Intel Architecture Instruction Set Extensions May 2019 (319433-037).
The instruction decoding can be tested using the perf tools' "x86 instruction decoder - new instructions" test as folllows:
$ perf test -v "new " 2>&1 | grep -i cldemote Decoded ok: 0f 1c 00 cldemote (%eax) Decoded ok: 0f 1c 05 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%eax,%ecx,8) Decoded ok: 0f 1c 00 cldemote (%rax) Decoded ok: 41 0f 1c 00 cldemote (%r8) Decoded ok: 0f 1c 04 25 78 56 34 12 cldemote 0x12345678 Decoded ok: 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%rax,%rcx,8) Decoded ok: 41 0f 1c 84 c8 78 56 34 12 cldemote 0x12345678(%r8,%rcx,8) $ perf test -v "new " 2>&1 | grep -i tpause Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 0f ae f3 tpause %ebx Decoded ok: 66 41 0f ae f0 tpause %r8d $ perf test -v "new " 2>&1 | grep -i umonitor Decoded ok: 67 f3 0f ae f0 umonitor %ax Decoded ok: f3 0f ae f0 umonitor %eax Decoded ok: 67 f3 0f ae f0 umonitor %eax Decoded ok: f3 0f ae f0 umonitor %rax Decoded ok: 67 f3 41 0f ae f0 umonitor %r8d $ perf test -v "new " 2>&1 | grep -i umwait Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 0f ae f0 umwait %eax Decoded ok: f2 41 0f ae f0 umwait %r8d $ perf test -v "new " 2>&1 | grep -i movdiri Decoded ok: 0f 38 f9 03 movdiri %eax,(%ebx) Decoded ok: 0f 38 f9 88 78 56 34 12 movdiri %ecx,0x12345678(%eax) Decoded ok: 48 0f 38 f9 03 movdiri %rax,(%rbx) Decoded ok: 48 0f 38 f9 88 78 56 34 12 movdiri %rcx,0x12345678(%rax) $ perf test -v "new " 2>&1 | grep -i movdir64b Decoded ok: 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx Decoded ok: 67 66 0f 38 f8 1c movdir64b (%si),%bx Decoded ok: 67 66 0f 38 f8 8c 34 12 movdir64b 0x1234(%si),%cx Decoded ok: 66 0f 38 f8 18 movdir64b (%rax),%rbx Decoded ok: 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%rax),%rcx Decoded ok: 67 66 0f 38 f8 18 movdir64b (%eax),%ebx Decoded ok: 67 66 0f 38 f8 88 78 56 34 12 movdir64b 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmd Decoded ok: f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: 67 f2 0f 38 f8 1c enqcmd (%si),%bx Decoded ok: 67 f2 0f 38 f8 8c 34 12 enqcmd 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f2 0f 38 f8 18 enqcmd (%rax),%rbx Decoded ok: f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%rax),%rcx Decoded ok: 67 f2 0f 38 f8 18 enqcmd (%eax),%ebx Decoded ok: 67 f2 0f 38 f8 88 78 56 34 12 enqcmd 0x12345678(%eax),%ecx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i enqcmds Decoded ok: f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx Decoded ok: 67 f3 0f 38 f8 1c enqcmds (%si),%bx Decoded ok: 67 f3 0f 38 f8 8c 34 12 enqcmds 0x1234(%si),%cx Decoded ok: f3 0f 38 f8 18 enqcmds (%rax),%rbx Decoded ok: f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%rax),%rcx Decoded ok: 67 f3 0f 38 f8 18 enqcmds (%eax),%ebx Decoded ok: 67 f3 0f 38 f8 88 78 56 34 12 enqcmds 0x12345678(%eax),%ecx $ perf test -v "new " 2>&1 | grep -i encls Decoded ok: 0f 01 cf encls Decoded ok: 0f 01 cf encls $ perf test -v "new " 2>&1 | grep -i enclu Decoded ok: 0f 01 d7 enclu Decoded ok: 0f 01 d7 enclu $ perf test -v "new " 2>&1 | grep -i enclv Decoded ok: 0f 01 c0 enclv Decoded ok: 0f 01 c0 enclv $ perf test -v "new " 2>&1 | grep -i pconfig Decoded ok: 0f 01 c5 pconfig Decoded ok: 0f 01 c5 pconfig $ perf test -v "new " 2>&1 | grep -i wbnoinvd Decoded ok: f3 0f 09 wbnoinvd Decoded ok: f3 0f 09 wbnoinvd
--- arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ tools/objtool/arch/x86/lib/x86-opcode-map.txt | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-)
arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
tools/objtool/arch/x86/lib/x86-opcode-map.txt +12 -6
@@ -333,7 +333,7 @@ AVXcode: 1 06: CLTS 07: SYSRET (o64) 08: INVD -09: WBINVD +09: WBINVD | WBNOINVD (F3) 0a: 0b: UD2 (1B) 0c:
@@ -364,7 +364,7 @@ AVXcode: 1 # a ModR/M byte. 1a: BNDCL Gv,Ev (F3) | BNDCU Gv,Ev (F2) | BNDMOV Gv,Ev (66) | BNDLDX Gv,Ev 1b: BNDCN Gv,Ev (F2) | BNDMOV Ev,Gv (66) | BNDMK Gv,Ev (F3) | BNDSTX Ev,Gv -1c: +1c: Grp20 (1A),(1C) 1d: 1e: 1f: NOP Ev
@@ -792,6 +792,8 @@ f3: Grp17 (1A) f5: BZHI Gy,Ey,By (v) | PEXT Gy,By,Ey (F3),(v) | PDEP Gy,By,Ey (F2),(v) f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) +f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) +f9: MOVDIRI My,Gy EndTable Table: 3-byte opcode 2 (0x0f 0x3a)
@@ -943,9 +945,9 @@ GrpTable: Grp6 EndTable GrpTable: Grp7 -0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) -1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) -2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) +0: SGDT Ms | VMCALL (001),(11B) | VMLAUNCH (010),(11B) | VMRESUME (011),(11B) | VMXOFF (100),(11B) | PCONFIG (101),(11B) | ENCLV (000),(11B) +1: SIDT Ms | MONITOR (000),(11B) | MWAIT (001),(11B) | CLAC (010),(11B) | STAC (011),(11B) | ENCLS (111),(11B) +2: LGDT Ms | XGETBV (000),(11B) | XSETBV (001),(11B) | VMFUNC (100),(11B) | XEND (101)(11B) | XTEST (110)(11B) | ENCLU (111),(11B) 3: LIDT Ms 4: SMSW Mw/Rv 5: rdpkru (110),(11B) | wrpkru (111),(11B)
@@ -1020,7 +1022,7 @@ GrpTable: Grp15 3: vstmxcsr Md (v1) | WRGSBASE Ry (F3),(11B) 4: XSAVE | ptwrite Ey (F3),(11B) 5: XRSTOR | lfence (11B) -6: XSAVEOPT | clwb (66) | mfence (11B) +6: XSAVEOPT | clwb (66) | mfence (11B) | TPAUSE Rd (66),(11B) | UMONITOR Rv (F3),(11B) | UMWAIT Rd (F2),(11B) 7: clflush | clflushopt (66) | sfence (11B) EndTable
@@ -1051,6 +1053,10 @@ GrpTable: Grp19 6: vscatterpf1qps/d Wx (66),(ev) EndTable +GrpTable: Grp20 +0: cldemote Mb +EndTable + # AMD's Prefetch Group GrpTable: GrpP 0: PREFETCH
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 127/161 iwlwifi: check kasprintf() return value
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 5974fbb5e10b018fdbe3c3b81cb4cc54e1105ab9 ]
kasprintf() can fail, we should check the return value.
--- drivers/net/wireless/intel/iwlwifi/dvm/led.c | 3 +++ drivers/net/wireless/intel/iwlwifi/mvm/led.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/dvm/led.c +3 -0
@@ -185,6 +185,9 @@ void iwl_leds_init(struct iwl_priv *priv) priv->led.name =kasprintf (GFP_KERNEL ,"%s-led" ,wiphy_name (priv->hw->wiphy)); +if (!priv->led.name) +return ; + priv->led.brightness_set = iwl_led_brightness_set; priv->led.blink_set = iwl_led_blink_set; priv->led.max_brightness =1 ;
drivers/net/wireless/intel/iwlwifi/mvm/led.c +3 -0
@@ -131,6 +131,9 @@ int iwl_mvm_leds_init(struct iwl_mvm *mvm) mvm->led.name =kasprintf (GFP_KERNEL ,"%s-led" ,wiphy_name (mvm->hw->wiphy)); +if (!mvm->led.name) +return -ENOMEM ; + mvm->led.brightness_set = iwl_led_brightness_set; mvm->led.max_brightness =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 128/161 fbtft: Make sure string is NULL terminated
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 21f585480deb4bcf0d92b08879c35d066dfee030 ]
New GCC warns about inappropriate use of strncpy():
drivers/staging/fbtft/fbtft-core.c: In function ‘fbtft_framebuffer_alloc’:drivers/staging/fbtft/fbtft-core.c:665:2: warning: ‘strncpy’ specified bound 16 equals destination size [-Wstringop-truncation]
665 | strncpy(info->fix.id, dev->driver->name, 16);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Later on the copy is being used with the assumption to be NULL terminated. Make sure string is NULL terminated by switching to snprintf().
--- drivers/staging/fbtft/fbtft-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/fbtft/fbtft-core.c +1 -1
@@ -780,7 +780,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, fbdefio->deferred_io = fbtft_deferred_io;fb_deferred_io_init (info); -strncpy (info->fix.id, dev->driver->name,16 ); +snprintf (info->fix.id,sizeof (info->fix.id),"%s" , dev->driver->name); info->fix.type =FB_TYPE_PACKED_PIXELS ; info->fix.visual =FB_VISUAL_TRUECOLOR ; info->fix.xpanstep =0 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 129/161 crypto: sun4i-ss - Fix 64-bit size_t warnings
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit d6e9da21ee8246b5e556b3b153401ab045adb986 ]
If you try to compile this driver on a 64-bit platform then you will get warnings because it mixes size_t with unsigned int which only works on 32-bit.
This patch fixes all of the warnings.
--- drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/crypto/sunxi-ss/sun4i-ss-cipher.c +14 -8
@@ -81,7 +81,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq) oi =0 ; oo =0 ; do { - todo = min3(rx_cnt, ileft, (mi.length - oi) / 4); + todo = min(rx_cnt, ileft); + todo = min_t(size_t, todo, (mi.length - oi) / 4); if (todo) { ileft -= todo; writesl(ss->base + SS_RXFIFO, mi.addr + oi, todo);
@@ -96,7 +97,8 @@ static int sun4i_ss_opti_poll(struct skcipher_request *areq) rx_cnt =SS_RXFIFO_SPACES (spaces); tx_cnt =SS_TXFIFO_SPACES (spaces); - todo =min3 (tx_cnt, oleft, (mo.length - oo) /4 ); + todo =min (tx_cnt, oleft); + todo =min_t (size_t, todo, (mo.length - oo) /4 );if (todo) { oleft -= todo;readsl (ss->base +SS_TXFIFO , mo.addr + oo, todo);
@@ -220,7 +222,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)* todo is the number of consecutive 4byte word that we * can read from current SG */ - todo =min3 (rx_cnt, ileft /4 , (mi.length - oi) /4 ); + todo =min (rx_cnt, ileft /4 ); + todo =min_t (size_t, todo, (mi.length - oi) /4 );if (todo && !ob) {writesl (ss->base +SS_RXFIFO , mi.addr + oi, todo);
@@ -234,8 +237,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)* we need to be able to write all buf in one * pass, so it is why we min() with rx_cnt */ - todo =min3 (rx_cnt *4 - ob, ileft, - mi.length - oi); + todo =min (rx_cnt *4 - ob, ileft); + todo =min_t (size_t, todo, mi.length - oi);memcpy (buf + ob, mi.addr + oi, todo); ileft -= todo; oi += todo;
@@ -255,7 +258,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq) spaces =readl (ss->base +SS_FCSR ); rx_cnt =SS_RXFIFO_SPACES (spaces); tx_cnt =SS_TXFIFO_SPACES (spaces); -dev_dbg (ss->dev,"%x %u/%u %u/%u cnt=%u %u/%u %u/%u cnt=%u %u\n" , +dev_dbg (ss->dev, +"%x %u/%zu %u/%u cnt=%u %u/%zu %u/%u cnt=%u %u\n" , mode, oi, mi.length, ileft, areq->cryptlen, rx_cnt, oo, mo.length, oleft, areq->cryptlen, tx_cnt, ob);
@@ -263,7 +267,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)if (!tx_cnt)continue ;/* todo in 4bytes word */ - todo =min3 (tx_cnt, oleft /4 , (mo.length - oo) /4 ); + todo =min (tx_cnt, oleft /4 ); + todo =min_t (size_t, todo, (mo.length - oo) /4 );if (todo) {readsl (ss->base +SS_TXFIFO , mo.addr + oo, todo); oleft -= todo *4 ;
@@ -287,7 +292,8 @@ static int sun4i_ss_cipher_poll(struct skcipher_request *areq)* no more than remaining buffer * no need to test against oleft */ - todo =min (mo.length - oo, obl - obo); + todo =min_t (size_t, + mo.length - oo, obl - obo);memcpy (mo.addr + oo, bufo + obo, todo); oleft -= todo; obo += todo;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 130/161 crypto: sun4i-ss - Fix 64-bit size_t warnings on sun4i-ss-hash.c
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit a7126603d46fe8f01aeedf589e071c6aaa6c6c39 ]
If you try to compile this driver on a 64-bit platform then you will get warnings because it mixes size_t with unsigned int which only works on 32-bit.
This patch fixes all of the warnings on sun4i-ss-hash.c.
--- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/crypto/sunxi-ss/sun4i-ss-hash.c +6 -6
@@ -276,8 +276,8 @@ static int sun4i_hash(struct ahash_request *areq)*/ while (op->len <64 && i < end) {/* how many bytes we can read from current SG */ - in_r =min3 (mi.length - in_i, end - i, -64 - op->len); + in_r =min (end - i,64 - op->len); + in_r =min_t (size_t, mi.length - in_i, in_r);memcpy (op->buf + op->len, mi.addr + in_i, in_r); op->len += in_r; i += in_r;
@@ -297,8 +297,8 @@ static int sun4i_hash(struct ahash_request *areq) }if (mi.length - in_i >3 && i < end) {/* how many bytes we can read from current SG */ - in_r =min3 (mi.length - in_i, areq->nbytes - i, - ((mi.length - in_i) /4 ) *4 ); + in_r =min_t (size_t, mi.length - in_i, areq->nbytes - i); + in_r =min_t (size_t, ((mi.length - in_i) /4 ) *4 , in_r);/* how many bytes we can write in the device*/ todo =min3 ((u32)(end - i) /4 , rx_cnt, (u32 )in_r /4 );writesl (ss->base +SS_RXFIFO , mi.addr + in_i, todo);
@@ -324,8 +324,8 @@ static int sun4i_hash(struct ahash_request *areq)if ((areq->nbytes - i) <64 ) {while (i < areq->nbytes && in_i < mi.length && op->len <64 ) {/* how many bytes we can read from current SG */ - in_r =min3 (mi.length - in_i, areq->nbytes - i, -64 - op->len); + in_r =min (areq->nbytes - i,64 - op->len); + in_r =min_t (size_t, mi.length - in_i, in_r);memcpy (op->buf + op->len, mi.addr + in_i, in_r); op->len += in_r; i += in_r;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 131/161 mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED
In reply to Greg Kroah-HartmanFrom: Thomas Pedersen <[email protected]>
[ Upstream commit 08a5bdde3812993cb8eb7aa9124703df0de28e4b ]
Commit 7b6ddeaf27ec ("mac80211: use QoS NDP for AP probing") let STAs send QoS Null frames as PS triggers if the AP was a QoS STA. However, the mac80211 PS stack relies on an interface flag IEEE80211_STA_NULLFUNC_ACKED for determining trigger frame ACK, which was not being set for acked non-QoS Null frames. The effect is an inability to trigger hardware sleep via IEEE80211_CONF_PS since the QoS Null frame was seemingly never acked.
This bug only applies to drivers which set bothIEEE80211_HW_REPORTS_TX_ACK_STATUS andIEEE80211_HW_PS_NULLFUNC_STACK.
Detect the acked QoS Null frame to restore STA power save.
--- net/mac80211/status.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/status.c +2 -1
@@ -856,7 +856,8 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,I802_DEBUG_INC (local->dot11FailedCount); } -if (ieee80211_is_nullfunc (fc) &&ieee80211_has_pm (fc) && +if ((ieee80211_is_nullfunc (fc) ||ieee80211_is_qos_nullfunc (fc)) && +ieee80211_has_pm (fc) &&ieee80211_hw_check (&local->hw,REPORTS_TX_ACK_STATUS ) && !(info->flags &IEEE80211_TX_CTL_INJECTED ) && local->ps_sdata && !(local->scanning)) {
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 132/161 crypto: vmx - Avoid weird build failures
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 4ee812f6143d78d8ba1399671d78c8d78bf2817c ]
In the vmx crypto Makefile we assign to a variable called TARGET and pass that to the aesp8-ppc.pl and ghashp8-ppc.pl scripts.
The variable is meant to describe what flavour of powerpc we're building for, eg. either 32 or 64-bit, and big or little endian.
Unfortunately TARGET is a fairly common name for a make variable, and if it happens that TARGET is specified as a command line parameter to make, the value specified on the command line will override our value.
In particular this can happen if the kernel Makefile is driven by an external Makefile that uses TARGET for something.
This leads to weird build failures, eg:
nonsense at /build/linux/drivers/crypto/vmx/ghashp8-ppc.pl line 45. /linux/drivers/crypto/vmx/Makefile:20: recipe for target 'drivers/crypto/vmx/ghashp8-ppc.S' failed
Which shows that we passed an empty value for $(TARGET) to the perl script, confirmed with make V=1:
perl /linux/drivers/crypto/vmx/ghashp8-ppc.pl > drivers/crypto/vmx/ghashp8-ppc.S
We can avoid this confusion by using override, to tell make that we don't want anything to override our variable, even a value specified on the command line. We can also use a less common name, given the script calls it "flavour", let's use that.
--- drivers/crypto/vmx/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/vmx/Makefile +3 -3
@@ -3,13 +3,13 @@ obj-$(CONFIG_CRYPTO_DEV_VMX_ENCRYPT) += vmx-crypto.o vmx-crypto-objs := vmx.o aesp8-ppc.o ghashp8-ppc.o aes.o aes_cbc.o aes_ctr.o aes_xts.o ghash.o ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) -TARGET := linux-ppc64le +override flavour := linux-ppc64le else -TARGET := linux-ppc64 +override flavour := linux-ppc64 endif quiet_cmd_perl = PERL $@ - cmd_perl = $(PERL) $(<) $(TARGET) > $(@) + cmd_perl = $(PERL) $(<) $(flavour) > $(@) targets += aesp8-ppc.S ghashp8-ppc.S
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 133/161 libtraceevent: Fix memory leakage in copy_filter_type
In reply to Greg Kroah-HartmanFrom: Hewenliang <[email protected]>
[ Upstream commit 10992af6bf46a2048ad964985a5b77464e5563b1 ]
It is necessary to free the memory that we have allocated when error occurs.
--- tools/lib/traceevent/parse-filter.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/lib/traceevent/parse-filter.c +7 -2
@@ -1492,8 +1492,10 @@ static int copy_filter_type(struct event_filter *filter,if (strcmp (str,"TRUE" ) ==0 ||strcmp (str,"FALSE" ) ==0 ) {/* Add trivial event */ arg =allocate_arg (); -if (arg ==NULL ) +if (arg ==NULL ) { +free (str);return -1 ; + } arg->type =FILTER_ARG_BOOLEAN ;if (strcmp (str,"TRUE" ) ==0 )
@@ -1502,8 +1504,11 @@ static int copy_filter_type(struct event_filter *filter, arg->boolean.value =0 ; filter_type =add_filter_type (filter, event->id); -if (filter_type ==NULL ) +if (filter_type ==NULL ) { +free (str); +free_arg (arg);return -1 ; + } filter_type->filter = arg;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 134/161 mips: fix build when "48 bits virtual memory" is enabled
In reply to Greg Kroah-HartmanFrom: Mike Rapoport <[email protected]>
[ Upstream commit 3ed6751bb8fa89c3014399bb0414348499ee202a ]
With CONFIG_MIPS_VA_BITS_48=y the build fails miserably:
CC arch/mips/kernel/asm-offsets.s
In file included from arch/mips/include/asm/pgtable.h:644,
from include/linux/mm.h:99,
from arch/mips/kernel/asm-offsets.c:15:include/asm-generic/pgtable.h:16:2: error: #error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED
#error CONFIG_PGTABLE_LEVELS is not consistent with __PAGETABLE_{P4D,PUD,PMD}_FOLDED
^~~~~include/asm-generic/pgtable.h:390:28: error: unknown type name 'p4d_t'; did you mean 'pmd_t'?
static inline int p4d_same(p4d_t p4d_a, p4d_t p4d_b)
^~~~~
pmd_t[ ... more such errors ... ]
scripts/Makefile.build:99: recipe for target 'arch/mips/kernel/asm-offsets.s' failed make[2]: *** [arch/mips/kernel/asm-offsets.s] Error 1
This happens because when CONFIG_MIPS_VA_BITS_48 enables 4th level of the page tables, but neither pgtable-nop4d.h nor 5level-fixup.h are included to cope with the 5th level.
Replace #ifdef conditions around includes of the pgtable-nop{m,u}d.h with explicit CONFIG_PGTABLE_LEVELS and add include of 5level-fixup.h for the case when CONFIG_PGTABLE_LEVELS==4
--- arch/mips/include/asm/pgtable-64.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/mips/include/asm/pgtable-64.h +7 -2
@@ -18,10 +18,12 @@#include <asm/fixmap.h> #define __ARCH_USE_5LEVEL_HACK -#if defined(CONFIG_PAGE_SIZE_64KB ) && !defined(CONFIG_MIPS_VA_BITS_48 ) +#if CONFIG_PGTABLE_LEVELS ==2 #include <asm-generic/pgtable-nopmd.h> -#elif !(defined(CONFIG_PAGE_SIZE_4KB ) && defined(CONFIG_MIPS_VA_BITS_48 )) +#elif CONFIG_PGTABLE_LEVELS ==3 #include <asm-generic/pgtable-nopud.h> +#else +#include <asm-generic/5level-fixup.h> #endif /*
@@ -222,6 +224,9 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd)return pgd_val (pgd); } +#define pgd_phys (pgd) virt_to_phys((void *)pgd_val(pgd)) +#define pgd_page (pgd) (pfn_to_page(pgd_phys(pgd) >> PAGE_SHIFT)) +static inline pud_t *pud_offset (pgd_t *pgd,unsigned long address) {return (pud_t *)pgd_page_vaddr (*pgd) +pud_index (address);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 135/161 net: phy: initialise phydev speed and duplex sanely
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit a5d66f810061e2dd70fb7a108dcd14e535bc639f ]
When a phydev is created, the speed and duplex are set to zero and -1 respectively, rather than using the predefined SPEED_UNKNOWN and DUPLEX_UNKNOWN constants.
There is a window at initialisation time where we may report link down using the 0/-1 values. Tidy this up and use the predefined constants, so debug doesn't complain with:
"Unsupported (update phy-core.c)/Unsupported (update phy-core.c)"
when the speed and duplex settings are printed.
--- drivers/net/phy/phy_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/phy_device.c +2 -2
@@ -367,8 +367,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, mdiodev->device_free = phy_mdio_device_free; mdiodev->device_remove = phy_mdio_device_remove; - dev->speed =0 ; - dev->duplex =-1 ; + dev->speed =SPEED_UNKNOWN ; + dev->duplex =DUPLEX_UNKNOWN ; dev->pause =0 ; dev->asym_pause =0 ; dev->link =1 ;
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 136/161 btrfs: dont prematurely free work in reada_start_machine_worker()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit e732fe95e4cad35fc1df278c23a32903341b08b3 ]
Currently, reada_start_machine_worker() frees the reada_machine_work and then calls __reada_start_machine() to do readahead. This is another potential instance of the bug in "btrfs: don't prematurely free work in run_ordered_work()".
There _might_ already be a deadlock here: reada_start_machine_worker() can depend on itself through stacked filesystems (__read_start_machine() -> reada_start_machine_dev() -> reada_tree_block_flagged() -> read_extent_buffer_pages() -> submit_one_bio() -> btree_submit_bio_hook() -> btrfs_map_bio() -> submit_stripe_bio() -> submit_bio() onto a loop device can trigger readahead on the lower filesystem).
Either way, let's fix it by freeing the work at the end.
--- fs/btrfs/reada.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/btrfs/reada.c +4 -6
@@ -734,21 +734,19 @@ static int reada_start_machine_dev(struct btrfs_device *dev)static void reada_start_machine_worker (struct btrfs_work *work) {struct reada_machine_work *rmw; -struct btrfs_fs_info *fs_info;int old_ioprio; rmw = container_of(work, struct reada_machine_work, work); - fs_info = rmw->fs_info; - -kfree (rmw); old_ioprio =IOPRIO_PRIO_VALUE (task_nice_ioclass (current),task_nice_ioprio (current));set_task_ioprio (current,BTRFS_IOPRIO_READA ); -__reada_start_machine (fs_info); +__reada_start_machine (rmw->fs_info);set_task_ioprio (current, old_ioprio); -atomic_dec (&fs_info->reada_works_cnt); +atomic_dec (&rmw->fs_info->reada_works_cnt); + +kfree (rmw); }static void __reada_start_machine (struct btrfs_fs_info *fs_info)
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 137/161 btrfs: dont prematurely free work in scrub_missing_raid56_worker()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 57d4f0b863272ba04ba85f86bfdc0f976f0af91c ]
Currently, scrub_missing_raid56_worker() puts and potentially frees sblock (which embeds the work item) and then submits a bio through scrub_wr_submit(). This is another potential instance of the bug in "btrfs: don't prematurely free work in run_ordered_work()". Fix it by dropping the reference after we submit the bio.
--- fs/btrfs/scrub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/btrfs/scrub.c +1 -2
@@ -2421,14 +2421,13 @@ static void scrub_missing_raid56_worker(struct btrfs_work *work)scrub_write_block_to_dev_replace (sblock); } -scrub_block_put (sblock); -if (sctx->is_dev_replace && sctx->flush_all_writes) {mutex_lock (&sctx->wr_lock);scrub_wr_submit (sctx);mutex_unlock (&sctx->wr_lock); } +scrub_block_put (sblock);scrub_pending_bio_dec (sctx); }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 138/161 Revert "mmc: sdhci: Fix incorrect switch to HS mode"
In reply to Greg Kroah-HartmanFrom: Faiz Abbas <[email protected]>
commit 07bcc411567cb96f9d1fc84fff8d387118a2920d upstream.
This reverts commit c894e33ddc1910e14d6f2a2016f60ab613fd8b37.
This commit aims to treat SD High speed and SDR25 as the same while setting UHS Timings in HOST_CONTROL2 which leads to failures with some SD cards in AM65x. Revert this commit.
The issue this commit was trying to fix can be implemented in a platform specific callback instead of common sdhci code.
--- drivers/mmc/host/sdhci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +1 -3
@@ -1635,9 +1635,7 @@ void sdhci_set_uhs_signaling(struct sdhc ctrl_2 |=SDHCI_CTRL_UHS_SDR104 ; else if (timing == MMC_TIMING_UHS_SDR12) ctrl_2 |= SDHCI_CTRL_UHS_SDR12; - else if (timing == MMC_TIMING_SD_HS || - timing == MMC_TIMING_MMC_HS || - timing == MMC_TIMING_UHS_SDR25) + else if (timing == MMC_TIMING_UHS_SDR25) ctrl_2 |= SDHCI_CTRL_UHS_SDR25; else if (timing == MMC_TIMING_UHS_SDR50) ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
Greg Kroah-Hartman
maintainerPATCH 139/161 mmc: mediatek: fix CMD_TA to 2 for MT8173 HS200/HS400 mode
In reply to Greg Kroah-HartmanFrom: Chaotian Jing <[email protected]>
commit 8f34e5bd7024d1ffebddd82d7318b1be17be9e9a upstream.
there is a chance that always get response CRC error after HS200 tuning, the reason is that need set CMD_TA to 2. this modification is only for MT8173.
--- drivers/mmc/host/mtk-sd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/mtk-sd.c +3 -0
@@ -212,6 +212,8 @@#define MSDC_PATCH_BIT_SPCPUSH (0x1 << 29)/* RW */ #define MSDC_PATCH_BIT_DECRCTMO (0x1 << 30)/* RW */ +#define MSDC_PATCH_BIT1_CMDTA (0x7 << 3)/* RW */ +#define MSDC_PAD_TUNE_DATWRDLY (0x1f << 0)/* RW */ #define MSDC_PAD_TUNE_DATRRDLY (0x1f << 8)/* RW */ #define MSDC_PAD_TUNE_CMDRDLY (0x1f << 16)/* RW */
@@ -1442,6 +1444,7 @@ static int hs400_tune_response(struct mm/* select EMMC50 PAD CMD tune */ sdr_set_bits (host->base +PAD_CMD_TUNE ,BIT (0 )); +sdr_set_field (host->base +MSDC_PATCH_BIT1 ,MSDC_PATCH_BIT1_CMDTA ,2 );if (mmc->ios.timing ==MMC_TIMING_MMC_HS200 || mmc->ios.timing ==MMC_TIMING_UHS_SDR104 )
Greg Kroah-Hartman
maintainerPATCH 140/161 usb: xhci: Fix build warning seen with CONFIG_PM=n
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 6056a0f8ede27b296d10ef46f7f677cc9d715371 ]
The following build warning is seen if CONFIG_PM is disabled.
drivers/usb/host/xhci-pci.c:498:13: warning:
unused function 'xhci_pci_shutdown'
--- drivers/usb/host/xhci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/xhci-pci.c +1 -1
@@ -497,7 +497,6 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated) retval =xhci_resume (xhci, hibernated);return retval; } -#endif /* CONFIG_PM */ static void xhci_pci_shutdown (struct usb_hcd *hcd) {
@@ -510,6 +509,7 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)if (xhci->quirks &XHCI_SPURIOUS_WAKEUP ) pci_set_power_state(pdev, PCI_D3hot); } +#endif /* CONFIG_PM */ /*-------------------------------------------------------------------------*/
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 141/161 s390/ftrace: fix endless recursion in function_graph tracer
In reply to Greg Kroah-HartmanFrom: Sven Schnelle <[email protected]>
[ Upstream commit 6feeee8efc53035c3195b02068b58ae947538aa4 ]
The following sequence triggers a kernel stack overflow on s390x:
mount -t tracefs tracefs /sys/kernel/tracing
cd /sys/kernel/tracing
echo function_graph > current_tracer
[crash]
This is because preempt_count_{add,sub} are in the list of traced functions, which can be demonstrated by:
echo preempt_count_add >set_ftrace_filter
echo function_graph > current_tracer
[crash]
The stack overflow happens because get_tod_clock_monotonic() gets called by ftrace but itself calls preempt_{disable,enable}(), which leads to a endless recursion. Fix this by using preempt_{disable,enable}_notrace().
--- arch/s390/include/asm/timex.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/include/asm/timex.h +2 -2
@@ -195,9 +195,9 @@ static inline unsigned long long get_tod_clock_monotonic(void) {unsigned long long tod; -preempt_disable (); +preempt_disable_notrace (); tod =get_tod_clock () - *(unsigned long long *) &tod_clock_base[1 ]; -preempt_enable (); +preempt_enable_notrace ();return tod; }
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 142/161 btrfs: return error pointer from alloc_test_extent_buffer
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b6293c821ea8fa2a631a2112cd86cd435effeb8b ]
Callers of alloc_test_extent_buffer have not correctly interpreted the return value as error pointer, as alloc_test_extent_buffer should behave as alloc_extent_buffer. The self-tests were unaffected but btrfs_find_create_tree_block could call both functions and that would cause problems up in the call chain.
--- fs/btrfs/extent_io.c | 6 ++++-- fs/btrfs/tests/free-space-tree-tests.c | 6 +++--- fs/btrfs/tests/qgroup-tests.c | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-)
fs/btrfs/extent_io.c +4 -2
@@ -4949,12 +4949,14 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info,return eb; eb =alloc_dummy_extent_buffer (fs_info, start);if (!eb) -return NULL ; +return ERR_PTR (-ENOMEM ); eb->fs_info = fs_info; again: ret =radix_tree_preload (GFP_NOFS ); -if (ret) +if (ret) { + exists =ERR_PTR (ret); goto free_eb; + }spin_lock (&fs_info->buffer_lock); ret =radix_tree_insert (&fs_info->buffer_radix, start >>PAGE_SHIFT , eb);
fs/btrfs/tests/free-space-tree-tests.c +3 -3
@@ -475,9 +475,9 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize, root->fs_info->tree_root = root; root->node =alloc_test_extent_buffer (root->fs_info, nodesize); -if (!root->node) { -test_msg ("Couldn't allocate dummy buffer\n" ); - ret = -ENOMEM ; +if (IS_ERR (root->node)) { +test_msg ("couldn't allocate dummy buffer\n" ); + ret =PTR_ERR (root->node); goto out; }btrfs_set_header_level (root->node,0 );
fs/btrfs/tests/qgroup-tests.c +2 -2
@@ -487,9 +487,9 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)* *cough*backref walking code*cough* */ root->node =alloc_test_extent_buffer (root->fs_info, nodesize); -if (!root->node) { +if (IS_ERR (root->node)) {test_msg ("Couldn't allocate dummy buffer\n" ); - ret = -ENOMEM ; + ret =PTR_ERR (root->node); goto out; }btrfs_set_header_level (root->node,0 );
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 143/161 btrfs: abort transaction after failed inode updates in create_subvol
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit c7e54b5102bf3614cadb9ca32d7be73bad6cecf0 ]
We can just abort the transaction here, and in fact do that for every other failure in this function except these two cases.
--- fs/btrfs/ioctl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/ioctl.c +8 -2
@@ -580,12 +580,18 @@ static noinline int create_subvol(struct inode *dir,btrfs_i_size_write (BTRFS_I (dir), dir->i_size + namelen *2 ); ret =btrfs_update_inode (trans, root, dir); -BUG_ON (ret); +if (ret) { +btrfs_abort_transaction (trans, ret); + goto fail; + } ret =btrfs_add_root_ref (trans, fs_info, objectid, root->root_key.objectid,btrfs_ino (BTRFS_I (dir)), index, name, namelen); -BUG_ON (ret); +if (ret) { +btrfs_abort_transaction (trans, ret); + goto fail; + } ret =btrfs_uuid_tree_add (trans, fs_info, root_item->uuid,BTRFS_UUID_KEY_SUBVOL , objectid);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 144/161 usbip: Fix receive error in vhci-hcd when using scatter-gather
In reply to Greg Kroah-HartmanFrom: Suwan Kim <[email protected]>
commit d986294ee55d719562b20aabe15a39bf8f863415 upstream.
When vhci uses SG and receives data whose size is smaller than SG buffer size, it tries to receive more data even if it acutally receives all the data from the server. If then, it erroneously adds error event and triggers connection shutdown.
vhci-hcd should check if it received all the data even if there are more SG entries left. So, check if it receivces all the data from the server in for_each_sg() loop.
--- drivers/usb/usbip/usbip_common.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/usbip/usbip_common.c +3 -0
@@ -742,6 +742,9 @@ int usbip_recv_xbuff(struct usbip_device copy -= recv; ret += recv; + +if (!copy) +break ; }if (ret != size)
Greg Kroah-Hartman
maintainerPATCH 145/161 usbip: Fix error path of vhci_recv_ret_submit()
In reply to Greg Kroah-HartmanFrom: Suwan Kim <[email protected]>
commit aabb5b833872524eaf28f52187e5987984982264 upstream.
If a transaction error happens in vhci_recv_ret_submit(), event handler closes connection and changes port status to kick hub_event. Then hub tries to flush the endpoint URBs, but that causes infinite loop between usb_hub_flush_endpoint() and vhci_urb_dequeue() because "vhci_priv" in vhci_urb_dequeue() was already released by vhci_recv_ret_submit() before a transmission error occurred. Thus, vhci_urb_dequeue() terminates early and usb_hub_flush_endpoint() continuously calls vhci_urb_dequeue().
The root cause of this issue is that vhci_recv_ret_submit() terminates early without giving back URB when transaction error occurs in vhci_recv_ret_submit(). That causes the error URB to still be linked at endpoint list without “vhci_priv".
So, in the case of transaction error in vhci_recv_ret_submit(), unlink URB from the endpoint, insert proper error code in urb->status and give back URB.
--- drivers/usb/usbip/vhci_rx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/usb/usbip/vhci_rx.c +9 -4
@@ -91,16 +91,21 @@ static void vhci_recv_ret_submit(structusbip_pack_pdu (pdu, urb,USBIP_RET_SUBMIT ,0 );/* recv transfer buffer */ -if (usbip_recv_xbuff (ud, urb) <0 ) -return ; +if (usbip_recv_xbuff (ud, urb) <0 ) { + urb->status = -EPROTO ; + goto error; + }/* recv iso_packet_descriptor */ -if (usbip_recv_iso (ud, urb) <0 ) -return ; +if (usbip_recv_iso (ud, urb) <0 ) { + urb->status = -EPROTO ; + goto error; + }/* restore the padding in iso packets */ usbip_pad_iso (ud, urb); +error:if (usbip_dbg_flag_vhci_rx)usbip_dump_urb (urb);
Greg Kroah-Hartman
maintainerPATCH 146/161 USB: EHCI: Do not return -EPIPE when hub is disconnected
In reply to Greg Kroah-HartmanFrom: Erkka Talvitie <[email protected]>
commit 64cc3f12d1c7dd054a215bc1ff9cc2abcfe35832 upstream.
When disconnecting a USB hub that has some child device(s) connected to it (such as a USB mouse), then the stack tries to clear halt and reset device(s) which are _already_ physically disconnected.
The issue has been reproduced with:
CPU: IMX6D5EYM10AD or MCIMX6D5EYM10AE.
SW: U-Boot 2019.07 and kernel 4.19.40.
CPU: HP Proliant Microserver Gen8.
SW: Linux version 4.2.3-300.fc23.x86_64
In this situation there will be error bit for MMF active yet the CERR equals EHCI_TUNE_CERR + halt. Existing implementation interprets this as a stall [1] (chapter 8.4.5).
The possible conditions when the MMF will be active + halt can be found from [2] (Table 4-13).
Fix for the issue is to check whether MMF is active and PID Code is IN before checking for the stall. If these conditions are true then it is not a stall.
What happens after the fix is that when disconnecting a hub with attached device(s) the situation is not interpret as a stall.
[1] [https://www.usb.org/document-library/usb-20-specification, usb_20.pdf]
[2] [https://www.intel.com/content/dam/www/public/us/en/documents/
technical-specifications/ehci-specification-for-usb.pdf]
--- drivers/usb/host/ehci-q.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-q.c +12 -1
@@ -40,6 +40,10 @@/*-------------------------------------------------------------------------*/ +/* PID Codes that are used here, from EHCI specification, Table 3-16. */ +#define PID_CODE_IN 1 +#define PID_CODE_SETUP 2 +/* fill a qtd, returning how much of the buffer we were able to queue up */ static int
@@ -203,7 +207,7 @@ static int qtd_copy_status (int status = -EINPROGRESS ;/* count IN/OUT bytes, not SETUP (even short packets) */ -if (likely (QTD_PID (token) !=2 )) +if (likely (QTD_PID (token) !=PID_CODE_SETUP )) urb->actual_length += length -QTD_LENGTH (token);/* don't modify error codes */
@@ -219,6 +223,13 @@ static int qtd_copy_status (if (token &QTD_STS_BABBLE ) {/* FIXME "must" disable babbling device's port too */ status = -EOVERFLOW ; +/* +* When MMF is active and PID Code is IN, queue is halted. +* EHCI Specification, Table 4-13. +*/ + }else if ((token &QTD_STS_MMF ) && + (QTD_PID (token) ==PID_CODE_IN )) { + status = -EPROTO ;/* CERR nonzero + halt --> stall */ }else if (QTD_CERR (token)) { status = -EPIPE ;
Greg Kroah-Hartman
maintainerPATCH 147/161 intel_th: pci: Add Comet Lake PCH-V support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit e4de2a5d51f97a6e720a1c0911f93e2d8c2f1c08 upstream.
This adds Intel(R) Trace Hub PCI ID for Comet Lake PCH-V.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -189,6 +189,11 @@ static const struct pci_device_id intel_ .driver_data = (kernel_ulong_t)&intel_th_2x, }, { +/* Comet Lake PCH-V */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa3a6), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + {/* Ice Lake NNPI */ PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x45c5 ), .driver_data = (kernel_ulong_t)&intel_th_2x,
Greg Kroah-Hartman
maintainerPATCH 148/161 intel_th: pci: Add Elkhart Lake SOC support
In reply to Greg Kroah-HartmanFrom: Alexander Shishkin <[email protected]>
commit 88385866bab8d5e18c7f45d1023052c783572e03 upstream.
This adds support for Intel Trace Hub in Elkhart Lake.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -218,6 +218,11 @@ static const struct pci_device_id intel_ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4da6), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Elkhart Lake */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x4b26), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, { 0 }, };
Greg Kroah-Hartman
maintainerPATCH 149/161 platform/x86: hp-wmi: Make buffer for HPWMI_FEATURE2_QUERY 128 bytes
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
commit 133b2acee3871ae6bf123b8fe34be14464aa3d2c upstream.
At least on the HP Envy x360 15-cp0xxx model the WMI interface for HPWMI_FEATURE2_QUERY requires an outsize of at least 128 bytes, otherwise it fails with an error code 5 (HPWMI_RET_INVALID_PARAMETERS):
Dec 06 00:59:38 kernel: hp_wmi: query 0xd returned error 0x5
We do not care about the contents of the buffer, we just want to know if the HPWMI_FEATURE2_QUERY command is supported.
This commits bumps the buffer size, fixing the error.
--- drivers/platform/x86/hp-wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/hp-wmi.c +1 -1
@@ -313,7 +313,7 @@ static int __init hp_wmi_bios_2008_laterstatic int __init hp_wmi_bios_2009_later (void ) { -int state =0 ; +u8 state[128 ];int ret =hp_wmi_perform_query (HPWMI_FEATURE2_QUERY ,HPWMI_READ , &state,sizeof (state),sizeof (state));if (!ret)
Greg Kroah-Hartman
maintainerPATCH 150/161 staging: comedi: gsc_hpdi: check dma_alloc_coherent() return value
In reply to Greg Kroah-HartmanFrom: Ian Abbott <[email protected]>
commit ab42b48f32d4c766420c3499ee9c0289b7028182 upstream.
The "auto-attach" handler function gsc_hpdi_auto_attach() calls dma_alloc_coherent() in a loop to allocate some DMA data buffers, and also calls it to allocate a buffer for a DMA descriptor chain. However, it does not check the return value of any of these calls. Change gsc_hpdi_auto_attach() to return -ENOMEM if any of these dma_alloc_coherent() calls fail. This will result in the comedi core calling the "detach" handler gsc_hpdi_detach() as part of the clean-up, which will call gsc_hpdi_free_dma() to free any allocated DMA coherent memory buffers.
--- drivers/staging/comedi/drivers/gsc_hpdi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/staging/comedi/drivers/gsc_hpdi.c +10 -0
@@ -632,6 +632,11 @@ static int gsc_hpdi_auto_attach(struct cdma_alloc_coherent (&pcidev->dev,DMA_BUFFER_SIZE , &devpriv->dio_buffer_phys_addr[i],GFP_KERNEL ); +if (!devpriv->dio_buffer[i]) { +dev_warn (dev->class_dev, +"failed to allocate DMA buffer\n" ); +return -ENOMEM ; + } }/* allocate dma descriptors */ devpriv->dma_desc = dma_alloc_coherent(&pcidev->dev,
@@ -639,6 +644,11 @@ static int gsc_hpdi_auto_attach(struct cNUM_DMA_DESCRIPTORS , &devpriv->dma_desc_phys_addr, GFP_KERNEL); +if (!devpriv->dma_desc) { +dev_warn (dev->class_dev, +"failed to allocate DMA descriptors\n" ); +return -ENOMEM ; + }if (devpriv->dma_desc_phys_addr &0xf ) {dev_warn (dev->class_dev," dma descriptors not quad-word aligned (bug)\n" );
Greg Kroah-Hartman
maintainerPATCH 151/161 ext4: fix ext4_empty_dir() for directories with holes
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 64d4ce892383b2ad6d782e080d25502f91bf2a38 upstream.
Function ext4_empty_dir() doesn't correctly handle directories with holes and crashes on bh->b_data dereference when bh is NULL. Reorganize the loop to use 'offset' variable all the times instead of comparing pointers to current direntry with bh->b_data pointer. Also add more strict checking of '.' and '..' directory entries to avoid entering loop in possibly invalid state on corrupted filesystems.
--- fs/ext4/namei.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
fs/ext4/namei.c +18 -14
@@ -2702,7 +2702,7 @@ bool ext4_empty_dir(struct inode *inode) {unsigned int offset;struct buffer_head *bh; -struct ext4_dir_entry_2 *de, *de1; +struct ext4_dir_entry_2 *de;struct super_block *sb;if (ext4_has_inline_data (inode)) {
@@ -2727,19 +2727,25 @@ bool ext4_empty_dir(struct inode *inode)return true; de = (struct ext4_dir_entry_2 *) bh->b_data; - de1 =ext4_next_entry (de, sb->s_blocksize); -if (le32_to_cpu (de->inode) != inode->i_ino || -le32_to_cpu (de1->inode) ==0 || -strcmp ("." , de->name) ||strcmp (".." , de1->name)) { -ext4_warning_inode (inode,"directory missing '.' and/or '..'" ); +if (ext4_check_dir_entry (inode,NULL , de, bh, bh->b_data, bh->b_size, +0 ) || +le32_to_cpu (de->inode) != inode->i_ino ||strcmp ("." , de->name)) { +ext4_warning_inode (inode,"directory missing '.'" );brelse (bh);return true; } - offset =ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize) + -ext4_rec_len_from_disk (de1->rec_len, sb->s_blocksize); - de =ext4_next_entry (de1, sb->s_blocksize); + offset =ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize); + de =ext4_next_entry (de, sb->s_blocksize); +if (ext4_check_dir_entry (inode,NULL , de, bh, bh->b_data, bh->b_size, + offset) || +le32_to_cpu (de->inode) ==0 ||strcmp (".." , de->name)) { +ext4_warning_inode (inode,"directory missing '..'" ); +brelse (bh); +return true; + } + offset +=ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize);while (offset < inode->i_size) { -if ((void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { +if (!(offset & (sb->s_blocksize -1 ))) {unsigned int lblock;brelse (bh); lblock = offset >>EXT4_BLOCK_SIZE_BITS (sb);
@@ -2750,12 +2756,11 @@ bool ext4_empty_dir(struct inode *inode) }if (IS_ERR (bh))return true; - de = (struct ext4_dir_entry_2 *) bh->b_data; } + de = (struct ext4_dir_entry_2 *) (bh->b_data + + (offset & (sb->s_blocksize -1 )));if (ext4_check_dir_entry (inode,NULL , de, bh, bh->b_data, bh->b_size, offset)) { - de = (struct ext4_dir_entry_2 *)(bh->b_data + - sb->s_blocksize); offset = (offset | (sb->s_blocksize -1 )) +1 ;continue ; }
@@ -2764,7 +2769,6 @@ bool ext4_empty_dir(struct inode *inode)return false; } offset +=ext4_rec_len_from_disk (de->rec_len, sb->s_blocksize); - de =ext4_next_entry (de, sb->s_blocksize); }brelse (bh);return true;
Greg Kroah-Hartman
maintainerPATCH 152/161 ext4: check for directory entries too close to block end
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 109ba779d6cca2d519c5dd624a3276d03e21948e upstream.
ext4_check_dir_entry() currently does not catch a case when a directory entry ends so close to the block end that the header of the next directory entry would not fit in the remaining space. This can lead to directory iteration code trying to access address beyond end of current buffer head leading to oops.
--- fs/ext4/dir.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/ext4/dir.c +5 -0
@@ -76,6 +76,11 @@ int __ext4_check_dir_entry(const char *f error_msg ="rec_len is too small for name_len" ; else if (unlikely(((char *) de - buf) + rlen > size)) error_msg ="directory entry overrun" ; + else if (unlikely(((char *) de - buf) + rlen > + size - EXT4_DIR_REC_LEN(1) && + ((char *) de - buf) + rlen != size)) { + error_msg ="directory entry too close to block end" ; + } else if (unlikely(le32_to_cpu(de->inode) > le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))) error_msg ="inode out of bounds" ;
Greg Kroah-Hartman
maintainerPATCH 153/161 ext4: unlock on error in ext4_expand_extra_isize()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 7f420d64a08c1dcd65b27be82a27cf2bdb2e7847 upstream.
We need to unlock the xattr before returning on this error path.
--- fs/ext4/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/inode.c +2 -2
@@ -5874,7 +5874,7 @@ int ext4_expand_extra_isize(struct inode error =ext4_journal_get_write_access (handle, iloc->bh);if (error) {brelse (iloc->bh); - goto out_stop; + goto out_unlock; } error = __ext4_expand_extra_isize(inode, new_extra_isize, iloc,
@@ -5884,8 +5884,8 @@ int ext4_expand_extra_isize(struct inodeif (!error) error = rc; +out_unlock:ext4_write_unlock_xattr (inode, &no_expand); -out_stop:ext4_journal_stop (handle);return error; }
Greg Kroah-Hartman
maintainerPATCH 154/161 KVM: arm64: Ensure params is initialised when looking up sys register
In reply to Greg Kroah-HartmanFrom: Will Deacon <[email protected]>
commit 1ce74e96c2407df2b5867e5d45a70aacb8923c14 upstream.
Commit 4b927b94d5df ("KVM: arm/arm64: vgic: Introduce find_reg_by_id()") introduced 'find_reg_by_id()', which looks up a system register only if the 'id' index parameter identifies a valid system register. As part of the patch, existing callers of 'find_reg()' were ported over to the new interface, but this breaks 'index_to_sys_reg_desc()' in the case that the initial lookup in the vCPU target table fails because we will then call into 'find_reg()' for the system register table with an uninitialised 'param' as the key to the lookup.
GCC 10 is bright enough to spot this (amongst a tonne of false positives, but hey!):
| arch/arm64/kvm/sys_regs.c: In function ‘index_to_sys_reg_desc.part.0.isra’: | arch/arm64/kvm/sys_regs.c:983:33: warning: ‘params.Op2’ may be used uninitialized in this function [-Wmaybe-uninitialized] | 983 | (u32)(x)->CRn, (u32)(x)->CRm, (u32)(x)->Op2); | [...]
Revert the hunk of 4b927b94d5df which breaks 'index_to_sys_reg_desc()' so that the old behaviour of checking the index upfront is restored.
--- arch/arm64/kvm/sys_regs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm64/kvm/sys_regs.c +4 -1
@@ -1785,8 +1785,11 @@ static const struct sys_reg_desc *index_if ((id &KVM_REG_ARM_COPROC_MASK ) !=KVM_REG_ARM64_SYSREG )return NULL ; +if (!index_to_params (id, ¶ms)) +return NULL ; + table =get_target_table (vcpu->arch.target, true, &num); - r =find_reg_by_id (id, ¶ms, table, num); + r =find_reg (¶ms, table, num);if (!r) r =find_reg (¶ms, sys_reg_descs,ARRAY_SIZE (sys_reg_descs));
Greg Kroah-Hartman
maintainerPATCH 155/161 x86/MCE/AMD: Do not use rdmsr_safe_on_cpu() in smca_configure()
In reply to Greg Kroah-HartmanFrom: Konstantin Khlebnikov <[email protected]>
commit 246ff09f89e54fdf740a8d496176c86743db3ec7 upstream.
... because interrupts are disabled that early and sending IPIs can deadlock:
BUG: sleeping function called from invalid context at kernel/sched/completion.c:99 in_atomic(): 1, irqs_disabled(): 1, non_block: 0, pid: 0, name: swapper/1 no locks held by swapper/1/0. irq event stamp: 0 hardirqs last enabled at (0): [<0000000000000000>] 0x0 hardirqs last disabled at (0): [<ffffffff8106dda9>] copy_process+0x8b9/0x1ca0 softirqs last enabled at (0): [<ffffffff8106dda9>] copy_process+0x8b9/0x1ca0 softirqs last disabled at (0): [<0000000000000000>] 0x0 Preemption disabled at: [<ffffffff8104703b>] start_secondary+0x3b/0x190 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.5.0-rc2+ #1 Hardware name: GIGABYTE MZ01-CE1-00/MZ01-CE1-00, BIOS F02 08/29/2018 Call Trace: dump_stack ___might_sleep.cold.92 wait_for_completion ? generic_exec_single rdmsr_safe_on_cpu ? wrmsr_on_cpus mce_amd_feature_init mcheck_cpu_init identify_cpu identify_secondary_cpu smp_store_cpu_info start_secondary secondary_startup_64
The function smca_configure() is called only on the current CPU anyway, therefore replace rdmsr_safe_on_cpu() with atomic rdmsr_safe() and avoid the IPI.
[ bp: Update commit message. ]
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +1 -1
@@ -231,7 +231,7 @@ static void smca_configure(unsigned intif (smca_banks[bank].hwid)return ; -if (rdmsr_safe_on_cpu (cpu,MSR_AMD64_SMCA_MCx_IPID (bank), &low, &high)) { +if (rdmsr_safe (MSR_AMD64_SMCA_MCx_IPID (bank), &low, &high)) {pr_warn ("Failed to read MCA_IPID for bank %d\n" , bank);return ; }
Greg Kroah-Hartman
maintainerPATCH 156/161 x86/MCE/AMD: Allow Reserved types to be overwritten in smca_banks[]
In reply to Greg Kroah-HartmanFrom: Yazen Ghannam <[email protected]>
commit 966af20929ac24360ba3fac5533eb2ab003747da upstream.
Each logical CPU in Scalable MCA systems controls a unique set of MCA banks in the system. These banks are not shared between CPUs. The bank types and ordering will be the same across CPUs on currently available systems.
However, some CPUs may see a bank as Reserved/Read-as-Zero (RAZ) while other CPUs do not. In this case, the bank seen as Reserved on one CPU is assumed to be the same type as the bank seen as a known type on another CPU.
In general, this occurs when the hardware represented by the MCA bank is disabled, e.g. disabled memory controllers on certain models, etc. The MCA bank is disabled in the hardware, so there is no possibility of getting an MCA/MCE from it even if it is assumed to have a known type.
For example:
Full system:
Bank | Type seen on CPU0 | Type seen on CPU1
------------------------------------------------
0 | LS | LS
1 | UMC | UMC
2 | CS | CS
System with hardware disabled:
Bank | Type seen on CPU0 | Type seen on CPU1
------------------------------------------------
0 | LS | LS
1 | UMC | RAZ
2 | CS | CS
For this reason, there is a single, global struct smca_banks[] that is initialized at boot time. This array is initialized on each CPU as it comes online. However, the array will not be updated if an entry already exists.
This works as expected when the first CPU (usually CPU0) has all possible MCA banks enabled. But if the first CPU has a subset, then it will save a "Reserved" type in smca_banks[]. Successive CPUs will then not be able to update smca_banks[] even if they encounter a known bank type.
This may result in unexpected behavior. Depending on the system configuration, a user may observe issues enumerating the MCA thresholding sysfs interface. The issues may be as trivial as sysfs entries not being available, or as severe as system hangs.
For example:
Bank | Type seen on CPU0 | Type seen on CPU1
------------------------------------------------
0 | LS | LS
1 | RAZ | UMC
2 | CS | CS
Extend the smca_banks[] entry check to return if the entry is a non-reserved type. Otherwise, continue so that CPUs that encounter a known bank type can update smca_banks[].
--- arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce_amd.c +1 -1
@@ -228,7 +228,7 @@ static void smca_configure(unsigned int }/* Return early if this bank was already initialized. */ -if (smca_banks[bank].hwid) +if (smca_banks[bank].hwid && smca_banks[bank].hwid->hwid_mcatype !=0 )return ;if (rdmsr_safe (MSR_AMD64_SMCA_MCx_IPID (bank), &low, &high)) {
Greg Kroah-Hartman
maintainerPATCH 157/161 powerpc/irq: fix stack overflow verification
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
commit 099bc4812f09155da77eeb960a983470249c9ce1 upstream.
Before commit 0366a1c70b89 ("powerpc/irq: Run softirqs off the top of the irq stack"), check_stack_overflow() was called by do_IRQ(), before switching to the irq stack.
In that commit, do_IRQ() was renamed __do_irq(), and is now executing on the irq stack, so check_stack_overflow() has just become almost useless.
Move check_stack_overflow() call in do_IRQ() to do the check while still on the current stack.
--- arch/powerpc/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/irq.c +2 -2
@@ -561,8 +561,6 @@ void __do_irq(struct pt_regs *regs)trace_irq_entry (regs); -check_stack_overflow (); -/* * Query the platform PIC for the interrupt & ack it. *
@@ -594,6 +592,8 @@ void do_IRQ(struct pt_regs *regs) irqtp = hardirq_ctx[raw_smp_processor_id ()]; sirqtp = softirq_ctx[raw_smp_processor_id ()]; +check_stack_overflow (); +/* Already there ? */ if (unlikely (curtp == irqtp || curtp == sirqtp)) {__do_irq (regs);
Greg Kroah-Hartman
maintainerPATCH 158/161 mmc: sdhci-of-esdhc: Revert "mmc: sdhci-of-esdhc: add erratum A-009204 support"
In reply to Greg Kroah-HartmanFrom: Rasmus Villemoes <[email protected]>
commit 8b6dc6b2d60221e90703babbc141f063b8a07e72 upstream.
This reverts commit 5dd195522562542bc6ebe6e7bd47890d8b7ca93c.
First, the fix seems to be plain wrong, since the erratum suggests waiting 5ms before setting setting SYSCTL[RSTD], but this msleep() happens after the call of sdhci_reset() which is where that bit gets set (if SDHCI_RESET_DATA is in mask).
Second, walking the whole device tree to figure out if some node has a "fsl,p2020-esdhc" compatible string is hugely expensive - about 70 to 100 us on our mpc8309 board. Walking the device tree is done under a raw_spin_lock, so this is obviously really bad on an -rt system, and a waste of time on all.
In fact, since esdhc_reset() seems to get called around 100 times per second, that mpc8309 now spends 0.8% of its time determining that it is not a p2020. Whether those 100 calls/s are normal or due to some other bug or misconfiguration, regularly hitting a 100 us non-preemptible window is unacceptable.
--- drivers/mmc/host/sdhci-of-esdhc.c | 3 --- 1 file changed, 3 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +0 -3
@@ -615,9 +615,6 @@ static void esdhc_reset(struct sdhci_hossdhci_writel (host, host->ier,SDHCI_INT_ENABLE );sdhci_writel (host, host->ier,SDHCI_SIGNAL_ENABLE ); -if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) -mdelay (5 ); -if (mask &SDHCI_RESET_ALL ) { val =sdhci_readl (host,ESDHC_TBCTL ); val &= ~ESDHC_TB_EN ;
Greg Kroah-Hartman
maintainerPATCH 159/161 mmc: sdhci: Update the tuning failed messages to pr_debug level
In reply to Greg Kroah-HartmanFrom: Faiz Abbas <[email protected]>
commit 2c92dd20304f505b6ef43d206fff21bda8f1f0ae upstream.
Tuning support in DDR50 speed mode was added in SD Specifications Part1 Physical Layer Specification v3.01. Its not possible to distinguish between v3.00 and v3.01 from the SCR and that is why since commit 4324f6de6d2e ("mmc: core: enable CMD19 tuning for DDR50 mode") tuning failures are ignored in DDR50 speed mode.
Cards compatible with v3.00 don't respond to CMD19 in DDR50 and this error gets printed during enumeration and also if retune is triggered at any time during operation. Update the printk level to pr_debug so that these errors don't lead to false error reports.
--- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +2 -2
@@ -2162,8 +2162,8 @@ static void __sdhci_execute_tuning(strucsdhci_send_tuning (host, opcode);if (!host->tuning_done) { -pr_info ("%s: Tuning timeout, falling back to fixed sampling clock\n" , -mmc_hostname (host->mmc)); +pr_debug ("%s: Tuning timeout, falling back to fixed sampling clock\n" , +mmc_hostname (host->mmc));sdhci_abort_tuning (host, opcode);return ; }
Greg Kroah-Hartman
maintainerPATCH 160/161 mmc: sdhci-of-esdhc: fix P2020 errata handling
In reply to Greg Kroah-HartmanFrom: Yangbo Lu <[email protected]>
commit fe0acab448f68c3146235afe03fb932e242ec94c upstream.
Two previous patches introduced below quirks for P2020 platforms.
- SDHCI_QUIRK_RESET_AFTER_REQUEST
- SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
The patches made a mistake to add them in quirks2 of sdhci_host structure, while they were defined for quirks.
host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
This patch is to fix them.
host->quirks |= SDHCI_QUIRK_RESET_AFTER_REQUEST; host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
--- drivers/mmc/host/sdhci-of-esdhc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci-of-esdhc.c +2 -2
@@ -886,8 +886,8 @@ static int sdhci_esdhc_probe(struct plat host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ ;if (of_find_compatible_node (NULL ,NULL ,"fsl,p2020-esdhc" )) { - host->quirks2 |=SDHCI_QUIRK_RESET_AFTER_REQUEST ; - host->quirks2 |=SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ; + host->quirks |=SDHCI_QUIRK_RESET_AFTER_REQUEST ; + host->quirks |=SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ; } if (of_device_is_compatible(np, "fsl,p5040-esdhc") ||
Greg Kroah-Hartman
maintainerPATCH 161/161 nbd: fix shutdown and recv work deadlock v2
In reply to Greg Kroah-HartmanFrom: Mike Christie <[email protected]>
commit 1c05839aa973cfae8c3db964a21f9c0eef8fcc21 upstream.
This fixes a regression added with:
commit e9e006f5fcf2bab59149cb38a48a4817c1b538b4
Author: Mike Christie <[email protected]> Date: Sun Aug 4 14:10:06 2019 -0500
nbd: fix max number of supported devs
where we can deadlock during device shutdown. The problem occurs if the recv_work's nbd_config_put occurs after nbd_start_device_ioctl has returned and the userspace app has droppped its reference via closing the device and running nbd_release. The recv_work nbd_config_put call would then drop the refcount to zero and try to destroy the config which would try to do destroy_workqueue from the recv work.
This patch just has nbd_start_device_ioctl do a flush_workqueue when it wakes so we know after the ioctl returns running works have exited. This also fixes a possible race where we could try to reuse the device while old recv_works are still running.
--- drivers/block/nbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/block/nbd.c +3 -3
@@ -1234,10 +1234,10 @@ static int nbd_start_device_ioctl(structmutex_unlock (&nbd->config_lock); ret =wait_event_interruptible (config->recv_wq,atomic_read (&config->recv_threads) ==0 ); -if (ret) { +if (ret)sock_shutdown (nbd); -flush_workqueue (nbd->recv_workq); - } +flush_workqueue (nbd->recv_workq); +mutex_lock (&nbd->config_lock);bd_set_size (bdev,0 );/* user requested, ignore socket errors */
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +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.14.161-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.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 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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.
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.161-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: 9973cdd1885ac46b53c6db9f07b9e22003b8b1fd
git describe: v4.14.160-162-g9973cdd1885a
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.160-162-g9973cdd1885a
No regressions (compared to build v4.14.160)
No fixes (compared to build v4.14.160)
Ran 24205 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-dio-tests
* ltp-io-tests
* network-basic-tests
* ltp-open-posix-tests
* kvm-unit-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
* ssuite
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +0000. Anything received after that time might be too late.
Build results:
total: 172 pass: 170 fail: 2 Failed builds: i386:tools/perf x86_64:tools/perf Qemu test results: total: 373 pass: 373 fail: 0
util/probe-finder.c: In function ‘probe_point_inline_cb’:util/dwarf-aux.c: In function ‘__die_walk_funclines_cb’:util/probe-finder.c:971:7: error: implicit declaration of function ‘die_entrypc’; did you mean ‘dwarf_entrypc’?
Guenter
Greg Kroah-Hartman
maintainerQuoted 17 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +0000. Anything received after that time might be too late.
Build results:
total: 172 pass: 170 fail: 2 Failed builds: i386:tools/perf x86_64:tools/perf Qemu test results: total: 373 pass: 373 fail: 0
Quoted 3 lines
util/probe-finder.c: In function ‘probe_point_inline_cb’:util/dwarf-aux.c: In function ‘__die_walk_funclines_cb’:util/probe-finder.c:971:7: error: implicit declaration of function ‘die_entrypc’; did you mean ‘dwarf_entrypc’?
Should now be fixed, will go push out a -rc2 with the resolution.
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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.
Quoted 8 lines
Responses should be made by Tue, 31 Dec 2019 16:17:25 +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.14.161-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
I have pushed out a -rc2 to resolve some reported issues:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.161-rc2.gz
Jon Hunter
maintainerQuoted 14 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +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.14.161-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
Quoted 5 lines
thanks,
greg k-h
-------------
All tests are passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.14.161-rc1-g9973cdd1885a
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +0000. Anything received after that time might be too late.
For -rc2:
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 373 pass: 373 fail: 0
Guenter
Greg Kroah-Hartman
maintainerQuoted 10 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.161 release. There are 161 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 Tue, 31 Dec 2019 16:17:25 +0000. Anything received after that time might be too late.
Quoted 6 lines
For -rc2:
Build results:
total: 172 pass: 172 fail: 0 Qemu test results: total: 373 pass: 373 fail: 0
Great, thanks for testing and letting me know.
greg k-h