4.9.276-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 4.9.276-rc1 review
This is the start of the stable review cycle for the 4.9.276 release. There are 245 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed, 21 Jul 2021 14:47:42 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.276-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.276-rc1
Martin Fäcknitz <[email protected]>
MIPS: vdso: Invalid GIC access through VDSO
Randy Dunlap <[email protected]>
mips: disable branch profiling in boot/decompress.o
Arnd Bergmann <[email protected]>
mips: always link byteswap helpers into decompressor
Christophe JAILLET <[email protected]>
scsi: be2iscsi: Fix an error handling path in beiscsi_dev_probe()
Aswath Govindraju <[email protected]>
ARM: dts: am335x: align ti,pindir-d0-out-d1-in property with dt-shema
Krzysztof Kozlowski <[email protected]>
memory: fsl_ifc: fix leak of private memory on probe failure
Krzysztof Kozlowski <[email protected]>
memory: fsl_ifc: fix leak of IO mapping on probe failure
Philipp Zabel <[email protected]>
reset: bail if try_module_get() fails
Geert Uytterhoeven <[email protected]>
ARM: dts: r8a7779, marzen: Fix DU clock names
Dan Carpenter <[email protected]>
rtc: fix snprintf() checking in is_rtc_hctosys()
Krzysztof Kozlowski <[email protected]>
ARM: dts: exynos: fix PWM LED max brightness on Odroid XU4
Krzysztof Kozlowski <[email protected]>
ARM: dts: exynos: fix PWM LED max brightness on Odroid XU/XU3
Nathan Chancellor <[email protected]>
hexagon: use common DISCARDS macro
Zhen Lei <[email protected]>
ALSA: isa: Fix error return code in snd_cmi8330_probe()
Thomas Gleixner <[email protected]>
x86/fpu: Limit xstate copy size in xstateregs_set()
Zhihao Cheng <[email protected]>
ubifs: Set/Clear I_LINKABLE under i_lock for whiteout inode
Gao Xiang <[email protected]>
nfs: fix acl memory leak of posix_acl_create()
Tao Ren <[email protected]>
watchdog: aspeed: fix hardware timeout calculation
Zhen Lei <[email protected]>
um: fix error return code in winch_tramp()
Zhen Lei <[email protected]>
um: fix error return code in slip_open()
Stephan Gerhold <[email protected]>
power: supply: rt5033_battery: Fix device tree enumeration
Krzysztof Wilczyński <[email protected]>
PCI/sysfs: Fix dsm_label_utf16s_to_utf8s() buffer overrun
Xie Yongji <[email protected]>
virtio_console: Assure used length from device is limited
Xie Yongji <[email protected]>
virtio-blk: Fix memory leak among suspend/resume procedure
Liguang Zhang <[email protected]>
ACPI: AMBA: Fix resource name in /proc/iomem
Uwe Kleine-König <[email protected]>
pwm: tegra: Don't modify HW state in .remove callback
Zou Wei <[email protected]>
power: supply: ab8500: add missing MODULE_DEVICE_TABLE
Zou Wei <[email protected]>
power: supply: charger-manager: add missing MODULE_DEVICE_TABLE
Jeff Layton <[email protected]>
ceph: remove bogus checks and WARN_ONs from ceph_set_page_dirty
Mike Marshall <[email protected]>
orangefs: fix orangefs df output.
Thomas Gleixner <[email protected]>
x86/fpu: Return proper error codes from user access functions
Zou Wei <[email protected]>
watchdog: Fix possible use-after-free by calling del_timer_sync()
Zou Wei <[email protected]>
watchdog: sc520_wdt: Fix possible use-after-free in wdt_turnoff()
Zou Wei <[email protected]>
watchdog: Fix possible use-after-free in wdt_startup()
Nick Desaulniers <[email protected]>
ARM: 9087/1: kprobes: test-thumb: fix for LLVM_IAS=1
Bixuan Cui <[email protected]>
power: reset: gpio-poweroff: add missing MODULE_DEVICE_TABLE
Linus Walleij <[email protected]>
power: supply: ab8500: Avoid NULL pointers
Uwe Kleine-König <[email protected]>
pwm: spear: Don't modify HW state in .remove callback
Dimitri John Ledkov <[email protected]>
lib/decompress_unlz4.c: correctly handle zero-padding around initrds.
Dmitry Torokhov <[email protected]>
i2c: core: Disable client irq on reboot/shutdown
Jiajun Cao <[email protected]>
ALSA: hda: Add IRQ check for platform_get_irq()
Uwe Kleine-König <[email protected]>
backlight: lm3630a: Fix return code of .update_status() callback
Benjamin Herrenschmidt <[email protected]>
powerpc/boot: Fixup device-tree on little endian
Yang Yingliang <[email protected]>
usb: gadget: hid: fix error return code in hid_bind()
Ruslan Bilovol <[email protected]>
usb: gadget: f_hid: fix endianness issue with descriptors
Takashi Sakamoto <[email protected]>
ALSA: bebob: add support for ToneWeal FW66
Zhen Lei <[email protected]>
ASoC: soc-core: Fix the error return code in snd_soc_of_parse_audio_routing()
Athira Rajeev <[email protected]>
selftests/powerpc: Fix "no_handler" EBB selftest
Yang Yingliang <[email protected]>
ALSA: ppc: fix error return code in snd_pmac_probe()
Srinivas Neeli <[email protected]>
gpio: zynq: Check return value of pm_runtime_get_sync
Geoff Levand <[email protected]>
powerpc/ps3: Add dma_mask to ps3_dma_region
Takashi Iwai <[email protected]>
ALSA: sb: Fix potential double-free of CSP mixer elements
Valentin Vidic <[email protected]>
s390/sclp_vt220: fix console name to match device
Zou Wei <[email protected]>
mfd: da9052/stmpe: Add and modify MODULE_DEVICE_TABLE
Mike Christie <[email protected]>
scsi: iscsi: Add iscsi_cls_conn refcount helpers
Jiapeng Chong <[email protected]>
fs/jfs: Fix missing error code in lmLogInit()
Christophe JAILLET <[email protected]>
tty: serial: 8250: serial_cs: Fix a memory leak in error handling path
James Smart <[email protected]>
scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
Takashi Sakamoto <[email protected]>
Revert "ALSA: bebob/oxfw: fix Kconfig entry for Mackie d.2 Pro"
Lv Yunlong <[email protected]>
misc/libmasm/module: Fix two use after free in ibmasm_init_one
Sherry Sun <[email protected]>
tty: serial: fsl_lpuart: fix the potential risk of division or modulo by zero
Eric Biggers <[email protected]>
fscrypt: don't ignore minor_hash when hash is 0
Steven Rostedt (VMware) <[email protected]>
tracing: Do not reference char * as a string in histograms
Tyrel Datwyler <[email protected]>
scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
Lai Jiangshan <[email protected]>
KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
Sean Christopherson <[email protected]>
KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
Tetsuo Handa <[email protected]>
smackfs: restrict bytes count in smk_set_cipso()
Pavel Skripkin <[email protected]>
jfs: fix GPF in diFree
Benjamin Drung <[email protected]>
media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
Johan Hovold <[email protected]>
media: gspca/sunplus: fix zero-length control requests
Johan Hovold <[email protected]>
media: gspca/sq905: fix control-request direction
Pavel Skripkin <[email protected]>
media: zr364xx: fix memory leak in zr364xx_start_readpipe
Johan Hovold <[email protected]>
media: dtv5100: fix control-request directions
Hou Tao <[email protected]>
dm btree remove: assign new_root only when removal succeeds
Lv Yunlong <[email protected]>
ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
Yun Zhou <[email protected]>
seq_buf: Fix overflow in seq_buf_putmem_hex()
Linus Walleij <[email protected]>
power: supply: ab8500: Fix an old bug
Petr Pavlu <[email protected]>
ipmi/watchdog: Stop watchdog timer when the current action is 'none'
Nathan Chancellor <[email protected]>
qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
Dmitry Osipenko <[email protected]>
ASoC: tegra: Set driver_name=tegra for all machine drivers
Timo Sigurdsson <[email protected]>
ata: ahci_sunxi: Disable DIPM
Wolfram Sang <[email protected]>
mmc: core: clear flags before allowing to retune
Al Cooper <[email protected]>
mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
Maximilian Luz <[email protected]>
pinctrl/amd: Add device HID for new AMD GPIO controller
Nathan Chancellor <[email protected]>
powerpc/barrier: Avoid collision with clang's __lwsync macro
Davis Mosenkovs <[email protected]>
mac80211: fix memory corruption in EAPOL handling
Thadeu Lima de Souza Cascardo <[email protected]>
can: bcm: delay release of struct bcm_op after synchronize_rcu()
Oliver Hartkopp <[email protected]>
can: gw: synchronize rcu operations before removing gw job entry
Miklos Szeredi <[email protected]>
fuse: reject internal errno
Marcelo Ricardo Leitner <[email protected]>
sctp: add size validation when walking chunks
Tim Jiang <[email protected]>
Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
Kai-Heng Feng <[email protected]>
Bluetooth: Shutdown controller after workqueues are flushed or cancelled
Yu Liu <[email protected]>
Bluetooth: Fix the HCI to MGMT status conversion table
Gerd Rausch <[email protected]>
RDMA/cma: Fix rdma_resolve_route() memory leak
Gustavo A. R. Silva <[email protected]>
wireless: wext-spy: Fix out-of-bounds warning
Íñigo Huguet <[email protected]>
sfc: error code if SRIOV cannot be disabled
Íñigo Huguet <[email protected]>
sfc: avoid double pci_remove of VFs
Xiao Yang <[email protected]>
RDMA/rxe: Don't overwrite errno from ib_umem_get()
Zheyu Ma <[email protected]>
atm: nicstar: register the interrupt handler in the right place
Zheyu Ma <[email protected]>
atm: nicstar: use 'dma_free_coherent' instead of 'kfree'
Huang Pei <[email protected]>
MIPS: add PMD table accounting into MIPS'pmd_alloc_one
Zou Wei <[email protected]>
cw1200: add missing MODULE_DEVICE_TABLE
Lee Gibson <[email protected]>
wl1251: Fix possible buffer overflow in wl1251_cmd_scan
Tony Lindgren <[email protected]>
wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
Steffen Klassert <[email protected]>
xfrm: Fix error reporting in xfrm_state_construct.
Minchan Kim <[email protected]>
selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
Yang Yingliang <[email protected]>
fjes: check return value after calling platform_get_resource()
Yang Yingliang <[email protected]>
net: micrel: check return value after calling platform_get_resource()
Joe Thornber <[email protected]>
dm space maps: don't reset space map allocation cursor when committing
Jiapeng Chong <[email protected]>
RDMA/cxgb4: Fix missing error code in create_qp()
Willy Tarreau <[email protected]>
ipv6: use prandom_u32() for ID generation
Dmitry Osipenko <[email protected]>
clk: tegra: Ensure that PLLU configuration is applied properly
Jesse Brandeburg <[email protected]>
e100: handle eeprom as little endian
Arturo Giusti <[email protected]>
udf: Fix NULL pointer dereference in udf_symlink function
Xie Yongji <[email protected]>
drm/virtio: Fix double free on probe failure
Pavel Skripkin <[email protected]>
reiserfs: add check for invalid 1st journal block
Sebastian Andrzej Siewior <[email protected]>
net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
Zou Wei <[email protected]>
atm: nicstar: Fix possible use-after-free in nicstar_cleanup()
Zou Wei <[email protected]>
mISDN: fix possible use-after-free in HFC_cleanup()
Zou Wei <[email protected]>
atm: iphase: fix possible use-after-free in ia_module_exit()
Bibo Mao <[email protected]>
hugetlb: clear huge pte during flush function on mips platform
Andy Shevchenko <[email protected]>
net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()
Quat Le <[email protected]>
scsi: core: Retry I/O for Notify (Enable Spinup) Required error
Johan Hovold <[email protected]>
mmc: vub3000: fix control-request direction
Dave Hansen <[email protected]>
selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
Miaohe Lin <[email protected]>
mm/huge_memory.c: don't discard hugepage if other processes are mapping it
Christophe JAILLET <[email protected]>
leds: ktd2692: Fix an error handling path
Chung-Chiang Cheng <[email protected]>
configfs: fix memleak in configfs_release_bin_file
Marek Szyprowski <[email protected]>
extcon: max8997: Add missing modalias string
Stephan Gerhold <[email protected]>
extcon: sm5502: Drop invalid register write in sm5502_reg_data
Christophe JAILLET <[email protected]>
phy: ti: dm816x: Fix the error handling path in 'dm816x_usb_phy_probe()
Zhen Lei <[email protected]>
scsi: mpt3sas: Fix error return value in _scsih_expander_add()
Geert Uytterhoeven <[email protected]>
of: Fix truncation of memory sizes on 32-bit platforms
Dan Carpenter <[email protected]>
staging: gdm724x: check for overflow in gdm_lte_netif_rx()
Dan Carpenter <[email protected]>
staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
Randy Dunlap <[email protected]>
s390: appldata depends on PROC_SYSCTL
Randy Dunlap <[email protected]>
scsi: FlashPoint: Rename si_flags field
Christophe JAILLET <[email protected]>
tty: nozomi: Fix the error handling path of 'nozomi_card_init()'
Yu Kuai <[email protected]>
char: pcmcia: error out if 'num_bytes_read' is greater than 4 in set_protocol()
Zhen Lei <[email protected]>
Input: hil_kbd - fix error return code in hil_dev_connect()
Jonathan Cameron <[email protected]>
iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Jonathan Cameron <[email protected]>
iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Nuno Sa <[email protected]>
iio: adis_buffer: do not return ints in irq handlers
Christophe JAILLET <[email protected]>
tty: nozomi: Fix a resource leak in an error handling function
Pavel Skripkin <[email protected]>
net: sched: fix warning in tcindex_alloc_perfect_hash
Muchun Song <[email protected]>
writeback: fix obtain a reference to a freeing memcg css
Luiz Augusto von Dentz <[email protected]>
Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
Dinghao Liu <[email protected]>
i40e: Fix error handling in i40e_vsi_open
Eric Dumazet <[email protected]>
vxlan: add missing rcu_read_lock() in neigh_reduce()
Pavel Skripkin <[email protected]>
net: ethernet: ezchip: fix error handling
Pavel Skripkin <[email protected]>
net: ethernet: ezchip: fix UAF in nps_enet_remove
Pavel Skripkin <[email protected]>
net: ethernet: aeroflex: fix UAF in greth_of_remove
Pablo Neira Ayuso <[email protected]>
netfilter: nft_exthdr: check for IPv6 packet before further processing
Liu Shixin <[email protected]>
netlabel: Fix memory leak in netlbl_mgmt_add_common
Yang Li <[email protected]>
ath10k: Fix an error code in ath10k_add_interface()
Christophe JAILLET <[email protected]>
brcmsmac: mac80211_if: Fix a resource leak in an error handling path
Randy Dunlap <[email protected]>
wireless: carl9170: fix LEDS build errors & warnings
Colin Ian King <[email protected]>
drm: qxl: ensure surf.data is ininitialized
Kamal Heib <[email protected]>
RDMA/rxe: Fix failure during driver load
Zhen Lei <[email protected]>
ehea: fix error return code in ehea_restart_qps()
Andy Shevchenko <[email protected]>
net: pch_gbe: Propagate error from devm_gpio_request_one()
Dan Carpenter <[email protected]>
ocfs2: fix snprintf() checking
Krzysztof Wilczyński <[email protected]>
ACPI: sysfs: Fix a buffer overrun problem with description_show()
Herbert Xu <[email protected]>
crypto: nx - Fix RCU warning in nx842_OF_upd_status
Mirko Vogt <mirko-dev|[email protected]>
spi: spi-sun6i: Fix chipselect/clock bug
Guenter Roeck <[email protected]>
hwmon: (max31790) Fix fan speed reporting for fan7..12
Guenter Roeck <[email protected]>
hwmon: (max31722) Remove non-standard ACPI device IDs
Dillon Min <[email protected]>
media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
Zhen Lei <[email protected]>
mmc: usdhi6rol0: fix error return code in usdhi6_probe()
Gustavo A. R. Silva <[email protected]>
media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
Zhen Lei <[email protected]>
media: tc358743: Fix error return code in tc358743_probe_of()
Sergey Shtylyov <[email protected]>
pata_ep93xx: fix deferred probing
Sergey Shtylyov <[email protected]>
pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
Randy Dunlap <[email protected]>
media: I2C: change 'RST' to "RSET" to fix multiple build errors
Sergey Shtylyov <[email protected]>
pata_rb532_cf: fix deferred probing
Sergey Shtylyov <[email protected]>
sata_highbank: fix deferred probing
Zhen Lei <[email protected]>
crypto: ux500 - Fix error return code in hash_hw_final()
Corentin Labbe <[email protected]>
crypto: ixp4xx - dma_unmap the correct address
Mauro Carvalho Chehab <[email protected]>
media: s5p_cec: decrement usage count if disabled
Arnd Bergmann <[email protected]>
ia64: mca_drv: fix incorrect array size calculation
Richard Fitzgerald <[email protected]>
ACPI: tables: Add custom DSDT file as makefile prerequisite
Jiapeng Chong <[email protected]>
platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
Hanjun Guo <[email protected]>
ACPI: bus: Call kobject_put() in acpi_init() error path
Alexander Aring <[email protected]>
fs: dlm: fix memory leak when fenced
Richard Fitzgerald <[email protected]>
random32: Fix implicit truncation warning in prandom_seed_state()
Alexander Aring <[email protected]>
fs: dlm: cancel work sync othercon
zhangyi (F) <[email protected]>
block_dump: remove block_dump feature in mark_inode_dirty()
Mario Limonciello <[email protected]>
ACPI: processor idle: Fix up C-state latency if not ordered
Axel Lin <[email protected]>
regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
Christophe Leroy <[email protected]>
btrfs: disable build on platforms having page size 256K
Josef Bacik <[email protected]>
btrfs: abort transaction if we fail to update the delayed inode
Mauro Carvalho Chehab <[email protected]>
media: siano: fix device register error path
Mauro Carvalho Chehab <[email protected]>
media: dvb_net: avoid speculation from net slot
Ard Biesheuvel <[email protected]>
crypto: shash - avoid comparing pointers to exported functions under CFI
Zheyu Ma <[email protected]>
mmc: via-sdmmc: add a check against NULL pointer dereference
Evgeny Novikov <[email protected]>
media: st-hva: Fix potential NULL pointer dereferences
Zheyu Ma <[email protected]>
media: bt8xx: Fix a missing check bug in bt878_probe
Lv Yunlong <[email protected]>
media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
Jack Xu <[email protected]>
crypto: qat - remove unused macro in FW loader
Jack Xu <[email protected]>
crypto: qat - check return code of qat_hal_rd_rel_reg()
Anirudh Rayabharam <[email protected]>
media: pvrusb2: fix warning in pvr2_i2c_core_done
Hans Verkuil <[email protected]>
media: cobalt: fix race condition in setting HPD
Pavel Skripkin <[email protected]>
media: cpia2: fix memory leak in cpia2_usb_probe
Bixuan Cui <[email protected]>
crypto: nx - add missing MODULE_DEVICE_TABLE
Tian Tao <[email protected]>
spi: omap-100k: Fix the length judgment problem
Jay Fang <[email protected]>
spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
Jay Fang <[email protected]>
spi: spi-loopback-test: Fix 'tx_buf' might be 'rx_buf'
Miklos Szeredi <[email protected]>
fuse: check connected before queueing on fpq->io
Yun Zhou <[email protected]>
seq_buf: Make trace_seq_putmem_hex() support data longer than 8
Michael Buesch <[email protected]>
ssb: sdio: Don't overwrite const buffer if block_write fails
Pali Rohár <[email protected]>
ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
Ondrej Zary <[email protected]>
serial_cs: remove wrong GLOBETROTTER.cis entry
Ondrej Zary <[email protected]>
serial_cs: Add Option International GSM-Ready 56K/ISDN modem
Yoshihiro Shimoda <[email protected]>
serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
Oliver Lang <[email protected]>
iio: ltr501: ltr501_read_ps(): add missing endianness conversion
Oliver Lang <[email protected]>
iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
Marc Kleine-Budde <[email protected]>
iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
Vineeth Vijayan <[email protected]>
s390/cio: dont call css_wait_for_slow_path() inside a lock
Zhang Xiaoxu <[email protected]>
SUNRPC: Should wake up the privileged task firstly.
Zhang Xiaoxu <[email protected]>
SUNRPC: Fix the batch tasks count wraparound.
Pan Dong <[email protected]>
ext4: fix avefreec in find_group_orlov
Zhang Yi <[email protected]>
ext4: remove check for zero nr_to_scan in ext4_es_scan()
Zhang Yi <[email protected]>
ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
Anirudh Rayabharam <[email protected]>
ext4: fix kernel infoleak via ext4_extent_header
David Sterba <[email protected]>
btrfs: clear defrag status of a root if starting transaction fails
Ludovic Desroches <[email protected]>
ARM: dts: at91: sama5d4: fix pinctrl muxing
Alexander Larkin <[email protected]>
Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
Al Viro <[email protected]>
iov_iter_fault_in_readable() should do nothing in xarray case
Desmond Cheong Zhi Xi <[email protected]>
ntfs: fix validity check for file name attribute
Hannu Hartikainen <[email protected]>
USB: cdc-acm: blacklist Heimann USB Appset device
Linyu Yuan <[email protected]>
usb: gadget: eem: fix echo command packet response issue
Pavel Skripkin <[email protected]>
net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
Johan Hovold <[email protected]>
Input: usbtouchscreen - fix control-request directions
Pavel Skripkin <[email protected]>
media: dvb-usb: fix wrong definition
Daehwan Jung <[email protected]>
ALSA: usb-audio: fix rate on Ozone Z90 USB headset
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/am335x-cm-t335.dts | 2 +- arch/arm/boot/dts/exynos5422-odroidxu4.dts | 2 +- arch/arm/boot/dts/exynos54xx-odroidxu-leds.dtsi | 4 +- arch/arm/boot/dts/r8a7779-marzen.dts | 2 +- arch/arm/boot/dts/r8a7779.dtsi | 1 + arch/arm/boot/dts/sama5d4.dtsi | 2 +- arch/arm/probes/kprobes/test-thumb.c | 10 ++-- arch/hexagon/kernel/vmlinux.lds.S | 7 +-- arch/ia64/kernel/mca_drv.c | 2 +- arch/mips/boot/compressed/Makefile | 4 +- arch/mips/boot/compressed/decompress.c | 2 + arch/mips/include/asm/hugetlb.h | 8 ++- arch/mips/include/asm/pgalloc.h | 10 ++-- arch/mips/vdso/vdso.h | 2 +- arch/powerpc/boot/devtree.c | 59 +++++++++++++--------- arch/powerpc/boot/ns16550.c | 9 +++- arch/powerpc/include/asm/barrier.h | 2 + arch/powerpc/include/asm/ps3.h | 2 + arch/powerpc/platforms/ps3/mm.c | 12 +++++ arch/s390/Kconfig | 2 +- arch/s390/kernel/setup.c | 2 +- arch/um/drivers/chan_user.c | 3 +- arch/um/drivers/slip_user.c | 3 +- arch/x86/include/asm/fpu/internal.h | 19 ++++--- arch/x86/kernel/fpu/regset.c | 2 +- arch/x86/kvm/cpuid.c | 8 ++- arch/x86/kvm/x86.c | 2 + crypto/shash.c | 18 +++++-- drivers/acpi/Makefile | 5 ++ drivers/acpi/acpi_amba.c | 1 + drivers/acpi/bus.c | 1 + drivers/acpi/device_sysfs.c | 2 +- drivers/acpi/processor_idle.c | 40 +++++++++++++++ drivers/ata/ahci_sunxi.c | 2 +- drivers/ata/pata_ep93xx.c | 2 +- drivers/ata/pata_octeon_cf.c | 5 +- drivers/ata/pata_rb532_cf.c | 6 ++- drivers/ata/sata_highbank.c | 6 ++- drivers/atm/iphase.c | 2 +- drivers/atm/nicstar.c | 26 +++++----- drivers/block/virtio_blk.c | 2 + drivers/bluetooth/btusb.c | 5 ++ drivers/char/ipmi/ipmi_watchdog.c | 22 ++++---- drivers/char/pcmcia/cm4000_cs.c | 4 ++ drivers/char/virtio_console.c | 4 +- drivers/clk/tegra/clk-pll.c | 6 ++- drivers/crypto/ixp4xx_crypto.c | 2 +- drivers/crypto/nx/nx-842-pseries.c | 9 ++-- drivers/crypto/qat/qat_common/qat_hal.c | 6 ++- drivers/crypto/qat/qat_common/qat_uclo.c | 1 - drivers/crypto/ux500/hash/hash_core.c | 1 + drivers/extcon/extcon-max8997.c | 1 + drivers/extcon/extcon-sm5502.c | 1 - drivers/firmware/qemu_fw_cfg.c | 8 ++- drivers/gpio/gpio-zynq.c | 5 +- drivers/gpu/drm/qxl/qxl_dumb.c | 2 + drivers/gpu/drm/virtio/virtgpu_kms.c | 1 + drivers/hwmon/max31722.c | 9 ---- drivers/hwmon/max31790.c | 2 +- drivers/i2c/i2c-core.c | 3 ++ drivers/iio/accel/bma180.c | 10 ++-- drivers/iio/accel/bma220_spi.c | 10 ++-- drivers/iio/accel/kxcjk-1013.c | 24 +++++---- drivers/iio/accel/stk8312.c | 12 +++-- drivers/iio/accel/stk8ba50.c | 17 +++---- drivers/iio/adc/ti-ads1015.c | 12 +++-- drivers/iio/adc/vf610_adc.c | 10 ++-- drivers/iio/gyro/bmg160_core.c | 10 ++-- drivers/iio/humidity/am2315.c | 16 +++--- drivers/iio/imu/adis_buffer.c | 3 -- drivers/iio/light/isl29125.c | 10 ++-- drivers/iio/light/ltr501.c | 15 ++++-- drivers/iio/light/tcs3414.c | 10 ++-- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 ++-- drivers/infiniband/core/cma.c | 3 +- drivers/infiniband/hw/cxgb4/qp.c | 1 + drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- drivers/infiniband/sw/rxe/rxe_net.c | 10 ++-- drivers/input/joydev.c | 2 +- drivers/input/keyboard/hil_kbd.c | 1 + drivers/input/touchscreen/usbtouchscreen.c | 8 +-- drivers/ipack/carriers/tpci200.c | 5 +- drivers/isdn/hardware/mISDN/hfcpci.c | 2 +- drivers/leds/leds-ktd2692.c | 27 ++++++---- drivers/md/persistent-data/dm-btree-remove.c | 3 +- drivers/md/persistent-data/dm-space-map-disk.c | 9 +++- drivers/md/persistent-data/dm-space-map-metadata.c | 9 +++- drivers/media/common/siano/smscoreapi.c | 22 ++++---- drivers/media/common/siano/smscoreapi.h | 4 +- drivers/media/common/siano/smsdvb-main.c | 4 ++ drivers/media/dvb-core/dvb_net.c | 25 ++++++--- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 6 +-- drivers/media/i2c/s5c73m3/s5c73m3.h | 2 +- drivers/media/i2c/s5k4ecgx.c | 10 ++-- drivers/media/i2c/s5k5baf.c | 6 +-- drivers/media/i2c/s5k6aa.c | 10 ++-- drivers/media/i2c/tc358743.c | 1 + drivers/media/pci/bt8xx/bt878.c | 3 ++ drivers/media/pci/cobalt/cobalt-driver.c | 1 + drivers/media/pci/cobalt/cobalt-driver.h | 7 ++- drivers/media/platform/s5p-g2d/g2d.c | 3 ++ drivers/media/platform/sti/hva/hva-hw.c | 3 +- drivers/media/usb/cpia2/cpia2.h | 1 + drivers/media/usb/cpia2/cpia2_core.c | 12 +++++ drivers/media/usb/cpia2/cpia2_usb.c | 13 ++--- drivers/media/usb/dvb-usb/cxusb.c | 2 +- drivers/media/usb/dvb-usb/dtv5100.c | 7 ++- drivers/media/usb/gspca/sq905.c | 2 +- drivers/media/usb/gspca/sunplus.c | 8 ++- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 4 +- drivers/media/usb/uvc/uvc_video.c | 27 ++++++++++ drivers/media/usb/zr364xx/zr364xx.c | 1 + drivers/media/v4l2-core/v4l2-fh.c | 1 + drivers/memory/fsl_ifc.c | 8 +-- drivers/mfd/da9052-i2c.c | 1 + drivers/mfd/stmpe-i2c.c | 2 +- drivers/misc/ibmasm/module.c | 5 +- drivers/mmc/core/core.c | 7 ++- drivers/mmc/host/sdhci.c | 4 ++ drivers/mmc/host/sdhci.h | 1 + drivers/mmc/host/usdhi6rol0.c | 1 + drivers/mmc/host/via-sdmmc.c | 3 ++ drivers/mmc/host/vub300.c | 2 +- drivers/net/can/usb/ems_usb.c | 3 +- drivers/net/ethernet/aeroflex/greth.c | 3 +- drivers/net/ethernet/ezchip/nps_enet.c | 4 +- drivers/net/ethernet/ibm/ehea/ehea_main.c | 9 ++-- drivers/net/ethernet/intel/e100.c | 12 ++--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 + drivers/net/ethernet/micrel/ks8842.c | 4 ++ .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 29 +++++------ drivers/net/ethernet/sfc/ef10_sriov.c | 25 +++++---- drivers/net/fjes/fjes_main.c | 4 ++ drivers/net/vxlan.c | 2 + drivers/net/wireless/ath/ath10k/mac.c | 1 + drivers/net/wireless/ath/ath9k/main.c | 5 ++ drivers/net/wireless/ath/carl9170/Kconfig | 8 ++- .../broadcom/brcm80211/brcmsmac/mac80211_if.c | 8 ++- drivers/net/wireless/st/cw1200/cw1200_sdio.c | 1 + drivers/net/wireless/ti/wl1251/cmd.c | 9 ++-- drivers/net/wireless/ti/wl12xx/main.c | 7 +++ drivers/of/fdt.c | 8 +-- drivers/of/of_reserved_mem.c | 8 +-- drivers/pci/pci-label.c | 2 +- drivers/phy/phy-dm816x-usb.c | 17 +++++-- drivers/pinctrl/pinctrl-amd.c | 1 + drivers/platform/x86/toshiba_acpi.c | 1 + drivers/power/reset/gpio-poweroff.c | 1 + drivers/power/supply/Kconfig | 3 +- drivers/power/supply/ab8500_btemp.c | 1 + drivers/power/supply/ab8500_charger.c | 19 ++++++- drivers/power/supply/ab8500_fg.c | 1 + drivers/power/supply/charger-manager.c | 1 + drivers/power/supply/rt5033_battery.c | 7 +++ drivers/pwm/pwm-spear.c | 4 -- drivers/pwm/pwm-tegra.c | 13 ----- drivers/regulator/da9052-regulator.c | 3 +- drivers/reset/core.c | 5 +- drivers/rtc/rtc-proc.c | 4 +- drivers/s390/char/sclp_vt220.c | 4 +- drivers/s390/cio/chp.c | 3 ++ drivers/s390/cio/chsc.c | 2 - drivers/scsi/FlashPoint.c | 32 ++++++------ drivers/scsi/be2iscsi/be_main.c | 1 + drivers/scsi/hosts.c | 1 + drivers/scsi/libiscsi.c | 7 +-- drivers/scsi/lpfc/lpfc_els.c | 9 ++++ drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +- drivers/scsi/scsi_lib.c | 1 + drivers/scsi/scsi_transport_iscsi.c | 12 +++++ drivers/spi/spi-loopback-test.c | 2 +- drivers/spi/spi-omap-100k.c | 2 +- drivers/spi/spi-sun6i.c | 6 ++- drivers/spi/spi-topcliff-pch.c | 4 +- drivers/ssb/sdio.c | 1 - drivers/staging/gdm724x/gdm_lte.c | 20 ++++++-- drivers/staging/media/s5p-cec/s5p_cec.c | 2 +- drivers/tty/nozomi.c | 9 ++-- drivers/tty/serial/8250/serial_cs.c | 13 ++++- drivers/tty/serial/fsl_lpuart.c | 3 ++ drivers/tty/serial/sh-sci.c | 8 +++ drivers/usb/class/cdc-acm.c | 5 ++ drivers/usb/gadget/function/f_eem.c | 43 ++++++++++++++-- drivers/usb/gadget/function/f_hid.c | 2 +- drivers/usb/gadget/legacy/hid.c | 4 +- drivers/video/backlight/lm3630a_bl.c | 12 ++--- drivers/watchdog/aspeed_wdt.c | 2 +- drivers/watchdog/lpc18xx_wdt.c | 2 +- drivers/watchdog/sbc60xxwdt.c | 2 +- drivers/watchdog/sc520_wdt.c | 2 +- drivers/watchdog/w83877f_wdt.c | 2 +- fs/btrfs/Kconfig | 2 + fs/btrfs/delayed-inode.c | 8 +++ fs/btrfs/transaction.c | 6 ++- fs/ceph/addr.c | 10 +--- fs/configfs/file.c | 10 ++-- fs/crypto/fname.c | 8 +-- fs/dlm/config.c | 9 ++++ fs/dlm/lowcomms.c | 2 +- fs/ext4/extents.c | 3 ++ fs/ext4/extents_status.c | 4 +- fs/ext4/ialloc.c | 11 ++-- fs/fs-writeback.c | 34 +++---------- fs/fuse/dev.c | 11 +++- fs/jfs/inode.c | 3 +- fs/jfs/jfs_logmgr.c | 1 + fs/nfs/nfs3proc.c | 4 +- fs/ntfs/inode.c | 2 +- fs/ocfs2/filecheck.c | 6 +-- fs/ocfs2/stackglue.c | 8 +-- fs/orangefs/super.c | 2 +- fs/reiserfs/journal.c | 14 +++++ fs/ubifs/dir.c | 7 +++ fs/udf/namei.c | 4 ++ include/crypto/internal/hash.h | 8 +-- include/linux/mfd/abx500/ux500_chargalg.h | 2 +- include/linux/prandom.h | 2 +- include/scsi/scsi_transport_iscsi.h | 2 + kernel/trace/trace_events_hist.c | 6 +-- lib/decompress_unlz4.c | 8 +++ lib/iov_iter.c | 2 +- lib/seq_buf.c | 8 ++- mm/huge_memory.c | 2 +- net/bluetooth/hci_core.c | 16 +++--- net/bluetooth/mgmt.c | 6 +++ net/can/bcm.c | 7 ++- net/can/gw.c | 3 ++ net/core/dev.c | 11 +++- net/ipv6/output_core.c | 28 ++-------- net/mac80211/rx.c | 2 +- net/netfilter/nft_exthdr.c | 3 ++ net/netlabel/netlabel_mgmt.c | 19 +++---- net/sched/cls_tcindex.c | 2 +- net/sctp/input.c | 2 +- net/sunrpc/sched.c | 12 ++++- net/wireless/wext-spy.c | 14 ++--- net/xfrm/xfrm_user.c | 28 +++++----- security/selinux/avc.c | 13 ++--- security/smack/smackfs.c | 2 + sound/firewire/Kconfig | 5 +- sound/firewire/bebob/bebob.c | 5 +- sound/firewire/oxfw/oxfw.c | 2 +- sound/isa/cmi8330.c | 2 +- sound/isa/sb/sb16_csp.c | 8 ++- sound/pci/hda/hda_tegra.c | 3 ++ sound/ppc/powermac.c | 6 ++- sound/soc/soc-core.c | 2 +- sound/soc/tegra/tegra_alc5632.c | 1 + sound/soc/tegra/tegra_max98090.c | 1 + sound/soc/tegra/tegra_rt5640.c | 1 + sound/soc/tegra/tegra_rt5677.c | 1 + sound/soc/tegra/tegra_sgtl5000.c | 1 + sound/soc/tegra/tegra_wm8753.c | 1 + sound/soc/tegra/tegra_wm8903.c | 1 + sound/soc/tegra/tegra_wm9712.c | 1 + sound/soc/tegra/trimslice.c | 1 + sound/usb/format.c | 2 + .../selftests/powerpc/pmu/ebb/no_handler_test.c | 2 - tools/testing/selftests/x86/protection_keys.c | 3 +- 260 files changed, 1146 insertions(+), 604 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/245 ALSA: usb-audio: fix rate on Ozone Z90 USB headset
From: Daehwan Jung <[email protected]>
commit aecc19ec404bdc745c781058ac97a373731c3089 upstream.
It mislabels its 96 kHz altsetting and that's why it causes some noise
--- sound/usb/format.c | 2 ++ 1 file changed, 2 insertions(+)
sound/usb/format.c +2 -0
@@ -189,9 +189,11 @@ static int parse_audio_format_rates_v1(scontinue ;/* C-Media CM6501 mislabels its 96 kHz altsetting */ /* Terratec Aureon 7.1 USB C-Media 6206, too */ +/* Ozone Z90 USB C-Media, too */ if (rate ==48000 && nr_rates ==1 && (chip->usb_id ==USB_ID (0x0d8c ,0x0201 ) || chip->usb_id ==USB_ID (0x0d8c ,0x0102 ) || + chip->usb_id ==USB_ID (0x0d8c ,0x0078 ) || chip->usb_id ==USB_ID (0x0ccd ,0x00b1 )) && fp->altsetting ==5 && fp->maxpacksize ==392 ) rate =96000 ;
Greg Kroah-Hartman
maintainerPATCH 2/245 media: dvb-usb: fix wrong definition
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit c680ed46e418e9c785d76cf44eb33bfd1e8cf3f6 upstream.
syzbot reported WARNING in vmalloc. The problem
was in zero size passed to vmalloc.
The root case was in wrong cxusb_bluebird_lgz201_properties definition. adapter array has only 1 entry, but num_adapters was 2.
Call Trace: __vmalloc_node mm/vmalloc.c:2963 [inline] vmalloc+0x67/0x80 mm/vmalloc.c:2996 dvb_dmx_init+0xe4/0xb90 drivers/media/dvb-core/dvb_demux.c:1251 dvb_usb_adapter_dvb_init+0x564/0x860 drivers/media/usb/dvb-usb/dvb-usb-dvb.c:184 dvb_usb_adapter_init drivers/media/usb/dvb-usb/dvb-usb-init.c:86 [inline] dvb_usb_init drivers/media/usb/dvb-usb/dvb-usb-init.c:184 [inline] dvb_usb_device_init.cold+0xc94/0x146e drivers/media/usb/dvb-usb/dvb-usb-init.c:308 cxusb_probe+0x159/0x5e0 drivers/media/usb/dvb-usb/cxusb.c:1634
--- drivers/media/usb/dvb-usb/cxusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/dvb-usb/cxusb.c +1 -1
@@ -1791,7 +1791,7 @@ static struct dvb_usb_device_properties .size_of_priv = sizeof(struct cxusb_state), - .num_adapters = 2, + .num_adapters = 1, .adapter = { { .num_frontends = 1,
Greg Kroah-Hartman
maintainerPATCH 3/245 Input: usbtouchscreen - fix control-request directions
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 41e81022a04a0294c55cfa7e366bc14b9634c66e upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the four control requests which erroneously used usb_rcvctrlpipe().
--- drivers/input/touchscreen/usbtouchscreen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/input/touchscreen/usbtouchscreen.c +4 -4
@@ -266,7 +266,7 @@ static int e2i_init(struct usbtouch_usbint ret;struct usb_device *udev =interface_to_usbdev (usbtouch->interface); - ret =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ), + ret =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),0x01 ,0x02 ,0x0000 ,0x0081 ,NULL ,0 ,USB_CTRL_SET_TIMEOUT );
@@ -462,7 +462,7 @@ static int mtouch_init(struct usbtouch_uint ret, i;struct usb_device *udev =interface_to_usbdev (usbtouch->interface); - ret =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ), + ret =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),MTOUCHUSB_RESET ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,1 ,0 ,NULL ,0 ,USB_CTRL_SET_TIMEOUT );
@@ -474,7 +474,7 @@ static int mtouch_init(struct usbtouch_umsleep (150 );for (i =0 ; i <3 ; i++) { - ret =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ), + ret =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),MTOUCHUSB_ASYNC_REPORT ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,1 ,1 ,NULL ,0 ,USB_CTRL_SET_TIMEOUT );
@@ -645,7 +645,7 @@ static int dmc_tsc10_init(struct usbtouc }/* start sending data */ - ret =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), + ret =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ),TSC10_CMD_DATA1 ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,0 ,0 ,NULL ,0 ,USB_CTRL_SET_TIMEOUT );
Greg Kroah-Hartman
maintainerPATCH 4/245 net: can: ems_usb: fix use-after-free in ems_usb_disconnect()
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit ab4a0b8fcb9a95c02909b62049811bd2e586aaa4 upstream.
In ems_usb_disconnect() dev pointer, which is netdev private data, is used after free_candev() call:
| if (dev) {
| unregister_netdev(dev->netdev);
| free_candev(dev->netdev);
|
| unlink_all_urbs(dev);
|
| usb_free_urb(dev->intr_urb);
|
| kfree(dev->intr_in_buffer);
| kfree(dev->tx_msg_buffer);
| }Fix it by simply moving free_candev() at the end of the block.
Fail log:
| BUG: KASAN: use-after-free in ems_usb_disconnect | Read of size 8 at addr ffff88804e041008 by task kworker/1:2/2895 | | CPU: 1 PID: 2895 Comm: kworker/1:2 Not tainted 5.13.0-rc5+ #164 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a-rebuilt.opensuse.4 | Workqueue: usb_hub_wq hub_event | Call Trace: | dump_stack (lib/dump_stack.c:122) | print_address_description.constprop.0.cold (mm/kasan/report.c:234) | kasan_report.cold (mm/kasan/report.c:420 mm/kasan/report.c:436) | ems_usb_disconnect (drivers/net/can/usb/ems_usb.c:683 drivers/net/can/usb/ems_usb.c:1058)
--- drivers/net/can/usb/ems_usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/can/usb/ems_usb.c +2 -1
@@ -1064,7 +1064,6 @@ static void ems_usb_disconnect(struct usif (dev) {unregister_netdev (dev->netdev); -free_candev (dev->netdev);unlink_all_urbs (dev);
@@ -1072,6 +1071,8 @@ static void ems_usb_disconnect(struct uskfree (dev->intr_in_buffer);kfree (dev->tx_msg_buffer); + +free_candev (dev->netdev); } }
Greg Kroah-Hartman
maintainerPATCH 5/245 usb: gadget: eem: fix echo command packet response issue
In reply to Greg Kroah-HartmanFrom: Linyu Yuan <[email protected]>
commit 4249d6fbc10fd997abdf8a1ea49c0389a0edf706 upstream.
when receive eem echo command, it will send a response, but queue this response to the usb request which allocate from gadget device endpoint zero,
and transmit the request to IN endpoint of eem interface.
on dwc3 gadget, it will trigger following warning in function __dwc3_gadget_ep_queue(),
if (WARN(req->dep != dep, "request %pK belongs to '%s'\n", &req->request, req->dep->name)) return -EINVAL;
fix it by allocating a usb request from IN endpoint of eem interface, and transmit the usb request to same IN endpoint of eem interface.
--- drivers/usb/gadget/function/f_eem.c | 43 ++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-)
drivers/usb/gadget/function/f_eem.c +39 -4
@@ -34,6 +34,11 @@ struct f_eem {u8 ctrl_id; }; +struct in_context { +struct sk_buff *skb; +struct usb_ep *ep; +}; +static inline struct f_eem *func_to_eem (struct usb_function *f) { return container_of(f, struct f_eem, port.func);
@@ -327,9 +332,12 @@ fail:static void eem_cmd_complete (struct usb_ep *ep,struct usb_request *req) { -struct sk_buff *skb = (struct sk_buff *)req->context; +struct in_context *ctx = req->context; -dev_kfree_skb_any (skb); +dev_kfree_skb_any (ctx->skb); +kfree (req->buf); +usb_ep_free_request (ctx->ep, req); +kfree (ctx); }/*
@@ -417,7 +425,9 @@ static int eem_unwrap(struct gether *por* b15: bmType (0 == data, 1 == command) */ if (header &BIT (15 )) { -struct usb_request *req = cdev->req; +struct usb_request *req; +struct in_context *ctx; +struct usb_ep *ep;u16 bmEEMCmd;/* EEM command packet format:
@@ -446,11 +456,36 @@ static int eem_unwrap(struct gether *porskb_trim (skb2, len);put_unaligned_le16 (BIT (15 ) |BIT (11 ) | len,skb_push (skb2,2 )); + + ep = port->in_ep; + req =usb_ep_alloc_request (ep,GFP_ATOMIC ); +if (!req) { +dev_kfree_skb_any (skb2); + goto next; + } + + req->buf =kmalloc (skb2->len,GFP_KERNEL ); +if (!req->buf) { +usb_ep_free_request (ep, req); +dev_kfree_skb_any (skb2); + goto next; + } + + ctx =kmalloc (sizeof (*ctx),GFP_KERNEL ); +if (!ctx) { +kfree (req->buf); +usb_ep_free_request (ep, req); +dev_kfree_skb_any (skb2); + goto next; + } + ctx->skb = skb2; + ctx->ep = ep; +skb_copy_bits (skb2,0 , req->buf, skb2->len); req->length = skb2->len; req->complete = eem_cmd_complete; req->zero =1 ; - req->context = skb2; + req->context = ctx;if (usb_ep_queue (port->in_ep, req,GFP_ATOMIC ))DBG (cdev,"echo response queue fail\n" );break ;
Greg Kroah-Hartman
maintainerPATCH 6/245 USB: cdc-acm: blacklist Heimann USB Appset device
In reply to Greg Kroah-HartmanFrom: Hannu Hartikainen <[email protected]>
commit 4897807753e078655a78de39ed76044d784f3e63 upstream.
The device (32a7:0000 Heimann Sensor GmbH USB appset demo) claims to be a CDC-ACM device in its descriptors but in fact is not. If it is run with echo disabled it returns garbled data, probably due to something that happens in the TTY layer. And when run with echo enabled (the default), it will mess up the calibration data of the sensor the first time any data is sent to the device.
In short, I had a bad time after connecting the sensor and trying to get it to work. I hope blacklisting it in the cdc-acm driver will save someone else a bit of trouble.
--- drivers/usb/class/cdc-acm.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/class/cdc-acm.c +5 -0
@@ -1894,6 +1894,11 @@ static const struct usb_device_id acm_id .driver_info = IGNORE_DEVICE, }, +/* Exclude Heimann Sensor GmbH USB appset demo */ + { USB_DEVICE(0x32a7, 0x0000), + .driver_info =IGNORE_DEVICE , + }, + /* control interfaces without any protocol set */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, USB_CDC_PROTO_NONE) },
Greg Kroah-Hartman
maintainerPATCH 7/245 ntfs: fix validity check for file name attribute
In reply to Greg Kroah-HartmanFrom: Desmond Cheong Zhi Xi <[email protected]>
commit d98e4d95411bbde2220a7afa38dcc9c14d71acbe upstream.
When checking the file name attribute, we want to ensure that it fits within the bounds of ATTR_RECORD. To do this, we should check that (attr record + file name offset + file name length) < (attr record + attr record length).
However, the original check did not include the file name offset in the calculation. This means that corrupted on-disk metadata might not caught by the incorrect file name check, and lead to an invalid memory access.
An example can be seen in the crash report of a memory corruption error found by Syzbot:
https://syzkaller.appspot.com/bug?id=a1a1e379b225812688566745c3e2f7242bffc246
Adding the file name offset to the validity check fixes this error and passes the Syzbot reproducer test.
--- fs/ntfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs/inode.c +1 -1
@@ -502,7 +502,7 @@ err_corrupt_attr: } file_name_attr = (FILE_NAME_ATTR *)((u8 *)attr +le16_to_cpu (attr->data.resident.value_offset)); - p2 = (u8 *)attr +le32_to_cpu (attr->data.resident.value_length); + p2 = (u8 *)file_name_attr +le32_to_cpu (attr->data.resident.value_length);if (p2 < (u8 *)attr || p2 > p) goto err_corrupt_attr;/* This attribute is ok, but is it in the $Extend directory? */
Greg Kroah-Hartman
maintainerPATCH 8/245 iov_iter_fault_in_readable() should do nothing in xarray case
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 0e8f0d67401589a141950856902c7d0ec8d9c985 upstream.
... and actually should just check it's given an iovec-backed iterator in the first place.
--- lib/iov_iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/iov_iter.c +1 -1
@@ -394,7 +394,7 @@ int iov_iter_fault_in_readable(struct ioint err;struct iovec v; -if (!(i->type & (ITER_BVEC |ITER_KVEC ))) { +if (iter_is_iovec (i)) { iterate_iovec(i, bytes, v, iov, skip, ({ err = fault_in_pages_readable(v.iov_base, v.iov_len); if (unlikely(err))
Greg Kroah-Hartman
maintainerPATCH 9/245 Input: joydev - prevent use of not validated data in JSIOCSBTNMAP ioctl
In reply to Greg Kroah-HartmanFrom: Alexander Larkin <[email protected]>
commit f8f84af5da9ee04ef1d271528656dac42a090d00 upstream.
Even though we validate user-provided inputs we then traverse past validated data when applying the new map. The issue was originally discovered by Murray McAllister with this simple POC (if the following is executed by an unprivileged user it will instantly panic the system):
int main(void) {
int fd, ret;
unsigned int buffer[10000];
fd = open("/dev/input/js0", O_RDONLY);
if (fd == -1)
printf("Error opening file\n");
ret = ioctl(fd, JSIOCSBTNMAP & ~IOCSIZE_MASK, &buffer);
printf("%d\n", ret);
}The solution is to traverse internal buffer which is guaranteed to only contain valid date when constructing the map.
--- drivers/input/joydev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joydev.c +1 -1
@@ -492,7 +492,7 @@ static int joydev_handle_JSIOCSBTNMAP(stmemcpy (joydev->keypam, keypam, len);for (i =0 ; i < joydev->nkey; i++) - joydev->keymap[keypam[i] -BTN_MISC ] = i; + joydev->keymap[joydev->keypam[i] -BTN_MISC ] = i; out:kfree (keypam);
Greg Kroah-Hartman
maintainerPATCH 10/245 ARM: dts: at91: sama5d4: fix pinctrl muxing
In reply to Greg Kroah-HartmanFrom: Ludovic Desroches <[email protected]>
commit 253adffb0e98eaf6da2e7cf73ae68695e21f2f3c upstream.
Fix pinctrl muxing, PD28, PD29 and PD31 can be muxed to peripheral A. It allows to use SCK0, SCK1 and SPI0_NPCS2 signals.
--- arch/arm/boot/dts/sama5d4.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d4.dtsi +1 -1
@@ -1371,7 +1371,7 @@ 0xffffffff 0x3ffcfe7c 0x1c010101 /* pioA */ 0x7fffffff 0xfffccc3a 0x3f00cc3a /* pioB */ 0xffffffff 0x3ff83fff 0xff00ffff /* pioC */ - 0x0003ff00 0x8002a800 0x00000000 /* pioD */ + 0xb003ff00 0x8002a800 0x00000000 /* pioD */ 0xffffffff 0x7fffffff 0x76fff1bf /* pioE */ >;
Greg Kroah-Hartman
maintainerPATCH 11/245 btrfs: clear defrag status of a root if starting transaction fails
In reply to Greg Kroah-HartmanFrom: David Sterba <[email protected]>
commit 6819703f5a365c95488b07066a8744841bf14231 upstream.
The defrag loop processes leaves in batches and starting transaction for each. The whole defragmentation on a given root is protected by a bit but in case the transaction fails, the bit is not cleared
In case the transaction fails the bit would prevent starting defragmentation again, so make sure it's cleared.
--- fs/btrfs/transaction.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/btrfs/transaction.c +4 -2
@@ -1287,8 +1287,10 @@ int btrfs_defrag_root(struct btrfs_rootwhile (1 ) { trans =btrfs_start_transaction (root,0 ); -if (IS_ERR (trans)) -return PTR_ERR (trans); +if (IS_ERR (trans)) { + ret =PTR_ERR (trans); +break ; + } ret =btrfs_defrag_leaves (trans, root);
Greg Kroah-Hartman
maintainerPATCH 12/245 ext4: fix kernel infoleak via ext4_extent_header
In reply to Greg Kroah-HartmanFrom: Anirudh Rayabharam <[email protected]>
commit ce3aba43599f0b50adbebff133df8d08a3d5fffe upstream.
Initialize eh_generation of struct ext4_extent_header to prevent leaking info to userspace. Fixes KMSAN kernel-infoleak bug reported by syzbot at:
http://syzkaller.appspot.com/bug?id=78e9ad0e6952a3ca16e8234724b2fa92d041b9b8
--- fs/ext4/extents.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/extents.c +3 -0
@@ -870,6 +870,7 @@ int ext4_ext_tree_init(handle_t *handle, eh->eh_entries =0 ; eh->eh_magic =EXT4_EXT_MAGIC ; eh->eh_max =cpu_to_le16 (ext4_ext_space_root (inode,0 )); + eh->eh_generation =0 ;ext4_mark_inode_dirty (handle, inode);return 0 ; }
@@ -1126,6 +1127,7 @@ static int ext4_ext_split(handle_t *hand neh->eh_max =cpu_to_le16 (ext4_ext_space_block (inode,0 )); neh->eh_magic =EXT4_EXT_MAGIC ; neh->eh_depth =0 ; + neh->eh_generation =0 ;/* move remainder of path[depth] to the new leaf */ if (unlikely(path[depth].p_hdr->eh_entries !=
@@ -1203,6 +1205,7 @@ static int ext4_ext_split(handle_t *hand neh->eh_magic =EXT4_EXT_MAGIC ; neh->eh_max =cpu_to_le16 (ext4_ext_space_block_idx (inode,0 )); neh->eh_depth =cpu_to_le16 (depth - i); + neh->eh_generation =0 ; fidx =EXT_FIRST_INDEX (neh); fidx->ei_block = border;ext4_idx_store_pblock (fidx, oldblock);
Greg Kroah-Hartman
maintainerPATCH 13/245 ext4: correct the cache_nr in tracepoint ext4_es_shrink_exit
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit 4fb7c70a889ead2e91e184895ac6e5354b759135 upstream.
The cache_cnt parameter of tracepoint ext4_es_shrink_exit means the remaining cache count after shrink, but now it is the cache count before shrink, fix it by read sbi->s_extent_cache_cnt again.
--- fs/ext4/extents_status.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/extents_status.c +1 -0
@@ -1085,6 +1085,7 @@ static unsigned long ext4_es_scan(struct nr_shrunk =__es_shrink (sbi, nr_to_scan,NULL ); + ret =percpu_counter_read_positive (&sbi->s_es_stats.es_stats_shk_cnt);trace_ext4_es_shrink_scan_exit (sbi->s_sb, nr_shrunk, ret);return nr_shrunk; }
Greg Kroah-Hartman
maintainerPATCH 14/245 ext4: remove check for zero nr_to_scan in ext4_es_scan()
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
commit e5e7010e5444d923e4091cafff61d05f2d19cada upstream.
After converting fs shrinkers to new scan/count API, we are no longer pass zero nr_to_scan parameter to detect the number of objects to free, just remove this check.
--- fs/ext4/extents_status.c | 3 --- 1 file changed, 3 deletions(-)
fs/ext4/extents_status.c +0 -3
@@ -1080,9 +1080,6 @@ static unsigned long ext4_es_scan(struct ret =percpu_counter_read_positive (&sbi->s_es_stats.es_stats_shk_cnt);trace_ext4_es_shrink_scan_enter (sbi->s_sb, nr_to_scan, ret); -if (!nr_to_scan) -return ret; - nr_shrunk =__es_shrink (sbi, nr_to_scan,NULL ); ret =percpu_counter_read_positive (&sbi->s_es_stats.es_stats_shk_cnt);
Greg Kroah-Hartman
maintainerPATCH 15/245 ext4: fix avefreec in find_group_orlov
In reply to Greg Kroah-HartmanFrom: Pan Dong <[email protected]>
commit c89849cc0259f3d33624cc3bd127685c3c0fa25d upstream.
The avefreec should be average free clusters instead of average free blocks, otherwize Orlov's allocator will not work properly when bigalloc enabled.
--- fs/ext4/ialloc.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/ext4/ialloc.c +5 -6
@@ -405,7 +405,7 @@ static void get_orlov_stats(struct super* * We always try to spread first-level directories. * -* If there are blockgroups with both free inodes and free blocks counts +* If there are blockgroups with both free inodes and free clusters counts * not worse than average we return one with smallest directory count. * Otherwise we simply return a random group. *
@@ -414,7 +414,7 @@ static void get_orlov_stats(struct super* It's OK to put directory into a group unless * it has too many directories already (max_dirs) or * it has too few free inodes left (min_inodes) or -* it has too few free blocks left (min_blocks) or +* it has too few free clusters left (min_clusters) or * Parent's group is preferred, if it doesn't satisfy these * conditions we search cyclically through the rest. If none * of the groups look good we just look for a group with more
@@ -430,7 +430,7 @@ static int find_group_orlov(struct superext4_group_t real_ngroups =ext4_get_groups_count (sb);int inodes_per_group =EXT4_INODES_PER_GROUP (sb);unsigned int freei, avefreei, grp_free; -ext4_fsblk_t freeb, avefreec; +ext4_fsblk_t freec, avefreec;unsigned int ndirs;int max_dirs, min_inodes;ext4_grpblk_t min_clusters;
@@ -449,9 +449,8 @@ static int find_group_orlov(struct super freei =percpu_counter_read_positive (&sbi->s_freeinodes_counter); avefreei = freei / ngroups; - freeb =EXT4_C2B (sbi, -percpu_counter_read_positive (&sbi->s_freeclusters_counter)); - avefreec = freeb; + freec =percpu_counter_read_positive (&sbi->s_freeclusters_counter); + avefreec = freec;do_div (avefreec, ngroups); ndirs =percpu_counter_read_positive (&sbi->s_dirs_counter);
Greg Kroah-Hartman
maintainerPATCH 16/245 SUNRPC: Fix the batch tasks count wraparound.
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
commit fcb170a9d825d7db4a3fb870b0300f5a40a8d096 upstream.
The 'queue->nr' will wraparound from 0 to 255 when only current priority queue has tasks. This maybe lead a deadlock same as commit dfe1fe75e00e ("NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()"):
Privileged delegreturn task is queued to privileged list because all the slots are assigned. When non-privileged task complete and release the slot, a non-privileged maybe picked out. It maybe allocate slot failed when the session on draining.
If the 'queue->nr' has wraparound to 255, and no enough slot to service it, then the privileged delegreturn will lost to wake up.
So we should avoid the wraparound on 'queue->nr'.
--- net/sunrpc/sched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/sched.c +2 -1
@@ -490,7 +490,8 @@ static struct rpc_task *__rpc_find_next_* Service a batch of tasks from a single owner. */ q = &queue->tasks[queue->priority]; -if (!list_empty (q) && --queue->nr) { +if (!list_empty (q) && queue->nr) { + queue->nr--; task = list_first_entry(q, struct rpc_task, u.tk_wait.list); goto out; }
Greg Kroah-Hartman
maintainerPATCH 17/245 SUNRPC: Should wake up the privileged task firstly.
In reply to Greg Kroah-HartmanFrom: Zhang Xiaoxu <[email protected]>
commit 5483b904bf336948826594610af4c9bbb0d9e3aa upstream.
When find a task from wait queue to wake up, a non-privileged task may be found out, rather than the privileged. This maybe lead a deadlock same as commit dfe1fe75e00e ("NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode()"):
Privileged delegreturn task is queued to privileged list because all the slots are assigned. If there has no enough slot to wake up the non-privileged batch tasks(session less than 8 slot), then the privileged delegreturn task maybe lost waked up because the found out task can't get slot since the session is on draining.
So we should treate the privileged task as the emergency task, and execute it as for as we can.
--- net/sunrpc/sched.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/sunrpc/sched.c +9 -0
@@ -487,6 +487,15 @@ static struct rpc_task *__rpc_find_next_struct rpc_task *task;/* +* Service the privileged queue. +*/ + q = &queue->tasks[RPC_NR_PRIORITY -1 ]; +if (queue->maxpriority >RPC_PRIORITY_PRIVILEGED && !list_empty (q)) { + task = list_first_entry(q, struct rpc_task, u.tk_wait.list); + goto out; + } + +/* * Service a batch of tasks from a single owner. */ q = &queue->tasks[queue->priority];
Greg Kroah-Hartman
maintainerPATCH 18/245 s390/cio: dont call css_wait_for_slow_path() inside a lock
In reply to Greg Kroah-HartmanFrom: Vineeth Vijayan <[email protected]>
commit c749d8c018daf5fba6dfac7b6c5c78b27efd7d65 upstream.
Currently css_wait_for_slow_path() gets called inside the chp->lock. The path-verification-loop of slowpath inside this lock could lead to deadlock as reported by the lockdep validator.
The ccw_device_get_chp_desc() during the instance of a device-set-online would try to acquire the same 'chp->lock' to read the chp->desc. The instance of this function can get called from multiple scenario, like probing or setting-device online manually. This could, in some corner-cases lead to the deadlock.
lockdep validator reported this as,
CPU0 CPU1
---- ----
lock(&chp->lock);
lock(kn->active#43);
lock(&chp->lock);lock((wq_completion)cio);
The chp->lock was introduced to serialize the access of struct channel_path. This lock is not needed for the css_wait_for_slow_path() function, so invoke the slow-path function outside this lock.
--- drivers/s390/cio/chp.c | 3 +++ drivers/s390/cio/chsc.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/s390/cio/chp.c +3 -0
@@ -254,6 +254,9 @@ static ssize_t chp_status_write(struct dif (!num_args)return count; +/* Wait until previous actions have settled. */ +css_wait_for_slow_path (); +if (!strncasecmp (cmd,"on" ,2 ) || !strcmp (cmd,"1" )) {mutex_lock (&cp->lock); error =s390_vary_chpid (cp->chpid,1 );
drivers/s390/cio/chsc.c +0 -2
@@ -769,8 +769,6 @@ int chsc_chp_vary(struct chp_id chpid, i {struct channel_path *chp =chpid_to_chp (chpid); -/* Wait until previous actions have settled. */ -css_wait_for_slow_path ();/* * Redo PathVerification on the devices the chpid connects to */
Greg Kroah-Hartman
maintainerPATCH 19/245 iio: ltr501: mark register holding upper 8 bits of ALS_DATA{0,1} and PS_DATA as volatile, too
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit 2ac0b029a04b673ce83b5089368f467c5dca720c upstream.
The regmap is configured for 8 bit registers, uses a RB-Tree cache and marks several registers as volatile (i.e. do not cache).
The ALS and PS data registers in the chip are 16 bit wide and spans two regmap registers. In the current driver only the base register is marked as volatile, resulting in the upper register only read once.
Further the data sheet notes:
| When the I2C read operation starts, all four ALS data registers are | locked until the I2C read operation of register 0x8B is completed.
Which results in the registers never update after the 2nd read.
This patch fixes the problem by marking the upper 8 bits of the ALS and PS registers as volatile, too.
--- drivers/iio/light/ltr501.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iio/light/ltr501.c +6 -0
@@ -35,9 +35,12 @@#define LTR501_PART_ID 0x86#define LTR501_MANUFAC_ID 0x87#define LTR501_ALS_DATA1 0x88/* 16-bit, little endian */ +#define LTR501_ALS_DATA1_UPPER 0x89/* upper 8 bits of LTR501_ALS_DATA1 */ #define LTR501_ALS_DATA0 0x8a/* 16-bit, little endian */ +#define LTR501_ALS_DATA0_UPPER 0x8b/* upper 8 bits of LTR501_ALS_DATA0 */ #define LTR501_ALS_PS_STATUS 0x8c#define LTR501_PS_DATA 0x8d/* 16-bit, little endian */ +#define LTR501_PS_DATA_UPPER 0x8e/* upper 8 bits of LTR501_PS_DATA */ #define LTR501_INTR 0x8f/* output mode, polarity, mode */ #define LTR501_PS_THRESH_UP 0x90/* 11 bit, ps upper threshold */ #define LTR501_PS_THRESH_LOW 0x92/* 11 bit, ps lower threshold */
@@ -1329,9 +1332,12 @@ static bool ltr501_is_volatile_reg(struc {switch (reg) {case LTR501_ALS_DATA1 : +case LTR501_ALS_DATA1_UPPER :case LTR501_ALS_DATA0 : +case LTR501_ALS_DATA0_UPPER :case LTR501_ALS_PS_STATUS :case LTR501_PS_DATA : +case LTR501_PS_DATA_UPPER :return true;default :return false;
Greg Kroah-Hartman
maintainerPATCH 20/245 iio: ltr501: ltr559: fix initialization of LTR501_ALS_CONTR
In reply to Greg Kroah-HartmanFrom: Oliver Lang <[email protected]>
commit 421a26f3d7a7c3ca43f3a9dc0f3cb0f562d5bd95 upstream.
The ltr559 chip uses only the lowest bit of the ALS_CONTR register to configure between active and stand-by mode. In the original driver BIT(1) is used, which does a software reset instead.
This patch fixes the problem by using BIT(0) as als_mode_active for the ltr559 chip.
--- drivers/iio/light/ltr501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/ltr501.c +1 -1
@@ -1183,7 +1183,7 @@ static struct ltr501_chip_info ltr501_ch .als_gain_tbl_size = ARRAY_SIZE(ltr559_als_gain_tbl), .ps_gain = ltr559_ps_gain_tbl, .ps_gain_tbl_size = ARRAY_SIZE(ltr559_ps_gain_tbl), - .als_mode_active = BIT(1), + .als_mode_active = BIT(0), .als_gain_mask = BIT(2) | BIT(3) | BIT(4), .als_gain_shift = 2, .info = <r501_info,
Greg Kroah-Hartman
maintainerPATCH 21/245 iio: ltr501: ltr501_read_ps(): add missing endianness conversion
In reply to Greg Kroah-HartmanFrom: Oliver Lang <[email protected]>
commit 71b33f6f93ef9462c84560e2236ed22209d26a58 upstream.
The PS ADC Channel data is spread over 2 registers in little-endian form. This patch adds the missing endianness conversion.
--- drivers/iio/light/ltr501.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iio/light/ltr501.c +4 -3
@@ -411,18 +411,19 @@ static int ltr501_read_als(struct ltr501static int ltr501_read_ps (struct ltr501_data *data) { -int ret, status; +__le16 status; +int ret; ret =ltr501_drdy (data,LTR501_STATUS_PS_RDY );if (ret <0 )return ret; ret =regmap_bulk_read (data->regmap,LTR501_PS_DATA , - &status,2 ); + &status,sizeof (status));if (ret <0 )return ret; -return status; +return le16_to_cpu (status); } static int ltr501_read_intr_prst(struct ltr501_data *data,
Greg Kroah-Hartman
maintainerPATCH 22/245 serial: sh-sci: Stop dmaengine transfer in sci_stop_tx()
In reply to Greg Kroah-HartmanFrom: Yoshihiro Shimoda <[email protected]>
commit 08a84410a04f05c7c1b8e833f552416d8eb9f6fe upstream.
Stop dmaengine transfer in sci_stop_tx(). Otherwise, the following message is possible output when system enters suspend and while transferring data, because clearing TIE bit in SCSCR is not able to stop any dmaengine transfer.
sh-sci e6550000.serial: ttySC1: Unable to drain transmitter
Note that this driver has already used some #ifdef in the .c file so that this patch also uses #ifdef to fix the issue. Otherwise, build errors happens if the CONFIG_SERIAL_SH_SCI_DMA is disabled.
--- drivers/tty/serial/sh-sci.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/tty/serial/sh-sci.c +8 -0
@@ -612,6 +612,14 @@ static void sci_stop_tx(struct uart_port ctrl &= ~SCSCR_TIE ;serial_port_out (port,SCSCR , ctrl); + +#ifdef CONFIG_SERIAL_SH_SCI_DMA +if (to_sci_port (port)->chan_tx && + !dma_submit_error (to_sci_port (port)->cookie_tx)) { +dmaengine_terminate_async (to_sci_port (port)->chan_tx); +to_sci_port (port)->cookie_tx = -EINVAL ; + } +#endif }static void sci_start_rx (struct uart_port *port)
Greg Kroah-Hartman
maintainerPATCH 23/245 serial_cs: Add Option International GSM-Ready 56K/ISDN modem
In reply to Greg Kroah-HartmanFrom: Ondrej Zary <[email protected]>
commit d495dd743d5ecd47288156e25c4d9163294a0992 upstream.
Add support for Option International GSM-Ready 56K/ISDN PCMCIA modem card.
--- drivers/tty/serial/8250/serial_cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/8250/serial_cs.c +1 -0
@@ -779,6 +779,7 @@ static const struct pcmcia_device_id serPCMCIA_DEVICE_PROD_ID12 ("Multi-Tech" ,"MT2834LT" ,0x5f73be51 ,0x4cd7c09e ),PCMCIA_DEVICE_PROD_ID12 ("OEM " ,"C288MX " ,0xb572d360 ,0xd2385b7a ),PCMCIA_DEVICE_PROD_ID12 ("Option International" ,"V34bis GSM/PSTN Data/Fax Modem" ,0x9d7cd6f5 ,0x5cb8bf41 ), +PCMCIA_DEVICE_PROD_ID12 ("Option International" ,"GSM-Ready 56K/ISDN" ,0x9d7cd6f5 ,0xb23844aa ),PCMCIA_DEVICE_PROD_ID12 ("PCMCIA " ,"C336MX " ,0x99bcafe9 ,0xaa25bcab ),PCMCIA_DEVICE_PROD_ID12 ("Quatech Inc" ,"PCMCIA Dual RS-232 Serial Port Card" ,0xc4420b35 ,0x92abc92f ), PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "Dual RS-232 Serial Port PC Card", 0xc4420b35, 0x031a380d),
Greg Kroah-Hartman
maintainerPATCH 24/245 serial_cs: remove wrong GLOBETROTTER.cis entry
In reply to Greg Kroah-HartmanFrom: Ondrej Zary <[email protected]>
commit 11b1d881a90fc184cc7d06e9804eb288c24a2a0d upstream.
The GLOBETROTTER.cis entry in serial_cs matches more devices than intended and breaks them. Remove it.
Example: # pccardctl info
PRODID_1="Option International
"
PRODID_2="GSM-Ready 56K/ISDN
"
PRODID_3="021
"
PRODID_4="A
"
MANFID=0013,0000
FUNCID=0
result:
pcmcia 0.0: Direct firmware load for cis/GLOBETROTTER.cis failed with error -2
The GLOBETROTTER.cis is nowhere to be found. There's GLOBETROTTER.cis.ihex at
https://netdev.vger.kernel.narkive.com/h4inqdxM/patch-axnet-cs-fix-phy-id-detection-for-bogus-asix-chip#post41
It's from completely diffetent card:vers_1 4.1, "Option International", "GSM/GPRS GlobeTrotter", "001", "A"
--- drivers/tty/serial/8250/serial_cs.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/serial/8250/serial_cs.c +0 -1
@@ -807,7 +807,6 @@ static const struct pcmcia_device_id serPCMCIA_DEVICE_CIS_PROD_ID12 ("ADVANTECH" ,"COMpad-32/85B-4" ,0x96913a85 ,0xcec8f102 ,"cis/COMpad4.cis" ),PCMCIA_DEVICE_CIS_PROD_ID123 ("ADVANTECH" ,"COMpad-32/85" ,"1.0" ,0x96913a85 ,0x8fbe92ae ,0x0877b627 ,"cis/COMpad2.cis" ),PCMCIA_DEVICE_CIS_PROD_ID2 ("RS-COM 2P" ,0xad20b156 ,"cis/RS-COM-2P.cis" ), -PCMCIA_DEVICE_CIS_MANF_CARD (0x0013 ,0x0000 ,"cis/GLOBETROTTER.cis" ),PCMCIA_DEVICE_PROD_ID12 ("ELAN DIGITAL SYSTEMS LTD, c1997." ,"SERIAL CARD: SL100 1.00." ,0x19ca78af ,0xf964f42b ),PCMCIA_DEVICE_PROD_ID12 ("ELAN DIGITAL SYSTEMS LTD, c1997." ,"SERIAL CARD: SL100" ,0x19ca78af ,0x71d98e83 ), PCMCIA_DEVICE_PROD_ID12("ELAN DIGITAL SYSTEMS LTD, c1997.", "SERIAL CARD: SL232 1.00.", 0x19ca78af, 0x69fb7490),
Greg Kroah-Hartman
maintainerPATCH 25/245 ath9k: Fix kernel NULL pointer dereference during ath_reset_internal()
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit fb312ac5ccb007e843f982b38d4d6886ba4b32f2 upstream.
I got this crash more times during debugging of PCIe controller and crash happens somehow at the time when PCIe kernel code started link retraining (as part of ASPM code) when at the same time PCIe link went down and ath9k probably executed hw reset procedure.
Currently I'm not able to reproduce this issue as it looks like to be some race condition between link training, ASPM, link down and reset path. And as always, race conditions which depends on more input parameters are hard to reproduce as it depends on precise timings.
But it is clear that pointers are zero in this case and should be properly filled as same code pattern is used in ath9k_stop() function. Anyway I was able to reproduce this crash by manually triggering ath reset worker prior putting card up. I created simple patch to export reset functionality via debugfs and use it to "simulate" of triggering
reset. s proved that NULL-pointer dereference issue is there.
Function ath9k_hw_reset() is dereferencing chan structure pointer, so it needs to be non-NULL pointer.
Function ath9k_stop() already contains code which sets ah->curchan to valid non-NULL pointer prior calling ath9k_hw_reset() function.
Add same code pattern also into ath_reset_internal() function to prevent kernel NULL pointer dereference in ath9k_hw_reset() function.
This change fixes kernel NULL pointer dereference in ath9k_hw_reset() which is caused by calling ath9k_hw_reset() from ath_reset_internal() with NULL chan structure.
[ 45.334305] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008
[ 45.344417] Mem abort info:
[ 45.347301] ESR = 0x96000005
[ 45.350448] EC = 0x25: DABT (current EL), IL = 32 bits
[ 45.356166] SET = 0, FnV = 0
[ 45.359350] EA = 0, S1PTW = 0
[ 45.362596] Data abort info:
[ 45.365756] ISV = 0, ISS = 0x00000005
[ 45.369735] CM = 0, WnR = 0
[ 45.372814] user pgtable: 4k pages, 39-bit VAs, pgdp=000000000685d000
[ 45.379663] [0000000000000008] pgd=0000000000000000, p4d=0000000000000000, pud=0000000000000000
[ 45.388856] Internal error: Oops: 96000005 [#1] SMP
[ 45.393897] Modules linked in: ath9k ath9k_common ath9k_hw
[ 45.399574] CPU: 1 PID: 309 Comm: kworker/u4:2 Not tainted 5.12.0-rc2-dirty #785
[ 45.414746] Workqueue: phy0 ath_reset_work [ath9k]
[ 45.419713] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 45.425910] pc : ath9k_hw_reset+0xc4/0x1c48 [ath9k_hw]
[ 45.431234] lr : ath9k_hw_reset+0xc0/0x1c48 [ath9k_hw]
[ 45.436548] sp : ffffffc0118dbca0
[ 45.439961] x29: ffffffc0118dbca0 x28: 0000000000000000
[ 45.445442] x27: ffffff800dee4080 x26: 0000000000000000
[ 45.450923] x25: ffffff800df9b9d8 x24: 0000000000000000
[ 45.456404] x23: ffffffc0115f6000 x22: ffffffc008d0d408
[ 45.461885] x21: ffffff800dee5080 x20: ffffff800df9b9d8
[ 45.467366] x19: 0000000000000000 x18: 0000000000000000
[ 45.472846] x17: 0000000000000000 x16: 0000000000000000
[ 45.478326] x15: 0000000000000010 x14: ffffffffffffffff
[ 45.483807] x13: ffffffc0918db94f x12: ffffffc011498720
[ 45.489289] x11: 0000000000000003 x10: ffffffc0114806e0
[ 45.494770] x9 : ffffffc01014b2ec x8 : 0000000000017fe8
[ 45.500251] x7 : c0000000ffffefff x6 : 0000000000000001
[ 45.505733] x5 : 0000000000000000 x4 : 0000000000000000
[ 45.511213] x3 : 0000000000000000 x2 : ffffff801fece870
[ 45.516693] x1 : ffffffc00eded000 x0 : 000000000000003f
[ 45.522174] Call trace:
[ 45.524695] ath9k_hw_reset+0xc4/0x1c48 [ath9k_hw]
[ 45.529653] ath_reset_internal+0x1a8/0x2b8 [ath9k]
[ 45.534696] ath_reset_work+0x2c/0x40 [ath9k]
[ 45.539198] process_one_work+0x210/0x480
[ 45.543339] worker_thread+0x5c/0x510
[ 45.547115] kthread+0x12c/0x130
[ 45.550445] ret_from_fork+0x10/0x1c
[ 45.554138] Code: 910922c2 9117e021 95ff0398 b4000294 (b9400a61)
[ 45.560430] ---[ end trace 566410ba90b50e8b ]---
[ 45.565193] Kernel panic - not syncing: Oops: Fatal exception in interrupt
[ 45.572282] SMP: stopping secondary CPUs
[ 45.576331] Kernel Offset: disabled
[ 45.579924] CPU features: 0x00040002,0000200c
[ 45.584416] Memory Limit: none
[ 45.587564] Rebooting in 3 seconds..--- drivers/net/wireless/ath/ath9k/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/main.c +5 -0
@@ -302,6 +302,11 @@ static int ath_reset_internal(struct ath hchan = ah->curchan; } +if (!hchan) { + fastcc = false; + hchan =ath9k_cmn_get_channel (sc->hw, ah, &sc->cur_chan->chandef); + } +if (!ath_prepare_reset (sc)) fastcc = false;
Greg Kroah-Hartman
maintainerPATCH 26/245 ssb: sdio: Dont overwrite const buffer if block_write fails
In reply to Greg Kroah-HartmanFrom: Michael Buesch <[email protected]>
commit 47ec636f7a25aa2549e198c48ecb6b1c25d05456 upstream.
It doesn't make sense to clobber the const driver-side buffer, if a write-to-device attempt failed. All other SSB variants (PCI, PCMCIA and SoC) also don't corrupt the buffer on any failure in block_write. Therefore, remove this memset from the SDIO variant.
--- drivers/ssb/sdio.c | 1 - 1 file changed, 1 deletion(-)
drivers/ssb/sdio.c +0 -1
@@ -411,7 +411,6 @@ static void ssb_sdio_block_write(structsdio_claim_host (bus->host_sdio);if (unlikely (ssb_sdio_switch_core (bus, dev))) { error = -EIO ; -memset ((void *)buffer,0xff , count); goto err_out; } offset |= bus->sdio_sbaddr &0xffff ;
Greg Kroah-Hartman
maintainerPATCH 27/245 seq_buf: Make trace_seq_putmem_hex() support data longer than 8
In reply to Greg Kroah-HartmanFrom: Yun Zhou <[email protected]>
commit 6a2cbc58d6c9d90cd74288cc497c2b45815bc064 upstream.
Since the raw memory 'data' does not go forward, it will dump repeated data if the data length is more than 8. If we want to dump longer data blocks, we need to repeatedly call macro SEQ_PUT_HEX_FIELD. I think it is a bit redundant, and multiple function calls also affect the performance.
--- lib/seq_buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/seq_buf.c +3 -1
@@ -241,12 +241,14 @@ int seq_buf_putmem_hex(struct seq_buf *sbreak ;/* j increments twice per loop */ - len -= j /2 ; hex[j++] =' ' ;seq_buf_putmem (s, hex, j);if (seq_buf_has_overflowed (s))return -1 ; + + len -= start_len; + data += start_len; }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 28/245 fuse: check connected before queueing on fpq->io
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 80ef08670d4c28a06a3de954bd350368780bcfef upstream.
A request could end up on the fpq->io list after fuse_abort_conn() has reset fpq->connected and aborted requests on that list:
Thread-1 Thread-2
======== ========
->fuse_simple_request() ->shutdown
->__fuse_request_send()
->queue_request() ->fuse_abort_conn() ->fuse_dev_do_read() ->acquire(fpq->lock) ->wait_for(fpq->lock) ->set err to all req's in fpq->io ->release(fpq->lock)
->acquire(fpq->lock)
->add req to fpq->io
After the userspace copy is done the request will be ended, but req->out.h.error will remain uninitialized. Also the copy might block despite being already aborted.
Fix both issues by not allowing the request to be queued on the fpq->io list after fuse_abort_conn() has processed this list.
--- fs/fuse/dev.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/fuse/dev.c +9 -0
@@ -1298,6 +1298,15 @@ static ssize_t fuse_dev_do_read(struct f goto restart; }spin_lock (&fpq->lock); +/* +* Must not put request on fpq->io queue after having been shut down by +* fuse_abort_conn() +*/ +if (!fpq->connected) { + req->out.h.error = err = -ECONNABORTED ; + goto out_end; + + }list_add (&req->list, &fpq->io);spin_unlock (&fpq->lock); cs->req = req;
Greg Kroah-Hartman
maintainerPATCH 29/245 spi: spi-loopback-test: Fix tx_buf might be rx_buf
In reply to Greg Kroah-HartmanFrom: Jay Fang <[email protected]>
[ Upstream commit 9e37a3ab0627011fb63875e9a93094b6fc8ddf48 ]
In function 'spi_test_run_iter': Value 'tx_buf' might be 'rx_buf'.
--- drivers/spi/spi-loopback-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-loopback-test.c +1 -1
@@ -803,7 +803,7 @@ static int spi_test_run_iter(struct spi_device *spi, test.transfers[i].len = len;if (test.transfers[i].tx_buf) test.transfers[i].tx_buf += tx_off; -if (test.transfers[i].tx_buf) +if (test.transfers[i].rx_buf) test.transfers[i].rx_buf += rx_off; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 30/245 spi: spi-topcliff-pch: Fix potential double free in pch_spi_process_messages()
In reply to Greg Kroah-HartmanFrom: Jay Fang <[email protected]>
[ Upstream commit 026a1dc1af52742c5897e64a3431445371a71871 ]
pch_spi_set_tx() frees data->pkt_tx_buff on failure of kzalloc() for data->pkt_rx_buff, but its caller, pch_spi_process_messages(), will free data->pkt_tx_buff again. Set data->pkt_tx_buff to NULL after kfree() to avoid double free.
--- drivers/spi/spi-topcliff-pch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-topcliff-pch.c +3 -1
@@ -585,8 +585,10 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) data->pkt_tx_buff =kzalloc (size,GFP_KERNEL );if (data->pkt_tx_buff !=NULL ) { data->pkt_rx_buff =kzalloc (size,GFP_KERNEL ); -if (!data->pkt_rx_buff) +if (!data->pkt_rx_buff) {kfree (data->pkt_tx_buff); + data->pkt_tx_buff =NULL ; + } }if (!data->pkt_rx_buff) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 31/245 spi: omap-100k: Fix the length judgment problem
In reply to Greg Kroah-HartmanFrom: Tian Tao <[email protected]>
[ Upstream commit e7a1a3abea373e41ba7dfe0fbc93cb79b6a3a529 ]
word_len should be checked in the omap1_spi100k_setup_transfer function to see if it exceeds 32.
--- drivers/spi/spi-omap-100k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-omap-100k.c +1 -1
@@ -251,7 +251,7 @@ static int omap1_spi100k_setup_transfer(struct spi_device *spi,else word_len = spi->bits_per_word; -if (spi->bits_per_word >32 ) +if (word_len >32 )return -EINVAL ; cs->word_len = word_len;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 32/245 crypto: nx - add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit 06676aa1f455c74e3ad1624cea3acb9ed2ef71ae ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/crypto/nx/nx-842-pseries.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/nx/nx-842-pseries.c +1 -0
@@ -1086,6 +1086,7 @@ static struct vio_device_id nx842_vio_driver_ids[] = { {"ibm,compression-v1", "ibm,compression"}, {"", ""}, }; +MODULE_DEVICE_TABLE (vio, nx842_vio_driver_ids);static struct vio_driver nx842_vio_driver = { .name = KBUILD_MODNAME,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 33/245 media: cpia2: fix memory leak in cpia2_usb_probe
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit be8656e62e9e791837b606a027802b504a945c97 ]
syzbot reported leak in cpia2 usb driver. The problem was in invalid error handling.
v4l2_device_register() is called in cpia2_init_camera_struct(), but all error cases after cpia2_init_camera_struct() did not call the v4l2_device_unregister()
--- drivers/media/usb/cpia2/cpia2.h | 1 + drivers/media/usb/cpia2/cpia2_core.c | 12 ++++++++++++ drivers/media/usb/cpia2/cpia2_usb.c | 13 +++++++------ 3 files changed, 20 insertions(+), 6 deletions(-)
drivers/media/usb/cpia2/cpia2.h +1 -0
@@ -442,6 +442,7 @@ int cpia2_send_command(struct camera_data *cam, struct cpia2_command *cmd);int cpia2_do_command (struct camera_data *cam,unsigned int command,unsigned char direction,unsigned char param); +void cpia2_deinit_camera_struct (struct camera_data *cam,struct usb_interface *intf);struct camera_data *cpia2_init_camera_struct (struct usb_interface *intf);int cpia2_init_camera (struct camera_data *cam);int cpia2_allocate_buffers (struct camera_data *cam);
drivers/media/usb/cpia2/cpia2_core.c +12 -0
@@ -2158,6 +2158,18 @@ static void reset_camera_struct(struct camera_data *cam) cam->height = cam->params.roi.height; } +/****************************************************************************** +* +* cpia2_init_camera_struct +* +* Deinitialize camera struct +*****************************************************************************/ +void cpia2_deinit_camera_struct (struct camera_data *cam,struct usb_interface *intf) +{ +v4l2_device_unregister (&cam->v4l2_dev); +kfree (cam); +} +/****************************************************************************** * * cpia2_init_camera_struct
drivers/media/usb/cpia2/cpia2_usb.c +7 -6
@@ -860,15 +860,13 @@ static int cpia2_usb_probe(struct usb_interface *intf, ret =set_alternate (cam,USBIF_CMDONLY );if (ret <0 ) {ERR ("%s: usb_set_interface error (ret = %d)\n" , __func__, ret); -kfree (cam); -return ret; + goto alt_err; }if ((ret =cpia2_init_camera (cam)) <0 ) {ERR ("%s: failed to initialize cpia2 camera (ret = %d)\n" , __func__, ret); -kfree (cam); -return ret; + goto alt_err; } LOG(" CPiA Version: %d.%02d (%d.%d)\n", cam->params.version.firmware_revision_hi,
@@ -888,11 +886,14 @@ static int cpia2_usb_probe(struct usb_interface *intf, ret =cpia2_register_camera (cam);if (ret <0 ) {ERR ("%s: Failed to register cpia2 camera (ret = %d)\n" , __func__, ret); -kfree (cam); -return ret; + goto alt_err; }return 0 ; + +alt_err: +cpia2_deinit_camera_struct (cam, intf); +return ret; }/******************************************************************************
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 34/245 media: cobalt: fix race condition in setting HPD
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 3d37ef41bed0854805ab9af22c422267510e1344 ]
The cobalt_s_bit_sysctrl reads the old register value over PCI, then changes a bit and sets writes the new value to the register.
This is used among other things for setting the HPD output pin.
But if the HPD is changed for multiple inputs at the same time, then this causes a race condition where a stale value is read.
Serialize this function with a mutex.
--- drivers/media/pci/cobalt/cobalt-driver.c | 1 + drivers/media/pci/cobalt/cobalt-driver.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/media/pci/cobalt/cobalt-driver.c +1 -0
@@ -689,6 +689,7 @@ static int cobalt_probe(struct pci_dev *pci_dev,return -ENOMEM ; cobalt->pci_dev = pci_dev; cobalt->instance = i; +mutex_init (&cobalt->pci_lock); retval =v4l2_device_register (&pci_dev->dev, &cobalt->v4l2_dev);if (retval) {
drivers/media/pci/cobalt/cobalt-driver.h +6 -1
@@ -262,6 +262,8 @@ struct cobalt {int instance;struct pci_dev *pci_dev;struct v4l2_device v4l2_dev; +/* serialize PCI access in cobalt_s_bit_sysctrl() */ +struct mutex pci_lock;void __iomem *bar0, *bar1;
@@ -333,10 +335,13 @@ static inline u32 cobalt_g_sysctrl(struct cobalt *cobalt)static inline void cobalt_s_bit_sysctrl (struct cobalt *cobalt,int bit,int val) { -u32 ctrl =cobalt_read_bar1 (cobalt,COBALT_SYS_CTRL_BASE ); +u32 ctrl; +mutex_lock (&cobalt->pci_lock); + ctrl =cobalt_read_bar1 (cobalt,COBALT_SYS_CTRL_BASE );cobalt_write_bar1 (cobalt,COBALT_SYS_CTRL_BASE , (ctrl & ~(1UL << bit)) | (val << bit)); +mutex_unlock (&cobalt->pci_lock); }static inline u32 cobalt_g_sysstat (struct cobalt *cobalt)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 35/245 media: pvrusb2: fix warning in pvr2_i2c_core_done
In reply to Greg Kroah-HartmanFrom: Anirudh Rayabharam <[email protected]>
[ Upstream commit f8194e5e63fdcb349e8da9eef9e574d5b1d687cb ]
syzbot has reported the following warning in pvr2_i2c_done:
sysfs group 'power' not found for kobject '1-0043'
When the device is disconnected (pvr_hdw_disconnect), the i2c adapter is not unregistered along with the USB and v4l2 teardown. As part of the USB device disconnect, the sysfs files of the subdevices are also deleted. So, by the time pvr_i2c_core_done is called by pvr_context_destroy, the sysfs files have been deleted.
To fix this, unregister the i2c adapter too in pvr_hdw_disconnect. Make the device deregistration code shared by calling pvr_hdw_disconnect from pvr2_hdw_destroy.
--- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/pvrusb2/pvrusb2-hdw.c +2 -2
@@ -2722,9 +2722,8 @@ void pvr2_hdw_destroy(struct pvr2_hdw *hdw)pvr2_stream_destroy (hdw->vid_stream); hdw->vid_stream =NULL ; } -pvr2_i2c_core_done (hdw);v4l2_device_unregister (&hdw->v4l2_dev); -pvr2_hdw_remove_usb_stuff (hdw); +pvr2_hdw_disconnect (hdw);mutex_lock (&pvr2_unit_mtx); do { if ((hdw->unit_number >= 0) &&
@@ -2751,6 +2750,7 @@ void pvr2_hdw_disconnect(struct pvr2_hdw *hdw) {pvr2_trace (PVR2_TRACE_INIT ,"pvr2_hdw_disconnect(hdw=%p)" ,hdw);LOCK_TAKE (hdw->big_lock); +pvr2_i2c_core_done (hdw);LOCK_TAKE (hdw->ctl_lock);pvr2_hdw_remove_usb_stuff (hdw);LOCK_GIVE (hdw->ctl_lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 36/245 crypto: qat - check return code of qat_hal_rd_rel_reg()
In reply to Greg Kroah-HartmanFrom: Jack Xu <[email protected]>
[ Upstream commit 96b57229209490c8bca4335b01a426a96173dc56 ]
Check the return code of the function qat_hal_rd_rel_reg() and return it to the caller.
This is to fix the following warning when compiling the driver with clang scan-build:
drivers/crypto/qat/qat_common/qat_hal.c:1436:2: warning: 6th function call argument is an uninitialized value
--- drivers/crypto/qat/qat_common/qat_hal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/crypto/qat/qat_common/qat_hal.c +5 -1
@@ -1255,7 +1255,11 @@ static int qat_hal_put_rel_wr_xfer(struct icp_qat_fw_loader_handle *handle,pr_err ("QAT: bad xfrAddr=0x%x\n" , xfr_addr);return -EINVAL ; } -qat_hal_rd_rel_reg (handle, ae, ctx,ICP_GPB_REL , gprnum, &gprval); + status =qat_hal_rd_rel_reg (handle, ae, ctx,ICP_GPB_REL , gprnum, &gprval); +if (status) { +pr_err ("QAT: failed to read register" ); +return status; + } gpr_addr =qat_hal_get_reg_addr (ICP_GPB_REL , gprnum); data16low =0xffff & data; data16hi =0xffff & (data >>0x10 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 37/245 crypto: qat - remove unused macro in FW loader
In reply to Greg Kroah-HartmanFrom: Jack Xu <[email protected]>
[ Upstream commit 9afe77cf25d9670e61b489fd52cc6f75fd7f6803 ]
Remove the unused macro ICP_DH895XCC_PESRAM_BAR_SIZE in the firmware loader.
This is to fix the following warning when compiling the driver using the clang compiler with CC=clang W=2:
drivers/crypto/qat/qat_common/qat_uclo.c:345:9: warning: macro is not used [-Wunused-macros]
--- drivers/crypto/qat/qat_common/qat_uclo.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/qat/qat_common/qat_uclo.c +0 -1
@@ -385,7 +385,6 @@ static int qat_uclo_init_umem_seg(struct icp_qat_fw_loader_handle *handle,return 0 ; } -#define ICP_DH895XCC_PESRAM_BAR_SIZE 0x80000static int qat_uclo_init_ae_memory (struct icp_qat_fw_loader_handle *handle,struct icp_qat_uof_initmem *init_mem) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 38/245 media: v4l2-core: Avoid the dangling pointer in v4l2_fh_release
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
[ Upstream commit 7dd0c9e547b6924e18712b6b51aa3cba1896ee2c ]
A use after free bug caused by the dangling pointer filp->privitate_data in v4l2_fh_release.
See https://lore.kernel.org/patchwork/patch/1419058/.
My patch sets the dangling pointer to NULL to provide robust.
--- drivers/media/v4l2-core/v4l2-fh.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/v4l2-core/v4l2-fh.c +1 -0
@@ -109,6 +109,7 @@ int v4l2_fh_release(struct file *filp)v4l2_fh_del (fh);v4l2_fh_exit (fh);kfree (fh); + filp->private_data =NULL ; }return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 39/245 media: bt8xx: Fix a missing check bug in bt878_probe
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 1a4520090681853e6b850cbe54b27247a013e0e5 ]
In 'bt878_irq', the driver calls 'tasklet_schedule', but this tasklet is set in 'dvb_bt8xx_load_card' of another driver 'dvb-bt8xx'. However, this two drivers are separate. The user may not load the 'dvb-bt8xx' driver when loading the 'bt8xx' driver, that is, the tasklet has not been initialized when 'tasklet_schedule' is called, so it is necessary to check whether the tasklet is initialized in 'bt878_probe'.
Fix this by adding a check at the end of bt878_probe.
The KASAN's report reveals it:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 PGD 800000006aab2067 P4D 800000006aab2067 PUD 6b2ea067 PMD 0 Oops: 0010 [#1] PREEMPT SMP KASAN PTI CPU: 2 PID: 8724 Comm: syz-executor.0 Not tainted 4.19.177- gdba4159c14ef-dirty #40 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59- gc9ba5276e321-prebuilt.qemu.org 04/01/2014 RIP: 0010: (null) Code: Bad RIP value. RSP: 0018:ffff88806c287ea0 EFLAGS: 00010246 RAX: fffffbfff1b01774 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 1ffffffff1b01775 RDI: 0000000000000000 RBP: ffff88806c287f00 R08: fffffbfff1b01774 R09: fffffbfff1b01774 R10: 0000000000000001 R11: fffffbfff1b01773 R12: 0000000000000000 R13: ffff88806c29f530 R14: ffffffff8d80bb88 R15: ffffffff8d80bb90 FS: 00007f6b550e6700(0000) GS:ffff88806c280000(0000) knlGS: 0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 000000005ec98000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <IRQ> tasklet_action_common.isra.17+0x141/0x420 kernel/softirq.c:522 tasklet_action+0x50/0x70 kernel/softirq.c:540 __do_softirq+0x224/0x92c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x15a/0x180 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:535 [inline] do_IRQ+0x123/0x1e0 arch/x86/kernel/irq.c:260 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:670 </IRQ> RIP: 0010:__do_sys_interrupt kernel/sys.c:2593 [inline] RIP: 0010:__se_sys_interrupt kernel/sys.c:2584 [inline] RIP: 0010:__x64_sys_interrupt+0x5b/0x80 kernel/sys.c:2584 Code: ba 00 04 00 00 48 c7 c7 c0 99 31 8c e8 ae 76 5e 01 48 85 c0 75 21 e8
14 ae 24 00 48 c7 c3 c0 99 31 8c b8 0c 00 00 00 0f 01 c1 <31> db e8 fe ad 24 00 48 89 d8 5b 5d c3 48 c7 c3 ea ff ff ff eb ec
RSP: 0018:ffff888054167f10 EFLAGS: 00000212 ORIG_RAX: ffffffffffffffde
RAX: 000000000000000c RBX: ffffffff8c3199c0 RCX: ffffc90001ca6000
RDX: 000000000000001a RSI: ffffffff813478fc RDI: ffffffff8c319dc0
RBP: ffff888054167f18 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000080 R11: fffffbfff18633b7 R12: ffff888054167f58
R13: ffff88805f638000 R14: 0000000000000000 R15: 0000000000000000
do_syscall_64+0xb0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4692a9 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6b550e5c48 EFLAGS: 00000246 ORIG_RAX: 000000000000014f
RAX: ffffffffffffffda RBX: 000000000077bf60 RCX: 00000000004692a9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000140
RBP: 00000000004cf7eb R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000077bf60
R13: 0000000000000000 R14: 000000000077bf60 R15: 00007fff55a1dca0
Modules linked in: Dumping ftrace buffer: (ftrace buffer empty) CR2: 0000000000000000 ---[ end trace 68e5849c3f77cbb6 ]--- RIP: 0010: (null) Code: Bad RIP value. RSP: 0018:ffff88806c287ea0 EFLAGS: 00010246 RAX: fffffbfff1b01774 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 1ffffffff1b01775 RDI: 0000000000000000 RBP: ffff88806c287f00 R08: fffffbfff1b01774 R09: fffffbfff1b01774 R10: 0000000000000001 R11: fffffbfff1b01773 R12: 0000000000000000 R13: ffff88806c29f530 R14: ffffffff8d80bb88 R15: ffffffff8d80bb90 FS: 00007f6b550e6700(0000) GS:ffff88806c280000(0000) knlGS: 0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffffffffd6 CR3: 000000005ec98000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
--- drivers/media/pci/bt8xx/bt878.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/pci/bt8xx/bt878.c +3 -0
@@ -494,6 +494,9 @@ static int bt878_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)btwrite (0 ,BT878_AINT_MASK ); bt878_num++; +if (!bt->tasklet.func) +tasklet_disable (&bt->tasklet); +return 0 ; fail2:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 40/245 media: st-hva: Fix potential NULL pointer dereferences
In reply to Greg Kroah-HartmanFrom: Evgeny Novikov <[email protected]>
[ Upstream commit b7fdd208687ba59ebfb09b2199596471c63b69e3 ]
When ctx_id >= HVA_MAX_INSTANCES in hva_hw_its_irq_thread() it tries to access fields of ctx that is NULL at that point. The patch gets rid of these accesses.
Found by Linux Driver Verification project (linuxtesting.org).
--- drivers/media/platform/sti/hva/hva-hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/sti/hva/hva-hw.c +1 -2
@@ -127,8 +127,7 @@ static irqreturn_t hva_hw_its_irq_thread(int irq, void *arg) ctx_id = (hva->sts_reg &0xFF00 ) >>8 ;if (ctx_id >=HVA_MAX_INSTANCES ) {dev_err (dev,"%s %s: bad context identifier: %d\n" , - ctx->name, __func__, ctx_id); - ctx->hw_err = true; +HVA_PREFIX , __func__, ctx_id); goto out; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 41/245 mmc: via-sdmmc: add a check against NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 45c8ddd06c4b729c56a6083ab311bfbd9643f4a6 ]
Before referencing 'host->data', the driver needs to check whether it is null pointer, otherwise it will cause a null pointer reference.
This log reveals it:
[ 29.355199] BUG: kernel NULL pointer dereference, address: 0000000000000014 [ 29.357323] #PF: supervisor write access in kernel mode [ 29.357706] #PF: error_code(0x0002) - not-present page [ 29.358088] PGD 0 P4D 0 [ 29.358280] Oops: 0002 [#1] PREEMPT SMP PTI [ 29.358595] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.12.4- g70e7f0549188-dirty #102 [ 29.359164] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 29.359978] RIP: 0010:via_sdc_isr+0x21f/0x410 [ 29.360314] Code: ff ff e8 84 aa d0 fd 66 45 89 7e 28 66 41 f7 c4 00 10 75 56 e8 72 aa d0 fd 66 41 f7 c4 00 c0 74 10 e8 65 aa d0 fd 48 8b 43 18 <c7> 40 14 ac ff ff ff e8 55 aa d0 fd 48 89 df e8 ad fb ff ff e9 77 [ 29.361661] RSP: 0018:ffffc90000118e98 EFLAGS: 00010046 [ 29.362042] RAX: 0000000000000000 RBX: ffff888107d77880 RCX: 0000000000000000 [ 29.362564] RDX: 0000000000000000 RSI: ffffffff835d20bb RDI: 00000000ffffffff [ 29.363085] RBP: ffffc90000118ed8 R08: 0000000000000001 R09: 0000000000000001 [ 29.363604] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000008600 [ 29.364128] R13: ffff888107d779c8 R14: ffffc90009c00200 R15: 0000000000008000 [ 29.364651] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 29.365235] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 29.365655] CR2: 0000000000000014 CR3: 0000000005a2e000 CR4: 00000000000006e0 [ 29.366170] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 29.366683] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 29.367197] Call Trace: [ 29.367381] <IRQ> [ 29.367537] __handle_irq_event_percpu+0x53/0x3e0 [ 29.367916] handle_irq_event_percpu+0x35/0x90 [ 29.368247] handle_irq_event+0x39/0x60 [ 29.368632] handle_fasteoi_irq+0xc2/0x1d0 [ 29.368950] __common_interrupt+0x7f/0x150 [ 29.369254] common_interrupt+0xb4/0xd0 [ 29.369547] </IRQ> [ 29.369708] asm_common_interrupt+0x1e/0x40 [ 29.370016] RIP: 0010:native_safe_halt+0x17/0x20 [ 29.370360] Code: 07 0f 00 2d db 80 43 00 f4 5d c3 0f 1f 84 00 00 00 00 00 8b 05 c2 37 e5 01 55 48 89 e5 85 c0 7e 07 0f 00 2d bb 80 43 00 fb f4 <5d> c3 cc cc cc cc cc cc cc 55 48 89 e5 e8 67 53 ff ff 8b 0d f9 91 [ 29.371696] RSP: 0018:ffffc9000008fe90 EFLAGS: 00000246 [ 29.372079] RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000 [ 29.372595] RDX: 0000000000000000 RSI: ffffffff854f67a4 RDI: ffffffff85403406 [ 29.373122] RBP: ffffc9000008fe90 R08: 0000000000000001 R09: 0000000000000001 [ 29.373646] R10: 0000000000000000 R11: 0000000000000001 R12: ffffffff86009188 [ 29.374160] R13: 0000000000000000 R14: 0000000000000000 R15: ffff888100258000 [ 29.374690] default_idle+0x9/0x10 [ 29.374944] arch_cpu_idle+0xa/0x10 [ 29.375198] default_idle_call+0x6e/0x250 [ 29.375491] do_idle+0x1f0/0x2d0 [ 29.375740] cpu_startup_entry+0x18/0x20 [ 29.376034] start_secondary+0x11f/0x160 [ 29.376328] secondary_startup_64_no_verify+0xb0/0xbb [ 29.376705] Modules linked in: [ 29.376939] Dumping ftrace buffer: [ 29.377187] (ftrace buffer empty) [ 29.377460] CR2: 0000000000000014 [ 29.377712] ---[ end trace 51a473dffb618c47 ]--- [ 29.378056] RIP: 0010:via_sdc_isr+0x21f/0x410 [ 29.378380] Code: ff ff e8 84 aa d0 fd 66 45 89 7e 28 66 41 f7 c4 00 10 75 56 e8 72 aa d0 fd 66 41 f7 c4 00 c0 74 10 e8 65 aa d0 fd 48 8b 43 18 <c7> 40 14 ac ff ff ff e8 55 aa d0 fd 48 89 df e8 ad fb ff ff e9 77 [ 29.379714] RSP: 0018:ffffc90000118e98 EFLAGS: 00010046 [ 29.380098] RAX: 0000000000000000 RBX: ffff888107d77880 RCX: 0000000000000000 [ 29.380614] RDX: 0000000000000000 RSI: ffffffff835d20bb RDI: 00000000ffffffff [ 29.381134] RBP: ffffc90000118ed8 R08: 0000000000000001 R09: 0000000000000001 [ 29.381653] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000008600 [ 29.382176] R13: ffff888107d779c8 R14: ffffc90009c00200 R15: 0000000000008000 [ 29.382697] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 29.383277] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 29.383697] CR2: 0000000000000014 CR3: 0000000005a2e000 CR4: 00000000000006e0 [ 29.384223] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 29.384736] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 29.385260] Kernel panic - not syncing: Fatal exception in interrupt [ 29.385882] Dumping ftrace buffer: [ 29.386135] (ftrace buffer empty) [ 29.386401] Kernel Offset: disabled [ 29.386656] Rebooting in 1 seconds..
--- drivers/mmc/host/via-sdmmc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/via-sdmmc.c +3 -0
@@ -859,6 +859,9 @@ static void via_sdc_data_isr(struct via_crdr_mmc_host *host, u16 intmask) {BUG_ON (intmask ==0 ); +if (!host->data) +return ; +if (intmask &VIA_CRDR_SDSTS_DT ) host->data->error = -ETIMEDOUT ;else if (intmask & (VIA_CRDR_SDSTS_RC |VIA_CRDR_SDSTS_WC ))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 42/245 crypto: shash - avoid comparing pointers to exported functions under CFI
In reply to Greg Kroah-HartmanFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit 22ca9f4aaf431a9413dcc115dd590123307f274f ]
crypto_shash_alg_has_setkey() is implemented by testing whether the .setkey() member of a struct shash_alg points to the default version, called shash_no_setkey(). As crypto_shash_alg_has_setkey() is a static inline, this requires shash_no_setkey() to be exported to modules.
Unfortunately, when building with CFI, function pointers are routed via CFI stubs which are private to each module (or to the kernel proper) and so this function pointer comparison may fail spuriously.
Let's fix this by turning crypto_shash_alg_has_setkey() into an out of line function.
--- crypto/shash.c | 18 +++++++++++++++--- include/crypto/internal/hash.h | 8 +------- 2 files changed, 16 insertions(+), 10 deletions(-)
crypto/shash.c +15 -3
@@ -24,12 +24,24 @@static const struct crypto_type crypto_shash_type; -int shash_no_setkey (struct crypto_shash *tfm,const u8 *key, -unsigned int keylen) +static int shash_no_setkey (struct crypto_shash *tfm,const u8 *key, +unsigned int keylen) {return -ENOSYS ; } -EXPORT_SYMBOL_GPL (shash_no_setkey); + +/* +* Check whether an shash algorithm has a setkey function. +* +* For CFI compatibility, this must not be an inline function. This is because +* when CFI is enabled, modules won't get the same address for shash_no_setkey +* (if it were exported, which inlining would require) as the core kernel will. +*/ +bool crypto_shash_alg_has_setkey (struct shash_alg *alg) +{ +return alg->setkey != shash_no_setkey; +} +EXPORT_SYMBOL_GPL (crypto_shash_alg_has_setkey);static int shash_setkey_unaligned (struct crypto_shash *tfm,const u8 *key,unsigned int keylen)
include/crypto/internal/hash.h +1 -7
@@ -80,13 +80,7 @@ int ahash_register_instance(struct crypto_template *tmpl, struct ahash_instance *inst);void ahash_free_instance (struct crypto_instance *inst); -int shash_no_setkey (struct crypto_shash *tfm,const u8 *key, -unsigned int keylen); - -static inline bool crypto_shash_alg_has_setkey (struct shash_alg *alg) -{ -return alg->setkey != shash_no_setkey; -} +bool crypto_shash_alg_has_setkey (struct shash_alg *alg);bool crypto_hash_alg_has_setkey (struct hash_alg_common *halg);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 43/245 media: dvb_net: avoid speculation from net slot
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit abc0226df64dc137b48b911c1fe4319aec5891bb ]
The risk of especulation is actually almost-non-existing here, as there are very few users of TCP/IP using the DVB stack, as, this is mainly used with DVB-S/S2 cards, and only by people that receives TCP/IP from satellite connections, which limits a lot the number of users of such feature(*).
(*) In thesis, DVB-C cards could also benefit from it, but I'm yet to see a hardware that supports it.
Yet, fixing it is trivial.
--- drivers/media/dvb-core/dvb_net.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/media/dvb-core/dvb_net.c +19 -6
@@ -57,6 +57,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/netdevice.h> +#include <linux/nospec.h> #include <linux/etherdevice.h> #include <linux/dvb/net.h> #include <linux/uio.h>
@@ -1350,14 +1351,20 @@ static int dvb_net_do_ioctl(struct file *file,struct net_device *netdev;struct dvb_net_priv *priv_data;struct dvb_net_if *dvbnetif = parg; +int if_num = dvbnetif->if_num; -if (dvbnetif->if_num >=DVB_NET_DEVICES_MAX || - !dvbnet->state[dvbnetif->if_num]) { +if (if_num >=DVB_NET_DEVICES_MAX ) { ret = -EINVAL ; goto ioctl_error; } + if_num =array_index_nospec (if_num,DVB_NET_DEVICES_MAX ); - netdev = dvbnet->device[dvbnetif->if_num]; +if (!dvbnet->state[if_num]) { + ret = -EINVAL ; + goto ioctl_error; + } + + netdev = dvbnet->device[if_num]; priv_data =netdev_priv (netdev); dvbnetif->pid=priv_data->pid;
@@ -1410,14 +1417,20 @@ static int dvb_net_do_ioctl(struct file *file,struct net_device *netdev;struct dvb_net_priv *priv_data;struct __dvb_net_if_old *dvbnetif = parg; +int if_num = dvbnetif->if_num; + +if (if_num >=DVB_NET_DEVICES_MAX ) { + ret = -EINVAL ; + goto ioctl_error; + } + if_num =array_index_nospec (if_num,DVB_NET_DEVICES_MAX ); -if (dvbnetif->if_num >=DVB_NET_DEVICES_MAX || - !dvbnet->state[dvbnetif->if_num]) { +if (!dvbnet->state[if_num]) { ret = -EINVAL ; goto ioctl_error; } - netdev = dvbnet->device[dvbnetif->if_num]; + netdev = dvbnet->device[if_num]; priv_data =netdev_priv (netdev); dvbnetif->pid=priv_data->pid;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 44/245 media: siano: fix device register error path
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 5368b1ee2939961a16e74972b69088433fc52195 ]
As reported by smatch:
drivers/media/common/siano/smsdvb-main.c:1231 smsdvb_hotplug() warn: '&client->entry' not removed from list
If an error occur at the end of the registration logic, it won't drop the device from the list.
--- drivers/media/common/siano/smsdvb-main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/media/common/siano/smsdvb-main.c +4 -0
@@ -1187,6 +1187,10 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev,return 0 ; media_graph_error: +mutex_lock (&g_smsdvb_clientslock); +list_del (&client->entry); +mutex_unlock (&g_smsdvb_clientslock); +smsdvb_debugfs_release (client); client_error:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 45/245 btrfs: abort transaction if we fail to update the delayed inode
In reply to Greg Kroah-HartmanFrom: Josef Bacik <[email protected]>
[ Upstream commit 04587ad9bef6ce9d510325b4ba9852b6129eebdb ]
If we fail to update the delayed inode we need to abort the transaction, because we could leave an inode with the improper counts or some other such corruption behind.
--- fs/btrfs/delayed-inode.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/btrfs/delayed-inode.c +8 -0
@@ -1076,6 +1076,14 @@ err_out:btrfs_delayed_inode_release_metadata (root, node);btrfs_release_delayed_inode (node); +/* +* If we fail to update the delayed inode we need to abort the +* transaction, because we could leave the inode with the improper +* counts behind. +*/ +if (ret && ret != -ENOENT ) +btrfs_abort_transaction (trans, ret); +return ret; search:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 46/245 btrfs: disable build on platforms having page size 256K
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit b05fbcc36be1f8597a1febef4892053a0b2f3f60 ]
With a config having PAGE_SIZE set to 256K, BTRFS build fails with the following message
include/linux/compiler_types.h:326:38: error: call to '__compiletime_assert_791' declared with attribute error:
BUILD_BUG_ON failed: (BTRFS_MAX_COMPRESSED % PAGE_SIZE) != 0
BTRFS_MAX_COMPRESSED being 128K, BTRFS cannot support platforms with 256K pages at the time being.
There are two platforms that can select 256K pages:
- hexagon
- powerpc
Disable BTRFS when 256K page size is selected. Supporting this would require changes to the subpage mode that's currently being developed. Given that 256K is many times larger than page sizes commonly used and for what the algorithms and structures have been tuned, it's out of scope and disabling build is a reasonable option.
--- fs/btrfs/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/Kconfig +2 -0
@@ -9,6 +9,8 @@ config BTRFS_FS select RAID6_PQ select XOR_BLOCKS select SRCU + depends on !PPC_256K_PAGES # powerpc + depends on !PAGE_SIZE_256KB # hexagon help Btrfs is a general purpose copy-on-write filesystem with extents,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 47/245 regulator: da9052: Ensure enough delay time for .set_voltage_time_sel
In reply to Greg Kroah-HartmanFrom: Axel Lin <[email protected]>
[ Upstream commit a336dc8f683e5be794186b5643cd34cb28dd2c53 ]
Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time.
Also fix returning negative value when new_sel < old_sel.
--- drivers/regulator/da9052-regulator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regulator/da9052-regulator.c +2 -1
@@ -258,7 +258,8 @@ static int da9052_regulator_set_voltage_time_sel(struct regulator_dev *rdev,case DA9052_ID_BUCK3 :case DA9052_ID_LDO2 :case DA9052_ID_LDO3 : - ret = (new_sel - old_sel) * info->step_uV /6250 ; + ret =DIV_ROUND_UP (abs (new_sel - old_sel) * info->step_uV, +6250 );break ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 48/245 ACPI: processor idle: Fix up C-state latency if not ordered
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit 65ea8f2c6e230bdf71fed0137cf9e9d1b307db32 ]
Generally, the C-state latency is provided by the _CST method or FADT, but some OEM platforms using AMD Picasso, Renoir, Van Gogh, and Cezanne set the C2 latency greater than C3's which causes the C2 state to be skipped.
That will block the core entering PC6, which prevents S0ix working properly on Linux systems.
In other operating systems, the latency values are not validated and this does not cause problems by skipping states.
To avoid this issue on Linux, detect when latencies are not an arithmetic progression and sort them.
--- drivers/acpi/processor_idle.c | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/acpi/processor_idle.c +40 -0
@@ -29,6 +29,7 @@#include <linux/acpi.h> #include <linux/dmi.h> #include <linux/sched.h> /* need_resched() */ +#include <linux/sort.h> #include <linux/tick.h> #include <linux/cpuidle.h> #include <linux/cpu.h>
@@ -538,10 +539,37 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,return ; } +static int acpi_cst_latency_cmp (const void *a,const void *b) +{ +const struct acpi_processor_cx *x = a, *y = b; + +if (!(x->valid && y->valid)) +return 0 ; +if (x->latency > y->latency) +return 1 ; +if (x->latency < y->latency) +return -1 ; +return 0 ; +} +static void acpi_cst_latency_swap (void *a,void *b,int n) +{ +struct acpi_processor_cx *x = a, *y = b; +u32 tmp; + +if (!(x->valid && y->valid)) +return ; + tmp = x->latency; + x->latency = y->latency; + y->latency = tmp; +} +static int acpi_processor_power_verify (struct acpi_processor *pr) {unsigned int i;unsigned int working =0 ; +unsigned int last_latency =0 ; +unsigned int last_type =0 ; +bool buggy_latency = false; pr->power.timer_broadcast_on_state =INT_MAX ;
@@ -565,12 +593,24 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) }if (!cx->valid)continue ; +if (cx->type >= last_type && cx->latency < last_latency) + buggy_latency = true; + last_latency = cx->latency; + last_type = cx->type;lapic_timer_check_state (i, pr, cx);tsc_check_state (cx->type); working++; } +if (buggy_latency) { +pr_notice ("FW issue: working around C-state latencies out of order\n" ); +sort (&pr->power.states[1 ], max_cstate, +sizeof (struct acpi_processor_cx ), + acpi_cst_latency_cmp, + acpi_cst_latency_swap); + } +lapic_timer_propagate_broadcast (pr);return (working);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 49/245 block_dump: remove block_dump feature in mark_inode_dirty()
In reply to Greg Kroah-HartmanFrom: zhangyi (F) <[email protected]>
[ Upstream commit 12e0613715e1cf305fffafaf0e89d810d9a85cc0 ]
block_dump is an old debugging interface, one of it's functions is used to print the information about who write which file on disk. If we enable block_dump through /proc/sys/vm/block_dump and turn on debug log level, we can gather information about write process name, target file name and disk from kernel message. This feature is realized in block_dump___mark_inode_dirty(), it print above information into kernel message directly when marking inode dirty, so it is noisy and can easily trigger log storm. At the same time, get the dentry refcount is also not safe, we found it will lead to deadlock on ext4 file system with data=journal mode.
After tracepoints has been introduced into the kernel, we got a tracepoint in __mark_inode_dirty(), which is a better replacement of block_dump___mark_inode_dirty(). The only downside is that it only trace the inode number and not a file name, but it probably doesn't matter because the original printed file name in block_dump is not accurate in some cases, and we can still find it through the inode number and device id. So this patch delete the dirting inode part of block_dump feature.
--- fs/fs-writeback.c | 25 ------------------------- 1 file changed, 25 deletions(-)
fs/fs-writeback.c +0 -25
@@ -2088,28 +2088,6 @@ int dirtytime_interval_handler(struct ctl_table *table, int write,return ret; } -static noinline void block_dump___mark_inode_dirty(struct inode *inode) -{ -if (inode->i_ino ||strcmp (inode->i_sb->s_id,"bdev" )) { -struct dentry *dentry; -const char *name ="?" ; - - dentry =d_find_alias (inode); -if (dentry) { -spin_lock (&dentry->d_lock); - name = (const char *) dentry->d_name.name; - } -printk (KERN_DEBUG -"%s(%d): dirtied inode %lu (%s) on %s\n" , - current->comm,task_pid_nr (current), inode->i_ino, - name, inode->i_sb->s_id); -if (dentry) { -spin_unlock (&dentry->d_lock); -dput (dentry); - } - } -} -/** * __mark_inode_dirty - internal function * @inode: inode to mark
@@ -2168,9 +2146,6 @@ void __mark_inode_dirty(struct inode *inode, int flags) (dirtytime && (inode->i_state & I_DIRTY_INODE))) return; -if (unlikely (block_dump)) -block_dump___mark_inode_dirty (inode); -spin_lock (&inode->i_lock);if (dirtytime && (inode->i_state &I_DIRTY_INODE )) goto out_unlock_inode;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 50/245 fs: dlm: cancel work sync othercon
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit c6aa00e3d20c2767ba3f57b64eb862572b9744b3 ]
These rx tx flags arguments are for signaling close_connection() from which worker they are called. Obviously the receive worker cannot cancel itself and vice versa for swork. For the othercon the receive worker should only be used, however to avoid deadlocks we should pass the same flags as the original close_connection() was called.
--- fs/dlm/lowcomms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dlm/lowcomms.c +1 -1
@@ -599,7 +599,7 @@ static void close_connection(struct connection *con, bool and_other, }if (con->othercon && and_other) {/* Will only re-enter once. */ -close_connection (con->othercon, false, true, true); +close_connection (con->othercon, false, tx, rx); }if (con->rx_page) {__free_page (con->rx_page);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 51/245 random32: Fix implicit truncation warning in prandom_seed_state()
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit d327ea15a305024ef0085252fa3657bbb1ce25f5 ]
sparse generates the following warning:
include/linux/prandom.h:114:45: sparse: sparse: cast truncates bits from constant value
This is because the 64-bit seed value is manipulated and then placed in a u32, causing an implicit cast and truncation. A forced cast to u32 doesn't prevent this warning, which is reasonable because a typecast doesn't prove that truncation was expected.
Logical-AND the value with 0xffffffff to make explicit that truncation to 32-bit is intended.
--- include/linux/prandom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/prandom.h +1 -1
@@ -93,7 +93,7 @@ static inline u32 __seed(u32 x, u32 m)*/ static inline void prandom_seed_state (struct rnd_state *state,u64 seed) { -u32 i = (seed >>32 ) ^ (seed <<10 ) ^ seed; +u32 i = ((seed >>32 ) ^ (seed <<10 ) ^ seed) &0xffffffffUL ; state->s1 =__seed (i,2U ); state->s2 =__seed (i,8U );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 52/245 fs: dlm: fix memory leak when fenced
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 700ab1c363c7b54c9ea3222379b33fc00ab02f7b ]
I got some kmemleak report when a node was fenced. The user space tool dlm_controld will therefore run some rmdir() in dlm configfs which was triggering some memleaks. This patch stores the sps and cms attributes which stores some handling for subdirectories of the configfs cluster entry and free them if they get released as the parent directory gets freed.
unreferenced object 0xffff88810d9e3e00 (size 192):
comm "dlm_controld", pid 342, jiffies 4294698126 (age 55438.801s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 73 70 61 63 65 73 00 00 ........spaces..
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000db8b640b>] make_cluster+0x5d/0x360
[<000000006a571db4>] configfs_mkdir+0x274/0x730
[<00000000b094501c>] vfs_mkdir+0x27e/0x340
[<0000000058b0adaf>] do_mkdirat+0xff/0x1b0
[<00000000d1ffd156>] do_syscall_64+0x40/0x80
[<00000000ab1408c8>] entry_SYSCALL_64_after_hwframe+0x44/0xae
unreferenced object 0xffff88810d9e3a00 (size 192):
comm "dlm_controld", pid 342, jiffies 4294698126 (age 55438.801s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 63 6f 6d 6d 73 00 00 00 ........comms...
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000a7ef6ad2>] make_cluster+0x82/0x360
[<000000006a571db4>] configfs_mkdir+0x274/0x730
[<00000000b094501c>] vfs_mkdir+0x27e/0x340
[<0000000058b0adaf>] do_mkdirat+0xff/0x1b0
[<00000000d1ffd156>] do_syscall_64+0x40/0x80
[<00000000ab1408c8>] entry_SYSCALL_64_after_hwframe+0x44/0xae--- fs/dlm/config.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/dlm/config.c +9 -0
@@ -80,6 +80,9 @@ struct dlm_cluster {unsigned int cl_new_rsb_count;unsigned int cl_recover_callbacks;char cl_cluster_name[DLM_LOCKSPACE_LEN ]; + +struct dlm_spaces *sps; +struct dlm_comms *cms; };static struct dlm_cluster *config_item_to_cluster (struct config_item *i)
@@ -356,6 +359,9 @@ static struct config_group *make_cluster(struct config_group *g,if (!cl || !sps || !cms) goto fail; + cl->sps = sps; + cl->cms = cms; +config_group_init_type_name (&cl->group, name, &cluster_type);config_group_init_type_name (&sps->ss_group,"spaces" , &spaces_type);config_group_init_type_name (&cms->cs_group,"comms" , &comms_type);
@@ -405,6 +411,9 @@ static void drop_cluster(struct config_group *g, struct config_item *i)static void release_cluster (struct config_item *i) {struct dlm_cluster *cl =config_item_to_cluster (i); + +kfree (cl->sps); +kfree (cl->cms);kfree (cl); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 53/245 ACPI: bus: Call kobject_put() in acpi_init() error path
In reply to Greg Kroah-HartmanFrom: Hanjun Guo <[email protected]>
[ Upstream commit 4ac7a817f1992103d4e68e9837304f860b5e7300 ]
Although the system will not be in a good condition or it will not boot if acpi_bus_init() fails, it is still necessary to put the kobject in the error path before returning to avoid leaking memory.
--- drivers/acpi/bus.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/bus.c +1 -0
@@ -1184,6 +1184,7 @@ static int __init acpi_init(void)init_acpi_device_notify (); result =acpi_bus_init ();if (result) { +kobject_put (acpi_kobj);disable_acpi ();return result; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 54/245 platform/x86: toshiba_acpi: Fix missing error code in toshiba_acpi_setup_keyboard()
In reply to Greg Kroah-HartmanFrom: Jiapeng Chong <[email protected]>
[ Upstream commit 28e367127718a9cb85d615a71e152f7acee41bfc ]
The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'error'.
Eliminate the follow smatch warning:
drivers/platform/x86/toshiba_acpi.c:2834 toshiba_acpi_setup_keyboard()
warn: missing error code 'error'.
--- drivers/platform/x86/toshiba_acpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/toshiba_acpi.c +1 -0
@@ -2866,6 +2866,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev)if (!dev->info_supported && !dev->system_event_supported) {pr_warn ("No hotkey query interface found\n" ); + error = -EINVAL ; goto err_remove_filter; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 55/245 ACPI: tables: Add custom DSDT file as makefile prerequisite
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit d1059c1b1146870c52f3dac12cb7b6cbf39ed27f ]
A custom DSDT file is mostly used during development or debugging, and in that case it is quite likely to want to rebuild the kernel after changing ONLY the content of the DSDT.
This patch adds the custom DSDT as a prerequisite to tables.o to ensure a rebuild if the DSDT file is updated. Make will merge the prerequisites from multiple rules for the same target.
--- drivers/acpi/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/Makefile +5 -0
@@ -7,6 +7,11 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT # # ACPI Boot-Time Table Parsing # +ifeq ($(CONFIG_ACPI_CUSTOM_DSDT),y) +tables.o: $(src)/../../include/$(subst $\",,$(CONFIG_ACPI_CUSTOM_DSDT_FILE)) ; + +endif + obj-$(CONFIG_ACPI) += tables.o obj-$(CONFIG_X86) += blacklist.o
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 56/245 ia64: mca_drv: fix incorrect array size calculation
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit c5f320ff8a79501bb59338278336ec43acb9d7e2 ]
gcc points out a mistake in the mca driver that goes back to before the git history:
arch/ia64/kernel/mca_drv.c: In function 'init_record_index_pools':arch/ia64/kernel/mca_drv.c:346:54: error: expression does not compute the number of elements in this array; element typ e is 'int', not 'size_t' {aka 'long unsigned int'} [-Werror=sizeof-array-div]
346 | for (i = 1; i < sizeof sal_log_sect_min_sizes/sizeof(size_t); i++)
| ^
This is the same as sizeof(size_t), which is two shorter than the actual array. Use the ARRAY_SIZE() macro to get the correct calculation instead.
--- arch/ia64/kernel/mca_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/kernel/mca_drv.c +1 -1
@@ -343,7 +343,7 @@ init_record_index_pools(void)/* - 2 - */ sect_min_size = sal_log_sect_min_sizes[0 ]; -for (i =1 ; i <sizeof sal_log_sect_min_sizes/sizeof (size_t ); i++) +for (i =1 ; i <ARRAY_SIZE (sal_log_sect_min_sizes); i++)if (sect_min_size > sal_log_sect_min_sizes[i]) sect_min_size = sal_log_sect_min_sizes[i];
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 57/245 media: s5p_cec: decrement usage count if disabled
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 747bad54a677d8633ec14b39dfbeb859c821d7f2 ]
There's a bug at s5p_cec_adap_enable(): if called to disable the device, it should call pm_runtime_put() instead of pm_runtime_disable(), as the goal here is to decrement the usage_count and not to disable PM runtime.
--- drivers/staging/media/s5p-cec/s5p_cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/s5p-cec/s5p_cec.c +1 -1
@@ -54,7 +54,7 @@ static int s5p_cec_adap_enable(struct cec_adapter *adap, bool enable) }else {s5p_cec_mask_tx_interrupts (cec);s5p_cec_mask_rx_interrupts (cec); -pm_runtime_disable (cec->dev); +pm_runtime_put (cec->dev); }return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 58/245 crypto: ixp4xx - dma_unmap the correct address
In reply to Greg Kroah-HartmanFrom: Corentin Labbe <[email protected]>
[ Upstream commit 9395c58fdddd79cdd3882132cdd04e8ac7ad525f ]
Testing ixp4xx_crypto with CONFIG_DMA_API_DEBUG lead to the following error:
DMA-API: platform ixp4xx_crypto.0: device driver tries to free DMA memory it has not allocated [device address=0x0000000000000000] [size=24 bytes]
This is due to dma_unmap using the wrong address.
--- drivers/crypto/ixp4xx_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/ixp4xx_crypto.c +1 -1
@@ -334,7 +334,7 @@ static void free_buf_chain(struct device *dev, struct buffer_desc *buf,u32 phys) buf1 = buf->next; phys1 = buf->phys_next; -dma_unmap_single (dev, buf->phys_next, buf->buf_len, buf->dir); +dma_unmap_single (dev, buf->phys_addr, buf->buf_len, buf->dir);dma_pool_free (buffer_pool, buf, phys); buf = buf1; phys = phys1;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 59/245 crypto: ux500 - Fix error return code in hash_hw_final()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit b01360384009ab066940b45f34880991ea7ccbfb ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/crypto/ux500/hash/hash_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/ux500/hash/hash_core.c +1 -0
@@ -1006,6 +1006,7 @@ static int hash_hw_final(struct ahash_request *req) goto out; } }else if (req->nbytes ==0 && ctx->keylen >0 ) { + ret = -EPERM ;dev_err (device_data->dev,"%s: Empty message with keylength > 0, NOT supported\n" , __func__); goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 60/245 sata_highbank: fix deferred probing
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 4a24efa16e7db02306fb5db84518bb0a7ada5a46 ]
The driver overrides the error codes returned by platform_get_irq() to -EINVAL, so if it returns -EPROBE_DEFER, the driver would fail the probe permanently instead of the deferred probing. Switch to propagating the error code upstream, still checking/overriding IRQ0 as libata regards it as "no IRQ" (thus polling) anyway...
--- drivers/ata/sata_highbank.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/sata_highbank.c +4 -2
@@ -483,10 +483,12 @@ static int ahci_highbank_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { +if (irq <0 ) {dev_err (dev,"no irq\n" ); -return -EINVAL ; +return irq; } +if (!irq) +return -EINVAL ; hpriv =devm_kzalloc (dev,sizeof (*hpriv),GFP_KERNEL );if (!hpriv) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 61/245 pata_rb532_cf: fix deferred probing
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 2d3a62fbae8e5badc2342388f65ab2191c209cc0 ]
The driver overrides the error codes returned by platform_get_irq() to -ENOENT, so if it returns -EPROBE_DEFER, the driver would fail the probe permanently instead of the deferred probing. Switch to propagating the error code upstream, still checking/overriding IRQ0 as libata regards it as "no IRQ" (thus polling) anyway...
--- drivers/ata/pata_rb532_cf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/ata/pata_rb532_cf.c +4 -2
@@ -120,10 +120,12 @@ static int rb532_pata_driver_probe(struct platform_device *pdev) } irq =platform_get_irq (pdev,0 ); -if (irq <=0 ) { +if (irq <0 ) {dev_err (&pdev->dev,"no IRQ resource found\n" ); -return -ENOENT ; +return irq; } +if (!irq) +return -EINVAL ; pdata =dev_get_platdata (&pdev->dev);if (!pdata) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 62/245 media: I2C: change RST to "RSET" to fix multiple build errors
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 8edcb5049ac29aa3c8acc5ef15dd4036543d747e ]
The use of an enum named 'RST' conflicts with a #define macro named 'RST' in arch/mips/include/asm/mach-rc32434/rb.h.
The MIPS use of RST was there first (AFAICT), so change the media/i2c/ uses of RST to be named 'RSET'.
'git grep -w RSET' does not report any naming conflicts with the new name.
This fixes multiple build errors:
arch/mips/include/asm/mach-rc32434/rb.h:15:14: error: expected identifier before '(' token
15 | #define RST (1 << 15)
| ^
drivers/media/i2c/s5c73m3/s5c73m3.h:356:2: note: in expansion of macro 'RST'
356 | RST,
| ^~~../arch/mips/include/asm/mach-rc32434/rb.h:15:14: error: expected identifier before '(' token
15 | #define RST (1 << 15)
| ^
../drivers/media/i2c/s5k6aa.c:180:2: note: in expansion of macro 'RST'
180 | RST,
| ^~~../arch/mips/include/asm/mach-rc32434/rb.h:15:14: error: expected identifier before '(' token
15 | #define RST (1 << 15)
| ^
../drivers/media/i2c/s5k5baf.c:238:2: note: in expansion of macro 'RST'
238 | RST,
| ^~~and some others that I have trimmed.
--- drivers/media/i2c/s5c73m3/s5c73m3-core.c | 6 +++--- drivers/media/i2c/s5c73m3/s5c73m3.h | 2 +- drivers/media/i2c/s5k4ecgx.c | 10 +++++----- drivers/media/i2c/s5k5baf.c | 6 +++--- drivers/media/i2c/s5k6aa.c | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-)
drivers/media/i2c/s5c73m3/s5c73m3-core.c +3 -3
@@ -1393,7 +1393,7 @@ static int __s5c73m3_power_on(struct s5c73m3 *state)s5c73m3_gpio_deassert (state,STBY );usleep_range (100 ,200 ); -s5c73m3_gpio_deassert (state,RST ); +s5c73m3_gpio_deassert (state,RSET );usleep_range (50 ,100 );return 0 ;
@@ -1408,7 +1408,7 @@ static int __s5c73m3_power_off(struct s5c73m3 *state) {int i, ret; -if (s5c73m3_gpio_assert (state,RST )) +if (s5c73m3_gpio_assert (state,RSET ))usleep_range (10 ,50 );if (s5c73m3_gpio_assert (state,STBY ))
@@ -1613,7 +1613,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 *state) state->mclk_frequency = pdata->mclk_frequency; state->gpio[STBY ] = pdata->gpio_stby; - state->gpio[RST ] = pdata->gpio_reset; + state->gpio[RSET ] = pdata->gpio_reset;return 0 ; }
drivers/media/i2c/s5c73m3/s5c73m3.h +1 -1
@@ -361,7 +361,7 @@ struct s5c73m3_ctrls {enum s5c73m3_gpio_id {STBY , -RST , +RSET ,GPIO_NUM , };
drivers/media/i2c/s5k4ecgx.c +5 -5
@@ -177,7 +177,7 @@ static const char * const s5k4ecgx_supply_names[] = {enum s5k4ecgx_gpio_id {STBY , -RST , +RSET ,GPIO_NUM , };
@@ -482,7 +482,7 @@ static int __s5k4ecgx_power_on(struct s5k4ecgx *priv)if (s5k4ecgx_gpio_set_value (priv,STBY , priv->gpio[STBY ].level))usleep_range (30 ,50 ); -if (s5k4ecgx_gpio_set_value (priv,RST , priv->gpio[RST ].level)) +if (s5k4ecgx_gpio_set_value (priv,RSET , priv->gpio[RSET ].level))usleep_range (30 ,50 );return 0 ;
@@ -490,7 +490,7 @@ static int __s5k4ecgx_power_on(struct s5k4ecgx *priv)static int __s5k4ecgx_power_off (struct s5k4ecgx *priv) { -if (s5k4ecgx_gpio_set_value (priv,RST , !priv->gpio[RST ].level)) +if (s5k4ecgx_gpio_set_value (priv,RSET , !priv->gpio[RSET ].level))usleep_range (30 ,50 );if (s5k4ecgx_gpio_set_value (priv,STBY , !priv->gpio[STBY ].level))
@@ -878,7 +878,7 @@ static int s5k4ecgx_config_gpios(struct s5k4ecgx *priv,int ret; priv->gpio[STBY ].gpio = -EINVAL ; - priv->gpio[RST ].gpio = -EINVAL ; + priv->gpio[RSET ].gpio = -EINVAL ; ret =s5k4ecgx_config_gpio (gpio->gpio, gpio->level,"S5K4ECGX_STBY" );
@@ -897,7 +897,7 @@ static int s5k4ecgx_config_gpios(struct s5k4ecgx *priv,s5k4ecgx_free_gpios (priv);return ret; } - priv->gpio[RST ] = *gpio; + priv->gpio[RSET ] = *gpio;if (gpio_is_valid (gpio->gpio))gpio_set_value (gpio->gpio,0 );
drivers/media/i2c/s5k5baf.c +3 -3
@@ -238,7 +238,7 @@ struct s5k5baf_gpio {enum s5k5baf_gpio_id {STBY , -RST , +RSET ,NUM_GPIOS , };
@@ -973,7 +973,7 @@ static int s5k5baf_power_on(struct s5k5baf *state)s5k5baf_gpio_deassert (state,STBY );usleep_range (50 ,100 ); -s5k5baf_gpio_deassert (state,RST ); +s5k5baf_gpio_deassert (state,RSET );return 0 ; err_reg_dis:
@@ -991,7 +991,7 @@ static int s5k5baf_power_off(struct s5k5baf *state) state->apply_cfg =0 ; state->apply_crop =0 ; -s5k5baf_gpio_assert (state,RST ); +s5k5baf_gpio_assert (state,RSET );s5k5baf_gpio_assert (state,STBY );if (!IS_ERR (state->clock))
drivers/media/i2c/s5k6aa.c +5 -5
@@ -181,7 +181,7 @@ static const char * const s5k6aa_supply_names[] = {enum s5k6aa_gpio_id {STBY , -RST , +RSET ,GPIO_NUM , };
@@ -845,7 +845,7 @@ static int __s5k6aa_power_on(struct s5k6aa *s5k6aa) ret = s5k6aa->s_power (1 );usleep_range (4000 ,4000 ); -if (s5k6aa_gpio_deassert (s5k6aa,RST )) +if (s5k6aa_gpio_deassert (s5k6aa,RSET ))msleep (20 );return ret;
@@ -855,7 +855,7 @@ static int __s5k6aa_power_off(struct s5k6aa *s5k6aa) {int ret; -if (s5k6aa_gpio_assert (s5k6aa,RST )) +if (s5k6aa_gpio_assert (s5k6aa,RSET ))usleep_range (100 ,150 );if (s5k6aa->s_power) {
@@ -1514,7 +1514,7 @@ static int s5k6aa_configure_gpios(struct s5k6aa *s5k6aa,int ret; s5k6aa->gpio[STBY ].gpio = -EINVAL ; - s5k6aa->gpio[RST ].gpio = -EINVAL ; + s5k6aa->gpio[RSET ].gpio = -EINVAL ; gpio = &pdata->gpio_stby;if (gpio_is_valid (gpio->gpio)) {
@@ -1537,7 +1537,7 @@ static int s5k6aa_configure_gpios(struct s5k6aa *s5k6aa,if (ret <0 )return ret; - s5k6aa->gpio[RST ] = *gpio; + s5k6aa->gpio[RSET ] = *gpio; }return 0 ;
Signature · 9 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 63/245 pata_octeon_cf: avoid WARN_ON() in ata_host_activate()
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit bfc1f378c8953e68ccdbfe0a8c20748427488b80 ]
Iff platform_get_irq() fails (or returns IRQ0) and thus the polling mode has to be used, ata_host_activate() hits the WARN_ON() due to 'irq_handler' parameter being non-NULL if the polling mode is selected. Let's only set the pointer to the driver's IRQ handler if platform_get_irq() returns a valid IRQ # -- this should avoid the unnecessary WARN_ON()...
--- drivers/ata/pata_octeon_cf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/pata_octeon_cf.c +3 -2
@@ -908,10 +908,11 @@ static int octeon_cf_probe(struct platform_device *pdev)return -EINVAL ; } - irq_handler = octeon_cf_interrupt; i =platform_get_irq (dma_dev,0 ); -if (i >0 ) +if (i >0 ) { irq = i; + irq_handler = octeon_cf_interrupt; + } }of_node_put (dma_node); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 64/245 pata_ep93xx: fix deferred probing
In reply to Greg Kroah-HartmanFrom: Sergey Shtylyov <[email protected]>
[ Upstream commit 5c8121262484d99bffb598f39a0df445cecd8efb ]
The driver overrides the error codes returned by platform_get_irq() to -ENXIO, so if it returns -EPROBE_DEFER, the driver would fail the probe permanently instead of the deferred probing. Propagate the error code upstream, as it should have been done from the start...
--- drivers/ata/pata_ep93xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/pata_ep93xx.c +1 -1
@@ -927,7 +927,7 @@ static int ep93xx_pata_probe(struct platform_device *pdev)/* INT[3] (IRQ_EP93XX_EXT3) line connected as pull down */ irq =platform_get_irq (pdev,0 );if (irq <0 ) { - err = -ENXIO ; + err = irq; goto err_rel_gpio; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 65/245 media: tc358743: Fix error return code in tc358743_probe_of()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit a6b1e7093f0a099571fc8836ab4a589633f956a8 ]
When the CSI bps per lane is not in the valid range, an appropriate error code -EINVAL should be returned. However, we currently do not explicitly assign this error code to 'ret'. As a result, 0 was incorrectly returned.
--- drivers/media/i2c/tc358743.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/tc358743.c +1 -0
@@ -1763,6 +1763,7 @@ static int tc358743_probe_of(struct tc358743_state *state) bps_pr_lane =2 * endpoint->link_frequencies[0 ];if (bps_pr_lane <62500000U || bps_pr_lane >1000000000U ) {dev_err (dev,"unsupported bps per lane: %u bps\n" , bps_pr_lane); + ret = -EINVAL ; goto disable_clk; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 66/245 media: siano: Fix out-of-bounds warnings in smscore_load_firmware_family2()
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit 13dfead49db07225335d4f587a560a2210391a1a ]
Rename struct sms_msg_data4 to sms_msg_data5 and increase the size of its msg_data array from 4 to 5 elements. Notice that at some point the 5th element of msg_data is being accessed in function smscore_load_firmware_family2():
1006 trigger_msg->msg_data[4] = 4; /* Task ID */
Also, there is no need for the object _trigger_msg_ of type struct sms_msg_data *, when _msg_ can be used, directly. Notice that msg_data in struct sms_msg_data is a one-element array, which causes multiple out-of-bounds warnings when accessing beyond its first element in function smscore_load_firmware_family2():
992 struct sms_msg_data *trigger_msg =
993 (struct sms_msg_data *) msg;
994
995 pr_debug("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ\n");
996 SMS_INIT_MSG(&msg->x_msg_header,
997 MSG_SMS_SWDOWNLOAD_TRIGGER_REQ, 998 sizeof(struct sms_msg_hdr) + 999 sizeof(u32) * 5); 1000 1001 trigger_msg->msg_data[0] = firmware->start_address; 1002 /* Entry point */ 1003 trigger_msg->msg_data[1] = 6; /* Priority */ 1004 trigger_msg->msg_data[2] = 0x200; /* Stack size */ 1005 trigger_msg->msg_data[3] = 0; /* Parameter */ 1006 trigger_msg->msg_data[4] = 4; /* Task ID */
even when enough dynamic memory is allocated for _msg_:
929 /* PAGE_SIZE buffer shall be enough and dma aligned */
930 msg = kmalloc(PAGE_SIZE, GFP_KERNEL | coredev->gfp_buf_flags);
but as _msg_ is casted to (struct sms_msg_data *):
992 struct sms_msg_data *trigger_msg =
993 (struct sms_msg_data *) msg;
the out-of-bounds warnings are actually valid and should be addressed.
Fix this by declaring object _msg_ of type struct sms_msg_data5 *, which contains a 5-elements array, instead of just 4. And use _msg_ directly, instead of creating object trigger_msg.
This helps with the ongoing efforts to enable -Warray-bounds by fixing the following warnings:
CC [M] drivers/media/common/siano/smscoreapi.odrivers/media/common/siano/smscoreapi.c: In function ‘smscore_load_firmware_family2’:drivers/media/common/siano/smscoreapi.c:1003:24: warning: array subscript 1 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
1003 | trigger_msg->msg_data[1] = 6; /* Priority */
| ~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/media/common/siano/smscoreapi.c:12:
drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
619 | u32 msg_data[1];
| ^~~~~~~~
drivers/media/common/siano/smscoreapi.c:1004:24: warning: array subscript 2 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
1004 | trigger_msg->msg_data[2] = 0x200; /* Stack size */
| ~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/media/common/siano/smscoreapi.c:12:
drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
619 | u32 msg_data[1];
| ^~~~~~~~
drivers/media/common/siano/smscoreapi.c:1005:24: warning: array subscript 3 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
1005 | trigger_msg->msg_data[3] = 0; /* Parameter */
| ~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/media/common/siano/smscoreapi.c:12:
drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
619 | u32 msg_data[1];
| ^~~~~~~~
drivers/media/common/siano/smscoreapi.c:1006:24: warning: array subscript 4 is above array bounds of ‘u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds]
1006 | trigger_msg->msg_data[4] = 4; /* Task ID */
| ~~~~~~~~~~~~~~~~~~~~~^~~
In file included from drivers/media/common/siano/smscoreapi.c:12:
drivers/media/common/siano/smscoreapi.h:619:6: note: while referencing ‘msg_data’
619 | u32 msg_data[1];
| ^~~~~~~~--- drivers/media/common/siano/smscoreapi.c | 22 +++++++++------------- drivers/media/common/siano/smscoreapi.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-)
drivers/media/common/siano/smscoreapi.c +9 -13
@@ -914,7 +914,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, void *buffer, size_t size) {struct sms_firmware *firmware = (struct sms_firmware *) buffer; -struct sms_msg_data4 *msg; +struct sms_msg_data5 *msg;u32 mem_address, calc_checksum =0 ;u32 i, *ptr;u8 *payload = firmware->payload;
@@ -995,24 +995,20 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, goto exit_fw_download;if (coredev->mode ==DEVICE_MODE_NONE ) { -struct sms_msg_data *trigger_msg = - (struct sms_msg_data *) msg; -pr_debug ("sending MSG_SMS_SWDOWNLOAD_TRIGGER_REQ\n" );SMS_INIT_MSG (&msg->x_msg_header,MSG_SMS_SWDOWNLOAD_TRIGGER_REQ , -sizeof (struct sms_msg_hdr ) + -sizeof (u32) *5 ); +sizeof (*msg)); - trigger_msg->msg_data[0 ] = firmware->start_address; + msg->msg_data[0 ] = firmware->start_address;/* Entry point */ - trigger_msg->msg_data[1 ] =6 ;/* Priority */ - trigger_msg->msg_data[2 ] =0x200 ;/* Stack size */ - trigger_msg->msg_data[3 ] =0 ;/* Parameter */ - trigger_msg->msg_data[4 ] =4 ;/* Task ID */ + msg->msg_data[1 ] =6 ;/* Priority */ + msg->msg_data[2 ] =0x200 ;/* Stack size */ + msg->msg_data[3 ] =0 ;/* Parameter */ + msg->msg_data[4 ] =4 ;/* Task ID */ - rc =smscore_sendrequest_and_wait (coredev, trigger_msg, - trigger_msg->x_msg_header.msg_length, + rc =smscore_sendrequest_and_wait (coredev, msg, + msg->x_msg_header.msg_length, &coredev->trigger_done); }else { SMS_INIT_MSG(&msg->x_msg_header, MSG_SW_RELOAD_EXEC_REQ,
drivers/media/common/siano/smscoreapi.h +2 -2
@@ -636,9 +636,9 @@ struct sms_msg_data2 {u32 msg_data[2 ]; }; -struct sms_msg_data4 { +struct sms_msg_data5 {struct sms_msg_hdr x_msg_header; -u32 msg_data[4 ]; +u32 msg_data[5 ]; };struct sms_data_download {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 67/245 mmc: usdhi6rol0: fix error return code in usdhi6_probe()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 2f9ae69e5267f53e89e296fccee291975a85f0eb ]
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function.
--- drivers/mmc/host/usdhi6rol0.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/usdhi6rol0.c +1 -0
@@ -1809,6 +1809,7 @@ static int usdhi6_probe(struct platform_device *pdev) version =usdhi6_read (host,USDHI6_VERSION );if ((version &0xfff ) !=0xa0d ) { + ret = -EPERM ;dev_err (dev,"Version not recognized %x\n" , version); goto e_clk_off; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 68/245 media: s5p-g2d: Fix a memory leak on ctx->fh.m2m_ctx
In reply to Greg Kroah-HartmanFrom: Dillon Min <[email protected]>
[ Upstream commit 5d11e6aad1811ea293ee2996cec9124f7fccb661 ]
The m2m_ctx resources was allocated by v4l2_m2m_ctx_init() in g2d_open() should be freed from g2d_release() when it's not used.
Fix it
--- drivers/media/platform/s5p-g2d/g2d.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/s5p-g2d/g2d.c +3 -0
@@ -283,6 +283,9 @@ static int g2d_release(struct file *file)struct g2d_dev *dev =video_drvdata (file);struct g2d_ctx *ctx =fh2ctx (file->private_data); +mutex_lock (&dev->mutex); +v4l2_m2m_ctx_release (ctx->fh.m2m_ctx); +mutex_unlock (&dev->mutex);v4l2_ctrl_handler_free (&ctx->ctrl_handler);v4l2_fh_del (&ctx->fh);v4l2_fh_exit (&ctx->fh);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 69/245 hwmon: (max31722) Remove non-standard ACPI device IDs
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit 97387c2f06bcfd79d04a848d35517b32ee6dca7c ]
Valid Maxim Integrated ACPI device IDs would start with MXIM, not with MAX1. On top of that, ACPI device IDs reflecting chip names are almost always invalid.
Remove the invalid ACPI IDs.
--- drivers/hwmon/max31722.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/hwmon/max31722.c +0 -9
@@ -9,7 +9,6 @@* directory of this archive for more details. */ -#include <linux/acpi.h> #include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/kernel.h>
@@ -138,20 +137,12 @@ static const struct spi_device_id max31722_spi_id[] = { {"max31723", 0}, {} }; - -static const struct acpi_device_id __maybe_unused max31722_acpi_id[] = { - {"MAX31722" ,0 }, - {"MAX31723" ,0 }, - {} -}; -MODULE_DEVICE_TABLE (spi, max31722_spi_id);static struct spi_driver max31722_driver = { .driver = { .name ="max31722" , .pm = &max31722_pm_ops, - .acpi_match_table =ACPI_PTR (max31722_acpi_id), }, .probe = max31722_probe, .remove = max31722_remove,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 70/245 hwmon: (max31790) Fix fan speed reporting for fan7..12
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
[ Upstream commit cbbf244f0515af3472084f22b6213121b4a63835 ]
Fans 7..12 do not have their own set of configuration registers. So far the code ignored that and read beyond the end of the configuration register range to get the tachometer period. This resulted in more or less random fan speed values for those fans.
The datasheet is quite vague when it comes to defining the tachometer period for fans 7..12. Experiments confirm that the period is the same for both fans associated with a given set of configuration registers.
--- drivers/hwmon/max31790.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/max31790.c +1 -1
@@ -179,7 +179,7 @@ static int max31790_read_fan(struct device *dev, u32 attr, int channel,switch (attr) {case hwmon_fan_input: - sr =get_tach_period (data->fan_dynamics[channel]); + sr =get_tach_period (data->fan_dynamics[channel %NR_CHANNEL ]); rpm =RPM_FROM_REG (data->tach[channel], sr); *val = rpm;return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 71/245 spi: spi-sun6i: Fix chipselect/clock bug
In reply to Greg Kroah-HartmanFrom: Mirko Vogt <mirko-dev|[email protected]>
[ Upstream commit 0d7993b234c9fad8cb6bec6adfaa74694ba85ecb ]
The current sun6i SPI implementation initializes the transfer too early, resulting in SCK going high before the transfer. When using an additional (gpio) chipselect with sun6i, the chipselect is asserted at a time when clock is high, making the SPI transfer fail.
This is due to SUN6I_GBL_CTL_BUS_ENABLE being written into SUN6I_GBL_CTL_REG at an early stage. Moving that to the transfer function, hence, right before the transfer starts, mitigates that problem.
--- drivers/spi/spi-sun6i.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-sun6i.c +5 -1
@@ -251,6 +251,10 @@ static int sun6i_spi_transfer_one(struct spi_master *master, }sun6i_spi_write (sspi,SUN6I_CLK_CTL_REG , reg); +/* Finally enable the bus - doing so before might raise SCK to HIGH */ + reg =sun6i_spi_read (sspi,SUN6I_GBL_CTL_REG ); + reg |=SUN6I_GBL_CTL_BUS_ENABLE ; +sun6i_spi_write (sspi,SUN6I_GBL_CTL_REG , reg);/* Setup the transfer now... */ if (sspi->tx_buf)
@@ -334,7 +338,7 @@ static int sun6i_spi_runtime_resume(struct device *dev) }sun6i_spi_write (sspi,SUN6I_GBL_CTL_REG , -SUN6I_GBL_CTL_BUS_ENABLE |SUN6I_GBL_CTL_MASTER |SUN6I_GBL_CTL_TP ); +SUN6I_GBL_CTL_MASTER |SUN6I_GBL_CTL_TP );return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 72/245 crypto: nx - Fix RCU warning in nx842_OF_upd_status
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 2a96726bd0ccde4f12b9b9a9f61f7b1ac5af7e10 ]
The function nx842_OF_upd_status triggers a sparse RCU warning when it directly dereferences the RCU-protected devdata. This appears to be an accident as there was another variable of the same name that was passed in from the caller.
After it was removed (because the main purpose of using it, to update the status member was itself removed) the global variable unintenionally stood in as its replacement.
This patch restores the devdata parameter.
--- drivers/crypto/nx/nx-842-pseries.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/nx/nx-842-pseries.c +5 -3
@@ -553,13 +553,15 @@ static int nx842_OF_set_defaults(struct nx842_devdata *devdata)* The status field indicates if the device is enabled when the status * is 'okay'. Otherwise the device driver will be disabled. * -* @prop - struct property point containing the maxsyncop for the update +* @devdata: struct nx842_devdata to use for dev_info +* @prop: struct property point containing the maxsyncop for the update * * Returns: * 0 - Device is available * -ENODEV - Device is not available */ -static int nx842_OF_upd_status (struct property *prop) +static int nx842_OF_upd_status (struct nx842_devdata *devdata, +struct property *prop) {const char *status = (const char *)prop->value;
@@ -773,7 +775,7 @@ static int nx842_OF_upd(struct property *new_prop) goto out;/* Perform property updates */ - ret =nx842_OF_upd_status (status); + ret =nx842_OF_upd_status (new_devdata, status);if (ret) goto error_out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 73/245 ACPI: sysfs: Fix a buffer overrun problem with description_show()
In reply to Greg Kroah-HartmanFrom: Krzysztof Wilczyński <[email protected]>
[ Upstream commit 888be6067b97132c3992866bbcf647572253ab3f ]
Currently, a device description can be obtained using ACPI, if the _STR method exists for a particular device, and then exposed to the userspace via a sysfs object as a string value.
If the _STR method is available for a given device then the data (usually a Unicode string) is read and stored in a buffer (of the ACPI_TYPE_BUFFER type) with a pointer to said buffer cached in the struct acpi_device_pnp for later access.
The description_show() function is responsible for exposing the device description to the userspace via a corresponding sysfs object and internally calls the utf16s_to_utf8s() function with a pointer to the buffer that contains the Unicode string so that it can be converted from UTF16 encoding to UTF8 and thus allowing for the value to be safely stored and later displayed.
When invoking the utf16s_to_utf8s() function, the description_show() function also sets a limit of the data that can be saved into a provided buffer as a result of the character conversion to be a total of PAGE_SIZE, and upon completion, the utf16s_to_utf8s() function returns an integer value denoting the number of bytes that have been written into the provided buffer.
Following the execution of the utf16s_to_utf8s() a newline character will be added at the end of the resulting buffer so that when the value is read in the userspace through the sysfs object then it would include newline making it more accessible when working with the sysfs file system in the shell, etc. Normally, this wouldn't be a problem, but if the function utf16s_to_utf8s() happens to return the number of bytes written to be precisely PAGE_SIZE, then we would overrun the buffer and write the newline character outside the allotted space which can have undefined consequences or result in a failure.
To fix this buffer overrun, ensure that there always is enough space left for the newline character to be safely appended.
--- drivers/acpi/device_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/device_sysfs.c +1 -1
@@ -452,7 +452,7 @@ static ssize_t description_show(struct device *dev, (wchar_t *)acpi_dev->pnp.str_obj->buffer.pointer, acpi_dev->pnp.str_obj->buffer.length,UTF16_LITTLE_ENDIAN , buf, - PAGE_SIZE); + PAGE_SIZE - 1); buf[result++] ='\n' ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 74/245 ocfs2: fix snprintf() checking
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 54e948c60cc843b6e84dc44496edc91f51d2a28e ]
The snprintf() function returns the number of bytes which would have been printed if the buffer was large enough. In other words it can return ">= remain" but this code assumes it returns "== remain".
The run time impact of this bug is not very severe. The next iteration through the loop would trigger a WARN() when we pass a negative limit to snprintf(). We would then return success instead of -E2BIG.
The kernel implementation of snprintf() will never return negatives so there is no need to check and I have deleted that dead code.
--- fs/ocfs2/filecheck.c | 6 +----- fs/ocfs2/stackglue.c | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-)
fs/ocfs2/filecheck.c +1 -5
@@ -431,11 +431,7 @@ static ssize_t ocfs2_filecheck_show(struct kobject *kobj, ret =snprintf (buf + total, remain,"%lu\t\t%u\t%s\n" , p->fe_ino, p->fe_done,ocfs2_filecheck_error (p->fe_status)); -if (ret <0 ) { - total = ret; -break ; - } -if (ret == remain) { +if (ret >= remain) {/* snprintf() didn't fit */ total = -E2BIG ;break ;
fs/ocfs2/stackglue.c +2 -6
@@ -510,11 +510,7 @@ static ssize_t ocfs2_loaded_cluster_plugins_show(struct kobject *kobj,list_for_each_entry (p, &ocfs2_stack_list, sp_list) { ret =snprintf (buf, remain,"%s\n" , p->sp_name); -if (ret <0 ) { - total = ret; -break ; - } -if (ret == remain) { +if (ret >= remain) {/* snprintf() didn't fit */ total = -E2BIG ;break ;
@@ -541,7 +537,7 @@ static ssize_t ocfs2_active_cluster_plugin_show(struct kobject *kobj,if (active_stack) { ret =snprintf (buf,PAGE_SIZE ,"%s\n" , active_stack->sp_name); -if (ret ==PAGE_SIZE ) +if (ret >=PAGE_SIZE ) ret = -E2BIG ; }spin_unlock (&ocfs2_stack_lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 75/245 net: pch_gbe: Propagate error from devm_gpio_request_one()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 9e3617a7b84512bf96c04f9cf82d1a7257d33794 ]
If GPIO controller is not available yet we need to defer the probe of GBE until provider will become available.
While here, drop GPIOF_EXPORT because it's deprecated and may not be available.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +7 -3
@@ -2617,9 +2617,13 @@ static int pch_gbe_probe(struct pci_dev *pdev, adapter->pdev = pdev; adapter->hw.back = adapter; adapter->hw.reg =pcim_iomap_table (pdev)[PCH_GBE_PCI_BAR ]; + adapter->pdata = (struct pch_gbe_privdata *)pci_id->driver_data; -if (adapter->pdata && adapter->pdata->platform_init) - adapter->pdata->platform_init (pdev); +if (adapter->pdata && adapter->pdata->platform_init) { + ret = adapter->pdata->platform_init (pdev); +if (ret) + goto err_free_netdev; + } adapter->ptp_pdev =pci_get_bus_and_slot (adapter->pdev->bus->number,PCI_DEVFN (12 ,4 ));
@@ -2709,7 +2713,7 @@ err_free_netdev:*/ static int pch_gbe_minnow_platform_init (struct pci_dev *pdev) { -unsigned long flags =GPIOF_DIR_OUT |GPIOF_INIT_HIGH |GPIOF_EXPORT ; +unsigned long flags =GPIOF_OUT_INIT_HIGH ;unsigned gpio =MINNOW_PHY_RESET_GPIO ;int ret;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 76/245 ehea: fix error return code in ehea_restart_qps()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 015dbf5662fd689d581c0bc980711b073ca09a1a ]
Fix to return -EFAULT from the error handling case instead of 0, as done elsewhere in this function.
By the way, when get_zeroed_page() fails, directly return -ENOMEM to simplify code.
--- drivers/net/ethernet/ibm/ehea/ehea_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/ibm/ehea/ehea_main.c +5 -4
@@ -2656,10 +2656,8 @@ static int ehea_restart_qps(struct net_device *dev)u16 dummy16 =0 ; cb0 = (void *)get_zeroed_page (GFP_KERNEL ); -if (!cb0) { - ret = -ENOMEM ; - goto out; - } +if (!cb0) +return -ENOMEM ;for (i =0 ; i < (port->num_def_qps); i++) {struct ehea_port_res *pr = &port->port_res[i];
@@ -2679,6 +2677,7 @@ static int ehea_restart_qps(struct net_device *dev) cb0);if (hret !=H_SUCCESS ) {netdev_err (dev,"query_ehea_qp failed (1)\n" ); + ret = -EFAULT ; goto out; }
@@ -2691,6 +2690,7 @@ static int ehea_restart_qps(struct net_device *dev) &dummy64, &dummy16, &dummy16);if (hret !=H_SUCCESS ) {netdev_err (dev,"modify_ehea_qp failed (1)\n" ); + ret = -EFAULT ; goto out; }
@@ -2699,6 +2699,7 @@ static int ehea_restart_qps(struct net_device *dev) cb0);if (hret !=H_SUCCESS ) {netdev_err (dev,"query_ehea_qp failed (2)\n" ); + ret = -EFAULT ; goto out; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 77/245 RDMA/rxe: Fix failure during driver load
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit 32a25f2ea690dfaace19f7a3a916f5d7e1ddafe8 ]
To avoid the following failure when trying to load the rdma_rxe module while IPv6 is disabled, add a check for EAFNOSUPPORT and ignore the failure, also delete the needless debug print from rxe_setup_udp_tunnel().
$ modprobe rdma_rxe modprobe: ERROR: could not insert 'rdma_rxe': Operation not permitted
--- drivers/infiniband/sw/rxe/rxe_net.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_net.c +7 -3
@@ -259,10 +259,8 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port,/* Create UDP socket */ err =udp_sock_create (net, &udp_cfg, &sock); -if (err <0 ) { -pr_err ("failed to create udp socket. err = %d\n" , err); +if (err <0 )return ERR_PTR (err); - } tnl_cfg.encap_type =1 ; tnl_cfg.encap_rcv = rxe_udp_encap_recv;
@@ -665,6 +663,12 @@ int rxe_net_ipv6_init(void) recv_sockets.sk6 =rxe_setup_udp_tunnel (&init_net,htons (ROCE_V2_UDP_DPORT ), true); +if (PTR_ERR (recv_sockets.sk6) == -EAFNOSUPPORT ) { + recv_sockets.sk6 =NULL ; +pr_warn ("IPv6 is not supported, can not create a UDPv6 socket\n" ); +return 0 ; + } +if (IS_ERR (recv_sockets.sk6)) { recv_sockets.sk6 =NULL ;pr_err ("Failed to create IPv6 UDP tunnel\n" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 78/245 drm: qxl: ensure surf.data is ininitialized
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit fbbf23ddb2a1cc0c12c9f78237d1561c24006f50 ]
The object surf is not fully initialized and the uninitialized field surf.data is being copied by the call to qxl_bo_create via the call to qxl_gem_object_create. Set surf.data to zero to ensure garbage data from the stack is not being copied.
Addresses-Coverity: ("Uninitialized scalar variable")
--- drivers/gpu/drm/qxl/qxl_dumb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/qxl/qxl_dumb.c +2 -0
@@ -57,6 +57,8 @@ int qxl_mode_dumb_create(struct drm_file *file_priv, surf.height = args->height; surf.stride = pitch; surf.format = format; + surf.data =0 ; + r = qxl_gem_object_create_with_handle(qdev, file_priv, QXL_GEM_DOMAIN_VRAM, args->size, &surf, &qobj,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 79/245 wireless: carl9170: fix LEDS build errors & warnings
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 272fdc0c4542fad173b44965be02a16d6db95499 ]
kernel test robot reports over 200 build errors and warnings that are due to this Kconfig problem when CARL9170=m, MAC80211=y, and LEDS_CLASS=m.
WARNING: unmet direct dependencies detected for MAC80211_LEDS
Depends on [n]: NET [=y] && WIRELESS [=y] && MAC80211 [=y] && (LEDS_CLASS [=m]=y || LEDS_CLASS [=m]=MAC80211 [=y]) Selected by [m]:
- CARL9170_LEDS [=y] && NETDEVICES [=y] && WLAN [=y] && WLAN_VENDOR_ATH [=y] && CARL9170 [=m]
CARL9170_LEDS selects MAC80211_LEDS even though its kconfig dependencies are not met. This happens because 'select' does not follow any Kconfig dependency chains.
Fix this by making CARL9170_LEDS depend on MAC80211_LEDS, where the latter supplies any needed dependencies on LEDS_CLASS.
--- drivers/net/wireless/ath/carl9170/Kconfig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/carl9170/Kconfig +3 -5
@@ -15,13 +15,11 @@ config CARL9170 config CARL9170_LEDS bool "SoftLED Support" - depends on CARL9170 - select MAC80211_LEDS - select LEDS_CLASS - select NEW_LEDS default y + depends on CARL9170 + depends on MAC80211_LEDS help - This option is necessary, if you want your device' LEDs to blink + This option is necessary, if you want your device's LEDs to blink. Say Y, unless you need the LEDs for firmware debugging.
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 80/245 brcmsmac: mac80211_if: Fix a resource leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 9a25344d5177c2b9285532236dc3d10a091f39a8 ]
If 'brcms_attach()' fails, we must undo the previous 'ieee80211_alloc_hw()' as already done in the remove function.
--- .../wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +7 -1
@@ -1221,6 +1221,7 @@ static int brcms_bcma_probe(struct bcma_device *pdev) {struct brcms_info *wl;struct ieee80211_hw *hw; +int ret; dev_info(&pdev->dev, "mfg %x core %x rev %d class %d irq %d\n", pdev->id.manuf, pdev->id.id, pdev->id.rev, pdev->id.class,
@@ -1245,11 +1246,16 @@ static int brcms_bcma_probe(struct bcma_device *pdev) wl =brcms_attach (pdev);if (!wl) {pr_err ("%s: brcms_attach failed!\n" , __func__); -return -ENODEV ; + ret = -ENODEV ; + goto err_free_ieee80211; }brcms_led_register (wl);return 0 ; + +err_free_ieee80211: +ieee80211_free_hw (hw); +return ret; }static int brcms_suspend (struct bcma_device *pdev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 81/245 ath10k: Fix an error code in ath10k_add_interface()
In reply to Greg Kroah-HartmanFrom: Yang Li <[email protected]>
[ Upstream commit e9ca70c735ce66fc6a0e02c8b6958434f74ef8de ]
When the code execute this if statement, the value of ret is 0. However, we can see from the ath10k_warn() log that the value of ret should be -EINVAL.
Clean up smatch warning:
drivers/net/wireless/ath/ath10k/mac.c:5596 ath10k_add_interface() warn:
missing error code 'ret'
--- drivers/net/wireless/ath/ath10k/mac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath10k/mac.c +1 -0
@@ -4947,6 +4947,7 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,if (arvif->nohwcrypt && !test_bit (ATH10K_FLAG_RAW_MODE , &ar->dev_flags)) { + ret = -EINVAL ;ath10k_warn (ar,"cryptmode module param needed for sw crypto\n" ); goto err; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 82/245 netlabel: Fix memory leak in netlbl_mgmt_add_common
In reply to Greg Kroah-HartmanFrom: Liu Shixin <[email protected]>
[ Upstream commit b8f6b0522c298ae9267bd6584e19b942a0636910 ]
Hulk Robot reported memory leak in netlbl_mgmt_add_common. The problem is non-freed map in case of netlbl_domhsh_add() failed.
BUG: memory leak
unreferenced object 0xffff888100ab7080 (size 96):
comm "syz-executor537", pid 360, jiffies 4294862456 (age 22.678s)
hex dump (first 32 bytes):
05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 ................
backtrace:
[<0000000008b40026>] netlbl_mgmt_add_common.isra.0+0xb2a/0x1b40
[<000000003be10950>] netlbl_mgmt_add+0x271/0x3c0
[<00000000c70487ed>] genl_family_rcv_msg_doit.isra.0+0x20e/0x320
[<000000001f2ff614>] genl_rcv_msg+0x2bf/0x4f0
[<0000000089045792>] netlink_rcv_skb+0x134/0x3d0
[<0000000020e96fdd>] genl_rcv+0x24/0x40
[<0000000042810c66>] netlink_unicast+0x4a0/0x6a0
[<000000002e1659f0>] netlink_sendmsg+0x789/0xc70
[<000000006e43415f>] sock_sendmsg+0x139/0x170
[<00000000680a73d7>] ____sys_sendmsg+0x658/0x7d0
[<0000000065cbb8af>] ___sys_sendmsg+0xf8/0x170
[<0000000019932b6c>] __sys_sendmsg+0xd3/0x190
[<00000000643ac172>] do_syscall_64+0x37/0x90
[<000000009b79d6dc>] entry_SYSCALL_64_after_hwframe+0x44/0xae--- net/netlabel/netlabel_mgmt.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
net/netlabel/netlabel_mgmt.c +10 -9
@@ -96,6 +96,7 @@ static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {static int netlbl_mgmt_add_common (struct genl_info *info,struct netlbl_audit *audit_info) { +void *pmap =NULL ;int ret_val = -EINVAL ;struct netlbl_domaddr_map *addrmap =NULL ;struct cipso_v4_doi *cipsov4 =NULL ;
@@ -195,6 +196,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val = -ENOMEM ; goto add_free_addrmap; } + pmap = map; map->list.addr = addr->s_addr & mask->s_addr; map->list.mask = mask->s_addr; map->list.valid =1 ;
@@ -203,10 +205,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, map->def.cipso = cipsov4; ret_val =netlbl_af4list_add (&map->list, &addrmap->list4); -if (ret_val !=0 ) { -kfree (map); - goto add_free_addrmap; - } +if (ret_val !=0 ) + goto add_free_map; entry->family =AF_INET ; entry->def.type =NETLBL_NLTYPE_ADDRSELECT ;
@@ -243,6 +243,7 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val = -ENOMEM ; goto add_free_addrmap; } + pmap = map; map->list.addr = *addr; map->list.addr.s6_addr32[0 ] &= mask->s6_addr32[0 ]; map->list.addr.s6_addr32[1 ] &= mask->s6_addr32[1 ];
@@ -255,10 +256,8 @@ static int netlbl_mgmt_add_common(struct genl_info *info, map->def.calipso = calipso; ret_val =netlbl_af6list_add (&map->list, &addrmap->list6); -if (ret_val !=0 ) { -kfree (map); - goto add_free_addrmap; - } +if (ret_val !=0 ) + goto add_free_map; entry->family =AF_INET6 ; entry->def.type =NETLBL_NLTYPE_ADDRSELECT ;
@@ -268,10 +267,12 @@ static int netlbl_mgmt_add_common(struct genl_info *info, ret_val =netlbl_domhsh_add (entry, audit_info);if (ret_val !=0 ) - goto add_free_addrmap; + goto add_free_map;return 0 ; +add_free_map: +kfree (pmap); add_free_addrmap:kfree (addrmap); add_doi_put_def:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 83/245 netfilter: nft_exthdr: check for IPv6 packet before further processing
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit cdd73cc545c0fb9b1a1f7b209f4f536e7990cff4 ]
ipv6_find_hdr() does not validate that this is an IPv6 packet. Add a sanity check for calling ipv6_find_hdr() to make sure an IPv6 packet is passed for parsing.
--- net/netfilter/nft_exthdr.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nft_exthdr.c +3 -0
@@ -34,6 +34,9 @@ static void nft_exthdr_eval(const struct nft_expr *expr,unsigned int offset =0 ;int err; +if (pkt->skb->protocol !=htons (ETH_P_IPV6 )) + goto err; + err =ipv6_find_hdr (pkt->skb, &offset, priv->type,NULL ,NULL );if (err <0 ) goto err;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 84/245 net: ethernet: aeroflex: fix UAF in greth_of_remove
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit e3a5de6d81d8b2199935c7eb3f7d17a50a7075b7 ]
static int greth_of_remove(struct platform_device *of_dev) {
...
struct greth_private *greth = netdev_priv(ndev); ... unregister_netdev(ndev); free_netdev(ndev); of_iounmap(&of_dev->resource[0], greth->regs, resource_size(&of_dev->resource[0]));
...
}
greth is netdev private data, but it is used
after free_netdev(). It can cause use-after-free when accessing greth pointer. So, fix it by moving free_netdev() after of_iounmap() call.
--- drivers/net/ethernet/aeroflex/greth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/aeroflex/greth.c +2 -1
@@ -1554,10 +1554,11 @@ static int greth_of_remove(struct platform_device *of_dev)mdiobus_unregister (greth->mdio);unregister_netdev (ndev); -free_netdev (ndev);of_iounmap (&of_dev->resource[0 ], greth->regs,resource_size (&of_dev->resource[0 ])); +free_netdev (ndev); +return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 85/245 net: ethernet: ezchip: fix UAF in nps_enet_remove
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit e4b8700e07a86e8eab6916aa5c5ba99042c34089 ]
priv is netdev private data, but it is used
after free_netdev(). It can cause use-after-free when accessing priv pointer. So, fix it by moving free_netdev() after netif_napi_del() call.
--- drivers/net/ethernet/ezchip/nps_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ezchip/nps_enet.c +1 -1
@@ -659,8 +659,8 @@ static s32 nps_enet_remove(struct platform_device *pdev)struct nps_enet_priv *priv =netdev_priv (ndev);unregister_netdev (ndev); -free_netdev (ndev);netif_napi_del (&priv->napi); +free_netdev (ndev);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 86/245 net: ethernet: ezchip: fix error handling
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 0de449d599594f5472e00267d651615c7f2c6c1d ]
As documented at drivers/base/platform.c for platform_get_irq:
* Gets an IRQ for a platform device and prints an error message if finding the
* IRQ fails. Device drivers should check the return value for errors so as to
* not pass a negative integer value to the request_irq() APIs.
So, the driver should check that platform_get_irq() return value is _negative_, not that it's equal to zero, because -ENXIO (return value from request_irq() if irq was not found) will
pass this check and it leads to passing negative irq to request_irq()
--- drivers/net/ethernet/ezchip/nps_enet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ezchip/nps_enet.c +1 -1
@@ -624,7 +624,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)/* Get IRQ number */ priv->irq =platform_get_irq (pdev,0 ); -if (!priv->irq) { +if (priv->irq <0 ) {dev_err (dev,"failed to retrieve <irq Rx-Tx> value from device tree\n" ); err = -ENODEV ; goto out_netdev;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 87/245 vxlan: add missing rcu_read_lock() in neigh_reduce()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 85e8b032d6ebb0f698a34dd22c2f13443d905888 ]
syzbot complained in neigh_reduce(), because rcu_read_lock_bh() is treated differently than rcu_read_lock()
WARNING: suspicious RCU usage
5.13.0-rc6-syzkaller #0 Not tainted
-----------------------------include/net/addrconf.h:313 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
3 locks held by kworker/0:0/5:
#0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: atomic64_set include/asm-generic/atomic-instrumented.h:856 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:617 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:644 [inline] #0: ffff888011064d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x871/0x1600 kernel/workqueue.c:2247 #1: ffffc90000ca7da8 ((work_completion)(&port->wq)){+.+.}-{0:0}, at: process_one_work+0x8a5/0x1600 kernel/workqueue.c:2251 #2: ffffffff8bf795c0 (rcu_read_lock_bh){....}-{1:2}, at: __dev_queue_xmit+0x1da/0x3130 net/core/dev.c:4180
stack backtrace: CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.13.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events ipvlan_process_multicast Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 __in6_dev_get include/net/addrconf.h:313 [inline] __in6_dev_get include/net/addrconf.h:311 [inline] neigh_reduce drivers/net/vxlan.c:2167 [inline] vxlan_xmit+0x34d5/0x4c30 drivers/net/vxlan.c:2919 __netdev_start_xmit include/linux/netdevice.h:4944 [inline] netdev_start_xmit include/linux/netdevice.h:4958 [inline] xmit_one net/core/dev.c:3654 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3670 __dev_queue_xmit+0x2133/0x3130 net/core/dev.c:4246 ipvlan_process_multicast+0xa99/0xd70 drivers/net/ipvlan/ipvlan_core.c:287 process_one_work+0x98d/0x1600 kernel/workqueue.c:2276 worker_thread+0x64c/0x1120 kernel/workqueue.c:2422 kthread+0x3b1/0x4a0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
--- drivers/net/vxlan.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/vxlan.c +2 -0
@@ -1594,6 +1594,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb)struct neighbour *n;struct inet6_dev *in6_dev; +rcu_read_lock (); in6_dev =__in6_dev_get (dev);if (!in6_dev) goto out;
@@ -1650,6 +1651,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) } out: +rcu_read_unlock ();consume_skb (skb);return NETDEV_TX_OK ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 88/245 i40e: Fix error handling in i40e_vsi_open
In reply to Greg Kroah-HartmanFrom: Dinghao Liu <[email protected]>
[ Upstream commit 9c04cfcd4aad232e36306cdc5c74cd9fc9148a7e ]
When vsi->type == I40E_VSI_FDIR, we have caught the return value of i40e_vsi_request_irq() but without further handling. Check and execute memory clean on failure just like the other i40e_vsi_request_irq().
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -0
@@ -5478,6 +5478,8 @@ int i40e_vsi_open(struct i40e_vsi *vsi)dev_driver_string (&pf->pdev->dev), dev_name(&pf->pdev->dev)); err =i40e_vsi_request_irq (vsi, int_name); +if (err) + goto err_setup_rx; }else { err = -EINVAL ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 89/245 Bluetooth: mgmt: Fix slab-out-of-bounds in tlv_data_is_valid
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 799acb9347915bfe4eac0ff2345b468f0a1ca207 ]
This fixes parsing of LTV entries when the length is 0.
Found with:
tools/mgmt-tester -s "Add Advertising - Success (ScRsp only)"
Add Advertising - Success (ScRsp only) - run
Sending Add Advertising (0x003e)
Test condition added, total 1
[ 11.004577] ================================================================== [ 11.005292] BUG: KASAN: slab-out-of-bounds in tlv_data_is_valid+0x87/0xe0 [ 11.005984] Read of size 1 at addr ffff888002c695b0 by task mgmt-tester/87 [ 11.006711] [ 11.007176] [ 11.007429] Allocated by task 87: [ 11.008151] [ 11.008438] The buggy address belongs to the object at ffff888002c69580 [ 11.008438] which belongs to the cache kmalloc-64 of size 64 [ 11.010526] The buggy address is located 48 bytes inside of [ 11.010526] 64-byte region [ffff888002c69580, ffff888002c695c0) [ 11.012423] The buggy address belongs to the page: [ 11.013291] [ 11.013544] Memory state around the buggy address: [ 11.014359] ffff888002c69480: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.015453] ffff888002c69500: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.016232] >ffff888002c69580: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc [ 11.017010] ^ [ 11.017547] ffff888002c69600: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc [ 11.018296] ffff888002c69680: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc [ 11.019116] ==================================================================
--- net/bluetooth/mgmt.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/mgmt.c +3 -0
@@ -6087,6 +6087,9 @@ static bool tlv_data_is_valid(struct hci_dev *hdev, u32 adv_flags, u8 *data,for (i =0 , cur_len =0 ; i < len; i += (cur_len +1 )) { cur_len = data[i]; +if (!cur_len) +continue ; +if (data[i +1 ] ==EIR_FLAGS && (!is_adv_data ||flags_managed (adv_flags)))return false;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 90/245 writeback: fix obtain a reference to a freeing memcg css
In reply to Greg Kroah-HartmanFrom: Muchun Song <[email protected]>
[ Upstream commit 8b0ed8443ae6458786580d36b7d5f8125535c5d4 ]
The caller of wb_get_create() should pin the memcg, because wb_get_create() relies on this guarantee. The rcu read lock only can guarantee that the memcg css returned by css_from_id() cannot be released, but the reference of the memcg can be zero.
rcu_read_lock()
memcg_css = css_from_id()
wb_get_create(memcg_css)
cgwb_create(memcg_css)
// css_get can change the ref counter from 0 back to 1
css_get(memcg_css) rcu_read_unlock()
Fix it by holding a reference to the css before calling wb_get_create(). This is not a problem I encountered in the real world. Just the result of a code review.
--- fs/fs-writeback.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/fs-writeback.c +7 -2
@@ -512,9 +512,14 @@ static void inode_switch_wbs(struct inode *inode, int new_wb_id)/* find and pin the new wb */ rcu_read_lock (); memcg_css =css_from_id (new_wb_id, &memory_cgrp_subsys); -if (memcg_css) - isw->new_wb =wb_get_create (bdi, memcg_css,GFP_ATOMIC ); +if (memcg_css && !css_tryget (memcg_css)) + memcg_css =NULL ;rcu_read_unlock (); +if (!memcg_css) + goto out_free; + + isw->new_wb =wb_get_create (bdi, memcg_css,GFP_ATOMIC ); +css_put (memcg_css);if (!isw->new_wb) goto out_free;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 91/245 net: sched: fix warning in tcindex_alloc_perfect_hash
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 3f2db250099f46988088800052cdf2332c7aba61 ]
Syzbot reported warning in tcindex_alloc_perfect_hash. The problem was in too big cp->hash, which triggers warning in kmalloc. Since cp->hash comes from userspace, there is no need to warn if value is not correct
--- net/sched/cls_tcindex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_tcindex.c +1 -1
@@ -247,7 +247,7 @@ static int tcindex_alloc_perfect_hash(struct tcindex_data *cp)int i, err =0 ; cp->perfect =kcalloc (cp->hash,sizeof (struct tcindex_filter_result ), -GFP_KERNEL ); +GFP_KERNEL | __GFP_NOWARN);if (!cp->perfect)return -ENOMEM ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 92/245 tty: nozomi: Fix a resource leak in an error handling function
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 31a9a318255960d32ae183e95d0999daf2418608 ]
A 'request_irq()' call is not balanced by a corresponding 'free_irq()' in the error handling path, as already done in the remove function.
Add it.
--- drivers/tty/nozomi.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/nozomi.c +1 -0
@@ -1479,6 +1479,7 @@ err_free_tty:tty_unregister_device (ntty_driver, dc->index_start + i);tty_port_destroy (&dc->port[i].port); } +free_irq (pdev->irq, dc); err_free_kfifo:for (i =0 ; i <MAX_PORT ; i++)kfifo_free (&dc->port[i].fifo_ul);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 93/245 iio: adis_buffer: do not return ints in irq handlers
In reply to Greg Kroah-HartmanFrom: Nuno Sa <[email protected]>
[ Upstream commit d877539ad8e8fdde9af69887055fec6402be1a13 ]
On an IRQ handler we should not return normal error codes as 'irqreturn_t' is expected.
Not necessarily stable material as the old check cannot fail, so it's a bug we can not hit.
--- drivers/iio/imu/adis_buffer.c | 3 --- 1 file changed, 3 deletions(-)
drivers/iio/imu/adis_buffer.c +0 -3
@@ -83,9 +83,6 @@ static irqreturn_t adis_trigger_handler(int irq, void *p)struct adis *adis =iio_device_get_drvdata (indio_dev);int ret; -if (!adis->buffer) -return -ENOMEM ; -if (adis->data->has_paging) {mutex_lock (&adis->txrx_lock);if (adis->current_page !=0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 94/245 iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit fc36da3131a747a9367a05caf06de19be1bcc972 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/bma180.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/bma180.c +7 -3
@@ -120,7 +120,11 @@ struct bma180_data {int scale;int bw;bool pmode; -u8 buff[16 ];/* 3x 16-bit + 8-bit + padding + timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chan[4 ]; +s64 timestamp__aligned(8) ; + } scan; };enum bma180_chan {
@@ -667,12 +671,12 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_unlock (&data->mutex); goto err; } - ((s16 *)data->buff)[i++] = ret; + data->scan.chan[i++] = ret; }mutex_unlock (&data->mutex); -iio_push_to_buffers_with_timestamp (indio_dev, data->buff, time_ns); +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, time_ns); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 95/245 iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 151dbf0078da98206817ee0b87d499035479ef11 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/bma220_spi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/bma220_spi.c +7 -3
@@ -76,7 +76,11 @@ static const int bma220_scale_table[][4] = {struct bma220_data {struct spi_device *spi_device;struct mutex lock; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 8x8 timestamp */ +struct { +s8 chans[3 ]; +/* Ensure timestamp is naturally aligned. */ +s64 timestamp__aligned(8) ; + } scan;u8 tx_buf[2 ]____cacheline_aligned ; };
@@ -107,12 +111,12 @@ static irqreturn_t bma220_trigger_handler(int irq, void *p)mutex_lock (&data->lock); data->tx_buf[0 ] =BMA220_REG_ACCEL_X |BMA220_READ_MASK ; - ret =spi_write_then_read (spi, data->tx_buf,1 , data->buffer, + ret =spi_write_then_read (spi, data->tx_buf,1 , &data->scan.chans,ARRAY_SIZE (bma220_channels) -1 );if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 96/245 iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3ab3aa2e7bd57497f9a7c6275c00dce237d2c9ba ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/kxcjk-1013.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/iio/accel/kxcjk-1013.c +14 -10
@@ -96,12 +96,23 @@ enum kx_acpi_type { ACPI_SMO8500, }; +enum kxcjk1013_axis { +AXIS_X , +AXIS_Y , +AXIS_Z , +AXIS_MAX +}; +struct kxcjk1013_data {struct i2c_client *client;struct iio_trigger *dready_trig;struct iio_trigger *motion_trig;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure timestamp naturally aligned */ +struct { +s16 chans[AXIS_MAX ]; +s64 timestamp__aligned(8) ; + } scan;u8 odr_bits;u8 range;int wake_thres;
@@ -115,13 +126,6 @@ struct kxcjk1013_data {enum kx_acpi_type acpi_type; }; -enum kxcjk1013_axis { -AXIS_X , -AXIS_Y , -AXIS_Z , -AXIS_MAX , -}; -enum kxcjk1013_mode {STANDBY ,OPERATION ,
@@ -971,12 +975,12 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data_or_emulated (data->client,KXCJK1013_REG_XOUT_L ,AXIS_MAX *2 , - (u8 *)data->buffer); + (u8 *)data->scan.chans);mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, data->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 97/245 iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f40a71ffec808e7e51848f63f0c0d3c32d65081b ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/stk8312.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/accel/stk8312.c +8 -4
@@ -106,7 +106,11 @@ struct stk8312_data {u8 mode;struct iio_trigger *dready_trig;bool dready_trigger_on; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s8 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; }; static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL);
@@ -443,7 +447,7 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8312_REG_XOUT ,STK8312_ALL_CHANNEL_SIZE , - data->buffer); + data->scan.chans);if (ret <STK8312_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" );mutex_unlock (&data->lock);
@@ -457,12 +461,12 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p)mutex_unlock (&data->lock); goto err; } - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 98/245 iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 334883894bc1e145a1e0f5de1b0d1b6a1133f0e6 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/stk8ba50.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/iio/accel/stk8ba50.c +8 -9
@@ -94,12 +94,11 @@ struct stk8ba50_data {u8 sample_rate_idx;struct iio_trigger *dready_trig;bool dready_trigger_on; -/* -* 3 x 16-bit channels (10-bit data, 6-bit padding) + -* 1 x 16 padding + -* 4 x 16 64-bit timestamp -*/ -s16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s16 chans[3 ]; +s64 timetamp__aligned(8) ; + } scan; };#define STK8BA50_ACCEL_CHANNEL (index, reg, axis) { \
@@ -329,7 +328,7 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8BA50_REG_XOUT ,STK8BA50_ALL_CHANNEL_SIZE , - (u8 *)data->buffer); + (u8 *)data->scan.chans);if (ret <STK8BA50_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" ); goto err;
@@ -342,10 +341,10 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p)if (ret <0 ) goto err; - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 99/245 iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit d85d71dd1ab67eaa7351f69fec512d8f09d164e1 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/adc/ti-ads1015.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-ads1015.c +8 -4
@@ -292,10 +292,14 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct ads1015_data *data =iio_priv (indio_dev); -s16 buf[8 ];/* 1x s16 ADC val + 3x s16 padding + 4x s16 timestamp */ +/* Ensure natural alignment of timestamp */ +struct { +s16 chan; +s64 timestamp__aligned(8) ; + } scan;int chan, ret, res; -memset (buf,0 ,sizeof (buf)); +memset (&scan,0 ,sizeof (scan));mutex_lock (&data->lock); chan = find_first_bit(indio_dev->active_scan_mask,
@@ -306,10 +310,10 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p) goto err; } - buf[0 ] = res; + scan.chan = res;mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, buf, +iio_push_to_buffers_with_timestamp (indio_dev, &scan,iio_get_time_ns (indio_dev)); err:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 100/245 iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 7765dfaa22ea08abf0c175e7553826ba2a939632 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/adc/vf610_adc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/adc/vf610_adc.c +7 -3
@@ -180,7 +180,11 @@ struct vf610_adc {u32 sample_freq_avail[5 ];struct completion completion; -u16 buffer[8 ]; +/* Ensure the timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const u32 vf610_hw_avgs[] = {1 ,4 ,8 ,16 ,32 };
@@ -592,9 +596,9 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id)if (coco &VF610_ADC_HS_COCO0 ) { info->value =vf610_adc_read_data (info);if (iio_buffer_enabled (indio_dev)) { - info->buffer[0 ] = info->value; + info->scan.chan = info->value;iio_push_to_buffers_with_timestamp (indio_dev, - info->buffer, + &info->scan,iio_get_time_ns (indio_dev));iio_trigger_notify_done (indio_dev->trig); }else
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 101/245 iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 06778d881f3798ce93ffbbbf801234292250b598 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/gyro/bmg160_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/gyro/bmg160_core.c +7 -3
@@ -104,7 +104,11 @@ struct bmg160_data {struct iio_trigger *dready_trig;struct iio_trigger *motion_trig;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure naturally aligned timestamp */ +struct { +s16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan;u32 dps_range;int ev_enable_state;int slope_thres;
@@ -874,12 +878,12 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); ret =regmap_bulk_read (data->regmap,BMG160_REG_XOUT_L , - data->buffer,AXIS_MAX *2 ); + data->scan.chans,AXIS_MAX *2 );mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 102/245 iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f4ca2e2595d9fee65d5ce0d218b22ce00e5b2915 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/humidity/am2315.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/iio/humidity/am2315.c +10 -6
@@ -36,7 +36,11 @@struct am2315_data {struct i2c_client *client;struct mutex lock; -s16 buffer[8 ];/* 2x16-bit channels + 2x16 padding + 4x16 timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chans[2 ]; +s64 timestamp__aligned(8) ; + } scan; };struct am2315_sensor_data {
@@ -170,20 +174,20 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p)mutex_lock (&data->lock);if (*(indio_dev->active_scan_mask) ==AM2315_ALL_CHANNEL_MASK ) { - data->buffer[0 ] = sensor_data.hum_data; - data->buffer[1 ] = sensor_data.temp_data; + data->scan.chans[0 ] = sensor_data.hum_data; + data->scan.chans[1 ] = sensor_data.temp_data; }else { i =0 ;for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { - data->buffer[i] = (bit ? sensor_data.temp_data : - sensor_data.hum_data); + data->scan.chans[i] = (bit ? sensor_data.temp_data : + sensor_data.hum_data); i++; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 103/245 iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 679cc377a03ff1944491eafc7355c1eb1fad4109 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +7 -3
@@ -51,7 +51,11 @@ struct lidar_data {int (*xfer)(struct lidar_data *data,u8 reg,u8 *val,int len);int i2c_enabled; -u16 buffer[8 ];/* 2 byte distance + 8 byte timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_chan_spec lidar_channels[] = {
@@ -236,9 +240,9 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private)struct lidar_data *data =iio_priv (indio_dev);int ret; - ret =lidar_get_measurement (data, data->buffer); + ret =lidar_get_measurement (data, &data->scan.chan);if (!ret) { -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); }else if (ret != -EINVAL ) {dev_err (&data->client->dev,"cannot read LIDAR measurement" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 104/245 iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 3d4725194de6935dba2ad7c9cc075c885008f747 ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/light/isl29125.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/isl29125.c +7 -3
@@ -54,7 +54,11 @@struct isl29125_data {struct i2c_client *client;u8 conf1; -u16 buffer[8 ];/* 3x 16-bit, padding, 8 bytes timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; };#define ISL29125_CHANNEL (_color, _si) { \
@@ -187,10 +191,10 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 105/245 iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit ff08fbc22ab32ccc6690c21b0e5e1d402dcc076f ]
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/light/tcs3414.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/tcs3414.c +7 -3
@@ -56,7 +56,11 @@ struct tcs3414_data {u8 control;u8 gain;u8 timing; -u16 buffer[8 ];/* 4x 16-bit + 8 bytes timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan; };#define TCS3414_CHANNEL (_color, _si, _addr) { \
@@ -212,10 +216,10 @@ static irqreturn_t tcs3414_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 106/245 Input: hil_kbd - fix error return code in hil_dev_connect()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit d9b576917a1d0efa293801a264150a1b37691617 ]
Return error code -EINVAL rather than '0' when the combo devices are not supported.
--- drivers/input/keyboard/hil_kbd.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/keyboard/hil_kbd.c +1 -0
@@ -512,6 +512,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv) HIL_IDD_NUM_AXES_PER_SET(*idd)) { printk(KERN_INFO PREFIX "combo devices are not supported.\n"); + error = -EINVAL ; goto bail1; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 107/245 char: pcmcia: error out if num_bytes_read is greater than 4 in set_protocol()
In reply to Greg Kroah-HartmanFrom: Yu Kuai <[email protected]>
[ Upstream commit 37188559c610f1b7eec83c8e448936c361c578de ]
Theoretically, it will cause index out of bounds error if 'num_bytes_read' is greater than 4. As we expect it(and was tested) never to be greater than 4, error out if it happens.
--- drivers/char/pcmcia/cm4000_cs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/char/pcmcia/cm4000_cs.c +4 -0
@@ -544,6 +544,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq)io_read_num_rec_bytes (iobase, &num_bytes_read);if (num_bytes_read >=4 ) {DEBUGP (2 , dev,"NumRecBytes = %i\n" , num_bytes_read); +if (num_bytes_read >4 ) { + rc = -EIO ; + goto exit_setprotocol; + }break ; }mdelay (10 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 108/245 tty: nozomi: Fix the error handling path of nozomi_card_init()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 6ae7d0f5a92b9619f6e3c307ce56b2cefff3f0e9 ]
The error handling path is broken and we may un-register things that have never been registered.
Update the loops index accordingly.
--- drivers/tty/nozomi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/nozomi.c +5 -3
@@ -1437,7 +1437,7 @@ static int nozomi_card_init(struct pci_dev *pdev, NOZOMI_NAME, dc);if (unlikely (ret)) {dev_err (&pdev->dev,"can't request irq %d\n" , pdev->irq); - goto err_free_kfifo; + goto err_free_all_kfifo; }DBG1 ("base_addr: %p" , dc->base_addr);
@@ -1475,13 +1475,15 @@ static int nozomi_card_init(struct pci_dev *pdev,return 0 ; err_free_tty: -for (i =0 ; i <MAX_PORT ; ++i) { +for (i--; i >=0 ; i--) {tty_unregister_device (ntty_driver, dc->index_start + i);tty_port_destroy (&dc->port[i].port); }free_irq (pdev->irq, dc); +err_free_all_kfifo: + i =MAX_PORT ; err_free_kfifo: -for (i =0 ; i <MAX_PORT ; i++) +for (i--; i >=PORT_MDM ; i--)kfifo_free (&dc->port[i].fifo_ul); err_free_sbuf:kfree (dc->send_buf);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 109/245 scsi: FlashPoint: Rename si_flags field
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 4d431153e751caa93f3b7e6f6313446974e92253 ]
The BusLogic driver has build errors on ia64 due to a name collision (in the #included FlashPoint.c file). Rename the struct field in struct sccb_mgr_info from si_flags to si_mflags (manager flags) to mend the build.
This is the first problem. There are 50+ others after this one:
In file included from ../include/uapi/linux/signal.h:6,
from ../include/linux/signal_types.h:10,
from ../include/linux/sched.h:29,
from ../include/linux/hardirq.h:9,
from ../include/linux/interrupt.h:11,
from ../drivers/scsi/BusLogic.c:27:../arch/ia64/include/uapi/asm/siginfo.h:15:27: error: expected ':', ',', ';', '}' or '__attribute__' before '.' token
15 | #define si_flags _sifields._sigfault._flags
| ^../drivers/scsi/FlashPoint.c:43:6: note: in expansion of macro 'si_flags'
43 | u16 si_flags;
| ^~~~~~~~In file included from ../drivers/scsi/BusLogic.c:51:../drivers/scsi/FlashPoint.c: In function 'FlashPoint_ProbeHostAdapter':../drivers/scsi/FlashPoint.c:1076:11: error: 'struct sccb_mgr_info' has no member named '_sifields'
1076 | pCardInfo->si_flags = 0x0000;
| ^~../drivers/scsi/FlashPoint.c:1079:12: error: 'struct sccb_mgr_info' has no member named '_sifields'
--- drivers/scsi/FlashPoint.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/scsi/FlashPoint.c +16 -16
@@ -40,7 +40,7 @@ struct sccb_mgr_info {u16 si_per_targ_ultra_nego;u16 si_per_targ_no_disc;u16 si_per_targ_wide_nego; -u16 si_flags; +u16 si_mflags;unsigned char si_card_family;unsigned char si_bustype;unsigned char si_card_model[3 ];
@@ -1070,22 +1070,22 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo) ScamFlg = (unsigned char )FPT_utilEERead (ioport,SCAM_CONFIG /2 ); - pCardInfo->si_flags =0x0000 ; + pCardInfo->si_mflags =0x0000 ;if (i &0x01 ) - pCardInfo->si_flags |=SCSI_PARITY_ENA ; + pCardInfo->si_mflags |=SCSI_PARITY_ENA ;if (!(i &0x02 )) - pCardInfo->si_flags |=SOFT_RESET ; + pCardInfo->si_mflags |=SOFT_RESET ;if (i &0x10 ) - pCardInfo->si_flags |=EXTENDED_TRANSLATION ; + pCardInfo->si_mflags |=EXTENDED_TRANSLATION ;if (ScamFlg &SCAM_ENABLED ) - pCardInfo->si_flags |=FLAG_SCAM_ENABLED ; + pCardInfo->si_mflags |=FLAG_SCAM_ENABLED ;if (ScamFlg &SCAM_LEVEL2 ) - pCardInfo->si_flags |=FLAG_SCAM_LEVEL2 ; + pCardInfo->si_mflags |=FLAG_SCAM_LEVEL2 ; j = (RD_HARPOON (ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L );if (i &0x04 ) {
@@ -1101,7 +1101,7 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)if (!(RD_HARPOON (ioport + hp_page_ctrl) &NARROW_SCSI_CARD )) - pCardInfo->si_flags |=SUPPORT_16TAR_32LUN ; + pCardInfo->si_mflags |=SUPPORT_16TAR_32LUN ; pCardInfo->si_card_family =HARPOON_FAMILY ; pCardInfo->si_bustype =BUSTYPE_PCI ;
@@ -1137,15 +1137,15 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)if (pCardInfo->si_card_model[1 ] =='3' ) {if (RD_HARPOON (ioport + hp_ee_ctrl) &BIT (7 )) - pCardInfo->si_flags |=LOW_BYTE_TERM ; + pCardInfo->si_mflags |=LOW_BYTE_TERM ; }else if (pCardInfo->si_card_model[2 ] =='0' ) { temp =RD_HARPOON (ioport + hp_xfer_pad);WR_HARPOON (ioport + hp_xfer_pad, (temp & ~BIT (4 )));if (RD_HARPOON (ioport + hp_ee_ctrl) &BIT (7 )) - pCardInfo->si_flags |=LOW_BYTE_TERM ; + pCardInfo->si_mflags |=LOW_BYTE_TERM ;WR_HARPOON (ioport + hp_xfer_pad, (temp |BIT (4 )));if (RD_HARPOON (ioport + hp_ee_ctrl) &BIT (7 )) - pCardInfo->si_flags |=HIGH_BYTE_TERM ; + pCardInfo->si_mflags |=HIGH_BYTE_TERM ;WR_HARPOON (ioport + hp_xfer_pad, temp); }else { temp =RD_HARPOON (ioport + hp_ee_ctrl);
@@ -1163,9 +1163,9 @@ static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)WR_HARPOON (ioport + hp_ee_ctrl, temp);WR_HARPOON (ioport + hp_xfer_pad, temp2);if (!(temp3 &BIT (7 ))) - pCardInfo->si_flags |=LOW_BYTE_TERM ; + pCardInfo->si_mflags |=LOW_BYTE_TERM ;if (!(temp3 &BIT (6 ))) - pCardInfo->si_flags |=HIGH_BYTE_TERM ; + pCardInfo->si_mflags |=HIGH_BYTE_TERM ; }ARAM_ACCESS (ioport);
@@ -1272,7 +1272,7 @@ static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_infoWR_HARPOON (ioport + hp_arb_id, pCardInfo->si_id); CurrCard->ourId = pCardInfo->si_id; - i = (unsigned char )pCardInfo->si_flags; + i = (unsigned char )pCardInfo->si_mflags;if (i &SCSI_PARITY_ENA )WR_HARPOON (ioport + hp_portctrl_1, (HOST_MODE8 |CHK_SCSI_P ));
@@ -1286,14 +1286,14 @@ static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info j |=SCSI_TERM_ENA_H ;WR_HARPOON (ioport + hp_ee_ctrl, j); -if (!(pCardInfo->si_flags &SOFT_RESET )) { +if (!(pCardInfo->si_mflags &SOFT_RESET )) {FPT_sresb (ioport, thisCard);FPT_scini (thisCard, pCardInfo->si_id,0 ); } -if (pCardInfo->si_flags &POST_ALL_UNDERRRUNS ) +if (pCardInfo->si_mflags &POST_ALL_UNDERRRUNS ) CurrCard->globalFlags |=F_NO_FILTER ;if (pCurrNvRam) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 110/245 s390: appldata depends on PROC_SYSCTL
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 5d3516b3647621d5a1180672ea9e0817fb718ada ]
APPLDATA_BASE should depend on PROC_SYSCTL instead of PROC_FS. Building with PROC_FS but not PROC_SYSCTL causes a build error, since appldata_base.c uses data and APIs from fs/proc/proc_sysctl.c.
arch/s390/appldata/appldata_base.o: in function `appldata_generic_handler':
appldata_base.c:(.text+0x192): undefined reference to `sysctl_vals'
--- arch/s390/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/Kconfig +1 -1
@@ -833,7 +833,7 @@ config CMM_IUCV config APPLDATA_BASE def_bool n prompt "Linux - VM Monitor Stream, base infrastructure" - depends on PROC_FS + depends on PROC_SYSCTL help This provides a kernel interface for creating and updating z/VM APPLDATA monitor records. The monitor records are updated at certain time
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 111/245 staging: gdm724x: check for buffer overflow in gdm_lte_multi_sdu_pkt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4a36e160856db8a8ddd6a3d2e5db5a850ab87f82 ]
There needs to be a check to verify that we don't read beyond the end of "buf". This function is called from do_rx(). The "buf" is the USB transfer_buffer and "len" is "urb->actual_length".
--- drivers/staging/gdm724x/gdm_lte.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/staging/gdm724x/gdm_lte.c +9 -1
@@ -689,6 +689,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len)struct multi_sdu *multi_sdu = (struct multi_sdu *)buf;struct sdu *sdu =NULL ;u8 *data = (u8 *)multi_sdu->data; +int copied;u16 i =0 ;u16 num_packet;u16 hci_len;
@@ -702,6 +703,12 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len) multi_sdu->num_packet);for (i =0 ; i < num_packet; i++) { + copied = data - multi_sdu->data; +if (len < copied +sizeof (*sdu)) { +pr_err ("rx prevent buffer overflow" ); +return ; + } + sdu = (struct sdu *)data; cmd_evt = gdm_dev16_to_cpu(phy_dev->
@@ -715,7 +722,8 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len)pr_err ("rx sdu wrong hci %04x\n" , cmd_evt);return ; } -if (hci_len <12 ) { +if (hci_len <12 || + len < copied +sizeof (*sdu) + (hci_len -12 )) {pr_err ("rx sdu invalid len %d\n" , hci_len);return ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 112/245 staging: gdm724x: check for overflow in gdm_lte_netif_rx()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7002b526f4ff1f6da34356e67085caafa6be383a ]
This code assumes that "len" is at least 62 bytes, but we need a check to prevent a read overflow.
--- drivers/staging/gdm724x/gdm_lte.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/gdm724x/gdm_lte.c +6 -4
@@ -624,10 +624,12 @@ static void gdm_lte_netif_rx(struct net_device *dev, char *buf,* bytes (99,130,83,99 dec) */ } __packed; -void *addr = buf +sizeof (struct iphdr ) + -sizeof (struct udphdr ) + - offsetof(struct dhcp_packet , chaddr); -ether_addr_copy (nic->dest_mac_addr, addr); +int offset =sizeof (struct iphdr ) + +sizeof (struct udphdr ) + + offsetof(struct dhcp_packet , chaddr); +if (offset +ETH_ALEN > len) +return ; +ether_addr_copy (nic->dest_mac_addr, buf + offset); } }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 113/245 of: Fix truncation of memory sizes on 32-bit platforms
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 2892d8a00d23d511a0591ac4b2ff3f050ae1f004 ]
Variable "size" has type "phys_addr_t", which can be either 32-bit or 64-bit on 32-bit systems, while "unsigned long" is always 32-bit on 32-bit systems. Hence the cast in
(unsigned long)size / SZ_1M
may truncate a 64-bit size to 32-bit, as casts have a higher operator precedence than divisions.
Fix this by inverting the order of the cast and division, which should be safe for memory blocks smaller than 4 PiB. Note that the division is actually a shift, as SZ_1M is a power-of-two constant, hence there is no need to use div_u64().
While at it, use "%lu" to format "unsigned long".
--- drivers/of/fdt.c | 8 ++++---- drivers/of/of_reserved_mem.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/of/fdt.c +4 -4
@@ -605,11 +605,11 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,if (size &&early_init_dt_reserve_memory_arch (base, size, nomap) ==0 ) -pr_debug ("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n" , - uname, &base, (unsigned long )size /SZ_1M ); +pr_debug ("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n" , + uname, &base, (unsigned long )(size /SZ_1M ));else -pr_info ("Reserved memory: failed to reserve memory for node '%s': base %pa, size %ld MiB\n" , - uname, &base, (unsigned long )size /SZ_1M ); +pr_info ("Reserved memory: failed to reserve memory for node '%s': base %pa, size %lu MiB\n" , + uname, &base, (unsigned long )(size /SZ_1M )); len -= t_len;if (first) {
drivers/of/of_reserved_mem.c +4 -4
@@ -158,9 +158,9 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret =early_init_dt_alloc_reserved_memory_arch (size, align, start, end, nomap, &base);if (ret ==0 ) { -pr_debug ("allocated memory for '%s' node: base %pa, size %ld MiB\n" , +pr_debug ("allocated memory for '%s' node: base %pa, size %lu MiB\n" , uname, &base, - (unsigned long )size /SZ_1M ); + (unsigned long )(size /SZ_1M ));break ; } len -= t_len;
@@ -170,8 +170,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node, ret =early_init_dt_alloc_reserved_memory_arch (size, align,0 ,0 , nomap, &base);if (ret ==0 ) -pr_debug ("allocated memory for '%s' node: base %pa, size %ld MiB\n" , - uname, &base, (unsigned long )size /SZ_1M ); +pr_debug ("allocated memory for '%s' node: base %pa, size %lu MiB\n" , + uname, &base, (unsigned long )(size /SZ_1M )); }if (base ==0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 114/245 scsi: mpt3sas: Fix error return value in _scsih_expander_add()
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit d6c2ce435ffe23ef7f395ae76ec747414589db46 ]
When an expander does not contain any 'phys', an appropriate error code -1 should be returned, as done elsewhere in this function. However, we currently do not explicitly assign this error code to 'rc'. As a result, 0 was incorrectly returned.
--- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_scsih.c +3 -1
@@ -5199,8 +5199,10 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) handle, parent_handle, (unsigned long long ) sas_expander->sas_address, sas_expander->num_phys); -if (!sas_expander->num_phys) +if (!sas_expander->num_phys) { + rc =-1 ; goto out_fail; + } sas_expander->phy =kcalloc (sas_expander->num_phys,sizeof (struct _sas_phy ),GFP_KERNEL );if (!sas_expander->phy) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 115/245 phy: ti: dm816x: Fix the error handling path in dm816x_usb_phy_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit f7eedcb8539ddcbb6fe7791f1b4ccf43f905c72f ]
Add an error handling path in the probe to release some resources, as already done in the remove function.
--- drivers/phy/phy-dm816x-usb.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/phy/phy-dm816x-usb.c +13 -4
@@ -246,19 +246,28 @@ static int dm816x_usb_phy_probe(struct platform_device *pdev)pm_runtime_enable (phy->dev); generic_phy =devm_phy_create (phy->dev,NULL , &ops); -if (IS_ERR (generic_phy)) -return PTR_ERR (generic_phy); +if (IS_ERR (generic_phy)) { + error =PTR_ERR (generic_phy); + goto clk_unprepare; + }phy_set_drvdata (generic_phy, phy); phy_provider =devm_of_phy_provider_register (phy->dev, of_phy_simple_xlate); -if (IS_ERR (phy_provider)) -return PTR_ERR (phy_provider); +if (IS_ERR (phy_provider)) { + error =PTR_ERR (phy_provider); + goto clk_unprepare; + }usb_add_phy_dev (&phy->phy);return 0 ; + +clk_unprepare: +pm_runtime_disable (phy->dev); +clk_unprepare (phy->refclk); +return error; }static int dm816x_usb_phy_remove (struct platform_device *pdev)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 116/245 extcon: sm5502: Drop invalid register write in sm5502_reg_data
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit d25b224f8e5507879b36a769a6d1324cf163466c ]
When sm5502_init_dev_type() iterates over sm5502_reg_data to initialize the registers it is limited by ARRAY_SIZE(sm5502_reg_data). There is no need to add another empty element to sm5502_reg_data.
Having the additional empty element in sm5502_reg_data will just result in writing 0xff to register 0x00, which does not really make sense.
--- drivers/extcon/extcon-sm5502.c | 1 - 1 file changed, 1 deletion(-)
drivers/extcon/extcon-sm5502.c +0 -1
@@ -92,7 +92,6 @@ static struct reg_data sm5502_reg_data[] = { | SM5502_REG_INTM2_MHL_MASK, .invert = true, }, - { } };/* List of detectable cables */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 117/245 extcon: max8997: Add missing modalias string
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit dc11fc2991e9efbceef93912b83e333d2835fb19 ]
The platform device driver name is "max8997-muic", so advertise it properly in the modalias string. This fixes automated module loading when this driver is compiled as a module.
--- drivers/extcon/extcon-max8997.c | 1 + 1 file changed, 1 insertion(+)
drivers/extcon/extcon-max8997.c +1 -0
@@ -783,3 +783,4 @@ module_platform_driver(max8997_muic_driver);MODULE_DESCRIPTION ("Maxim MAX8997 Extcon driver" );MODULE_AUTHOR ("Donggeun Kim <[email protected]>" );MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:max8997-muic" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 118/245 configfs: fix memleak in configfs_release_bin_file
In reply to Greg Kroah-HartmanFrom: Chung-Chiang Cheng <[email protected]>
[ Upstream commit 3c252b087de08d3cb32468b54a158bd7ad0ae2f7 ]
When reading binary attributes in progress, buffer->bin_buffer is setup in configfs_read_bin_file() but never freed.
--- fs/configfs/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/configfs/file.c +5 -5
@@ -496,13 +496,13 @@ static int configfs_release_bin_file(struct inode *inode, struct file *file) buffer->bin_buffer_size); }up_read (&frag->frag_sem); -/* vfree on NULL is safe */ -vfree (buffer->bin_buffer); - buffer->bin_buffer =NULL ; - buffer->bin_buffer_size =0 ; - buffer->needs_read_fill =1 ; } +vfree (buffer->bin_buffer); + buffer->bin_buffer =NULL ; + buffer->bin_buffer_size =0 ; + buffer->needs_read_fill =1 ; +configfs_release (inode, file);return 0 ; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 119/245 leds: ktd2692: Fix an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ee78b9360e14c276f5ceaa4a0d06f790f04ccdad ]
In 'ktd2692_parse_dt()', if an error occurs after a successful 'regulator_enable()' call, we should call 'regulator_enable()'.
This is the same in 'ktd2692_probe()', if an error occurs after a successful 'ktd2692_parse_dt()' call.
Instead of adding 'regulator_enable()' in several places, implement a resource managed solution and simplify the remove function accordingly.
--- drivers/leds/leds-ktd2692.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
drivers/leds/leds-ktd2692.c +18 -9
@@ -259,6 +259,17 @@ static void ktd2692_setup(struct ktd2692_context *led) | KTD2692_REG_FLASH_CURRENT_BASE); } +static void regulator_disable_action (void *_data) +{ +struct device *dev = _data; +struct ktd2692_context *led =dev_get_drvdata (dev); +int ret; + + ret =regulator_disable (led->regulator); +if (ret) +dev_err (dev,"Failed to disable supply: %d\n" , ret); +} +static int ktd2692_parse_dt (struct ktd2692_context *led,struct device *dev,struct ktd2692_led_config_data *cfg) {
@@ -289,8 +300,14 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,if (led->regulator) { ret =regulator_enable (led->regulator); -if (ret) +if (ret) {dev_err (dev,"Failed to enable supply: %d\n" , ret); + }else { + ret =devm_add_action_or_reset (dev, + regulator_disable_action, dev); +if (ret) +return ret; + } } child_node =of_get_next_available_child (np,NULL );
@@ -380,17 +397,9 @@ static int ktd2692_probe(struct platform_device *pdev)static int ktd2692_remove (struct platform_device *pdev) {struct ktd2692_context *led =platform_get_drvdata (pdev); -int ret;led_classdev_flash_unregister (&led->fled_cdev); -if (led->regulator) { - ret =regulator_disable (led->regulator); -if (ret) -dev_err (&pdev->dev, -"Failed to disable supply: %d\n" , ret); - } -mutex_destroy (&led->lock);return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 120/245 mm/huge_memory.c: dont discard hugepage if other processes are mapping it
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit babbbdd08af98a59089334eb3effbed5a7a0cf7f ]
If other processes are mapping any other subpages of the hugepage, i.e. in pte-mapped thp case, page_mapcount() will return 1 incorrectly. Then we would discard the page while other processes are still mapping it. Fix it by using total_mapcount() which can tell whether other processes are still mapping it.
--- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/huge_memory.c +1 -1
@@ -1369,7 +1369,7 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,* If other processes are mapping this page, we couldn't discard * the page unless they all do MADV_FREE so let's skip the page. */ -if (page_mapcount (page) !=1 ) +if (total_mapcount (page) !=1 ) goto out;if (!trylock_page (page))
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 121/245 selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
In reply to Greg Kroah-HartmanFrom: Dave Hansen <[email protected]>
[ Upstream commit f36ef407628835a7d7fb3d235b1f1aac7022d9a3 ]
Patch series "selftests/vm/pkeys: Bug fixes and a new test".
There has been a lot of activity on the x86 front around the XSAVE architecture which is used to context-switch processor state (among other things). In addition, AMD has recently joined the protection keys club by adding processor support for PKU.
The AMD implementation helped uncover a kernel bug around the PKRU "init state", which actually applied to Intel's implementation but was just harder to hit. This series adds a test which is expected to help find this class of bug both on AMD and Intel. All the work around pkeys on x86 also uncovered a few bugs in the selftest.
This patch (of 4):
The "random" pkey allocation code currently does the good old:
srand((unsigned int)time(NULL));
*But*, it unfortunately does this on every random pkey allocation.
There may be thousands of these a second. time() has a one second resolution. So, each time alloc_random_pkey() is called, the PRNG is *RESET* to time(). This is nasty. Normally, if you do:
srand(<ANYTHING>); foo = rand(); bar = rand();
You'll be quite guaranteed that 'foo' and 'bar' are different. But, if you do:
srand(1); foo = rand(); srand(1); bar = rand();
You are quite guaranteed that 'foo' and 'bar' are the *SAME*. The recent "fix" effectively forced the test case to use the same "random" pkey for the whole test, unless the test run crossed a second boundary.
Only run srand() once at program startup.
This explains some very odd and persistent test failures I've been seeing.
--- tools/testing/selftests/x86/protection_keys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/protection_keys.c +2 -1
@@ -609,7 +609,6 @@ int alloc_random_pkey(void)int nr_alloced =0 ;int random_index;memset (alloced_pkeys,0 ,sizeof (alloced_pkeys)); -srand ((unsigned int )time (NULL ));/* allocate every possible key and make a note of which ones we got */ max_nr_pkey_allocs =NR_PKEYS ;
@@ -1387,6 +1386,8 @@ int main(void) {int nr_iterations =22 ; +srand ((unsigned int )time (NULL )); +setup_handlers ();printf ("has pku: %d\n" ,cpu_has_pku ());
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 122/245 mmc: vub3000: fix control-request direction
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 3c0bb3107703d2c58f7a0a7a2060bb57bc120326 upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the SET_ROM_WAIT_STATES request which erroneously used usb_rcvctrlpipe().
--- drivers/mmc/host/vub300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/vub300.c +1 -1
@@ -2292,7 +2292,7 @@ static int vub300_probe(struct usb_interif (retval <0 ) goto error5; retval = -usb_control_msg (vub300->udev,usb_rcvctrlpipe (vub300->udev,0 ), +usb_control_msg (vub300->udev,usb_sndctrlpipe (vub300->udev,0 ),SET_ROM_WAIT_STATES ,USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_DEVICE , firmware_rom_wait_states,0x0000 ,NULL ,0 ,HZ );
Greg Kroah-Hartman
maintainerPATCH 123/245 scsi: core: Retry I/O for Notify (Enable Spinup) Required error
In reply to Greg Kroah-HartmanFrom: Quat Le <[email protected]>
commit 104739aca4488909175e9e31d5cd7d75b82a2046 upstream.
If the device is power-cycled, it takes time for the initiator to transmit the periodic NOTIFY (ENABLE SPINUP) SAS primitive, and for the device to respond to the primitive to become ACTIVE. Retry the I/O request to allow the device time to become ACTIVE.
--- drivers/scsi/scsi_lib.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/scsi_lib.c +1 -0
@@ -915,6 +915,7 @@ void scsi_io_completion(struct scsi_cmndcase 0x07 :/* operation in progress */ case 0x08 :/* Long write in progress */ case 0x09 :/* self test in progress */ +case 0x11 :/* notify (enable spinup) required */ case 0x14 :/* space allocation in progress */ action =ACTION_DELAYED_RETRY ;break ;
Greg Kroah-Hartman
maintainerPATCH 124/245 net: pch_gbe: Use proper accessors to BE data in pch_ptp_match()
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 443ef39b499cc9c6635f83238101f1bb923e9326 ]
Sparse is not happy about handling of strict types in pch_ptp_match():
.../pch_gbe_main.c:158:33: warning: incorrect type in argument 2 (different base types)
.../pch_gbe_main.c:158:33: expected unsigned short [usertype] uid_hi
.../pch_gbe_main.c:158:33: got restricted __be16 [usertype]
.../pch_gbe_main.c:158:45: warning: incorrect type in argument 3 (different base types)
.../pch_gbe_main.c:158:45: expected unsigned int [usertype] uid_lo
.../pch_gbe_main.c:158:45: got restricted __be32 [usertype]
.../pch_gbe_main.c:158:56: warning: incorrect type in argument 4 (different base types)
.../pch_gbe_main.c:158:56: expected unsigned short [usertype] seqid
.../pch_gbe_main.c:158:56: got restricted __be16 [usertype]
Fix that by switching to use proper accessors to BE data.
--- .../ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +6 -13
@@ -124,7 +124,7 @@ static int pch_ptp_match(struct sk_buff *skb, u16 uid_hi, u32 uid_lo, u16 seqid) {u8 *data = skb->data;unsigned int offset; -u16 *hi, *id; +u16 hi, id;u32 lo;if (ptp_classify_raw (skb) ==PTP_CLASS_NONE )
@@ -135,14 +135,11 @@ static int pch_ptp_match(struct sk_buff *skb, u16 uid_hi, u32 uid_lo, u16 seqid)if (skb->len < offset +OFF_PTP_SEQUENCE_ID +sizeof (seqid))return 0 ; - hi = (u16 *)(data + offset +OFF_PTP_SOURCE_UUID ); - id = (u16 *)(data + offset +OFF_PTP_SEQUENCE_ID ); + hi =get_unaligned_be16 (data + offset +OFF_PTP_SOURCE_UUID +0 ); + lo =get_unaligned_be32 (data + offset +OFF_PTP_SOURCE_UUID +2 ); + id =get_unaligned_be16 (data + offset +OFF_PTP_SEQUENCE_ID ); -memcpy (&lo, &hi[1 ],sizeof (lo)); - -return (uid_hi == *hi && - uid_lo == lo && - seqid == *id); +return (uid_hi == hi && uid_lo == lo && seqid == id); } static void
@@ -152,7 +149,6 @@ pch_rx_timestamp(struct pch_gbe_adapter *adapter, struct sk_buff *skb)struct pci_dev *pdev;u64 ns;u32 hi, lo, val; -u16 uid, seq;if (!adapter->hwts_rx_en)return ;
@@ -168,10 +164,7 @@ pch_rx_timestamp(struct pch_gbe_adapter *adapter, struct sk_buff *skb) lo =pch_src_uuid_lo_read (pdev); hi =pch_src_uuid_hi_read (pdev); - uid = hi &0xffff ; - seq = (hi >>16 ) &0xffff ; - -if (!pch_ptp_match (skb,htons (uid),htonl (lo),htons (seq))) +if (!pch_ptp_match (skb, hi, lo, hi >>16 )) goto out; ns =pch_rx_snap_read (pdev);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 125/245 hugetlb: clear huge pte during flush function on mips platform
In reply to Greg Kroah-HartmanFrom: Bibo Mao <[email protected]>
[ Upstream commit 33ae8f801ad8bec48e886d368739feb2816478f2 ]
If multiple threads are accessing the same huge page at the same time, hugetlb_cow will be called if one thread write the COW huge page. And function huge_ptep_clear_flush is called to notify other threads to clear the huge pte tlb entry. The other threads clear the huge pte tlb entry and reload it from page table, the reload huge pte entry may be old.
This patch fixes this issue on mips platform, and it clears huge pte entry before notifying other threads to flush current huge page entry, it is similar with other architectures.
--- arch/mips/include/asm/hugetlb.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/mips/include/asm/hugetlb.h +7 -1
@@ -67,7 +67,13 @@ static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,static inline void huge_ptep_clear_flush (struct vm_area_struct *vma,unsigned long addr,pte_t *ptep) { -flush_tlb_page (vma, addr &huge_page_mask (hstate_vma (vma))); +/* +* clear the huge pte entry firstly, so that the other smp threads will +* not get old pte entry after finishing flush_tlb_page and before +* setting new huge pte entry +*/ +huge_ptep_get_and_clear (vma->vm_mm, addr, ptep); +flush_tlb_page (vma, addr); }static inline int huge_pte_none (pte_t pte)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 126/245 atm: iphase: fix possible use-after-free in ia_module_exit()
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit 1c72e6ab66b9598cac741ed397438a52065a8f1f ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/atm/iphase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/atm/iphase.c +1 -1
@@ -3301,7 +3301,7 @@ static void __exit ia_module_exit(void) {pci_unregister_driver (&ia_driver); -del_timer (&ia_timer); +del_timer_sync (&ia_timer); }module_init (ia_module_init);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 127/245 mISDN: fix possible use-after-free in HFC_cleanup()
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit 009fc857c5f6fda81f2f7dd851b2d54193a8e733 ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/isdn/hardware/mISDN/hfcpci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/isdn/hardware/mISDN/hfcpci.c +1 -1
@@ -2352,7 +2352,7 @@ static void __exitHFC_cleanup (void) {if (timer_pending (&hfc_tl)) -del_timer (&hfc_tl); +del_timer_sync (&hfc_tl);pci_unregister_driver (&hfc_driver); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 128/245 atm: nicstar: Fix possible use-after-free in nicstar_cleanup()
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit 34e7434ba4e97f4b85c1423a59b2922ba7dff2ea ]
This module's remove path calls del_timer(). However, that function does not wait until the timer handler finishes. This means that the timer handler may still be running after the driver's remove function has finished, which would result in a use-after-free.
Fix by calling del_timer_sync(), which makes sure the timer handler has finished, and unable to re-schedule itself.
--- drivers/atm/nicstar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/atm/nicstar.c +1 -1
@@ -298,7 +298,7 @@ static void __exit nicstar_cleanup(void) {XPRINTK ("nicstar: nicstar_cleanup() called.\n" ); -del_timer (&ns_timer); +del_timer_sync (&ns_timer);pci_unregister_driver (&nicstar_driver);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 129/245 net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT
In reply to Greg Kroah-HartmanFrom: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 8380c81d5c4fced6f4397795a5ae65758272bbfd ]
__napi_schedule_irqoff() is an optimized version of __napi_schedule() which can be used where it is known that interrupts are disabled, e.g. in interrupt-handlers, spin_lock_irq() sections or hrtimer callbacks.
On PREEMPT_RT enabled kernels this assumptions is not true. Force- threaded interrupt handlers and spinlocks are not disabling interrupts and the NAPI hrtimer callback is forced into softirq context which runs with interrupts enabled as well.
Chasing all usage sites of __napi_schedule_irqoff() is a whack-a-mole game so make __napi_schedule_irqoff() invoke __napi_schedule() for PREEMPT_RT kernels.
The callers of ____napi_schedule() in the networking core have been audited and are correct on PREEMPT_RT kernels as well.
--- net/core/dev.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/core/dev.c +9 -2
@@ -4998,11 +4998,18 @@ EXPORT_SYMBOL(__napi_schedule);* __napi_schedule_irqoff - schedule for receive * @n: entry to schedule * -* Variant of __napi_schedule() assuming hard irqs are masked +* Variant of __napi_schedule() assuming hard irqs are masked. +* +* On PREEMPT_RT enabled kernels this maps to __napi_schedule() +* because the interrupt disabled assumption might not be true +* due to force-threaded interrupts and spinlock substitution. */ void __napi_schedule_irqoff (struct napi_struct *n) { -____napi_schedule (this_cpu_ptr (&softnet_data), n); +if (!IS_ENABLED (CONFIG_PREEMPT_RT )) +____napi_schedule (this_cpu_ptr (&softnet_data), n); +else +__napi_schedule (n); }EXPORT_SYMBOL (__napi_schedule_irqoff);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 130/245 reiserfs: add check for invalid 1st journal block
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit a149127be52fa7eaf5b3681a0317a2bbb772d5a9 ]
syzbot reported divide error in reiserfs.
The problem was in incorrect journal 1st block.
Syzbot's reproducer manualy generated wrong superblock with incorrect 1st block. In journal_init() wasn't any checks about this particular case.
For example, if 1st journal block is before superblock 1st block, it can cause zeroing important superblock members in do_journal_end().
--- fs/reiserfs/journal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/reiserfs/journal.c +14 -0
@@ -2766,6 +2766,20 @@ int journal_init(struct super_block *sb, const char *j_dev_name, goto free_and_return; } +/* +* Sanity check to see if journal first block is correct. +* If journal first block is invalid it can cause +* zeroing important superblock members. +*/ +if (!SB_ONDISK_JOURNAL_DEVICE (sb) && +SB_ONDISK_JOURNAL_1st_BLOCK (sb) <SB_JOURNAL_1st_RESERVED_BLOCK (sb)) { +reiserfs_warning (sb,"journal-1393" , +"journal 1st super block is invalid: 1st reserved block %d, but actual 1st block is %d" , +SB_JOURNAL_1st_RESERVED_BLOCK (sb), +SB_ONDISK_JOURNAL_1st_BLOCK (sb)); + goto free_and_return; + } +if (journal_init_dev (sb, journal, j_dev_name) !=0 ) {reiserfs_warning (sb,"sh-462" ,"unable to initialize journal device" );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 131/245 drm/virtio: Fix double free on probe failure
In reply to Greg Kroah-HartmanFrom: Xie Yongji <[email protected]>
[ Upstream commit cec7f1774605a5ef47c134af62afe7c75c30b0ee ]
The virtio_gpu_init() will free vgdev and vgdev->vbufs on failure. But such failure will be caught by virtio_gpu_probe() and then virtio_gpu_release() will be called to do some cleanup which will free vgdev and vgdev->vbufs again. So let's set dev->dev_private to NULL to avoid double free.
--- drivers/gpu/drm/virtio/virtgpu_kms.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/virtio/virtgpu_kms.c +1 -0
@@ -234,6 +234,7 @@ err_ttm: err_vbufs: vgdev->vdev->config->del_vqs (vgdev->vdev); err_vqs: + dev->dev_private =NULL ;kfree (vgdev);return ret; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 132/245 udf: Fix NULL pointer dereference in udf_symlink function
In reply to Greg Kroah-HartmanFrom: Arturo Giusti <[email protected]>
[ Upstream commit fa236c2b2d4436d9f19ee4e5d5924e90ffd7bb43 ]
In function udf_symlink, epos.bh is assigned with the value returned by udf_tgetblk. The function udf_tgetblk is defined in udf/misc.c and returns the value of sb_getblk function that could be NULL. Then, epos.bh is used without any check, causing a possible NULL pointer dereference when sb_getblk fails.
This fix adds a check to validate the value of epos.bh.
--- fs/udf/namei.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/udf/namei.c +4 -0
@@ -956,6 +956,10 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, iinfo->i_location.partitionReferenceNum, 0); epos.bh =udf_tgetblk (sb, block); +if (unlikely (!epos.bh)) { + err = -ENOMEM ; + goto out_no_entry; + }lock_buffer (epos.bh);memset (epos.bh->b_data,0x00 , bsize);set_buffer_uptodate (epos.bh);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 133/245 e100: handle eeprom as little endian
In reply to Greg Kroah-HartmanFrom: Jesse Brandeburg <[email protected]>
[ Upstream commit d4ef55288aa2e1b76033717242728ac98ddc4721 ]
Sparse tool was warning on some implicit conversions from little endian data read from the EEPROM on the e100 cards.
Fix these by being explicit about the conversions using le16_to_cpu().
--- drivers/net/ethernet/intel/e100.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/e100.c +6 -6
@@ -1423,7 +1423,7 @@ static int e100_phy_check_without_mii(struct nic *nic)u8 phy_type;int without_mii; - phy_type = (nic->eeprom[eeprom_phy_iface] >>8 ) &0x0f ; + phy_type = (le16_to_cpu (nic->eeprom[eeprom_phy_iface]) >>8 ) &0x0f ;switch (phy_type) {case NoSuchPhy:/* Non-MII PHY; UNTESTED! */
@@ -1543,7 +1543,7 @@ static int e100_phy_init(struct nic *nic)mdio_write (netdev, nic->mii.phy_id,MII_BMCR , bmcr); }else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && (mdio_read (netdev, nic->mii.phy_id,MII_TPISTATUS ) &0x8000 ) && - (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { + (le16_to_cpu (nic->eeprom[eeprom_cnfg_mdix]) & eeprom_mdix_enabled))) {/* enable/disable MDI/MDI-X auto-switching. */ mdio_write (netdev, nic->mii.phy_id,MII_NCONFIG , nic->mii.force_media ?0 :NCONFIG_AUTO_SWITCH );
@@ -2298,9 +2298,9 @@ static int e100_asf(struct nic *nic) {/* ASF can be enabled from eeprom */ return (nic->pdev->device >=0x1050 ) && (nic->pdev->device <=0x1057 ) && - (nic->eeprom[eeprom_config_asf] & eeprom_asf) && - !(nic->eeprom[eeprom_config_asf] & eeprom_gcl) && - ((nic->eeprom[eeprom_smbus_addr] &0xFF ) !=0xFE ); + (le16_to_cpu (nic->eeprom[eeprom_config_asf]) & eeprom_asf) && + !(le16_to_cpu (nic->eeprom[eeprom_config_asf]) & eeprom_gcl) && + ((le16_to_cpu (nic->eeprom[eeprom_smbus_addr]) &0xFF ) !=0xFE ); }static int e100_up (struct nic *nic)
@@ -2952,7 +2952,7 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* Wol magic packet can be enabled from eeprom */ if ((nic->mac >= mac_82558_D101_A4) && - (nic->eeprom[eeprom_id] & eeprom_id_wol)) { + (le16_to_cpu (nic->eeprom[eeprom_id]) & eeprom_id_wol)) { nic->flags |= wol_magic;device_set_wakeup_enable (&pdev->dev, true); }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 134/245 clk: tegra: Ensure that PLLU configuration is applied properly
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit a7196048cd5168096c2c4f44a3939d7a6dcd06b9 ]
The PLLU (USB) consists of the PLL configuration itself and configuration of the PLLU outputs. The PLLU programming is inconsistent on T30 vs T114, where T114 immediately bails out if PLLU is enabled and T30 re-enables a potentially already enabled PLL (left after bootloader) and then fully reprograms it, which could be unsafe to do. The correct way should be to skip enabling of the PLL if it's already enabled and then apply configuration to the outputs. This patch doesn't fix any known problems, it's a minor improvement.
--- drivers/clk/tegra/clk-pll.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-pll.c +4 -2
@@ -1085,7 +1085,8 @@ static int clk_pllu_enable(struct clk_hw *hw)if (pll->lock)spin_lock_irqsave (pll->lock, flags); -_clk_pll_enable (hw); +if (!clk_pll_is_enabled (hw)) +_clk_pll_enable (hw); ret =clk_pll_wait_for_lock (pll);if (ret <0 )
@@ -1702,7 +1703,8 @@ static int clk_pllu_tegra114_enable(struct clk_hw *hw)if (pll->lock)spin_lock_irqsave (pll->lock, flags); -_clk_pll_enable (hw); +if (!clk_pll_is_enabled (hw)) +_clk_pll_enable (hw); ret =clk_pll_wait_for_lock (pll);if (ret <0 )
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 135/245 ipv6: use prandom_u32() for ID generation
In reply to Greg Kroah-HartmanFrom: Willy Tarreau <[email protected]>
[ Upstream commit 62f20e068ccc50d6ab66fdb72ba90da2b9418c99 ]
This is a complement to commit aa6dd211e4b1 ("inet: use bigger hash table for IP ID generation"), but focusing on some specific aspects of IPv6.
Contary to IPv4, IPv6 only uses packet IDs with fragments, and with a minimum MTU of 1280, it's much less easy to force a remote peer to produce many fragments to explore its ID sequence. In addition packet IDs are 32-bit in IPv6, which further complicates their analysis. On the other hand, it is often easier to choose among plenty of possible source addresses and partially work around the bigger hash table the commit above permits, which leaves IPv6 partially exposed to some possibilities of remote analysis at the risk of weakening some protocols like DNS if some IDs can be predicted with a good enough probability.
Given the wide range of permitted IDs, the risk of collision is extremely low so there's no need to rely on the positive increment algorithm that is shared with the IPv4 code via ip_idents_reserve(). We have a fast PRNG, so let's simply call prandom_u32() and be done with it.
Performance measurements at 10 Gbps couldn't show any difference with the previous code, even when using a single core, because due to the large fragments, we're limited to only ~930 kpps at 10 Gbps and the cost of the random generation is completely offset by other operations and by the network transfer time. In addition, this change removes the need to update a shared entry in the idents table so it may even end up being slightly faster on large scale systems where this matters.
The risk of at least one collision here is about 1/80 million among 10 IDs, 1/850k among 100 IDs, and still only 1/8.5k among 1000 IDs, which remains very low compared to IPv4 where all IDs are reused every 4 to 80ms on a 10 Gbps flow depending on packet sizes.
--- net/ipv6/output_core.c | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-)
net/ipv6/output_core.c +5 -23
@@ -14,29 +14,11 @@ static u32 __ipv6_select_ident(struct net *net,const struct in6_addr *dst, const struct in6_addr *src) { -const struct { -struct in6_addr dst; -struct in6_addr src; - }__aligned(SIPHASH_ALIGNMENT) combined = { - .dst = *dst, - .src = *src, - }; -u32 hash, id; - -/* Note the following code is not safe, but this is okay. */ -if (unlikely (siphash_key_is_zero (&net->ipv4.ip_id_key))) -get_random_bytes (&net->ipv4.ip_id_key, -sizeof (net->ipv4.ip_id_key)); - - hash =siphash (&combined,sizeof (combined), &net->ipv4.ip_id_key); - -/* Treat id of 0 as unset and if we get 0 back from ip_idents_reserve, -* set the hight order instead thus minimizing possible future -* collisions. -*/ - id =ip_idents_reserve (hash,1 ); -if (unlikely (!id)) - id =1 <<31 ; + u32 id; + +do { + id =prandom_u32 (); + }while (!id);return id; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 136/245 RDMA/cxgb4: Fix missing error code in create_qp()
In reply to Greg Kroah-HartmanFrom: Jiapeng Chong <[email protected]>
[ Upstream commit aeb27bb76ad8197eb47890b1ff470d5faf8ec9a5 ]
The error code is missing in this code scenario so 0 will be returned. Add the error code '-EINVAL' to the return value 'ret'.
Eliminates the follow smatch warning:
drivers/infiniband/hw/cxgb4/qp.c:298 create_qp() warn: missing error code 'ret'.
--- drivers/infiniband/hw/cxgb4/qp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/qp.c +1 -0
@@ -277,6 +277,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,if (user && (!wq->sq.bar2_pa || !wq->rq.bar2_pa)) {pr_warn (MOD "%s: sqid %u or rqid %u not in BAR2 range.\n" ,pci_name (rdev->lldi.pdev), wq->sq.qid, wq->rq.qid); + ret = -EINVAL ; goto free_dma; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 137/245 dm space maps: dont reset space map allocation cursor when committing
In reply to Greg Kroah-HartmanFrom: Joe Thornber <[email protected]>
[ Upstream commit 5faafc77f7de69147d1e818026b9a0cbf036a7b2 ]
Current commit code resets the place where the search for free blocks will begin back to the start of the metadata device. There are a couple of repercussions to this:
- The first allocation after the commit is likely to take longer than normal as it searches for a free block in an area that is likely to have very few free blocks (if any).
- Any free blocks it finds will have been recently freed. Reusing them means we have fewer old copies of the metadata to aid recovery from hardware error.
Fix these issues by leaving the cursor alone, only resetting when the search hits the end of the metadata device.
--- drivers/md/persistent-data/dm-space-map-disk.c | 9 ++++++++- drivers/md/persistent-data/dm-space-map-metadata.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/md/persistent-data/dm-space-map-disk.c +8 -1
@@ -171,6 +171,14 @@ static int sm_disk_new_block(struct dm_space_map *sm, dm_block_t *b)* Any block we allocate has to be free in both the old and current ll. */ r =sm_ll_find_common_free_block (&smd->old_ll, &smd->ll, smd->begin, smd->ll.nr_blocks, b); +if (r == -ENOSPC ) { +/* +* There's no free block between smd->begin and the end of the metadata device. +* We search before smd->begin in case something has been freed. +*/ + r =sm_ll_find_common_free_block (&smd->old_ll, &smd->ll,0 , smd->begin, b); + } +if (r)return r;
@@ -199,7 +207,6 @@ static int sm_disk_commit(struct dm_space_map *sm)return r;memcpy (&smd->old_ll, &smd->ll,sizeof (smd->old_ll)); - smd->begin =0 ; smd->nr_allocated_this_transaction =0 ; r =sm_disk_get_nr_free (sm, &nr_free);
drivers/md/persistent-data/dm-space-map-metadata.c +8 -1
@@ -451,6 +451,14 @@ static int sm_metadata_new_block_(struct dm_space_map *sm, dm_block_t *b)* Any block we allocate has to be free in both the old and current ll. */ r =sm_ll_find_common_free_block (&smm->old_ll, &smm->ll, smm->begin, smm->ll.nr_blocks, b); +if (r == -ENOSPC ) { +/* +* There's no free block between smm->begin and the end of the metadata device. +* We search before smm->begin in case something has been freed. +*/ + r =sm_ll_find_common_free_block (&smm->old_ll, &smm->ll,0 , smm->begin, b); + } +if (r)return r;
@@ -502,7 +510,6 @@ static int sm_metadata_commit(struct dm_space_map *sm)return r;memcpy (&smm->old_ll, &smm->ll,sizeof (smm->old_ll)); - smm->begin =0 ; smm->allocated_this_transaction =0 ;return 0 ;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 138/245 net: micrel: check return value after calling platform_get_resource()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 20f1932e2282c58cb5ac59517585206cf5b385ae ]
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
--- drivers/net/ethernet/micrel/ks8842.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/micrel/ks8842.c +4 -0
@@ -1150,6 +1150,10 @@ static int ks8842_probe(struct platform_device *pdev)unsigned i; iomem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!iomem) { +dev_err (&pdev->dev,"Invalid resource\n" ); +return -EINVAL ; + }if (!request_mem_region (iomem->start,resource_size (iomem),DRV_NAME )) goto err_mem_region;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 139/245 fjes: check return value after calling platform_get_resource()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit f18c11812c949553d2b2481ecaa274dd51bed1e7 ]
It will cause null-ptr-deref if platform_get_resource() returns NULL, we need check the return value.
--- drivers/net/fjes/fjes_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/fjes/fjes_main.c +4 -0
@@ -1212,6 +1212,10 @@ static int fjes_probe(struct platform_device *plat_dev) adapter->interrupt_watch_enable = false; res =platform_get_resource (plat_dev,IORESOURCE_MEM ,0 ); +if (!res) { + err = -EINVAL ; + goto err_free_control_wq; + } hw->hw_res.start = res->start; hw->hw_res.size =resource_size (res); hw->hw_res.irq =platform_get_irq (plat_dev,0 );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 140/245 selinux: use __GFP_NOWARN with GFP_NOWAIT in the AVC
In reply to Greg Kroah-HartmanFrom: Minchan Kim <[email protected]>
[ Upstream commit 648f2c6100cfa18e7dfe43bc0b9c3b73560d623c ]
In the field, we have seen lots of allocation failure from the call path below.
06-03 13:29:12.999 1010315 31557 31557 W Binder : 31542_2: page allocation failure: order:0, mode:0x800(GFP_NOWAIT), nodemask=(null),cpuset=background,mems_allowed=0
...
...
06-03 13:29:12.999 1010315 31557 31557 W Call trace:
06-03 13:29:12.999 1010315 31557 31557 W : dump_backtrace.cfi_jt+0x0/0x8 06-03 13:29:12.999 1010315 31557 31557 W : dump_stack+0xc8/0x14c 06-03 13:29:12.999 1010315 31557 31557 W : warn_alloc+0x158/0x1c8 06-03 13:29:12.999 1010315 31557 31557 W : __alloc_pages_slowpath+0x9d8/0xb80 06-03 13:29:12.999 1010315 31557 31557 W : __alloc_pages_nodemask+0x1c4/0x430 06-03 13:29:12.999 1010315 31557 31557 W : allocate_slab+0xb4/0x390 06-03 13:29:12.999 1010315 31557 31557 W : ___slab_alloc+0x12c/0x3a4 06-03 13:29:12.999 1010315 31557 31557 W : kmem_cache_alloc+0x358/0x5e4 06-03 13:29:12.999 1010315 31557 31557 W : avc_alloc_node+0x30/0x184 06-03 13:29:12.999 1010315 31557 31557 W : avc_update_node+0x54/0x4f0 06-03 13:29:12.999 1010315 31557 31557 W : avc_has_extended_perms+0x1a4/0x460 06-03 13:29:12.999 1010315 31557 31557 W : selinux_file_ioctl+0x320/0x3d0 06-03 13:29:12.999 1010315 31557 31557 W : __arm64_sys_ioctl+0xec/0x1fc 06-03 13:29:12.999 1010315 31557 31557 W : el0_svc_common+0xc0/0x24c 06-03 13:29:12.999 1010315 31557 31557 W : el0_svc+0x28/0x88 06-03 13:29:12.999 1010315 31557 31557 W : el0_sync_handler+0x8c/0xf0 06-03 13:29:12.999 1010315 31557 31557 W : el0_sync+0x1a4/0x1c0 .. .. 06-03 13:29:12.999 1010315 31557 31557 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010315 31557 31557 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010315 31557 31557 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:12.999 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:12.999 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:12.999 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:12.999 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:12.999 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 1010161 10686 10686 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 1010161 10686 10686 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 1010161 10686 10686 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 10230 30892 30892 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 10230 30892 30892 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0 06-03 13:29:13.000 10230 30892 30892 W node 0 : slabs: 57, objs: 2907, free: 0 06-03 13:29:13.000 10230 30892 30892 W SLUB : Unable to allocate memory on node -1, gfp=0x900(GFP_NOWAIT|__GFP_ZERO) 06-03 13:29:13.000 10230 30892 30892 W cache : avc_node, object size: 72, buffer size: 80, default order: 0, min order: 0
Based on [1], selinux is tolerate for failure of memory allocation. Then, use __GFP_NOWARN together.
[1] 476accbe2f6e ("selinux: use GFP_NOWAIT in the AVC kmem_caches")
--- security/selinux/avc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
security/selinux/avc.c +7 -6
@@ -348,26 +348,27 @@ static struct avc_xperms_decision_nodestruct avc_xperms_decision_node *xpd_node;struct extended_perms_decision *xpd; - xpd_node =kmem_cache_zalloc (avc_xperms_decision_cachep,GFP_NOWAIT ); + xpd_node =kmem_cache_zalloc (avc_xperms_decision_cachep, +GFP_NOWAIT | __GFP_NOWARN);if (!xpd_node)return NULL ; xpd = &xpd_node->xpd;if (which &XPERMS_ALLOWED ) { xpd->allowed =kmem_cache_zalloc (avc_xperms_data_cachep, -GFP_NOWAIT ); +GFP_NOWAIT | __GFP_NOWARN);if (!xpd->allowed) goto error; }if (which &XPERMS_AUDITALLOW ) { xpd->auditallow =kmem_cache_zalloc (avc_xperms_data_cachep, -GFP_NOWAIT ); +GFP_NOWAIT | __GFP_NOWARN);if (!xpd->auditallow) goto error; }if (which &XPERMS_DONTAUDIT ) { xpd->dontaudit =kmem_cache_zalloc (avc_xperms_data_cachep, -GFP_NOWAIT ); +GFP_NOWAIT | __GFP_NOWARN);if (!xpd->dontaudit) goto error; }
@@ -395,7 +396,7 @@ static struct avc_xperms_node *avc_xperms_alloc(void) {struct avc_xperms_node *xp_node; - xp_node =kmem_cache_zalloc (avc_xperms_cachep,GFP_NOWAIT ); + xp_node =kmem_cache_zalloc (avc_xperms_cachep,GFP_NOWAIT | __GFP_NOWARN);if (!xp_node)return xp_node;INIT_LIST_HEAD (&xp_node->xpd_head);
@@ -548,7 +549,7 @@ static struct avc_node *avc_alloc_node(void) {struct avc_node *node; - node =kmem_cache_zalloc (avc_node_cachep,GFP_NOWAIT ); + node =kmem_cache_zalloc (avc_node_cachep,GFP_NOWAIT | __GFP_NOWARN);if (!node) goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 141/245 xfrm: Fix error reporting in xfrm_state_construct.
In reply to Greg Kroah-HartmanFrom: Steffen Klassert <[email protected]>
[ Upstream commit 6fd06963fa74197103cdbb4b494763127b3f2f34 ]
When memory allocation for XFRMA_ENCAP or XFRMA_COADDR fails, the error will not be reported because the -ENOMEM assignment to the err variable is overwritten before. Fix this by moving these two in front of the function so that memory allocation failures will be reported.
--- net/xfrm/xfrm_user.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
net/xfrm/xfrm_user.c +14 -14
@@ -566,6 +566,20 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,copy_from_user_state (x, p); +if (attrs[XFRMA_ENCAP ]) { + x->encap =kmemdup (nla_data (attrs[XFRMA_ENCAP ]), +sizeof (*x->encap),GFP_KERNEL ); +if (x->encap ==NULL ) + goto error; + } + +if (attrs[XFRMA_COADDR ]) { + x->coaddr =kmemdup (nla_data (attrs[XFRMA_COADDR ]), +sizeof (*x->coaddr),GFP_KERNEL ); +if (x->coaddr ==NULL ) + goto error; + } +if (attrs[XFRMA_SA_EXTRA_FLAGS ]) x->props.extra_flags =nla_get_u32 (attrs[XFRMA_SA_EXTRA_FLAGS ]);
@@ -586,23 +600,9 @@ static struct xfrm_state *xfrm_state_construct(struct net *net, attrs[XFRMA_ALG_COMP]))) goto error; -if (attrs[XFRMA_ENCAP ]) { - x->encap =kmemdup (nla_data (attrs[XFRMA_ENCAP ]), -sizeof (*x->encap),GFP_KERNEL ); -if (x->encap ==NULL ) - goto error; - } -if (attrs[XFRMA_TFCPAD ]) x->tfcpad =nla_get_u32 (attrs[XFRMA_TFCPAD ]); -if (attrs[XFRMA_COADDR ]) { - x->coaddr =kmemdup (nla_data (attrs[XFRMA_COADDR ]), -sizeof (*x->coaddr),GFP_KERNEL ); -if (x->coaddr ==NULL ) - goto error; - } -xfrm_mark_get (attrs, &x->mark); err =__xfrm_init_state (x, false);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 142/245 wlcore/wl12xx: Fix wl12xx get_mac error if device is in ELP
In reply to Greg Kroah-HartmanFrom: Tony Lindgren <[email protected]>
[ Upstream commit 11ef6bc846dcdce838f0b00c5f6a562c57e5d43b ]
At least on wl12xx, reading the MAC after boot can fail with a warning at drivers/net/wireless/ti/wlcore/sdio.c:78 wl12xx_sdio_raw_read. The failed call comes from wl12xx_get_mac() that wlcore_nvs_cb() calls after request_firmware_work_func().
After the error, no wireless interface is created. Reloading the wl12xx module makes the interface work.
Turns out the wlan controller can be in a low-power ELP state after the boot from the bootloader or kexec, and needs to be woken up first.
Let's wake the hardware and add a sleep after that similar to wl12xx_pre_boot() is already doing.
Note that a similar issue could exist for wl18xx, but I have not seen it so far. And a search for wl18xx_get_mac and wl12xx_sdio_raw_read did not produce similar errors.
--- drivers/net/wireless/ti/wl12xx/main.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/ti/wl12xx/main.c +7 -0
@@ -1516,6 +1516,13 @@ static int wl12xx_get_fuse_mac(struct wl1271 *wl)u32 mac1, mac2;int ret; +/* Device may be in ELP from the bootloader or kexec */ + ret =wlcore_write32 (wl,WL12XX_WELP_ARM_COMMAND ,WELP_ARM_COMMAND_VAL ); +if (ret <0 ) + goto out; + +usleep_range (500000 ,700000 ); + ret =wlcore_set_partition (wl, &wl->ptable[PART_DRPW ]);if (ret <0 ) goto out;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 143/245 wl1251: Fix possible buffer overflow in wl1251_cmd_scan
In reply to Greg Kroah-HartmanFrom: Lee Gibson <[email protected]>
[ Upstream commit d10a87a3535cce2b890897914f5d0d83df669c63 ]
Function wl1251_cmd_scan calls memcpy without checking the length. Harden by checking the length is within the maximum allowed size.
--- drivers/net/wireless/ti/wl1251/cmd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ti/wl1251/cmd.c +6 -3
@@ -465,9 +465,12 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len, cmd->channels[i].channel = channels[i]->hw_value; } - cmd->params.ssid_len = ssid_len; -if (ssid) -memcpy (cmd->params.ssid, ssid, ssid_len); +if (ssid) { +int len =clamp_val (ssid_len,0 ,IEEE80211_MAX_SSID_LEN ); + + cmd->params.ssid_len = len; +memcpy (cmd->params.ssid, ssid, len); + } ret =wl1251_cmd_send (wl,CMD_SCAN , cmd,sizeof (*cmd));if (ret <0 ) {
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 144/245 cw1200: add missing MODULE_DEVICE_TABLE
In reply to Greg Kroah-HartmanFrom: Zou Wei <[email protected]>
[ Upstream commit dd778f89225cd258e8f0fed2b7256124982c8bb5 ]
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module.
--- drivers/net/wireless/st/cw1200/cw1200_sdio.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/st/cw1200/cw1200_sdio.c +1 -0
@@ -62,6 +62,7 @@ static const struct sdio_device_id cw1200_sdio_ids[] = { { SDIO_DEVICE(SDIO_VENDOR_ID_STE, SDIO_DEVICE_ID_STE_CW1200) }, { /* end: all zeroes */ }, }; +MODULE_DEVICE_TABLE (sdio, cw1200_sdio_ids);/* hwbus_ops implemetation */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 145/245 MIPS: add PMD table accounting into MIPSpmd_alloc_one
In reply to Greg Kroah-HartmanFrom: Huang Pei <[email protected]>
[ Upstream commit ed914d48b6a1040d1039d371b56273d422c0081e ]
This fixes Page Table accounting bug.
MIPS is the ONLY arch just defining __HAVE_ARCH_PMD_ALLOC_ONE alone. Since commit b2b29d6d011944 (mm: account PMD tables like PTE tables), "pmd_free" in asm-generic with PMD table accounting and "pmd_alloc_one" in MIPS without PMD table accounting causes PageTable accounting number negative, which read by global_zone_page_state(), always returns 0.
--- arch/mips/include/asm/pgalloc.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/mips/include/asm/pgalloc.h +7 -3
@@ -107,11 +107,15 @@ do { \static inline pmd_t *pmd_alloc_one (struct mm_struct *mm,unsigned long address) { -pmd_t *pmd; +pmd_t *pmd =NULL ; +struct page *pg; - pmd = (pmd_t *)__get_free_pages (GFP_KERNEL ,PMD_ORDER ); -if (pmd) + pg =alloc_pages (GFP_KERNEL | __GFP_ACCOUNT,PMD_ORDER ); +if (pg) { +pgtable_pmd_page_ctor (pg); + pmd = (pmd_t *)page_address (pg);pmd_init ((unsigned long )pmd, (unsigned long )invalid_pte_table); + }return pmd; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 146/245 atm: nicstar: use dma_free_coherent instead of kfree
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 6a1e5a4af17e440dd82a58a2c5f40ff17a82b722 ]
When 'nicstar_init_one' fails, 'ns_init_card_error' will be executed for error handling, but the correct memory free function should be used, otherwise it will cause an error. Since 'card->rsq.org' and 'card->tsq.org' are allocated using 'dma_alloc_coherent' function, they should be freed using 'dma_free_coherent'.
Fix this by using 'dma_free_coherent' instead of 'kfree'
This log reveals it:
[ 3.440294] kernel BUG at mm/slub.c:4206! [ 3.441059] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 3.441430] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #141 [ 3.441986] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 3.442780] RIP: 0010:kfree+0x26a/0x300 [ 3.443065] Code: e8 3a c3 b9 ff e9 d6 fd ff ff 49 8b 45 00 31 db a9 00 00 01 00 75 4d 49 8b 45 00 a9 00 00 01 00 75 0a 49 8b 45 08 a8 01 75 02 <0f> 0b 89 d9 b8 00 10 00 00 be 06 00 00 00 48 d3 e0 f7 d8 48 63 d0 [ 3.443396] RSP: 0000:ffffc90000017b70 EFLAGS: 00010246 [ 3.443396] RAX: dead000000000100 RBX: 0000000000000000 RCX: 0000000000000000 [ 3.443396] RDX: 0000000000000000 RSI: ffffffff85d3df94 RDI: ffffffff85df38e6 [ 3.443396] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000001 [ 3.443396] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888107dc0000 [ 3.443396] R13: ffffea00001f0100 R14: ffff888101a8bf00 R15: ffff888107dc0160 [ 3.443396] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 3.443396] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.443396] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0 [ 3.443396] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3.443396] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3.443396] Call Trace: [ 3.443396] ns_init_card_error+0x12c/0x220 [ 3.443396] nicstar_init_one+0x10d2/0x1130 [ 3.443396] local_pci_probe+0x4a/0xb0 [ 3.443396] pci_device_probe+0x126/0x1d0 [ 3.443396] ? pci_device_remove+0x100/0x100 [ 3.443396] really_probe+0x27e/0x650 [ 3.443396] driver_probe_device+0x84/0x1d0 [ 3.443396] ? mutex_lock_nested+0x16/0x20 [ 3.443396] device_driver_attach+0x63/0x70 [ 3.443396] __driver_attach+0x117/0x1a0 [ 3.443396] ? device_driver_attach+0x70/0x70 [ 3.443396] bus_for_each_dev+0xb6/0x110 [ 3.443396] ? rdinit_setup+0x40/0x40 [ 3.443396] driver_attach+0x22/0x30 [ 3.443396] bus_add_driver+0x1e6/0x2a0 [ 3.443396] driver_register+0xa4/0x180 [ 3.443396] __pci_register_driver+0x77/0x80 [ 3.443396] ? uPD98402_module_init+0xd/0xd [ 3.443396] nicstar_init+0x1f/0x75 [ 3.443396] do_one_initcall+0x7a/0x3d0 [ 3.443396] ? rdinit_setup+0x40/0x40 [ 3.443396] ? rcu_read_lock_sched_held+0x4a/0x70 [ 3.443396] kernel_init_freeable+0x2a7/0x2f9 [ 3.443396] ? rest_init+0x2c0/0x2c0 [ 3.443396] kernel_init+0x13/0x180 [ 3.443396] ? rest_init+0x2c0/0x2c0 [ 3.443396] ? rest_init+0x2c0/0x2c0 [ 3.443396] ret_from_fork+0x1f/0x30 [ 3.443396] Modules linked in: [ 3.443396] Dumping ftrace buffer: [ 3.443396] (ftrace buffer empty) [ 3.458593] ---[ end trace 3c6f8f0d8ef59bcd ]--- [ 3.458922] RIP: 0010:kfree+0x26a/0x300 [ 3.459198] Code: e8 3a c3 b9 ff e9 d6 fd ff ff 49 8b 45 00 31 db a9 00 00 01 00 75 4d 49 8b 45 00 a9 00 00 01 00 75 0a 49 8b 45 08 a8 01 75 02 <0f> 0b 89 d9 b8 00 10 00 00 be 06 00 00 00 48 d3 e0 f7 d8 48 63 d0 [ 3.460499] RSP: 0000:ffffc90000017b70 EFLAGS: 00010246 [ 3.460870] RAX: dead000000000100 RBX: 0000000000000000 RCX: 0000000000000000 [ 3.461371] RDX: 0000000000000000 RSI: ffffffff85d3df94 RDI: ffffffff85df38e6 [ 3.461873] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000001 [ 3.462372] R10: 0000000000000000 R11: 0000000000000001 R12: ffff888107dc0000 [ 3.462871] R13: ffffea00001f0100 R14: ffff888101a8bf00 R15: ffff888107dc0160 [ 3.463368] FS: 0000000000000000(0000) GS:ffff88817bc80000(0000) knlGS:0000000000000000 [ 3.463949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.464356] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0 [ 3.464856] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3.465356] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3.465860] Kernel panic - not syncing: Fatal exception [ 3.466370] Dumping ftrace buffer: [ 3.466616] (ftrace buffer empty) [ 3.466871] Kernel Offset: disabled [ 3.467122] Rebooting in 1 seconds..
--- drivers/atm/nicstar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/atm/nicstar.c +4 -2
@@ -838,10 +838,12 @@ static void ns_init_card_error(ns_dev *card, int error)dev_kfree_skb_any (hb); }if (error >=12 ) { -kfree (card->rsq.org); +dma_free_coherent (&card->pcidev->dev,NS_RSQSIZE +NS_RSQ_ALIGNMENT , + card->rsq.org, card->rsq.dma); }if (error >=11 ) { -kfree (card->tsq.org); +dma_free_coherent (&card->pcidev->dev,NS_TSQSIZE +NS_TSQ_ALIGNMENT , + card->tsq.org, card->tsq.dma); }if (error >=10 ) {free_irq (card->pcidev->irq, card);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 147/245 atm: nicstar: register the interrupt handler in the right place
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 70b639dc41ad499384e41e106fce72e36805c9f2 ]
Because the error handling is sequential, the application of resources should be carried out in the order of error handling, so the operation of registering the interrupt handler should be put in front, so as not to free the unregistered interrupt handler during error handling.
This log reveals it:
[ 3.438724] Trying to free already-free IRQ 23 [ 3.439060] WARNING: CPU: 5 PID: 1 at kernel/irq/manage.c:1825 free_irq+0xfb/0x480 [ 3.440039] Modules linked in: [ 3.440257] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #142 [ 3.440793] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 3.441561] RIP: 0010:free_irq+0xfb/0x480 [ 3.441845] Code: 6e 08 74 6f 4d 89 f4 e8 c3 78 09 00 4d 8b 74 24 18 4d 85 f6 75 e3 e8 b4 78 09 00 8b 75 c8 48 c7 c7 a0 ac d5 85 e8 95 d7 f5 ff <0f> 0b 48 8b 75 c0 4c 89 ff e8 87 c5 90 03 48 8b 43 40 4c 8b a0 80 [ 3.443121] RSP: 0000:ffffc90000017b50 EFLAGS: 00010086 [ 3.443483] RAX: 0000000000000000 RBX: ffff888107c6f000 RCX: 0000000000000000 [ 3.443972] RDX: 0000000000000000 RSI: ffffffff8123f301 RDI: 00000000ffffffff [ 3.444462] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000003 [ 3.444950] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 [ 3.444994] R13: ffff888107dc0000 R14: ffff888104f6bf00 R15: ffff888107c6f0a8 [ 3.444994] FS: 0000000000000000(0000) GS:ffff88817bd40000(0000) knlGS:0000000000000000 [ 3.444994] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.444994] CR2: 0000000000000000 CR3: 000000000642e000 CR4: 00000000000006e0 [ 3.444994] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3.444994] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3.444994] Call Trace: [ 3.444994] ns_init_card_error+0x18e/0x250 [ 3.444994] nicstar_init_one+0x10d2/0x1130 [ 3.444994] local_pci_probe+0x4a/0xb0 [ 3.444994] pci_device_probe+0x126/0x1d0 [ 3.444994] ? pci_device_remove+0x100/0x100 [ 3.444994] really_probe+0x27e/0x650 [ 3.444994] driver_probe_device+0x84/0x1d0 [ 3.444994] ? mutex_lock_nested+0x16/0x20 [ 3.444994] device_driver_attach+0x63/0x70 [ 3.444994] __driver_attach+0x117/0x1a0 [ 3.444994] ? device_driver_attach+0x70/0x70 [ 3.444994] bus_for_each_dev+0xb6/0x110 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] driver_attach+0x22/0x30 [ 3.444994] bus_add_driver+0x1e6/0x2a0 [ 3.444994] driver_register+0xa4/0x180 [ 3.444994] __pci_register_driver+0x77/0x80 [ 3.444994] ? uPD98402_module_init+0xd/0xd [ 3.444994] nicstar_init+0x1f/0x75 [ 3.444994] do_one_initcall+0x7a/0x3d0 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] ? rcu_read_lock_sched_held+0x4a/0x70 [ 3.444994] kernel_init_freeable+0x2a7/0x2f9 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] kernel_init+0x13/0x180 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ret_from_fork+0x1f/0x30 [ 3.444994] Kernel panic - not syncing: panic_on_warn set ... [ 3.444994] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.12.4-g70e7f0549188-dirty #142 [ 3.444994] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 3.444994] Call Trace: [ 3.444994] dump_stack+0xba/0xf5 [ 3.444994] ? free_irq+0xfb/0x480 [ 3.444994] panic+0x155/0x3ed [ 3.444994] ? __warn+0xed/0x150 [ 3.444994] ? free_irq+0xfb/0x480 [ 3.444994] __warn+0x103/0x150 [ 3.444994] ? free_irq+0xfb/0x480 [ 3.444994] report_bug+0x119/0x1c0 [ 3.444994] handle_bug+0x3b/0x80 [ 3.444994] exc_invalid_op+0x18/0x70 [ 3.444994] asm_exc_invalid_op+0x12/0x20 [ 3.444994] RIP: 0010:free_irq+0xfb/0x480 [ 3.444994] Code: 6e 08 74 6f 4d 89 f4 e8 c3 78 09 00 4d 8b 74 24 18 4d 85 f6 75 e3 e8 b4 78 09 00 8b 75 c8 48 c7 c7 a0 ac d5 85 e8 95 d7 f5 ff <0f> 0b 48 8b 75 c0 4c 89 ff e8 87 c5 90 03 48 8b 43 40 4c 8b a0 80 [ 3.444994] RSP: 0000:ffffc90000017b50 EFLAGS: 00010086 [ 3.444994] RAX: 0000000000000000 RBX: ffff888107c6f000 RCX: 0000000000000000 [ 3.444994] RDX: 0000000000000000 RSI: ffffffff8123f301 RDI: 00000000ffffffff [ 3.444994] RBP: ffffc90000017b90 R08: 0000000000000001 R09: 0000000000000003 [ 3.444994] R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000 [ 3.444994] R13: ffff888107dc0000 R14: ffff888104f6bf00 R15: ffff888107c6f0a8 [ 3.444994] ? vprintk_func+0x71/0x110 [ 3.444994] ns_init_card_error+0x18e/0x250 [ 3.444994] nicstar_init_one+0x10d2/0x1130 [ 3.444994] local_pci_probe+0x4a/0xb0 [ 3.444994] pci_device_probe+0x126/0x1d0 [ 3.444994] ? pci_device_remove+0x100/0x100 [ 3.444994] really_probe+0x27e/0x650 [ 3.444994] driver_probe_device+0x84/0x1d0 [ 3.444994] ? mutex_lock_nested+0x16/0x20 [ 3.444994] device_driver_attach+0x63/0x70 [ 3.444994] __driver_attach+0x117/0x1a0 [ 3.444994] ? device_driver_attach+0x70/0x70 [ 3.444994] bus_for_each_dev+0xb6/0x110 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] driver_attach+0x22/0x30 [ 3.444994] bus_add_driver+0x1e6/0x2a0 [ 3.444994] driver_register+0xa4/0x180 [ 3.444994] __pci_register_driver+0x77/0x80 [ 3.444994] ? uPD98402_module_init+0xd/0xd [ 3.444994] nicstar_init+0x1f/0x75 [ 3.444994] do_one_initcall+0x7a/0x3d0 [ 3.444994] ? rdinit_setup+0x40/0x40 [ 3.444994] ? rcu_read_lock_sched_held+0x4a/0x70 [ 3.444994] kernel_init_freeable+0x2a7/0x2f9 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] kernel_init+0x13/0x180 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ? rest_init+0x2c0/0x2c0 [ 3.444994] ret_from_fork+0x1f/0x30 [ 3.444994] Dumping ftrace buffer: [ 3.444994] (ftrace buffer empty) [ 3.444994] Kernel Offset: disabled [ 3.444994] Rebooting in 1 seconds..
--- drivers/atm/nicstar.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/atm/nicstar.c +9 -9
@@ -526,6 +526,15 @@ static int ns_init_card(int i, struct pci_dev *pcidev)/* Set the VPI/VCI MSb mask to zero so we can receive OAM cells */ writel (0x00000000 , card->membase +VPM ); + card->intcnt =0 ; +if (request_irq + (pcidev->irq, &ns_irq_handler,IRQF_SHARED ,"nicstar" , card) !=0 ) { +pr_err ("nicstar%d: can't allocate IRQ %d.\n" , i, pcidev->irq); + error =9 ; +ns_init_card_error (card, error); +return error; + } +/* Initialize TSQ */ card->tsq.org = dma_alloc_coherent(&card->pcidev->dev, NS_TSQSIZE + NS_TSQ_ALIGNMENT,
@@ -752,15 +761,6 @@ static int ns_init_card(int i, struct pci_dev *pcidev) card->efbie =1 ; - card->intcnt =0 ; -if (request_irq - (pcidev->irq, &ns_irq_handler,IRQF_SHARED ,"nicstar" , card) !=0 ) { -printk ("nicstar%d: can't allocate IRQ %d.\n" , i, pcidev->irq); - error =9 ; -ns_init_card_error (card, error); -return error; - } -/* Register device */ card->atmdev =atm_dev_register ("nicstar" , &card->pcidev->dev, &atm_ops,-1 ,NULL );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 148/245 RDMA/rxe: Dont overwrite errno from ib_umem_get()
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit 20ec0a6d6016aa28b9b3299be18baef1a0f91cd2 ]
rxe_mr_init_user() always returns the fixed -EINVAL when ib_umem_get() fails so it's hard for user to know which actual error happens in ib_umem_get(). For example, ib_umem_get() will return -EOPNOTSUPP when trying to pin pages on a DAX file.
Return actual error as mlx4/mlx5 does.
--- drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_mr.c +1 -1
@@ -175,7 +175,7 @@ int rxe_mem_init_user(struct rxe_dev *rxe, struct rxe_pd *pd, u64 start,if (IS_ERR (umem)) {pr_warn ("err %d from rxe_umem_get\n" , (int )PTR_ERR (umem)); - err = -EINVAL ; + err =PTR_ERR (umem); goto err1; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 149/245 sfc: avoid double pci_remove of VFs
In reply to Greg Kroah-HartmanFrom: Íñigo Huguet <[email protected]>
[ Upstream commit 45423cff1db66cf0993e8a9bd0ac93e740149e49 ]
If pci_remove was called for a PF with VFs, the removal of the VFs was called twice from efx_ef10_sriov_fini: one directly with pci_driver->remove and another implicit by calling pci_disable_sriov, which also perform the VFs remove. This was leading to crashing the kernel on the second attempt.
Given that pci_disable_sriov already calls to pci remove function, get rid of the direct call to pci_driver->remove from the driver.
2 different ways to trigger the bug:
- Create one or more VFs, then attach the PF to a virtual machine (at least with qemu/KVM)
- Create one or more VFs, then remove the PF with:
echo 1 > /sys/bus/pci/devices/PF_PCI_ID/remove
Removing sfc module does not trigger the error, at least for me, because it removes the VF first, and then the PF.
Example of a log with the error:
list_del corruption, ffff967fd20a8ad0->next is LIST_POISON1 (dead000000000100)
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:47!
[...trimmed...]
RIP: 0010:__list_del_entry_valid.cold.1+0x12/0x4c
[...trimmed...]
Call Trace:
efx_dissociate+0x1f/0x140 [sfc]
efx_pci_remove+0x27/0x150 [sfc]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0x103/0x1f0
pci_stop_bus_device+0x69/0x90
pci_stop_and_remove_bus_device+0xe/0x20
pci_iov_remove_virtfn+0xba/0x120
sriov_disable+0x2f/0xe0
efx_ef10_pci_sriov_disable+0x52/0x80 [sfc]
? pcie_aer_is_native+0x12/0x40
efx_ef10_sriov_fini+0x72/0x110 [sfc]
efx_pci_remove+0x62/0x150 [sfc]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0x103/0x1f0
unbind_store+0xf6/0x130
kernfs_fop_write+0x116/0x190
vfs_write+0xa5/0x1a0
ksys_write+0x4f/0xb0
do_syscall_64+0x5b/0x1a0
entry_SYSCALL_64_after_hwframe+0x65/0xca--- drivers/net/ethernet/sfc/ef10_sriov.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/ethernet/sfc/ef10_sriov.c +1 -9
@@ -442,7 +442,6 @@ int efx_ef10_sriov_init(struct efx_nic *efx)void efx_ef10_sriov_fini (struct efx_nic *efx) {struct efx_ef10_nic_data *nic_data = efx->nic_data; -unsigned int i;int rc;if (!nic_data->vf) {
@@ -452,14 +451,7 @@ void efx_ef10_sriov_fini(struct efx_nic *efx)return ; } -/* Remove any VFs in the host */ -for (i =0 ; i < efx->vf_count; ++i) { -struct efx_nic *vf_efx = nic_data->vf[i].efx; - -if (vf_efx) - vf_efx->pci_dev->driver->remove (vf_efx->pci_dev); - } - +/* Disable SRIOV and remove any VFs in the host */ rc =efx_ef10_pci_sriov_disable (efx, true);if (rc) netif_dbg(efx, drv, efx->net_dev,
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 150/245 sfc: error code if SRIOV cannot be disabled
In reply to Greg Kroah-HartmanFrom: Íñigo Huguet <[email protected]>
[ Upstream commit 1ebe4feb8b442884f5a28d2437040096723dd1ea ]
If SRIOV cannot be disabled during device removal or module unloading, return error code so it can be logged properly in the calling function.
Note that this can only happen if any VF is currently attached to a guest using Xen, but not with vfio/KVM. Despite that in that case the VFs won't work properly with PF removed and/or the module unloaded, I have let it as is because I don't know what side effects may have changing it, and also it seems to be the same that other drivers are doing in this situation.
In the case of being called during SRIOV reconfiguration, the behavior hasn't changed because the function is called with force=false.
--- drivers/net/ethernet/sfc/ef10_sriov.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/net/ethernet/sfc/ef10_sriov.c +11 -4
@@ -405,12 +405,17 @@ fail1:return rc; } +/* Disable SRIOV and remove VFs +* If some VFs are attached to a guest (using Xen, only) nothing is +* done if force=false, and vports are freed if force=true (for the non +* attachedc ones, only) but SRIOV is not disabled and VFs are not +* removed in either case. +*/ static int efx_ef10_pci_sriov_disable (struct efx_nic *efx,bool force) {struct pci_dev *dev = efx->pci_dev; -unsigned int vfs_assigned =0 ; - - vfs_assigned =pci_vfs_assigned (dev); +unsigned int vfs_assigned =pci_vfs_assigned (dev); +int rc =0 ;if (vfs_assigned && !force) { netif_info(efx, drv, efx->net_dev, "VFs are assigned to guests; "
@@ -420,10 +425,12 @@ static int efx_ef10_pci_sriov_disable(struct efx_nic *efx, bool force)if (!vfs_assigned)pci_disable_sriov (dev); +else + rc = -EBUSY ;efx_ef10_sriov_free_vf_vswitching (efx); efx->vf_count =0 ; -return 0 ; +return rc; }int efx_ef10_sriov_configure (struct efx_nic *efx,int num_vfs)
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 151/245 wireless: wext-spy: Fix out-of-bounds warning
In reply to Greg Kroah-HartmanFrom: Gustavo A. R. Silva <[email protected]>
[ Upstream commit e93bdd78406da9ed01554c51e38b2a02c8ef8025 ]
Fix the following out-of-bounds warning:
net/wireless/wext-spy.c:178:2: warning: 'memcpy' offset [25, 28] from the object at 'threshold' is out of the bounds of referenced subobject 'low' with type 'struct iw_quality' at offset 20 [-Warray-bounds]
The problem is that the original code is trying to copy data into a couple of struct members adjacent to each other in a single call to memcpy(). This causes a legitimate compiler warning because memcpy() overruns the length of &threshold.low and &spydata->spy_thr_low. As these are just a couple of struct members, fix this by using direct assignments, instead of memcpy().
This helps with the ongoing efforts to globally enable -Warray-bounds and get us closer to being able to tighten the FORTIFY_SOURCE routines on memcpy().
--- net/wireless/wext-spy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
net/wireless/wext-spy.c +7 -7
@@ -120,8 +120,8 @@ int iw_handler_set_thrspy(struct net_device * dev,return -EOPNOTSUPP ;/* Just do it */ -memcpy (&(spydata->spy_thr_low), &(threshold->low), -2 *sizeof (struct iw_quality )); + spydata->spy_thr_low = threshold->low; + spydata->spy_thr_high = threshold->high;/* Clear flag */ memset (spydata->spy_thr_under,'\0' ,sizeof (spydata->spy_thr_under));
@@ -147,8 +147,8 @@ int iw_handler_get_thrspy(struct net_device * dev,return -EOPNOTSUPP ;/* Just do it */ -memcpy (&(threshold->low), &(spydata->spy_thr_low), -2 *sizeof (struct iw_quality )); + threshold->low = spydata->spy_thr_low; + threshold->high = spydata->spy_thr_high;return 0 ; }
@@ -173,10 +173,10 @@ static void iw_send_thrspy_event(struct net_device * dev,memcpy (threshold.addr.sa_data, address,ETH_ALEN ); threshold.addr.sa_family =ARPHRD_ETHER ;/* Copy stats */ -memcpy (&(threshold.qual), wstats,sizeof (struct iw_quality )); + threshold.qual = *wstats;/* Copy also thresholds */ -memcpy (&(threshold.low), &(spydata->spy_thr_low), -2 *sizeof (struct iw_quality )); + threshold.low = spydata->spy_thr_low; + threshold.high = spydata->spy_thr_high;/* Send event to user space */ wireless_send_event (dev,SIOCGIWTHRSPY , &wrqu, (char *) &threshold);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 152/245 RDMA/cma: Fix rdma_resolve_route() memory leak
In reply to Greg Kroah-HartmanFrom: Gerd Rausch <[email protected]>
[ Upstream commit 74f160ead74bfe5f2b38afb4fcf86189f9ff40c9 ]
Fix a memory leak when "mda_resolve_route() is called more than once on the same "rdma_cm_id".
This is possible if cma_query_handler() triggers the RDMA_CM_EVENT_ROUTE_ERROR flow which puts the state machine back and allows rdma_resolve_route() to be called again.
--- drivers/infiniband/core/cma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/cma.c +2 -1
@@ -2370,7 +2370,8 @@ static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms) work->new_state =RDMA_CM_ROUTE_RESOLVED ; work->event.event =RDMA_CM_EVENT_ROUTE_RESOLVED ; - route->path_rec =kmalloc (sizeof *route->path_rec,GFP_KERNEL ); +if (!route->path_rec) + route->path_rec =kmalloc (sizeof *route->path_rec,GFP_KERNEL );if (!route->path_rec) { ret = -ENOMEM ; goto err1;
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 153/245 Bluetooth: Fix the HCI to MGMT status conversion table
In reply to Greg Kroah-HartmanFrom: Yu Liu <[email protected]>
[ Upstream commit 4ef36a52b0e47c80bbfd69c0cce61c7ae9f541ed ]
0x2B, 0x31 and 0x33 are reserved for future use but were not present in the HCI to MGMT conversion table, this caused the conversion to be incorrect for the HCI status code greater than 0x2A.
--- net/bluetooth/mgmt.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/mgmt.c +3 -0
@@ -219,12 +219,15 @@ static u8 mgmt_status_table[] = {MGMT_STATUS_TIMEOUT ,/* Instant Passed */ MGMT_STATUS_NOT_SUPPORTED ,/* Pairing Not Supported */ MGMT_STATUS_FAILED ,/* Transaction Collision */ +MGMT_STATUS_FAILED ,/* Reserved for future use */ MGMT_STATUS_INVALID_PARAMS ,/* Unacceptable Parameter */ MGMT_STATUS_REJECTED ,/* QoS Rejected */ MGMT_STATUS_NOT_SUPPORTED ,/* Classification Not Supported */ MGMT_STATUS_REJECTED ,/* Insufficient Security */ MGMT_STATUS_INVALID_PARAMS ,/* Parameter Out Of Range */ +MGMT_STATUS_FAILED ,/* Reserved for future use */ MGMT_STATUS_BUSY ,/* Role Switch Pending */ +MGMT_STATUS_FAILED ,/* Reserved for future use */ MGMT_STATUS_FAILED ,/* Slot Violation */ MGMT_STATUS_FAILED ,/* Role Switch Failed */ MGMT_STATUS_INVALID_PARAMS, /* EIR Too Large */
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 154/245 Bluetooth: Shutdown controller after workqueues are flushed or cancelled
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 0ea9fd001a14ebc294f112b0361a4e601551d508 ]
Rfkill block and unblock Intel USB Bluetooth [8087:0026] may make it stops working:
[ 509.691509] Bluetooth: hci0: HCI reset during shutdown failed [ 514.897584] Bluetooth: hci0: MSFT filter_enable is already on [ 530.044751] usb 3-10: reset full-speed USB device number 5 using xhci_hcd [ 545.660350] usb 3-10: device descriptor read/64, error -110 [ 561.283530] usb 3-10: device descriptor read/64, error -110 [ 561.519682] usb 3-10: reset full-speed USB device number 5 using xhci_hcd [ 566.686650] Bluetooth: hci0: unexpected event for opcode 0x0500 [ 568.752452] Bluetooth: hci0: urb 0000000096cd309b failed to resubmit (113) [ 578.797955] Bluetooth: hci0: Failed to read MSFT supported features (-110) [ 586.286565] Bluetooth: hci0: urb 00000000c522f633 failed to resubmit (113) [ 596.215302] Bluetooth: hci0: Failed to read MSFT supported features (-110)
Or kernel panics because other workqueues already freed skb:
[ 2048.663763] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 2048.663775] #PF: supervisor read access in kernel mode [ 2048.663779] #PF: error_code(0x0000) - not-present page [ 2048.663782] PGD 0 P4D 0 [ 2048.663787] Oops: 0000 [#1] SMP NOPTI [ 2048.663793] CPU: 3 PID: 4491 Comm: rfkill Tainted: G W 5.13.0-rc1-next-20210510+ #20 [ 2048.663799] Hardware name: HP HP EliteBook 850 G8 Notebook PC/8846, BIOS T76 Ver. 01.01.04 12/02/2020 [ 2048.663801] RIP: 0010:__skb_ext_put+0x6/0x50 [ 2048.663814] Code: 8b 1b 48 85 db 75 db 5b 41 5c 5d c3 be 01 00 00 00 e8 de 13 c0 ff eb e7 be 02 00 00 00 e8 d2 13 c0 ff eb db 0f 1f 44 00 00 55 <8b> 07 48 89 e5 83 f8 01 74 14 b8 ff ff ff ff f0 0f c1 07 83 f8 01 [ 2048.663819] RSP: 0018:ffffc1d105b6fd80 EFLAGS: 00010286 [ 2048.663824] RAX: 0000000000000000 RBX: ffff9d9ac5649000 RCX: 0000000000000000 [ 2048.663827] RDX: ffffffffc0d1daf6 RSI: 0000000000000206 RDI: 0000000000000000 [ 2048.663830] RBP: ffffc1d105b6fd98 R08: 0000000000000001 R09: ffff9d9ace8ceac0 [ 2048.663834] R10: ffff9d9ace8ceac0 R11: 0000000000000001 R12: ffff9d9ac5649000 [ 2048.663838] R13: 0000000000000000 R14: 00007ffe0354d650 R15: 0000000000000000 [ 2048.663843] FS: 00007fe02ab19740(0000) GS:ffff9d9e5f8c0000(0000) knlGS:0000000000000000 [ 2048.663849] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2048.663853] CR2: 0000000000000000 CR3: 0000000111a52004 CR4: 0000000000770ee0 [ 2048.663856] PKRU: 55555554 [ 2048.663859] Call Trace: [ 2048.663865] ? skb_release_head_state+0x5e/0x80 [ 2048.663873] kfree_skb+0x2f/0xb0 [ 2048.663881] btusb_shutdown_intel_new+0x36/0x60 [btusb] [ 2048.663905] hci_dev_do_close+0x48c/0x5e0 [bluetooth] [ 2048.663954] ? __cond_resched+0x1a/0x50 [ 2048.663962] hci_rfkill_set_block+0x56/0xa0 [bluetooth] [ 2048.664007] rfkill_set_block+0x98/0x170 [ 2048.664016] rfkill_fop_write+0x136/0x1e0 [ 2048.664022] vfs_write+0xc7/0x260 [ 2048.664030] ksys_write+0xb1/0xe0 [ 2048.664035] ? exit_to_user_mode_prepare+0x37/0x1c0 [ 2048.664042] __x64_sys_write+0x1a/0x20 [ 2048.664048] do_syscall_64+0x40/0xb0 [ 2048.664055] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 2048.664060] RIP: 0033:0x7fe02ac23c27 [ 2048.664066] Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 [ 2048.664070] RSP: 002b:00007ffe0354d638 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ 2048.664075] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fe02ac23c27 [ 2048.664078] RDX: 0000000000000008 RSI: 00007ffe0354d650 RDI: 0000000000000003 [ 2048.664081] RBP: 0000000000000000 R08: 0000559b05998440 R09: 0000559b05998440 [ 2048.664084] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000003 [ 2048.664086] R13: 0000000000000000 R14: ffffffff00000000 R15: 00000000ffffffff
So move the shutdown callback to a place where workqueues are either flushed or cancelled to resolve the issue.
--- net/bluetooth/hci_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/bluetooth/hci_core.c +8 -8
@@ -1533,14 +1533,6 @@ int hci_dev_do_close(struct hci_dev *hdev)BT_DBG ("%s %p" , hdev->name, hdev); -if (!hci_dev_test_flag (hdev,HCI_UNREGISTER ) && - !hci_dev_test_flag (hdev,HCI_USER_CHANNEL ) && -test_bit (HCI_UP , &hdev->flags)) { -/* Execute vendor specific shutdown routine */ -if (hdev->shutdown) - hdev->shutdown (hdev); - } -cancel_delayed_work (&hdev->power_off);hci_request_cancel_all (hdev);
@@ -1608,6 +1600,14 @@ int hci_dev_do_close(struct hci_dev *hdev)clear_bit (HCI_INIT , &hdev->flags); } +if (!hci_dev_test_flag (hdev,HCI_UNREGISTER ) && + !hci_dev_test_flag (hdev,HCI_USER_CHANNEL ) && +test_bit (HCI_UP , &hdev->flags)) { +/* Execute vendor specific shutdown routine */ +if (hdev->shutdown) + hdev->shutdown (hdev); + } +/* flush cmd work */ flush_work (&hdev->cmd_work);
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 155/245 Bluetooth: btusb: fix bt fiwmare downloading failure issue for qca btsoc.
In reply to Greg Kroah-HartmanFrom: Tim Jiang <[email protected]>
[ Upstream commit 4f00bfb372674d586c4a261bfc595cbce101fbb6 ]
This is btsoc timing issue, after host start to downloading bt firmware, ep2 need time to switch from function acl to function dfu, so host add 20ms delay as workaround.
--- drivers/bluetooth/btusb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/bluetooth/btusb.c +5 -0
@@ -2508,6 +2508,11 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev, sent += size; count -= size; +/* ep2 need time to switch from function acl to function dfu, +* so we add 20ms delay here. +*/ +msleep (20 ); +while (count) { size =min_t (size_t, count,QCA_DFU_PACKET_LEN );
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 156/245 sctp: add size validation when walking chunks
In reply to Greg Kroah-HartmanFrom: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 50619dbf8db77e98d821d615af4f634d08e22698 ]
The first chunk in a packet is ensured to be present at the beginning of sctp_rcv(), as a packet needs to have at least 1 chunk. But the second one, may not be completely available and ch->length can be over uninitialized memory.
Fix here is by only trying to walk on the next chunk if there is enough to hold at least the header, and then proceed with the ch->length validation that is already there.
--- net/sctp/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/input.c +1 -1
@@ -1165,7 +1165,7 @@ static struct sctp_association *__sctp_rcv_walk_lookup(struct net *net, ch = (sctp_chunkhdr_t *) ch_end; chunk_num++; - }while (ch_end <skb_tail_pointer (skb)); + }while (ch_end +sizeof (*ch) <skb_tail_pointer (skb));return asoc; }
Signature · 1 line
2.30.2
Greg Kroah-Hartman
maintainerPATCH 157/245 fuse: reject internal errno
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 49221cf86d18bb66fe95d3338cb33bd4b9880ca5 upstream.
Don't allow userspace to report errors that could be kernel-internal.
--- fs/fuse/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/dev.c +1 -1
@@ -1883,7 +1883,7 @@ static ssize_t fuse_dev_do_write(struct } err = -EINVAL ; -if (oh.error <=-1000 || oh.error >0 ) +if (oh.error <=-512 || oh.error >0 ) goto err_finish;spin_lock (&fpq->lock);
Greg Kroah-Hartman
maintainerPATCH 158/245 can: gw: synchronize rcu operations before removing gw job entry
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
commit fb8696ab14adadb2e3f6c17c18ed26b3ecd96691 upstream.
can_can_gw_rcv() is called under RCU protection, so after calling can_rx_unregister(), we have to call synchronize_rcu in order to wait for any RCU read-side critical sections to finish before removing the kmem_cache entry with the referenced gw job entry.
--- net/can/gw.c | 3 +++ 1 file changed, 3 insertions(+)
net/can/gw.c +3 -0
@@ -497,6 +497,7 @@ static int cgw_notifier(struct notifier_if (gwj->src.dev == dev || gwj->dst.dev == dev) {hlist_del (&gwj->list);cgw_unregister_filter (gwj); +synchronize_rcu ();kmem_cache_free (cgw_cache, gwj); } }
@@ -941,6 +942,7 @@ static void cgw_remove_all_jobs(void)hlist_for_each_entry_safe (gwj, nx, &cgw_list, list) {hlist_del (&gwj->list);cgw_unregister_filter (gwj); +synchronize_rcu ();kmem_cache_free (cgw_cache, gwj); } }
@@ -1008,6 +1010,7 @@ static int cgw_remove_job(struct sk_buffhlist_del (&gwj->list);cgw_unregister_filter (gwj); +synchronize_rcu ();kmem_cache_free (cgw_cache, gwj); err =0 ;break ;
Greg Kroah-Hartman
maintainerPATCH 159/245 can: bcm: delay release of struct bcm_op after synchronize_rcu()
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit d5f9023fa61ee8b94f37a93f08e94b136cf1e463 upstream.
can_rx_register() callbacks may be called concurrently to the call to can_rx_unregister(). The callbacks and callback data, though, are protected by RCU and the struct sock reference count.
So the callback data is really attached to the life of sk, meaning that it should be released on sk_destruct. However, bcm_remove_op() calls tasklet_kill(), and RCU callbacks may be called under RCU softirq, so that cannot be used on kernels before the introduction of HRTIMER_MODE_SOFT.
However, bcm_rx_handler() is called under RCU protection, so after calling can_rx_unregister(), we may call synchronize_rcu() in order to wait for any RCU read-side critical sections to finish. That is, bcm_rx_handler() won't be called anymore for those ops. So, we only free them, after we do that synchronize_rcu().
--- net/can/bcm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/can/bcm.c +6 -1
@@ -839,6 +839,7 @@ static int bcm_delete_rx_op(struct list_ bcm_rx_handler, op);list_del (&op->list); +synchronize_rcu ();bcm_remove_op (op);return 1 ;/* done */ }
@@ -1589,9 +1590,13 @@ static int bcm_release(struct socket *soREGMASK (op->can_id), bcm_rx_handler, op); -bcm_remove_op (op); } +synchronize_rcu (); + +list_for_each_entry_safe (op, next, &bo->rx_ops, list) +bcm_remove_op (op); +/* remove procfs entry */ if (proc_dir && bo->bcm_proc_read)remove_proc_entry (bo->procname, proc_dir);
Greg Kroah-Hartman
maintainerPATCH 160/245 mac80211: fix memory corruption in EAPOL handling
In reply to Greg Kroah-HartmanFrom: Davis Mosenkovs <[email protected]>
Commit e3d4030498c3 ("mac80211: do not accept/forward invalid EAPOL frames") uses skb_mac_header() before eth_type_trans() is called leading to incorrect pointer, the pointer gets written to. This issue has appeared during backporting to 4.4, 4.9 and 4.14.
--- net/mac80211/rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/rx.c +1 -1
@@ -2380,7 +2380,7 @@ ieee80211_deliver_skb(struct ieee80211_r#endif if (skb) { -struct ethhdr *ehdr = (void *)skb_mac_header (skb); +struct ethhdr *ehdr = (struct ethhdr *)skb->data;/* deliver to local stack */ skb->protocol =eth_type_trans (skb, dev);
Greg Kroah-Hartman
maintainerPATCH 161/245 powerpc/barrier: Avoid collision with clangs __lwsync macro
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit 015d98149b326e0f1f02e44413112ca8b4330543 upstream.
A change in clang 13 results in the __lwsync macro being defined as __builtin_ppc_lwsync, which emits 'lwsync' or 'msync' depending on what the target supports. This breaks the build because of -Werror in arch/powerpc, along with thousands of warnings:
In file included from arch/powerpc/kernel/pmc.c:12:
In file included from include/linux/bug.h:5:
In file included from arch/powerpc/include/asm/bug.h:109:
In file included from include/asm-generic/bug.h:20:
In file included from include/linux/kernel.h:12:
In file included from include/linux/bitops.h:32:
In file included from arch/powerpc/include/asm/bitops.h:62:
arch/powerpc/include/asm/barrier.h:49:9: error: '__lwsync' macro redefined [-Werror,-Wmacro-redefined]
#define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
^
<built-in>:308:9: note: previous definition is here
#define __lwsync __builtin_ppc_lwsync
^1 error generated.
Undefine this macro so that the runtime patching introduced by commit 2d1b2027626d ("powerpc: Fixup lwsync at runtime") continues to work properly with clang and the build no longer breaks.
--- arch/powerpc/include/asm/barrier.h | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/include/asm/barrier.h +2 -0
@@ -41,6 +41,8 @@# define SMPWMB eieio#endif +/* clang defines this macro for a builtin, which will not work with runtime patching */ +#undef __lwsync#define __lwsync () __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")#define dma_rmb () __lwsync()#define dma_wmb () __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory")
Greg Kroah-Hartman
maintainerPATCH 162/245 pinctrl/amd: Add device HID for new AMD GPIO controller
In reply to Greg Kroah-HartmanFrom: Maximilian Luz <[email protected]>
commit 1ca46d3e43569186bd1decfb02a6b4c4ddb4304b upstream.
Add device HID AMDI0031 to the AMD GPIO controller driver match table. This controller can be found on Microsoft Surface Laptop 4 devices and seems similar enough that we can just copy the existing AMDI0030 entry.
--- drivers/pinctrl/pinctrl-amd.c | 1 + 1 file changed, 1 insertion(+)
drivers/pinctrl/pinctrl-amd.c +1 -0
@@ -896,6 +896,7 @@ static int amd_gpio_remove(struct platfostatic const struct acpi_device_id amd_gpio_acpi_match[] = { {"AMD0030" ,0 }, {"AMDI0030" ,0 }, + {"AMDI0031" ,0 }, { }, };MODULE_DEVICE_TABLE (acpi, amd_gpio_acpi_match);
Greg Kroah-Hartman
maintainerPATCH 163/245 mmc: sdhci: Fix warning message when accessing RPMB in HS400 mode
In reply to Greg Kroah-HartmanFrom: Al Cooper <[email protected]>
commit d0244847f9fc5e20df8b7483c8a4717fe0432d38 upstream.
When an eMMC device is being run in HS400 mode, any access to the RPMB device will cause the error message "mmc1: Invalid UHS-I mode selected". This happens as a result of tuning being disabled before RPMB access and then re-enabled after the RPMB access is complete. When tuning is re-enabled, the system has to switch from HS400 to HS200 to do the tuning and then back to HS400. As part of sequence to switch from HS400 to HS200 the system is temporarily put into HS mode. When switching to HS mode, sdhci_get_preset_value() is called and does not have support for HS mode and prints the warning message and returns the preset for SDR12. The fix is to add support for MMC and SD HS modes to sdhci_get_preset_value().
This can be reproduced on any system running eMMC in HS400 mode (not HS400ES) by using the "mmc" utility to run the following
command: "mmc rpmb read-counter /dev/mmcblk0rpmb".
--- drivers/mmc/host/sdhci.c | 4 ++++ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 5 insertions(+)
drivers/mmc/host/sdhci.c +4 -0
@@ -1219,6 +1219,10 @@ static u16 sdhci_get_preset_value(structu16 preset =0 ;switch (host->timing) { +case MMC_TIMING_MMC_HS : +case MMC_TIMING_SD_HS : + preset =sdhci_readw (host,SDHCI_PRESET_FOR_HIGH_SPEED ); +break ;case MMC_TIMING_UHS_SDR12 : preset =sdhci_readw (host,SDHCI_PRESET_FOR_SDR12 );break ;
drivers/mmc/host/sdhci.h +1 -0
@@ -237,6 +237,7 @@/* 60-FB reserved */ +#define SDHCI_PRESET_FOR_HIGH_SPEED 0x64#define SDHCI_PRESET_FOR_SDR12 0x66#define SDHCI_PRESET_FOR_SDR25 0x68#define SDHCI_PRESET_FOR_SDR50 0x6A
Greg Kroah-Hartman
maintainerPATCH 164/245 mmc: core: clear flags before allowing to retune
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
commit 77347eda64ed5c9383961d1de9165f9d0b7d8df6 upstream.
It might be that something goes wrong during tuning so the MMC core will immediately trigger a retune. In our case it was:
- we sent a tuning block
- there was an error so we need to send an abort cmd to the eMMC
- the abort cmd had a CRC error
- retune was set by the MMC core
This lead to a vicious circle causing a performance regression of 75%. So, clear retuning flags before we enable retuning to start with a known cleared state.
Reported-by Yoshihiro Shimoda <[email protected]>
--- drivers/mmc/core/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +5 -2
@@ -1171,11 +1171,14 @@ int mmc_execute_tuning(struct mmc_card * err = host->ops->execute_tuning (host, opcode); -if (err) +if (err) {pr_err ("%s: tuning execution failed: %d\n" ,mmc_hostname (host), err); -else + }else { + host->retune_now =0 ; + host->need_retune =0 ;mmc_retune_enable (host); + }return err; }
Greg Kroah-Hartman
maintainerPATCH 165/245 ata: ahci_sunxi: Disable DIPM
In reply to Greg Kroah-HartmanFrom: Timo Sigurdsson <[email protected]>
commit f6bca4d91b2ea052e917cca3f9d866b5cc1d500a upstream.
DIPM is unsupported or broken on sunxi. Trying to enable the power management policy med_power_with_dipm on an Allwinner A20 SoC based board leads to immediate I/O errors and the attached SATA disk disappears from the /dev filesystem. A reset (power cycle) is required to make the SATA controller or disk work again. The A10 and A20 SoC data sheets and manuals don't mention DIPM at all [1], so it's fair to assume that it's simply not supported. But even if it was, it should be considered broken and best be disabled in the ahci_sunxi driver.
[1] https://github.com/allwinner-zh/documents/tree/master/
--- drivers/ata/ahci_sunxi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/ahci_sunxi.c +1 -1
@@ -165,7 +165,7 @@ static void ahci_sunxi_start_engine(stru }static const struct ata_port_info ahci_sunxi_port_info = { - .flags =AHCI_FLAG_COMMON |ATA_FLAG_NCQ , + .flags =AHCI_FLAG_COMMON |ATA_FLAG_NCQ |ATA_FLAG_NO_DIPM , .pio_mask =ATA_PIO4 , .udma_mask =ATA_UDMA6 , .port_ops = &ahci_platform_ops,
Greg Kroah-Hartman
maintainerPATCH 166/245 ASoC: tegra: Set driver_name=tegra for all machine drivers
In reply to Greg Kroah-HartmanFrom: Dmitry Osipenko <[email protected]>
commit f6eb84fa596abf28959fc7e0b626f925eb1196c7 upstream.
The driver_name="tegra" is now required by the newer ALSA UCMs, otherwise Tegra UCMs don't match by the path/name.
All Tegra machine drivers are specifying the card's name, but it has no effect if model name is specified in the device-tree since it overrides the card's name. We need to set the driver_name to "tegra" in order to get a usable lookup path for the updated ALSA UCMs. The new UCM lookup path has a form of driver_name/card_name.
The old lookup paths that are based on driver module name continue to work as before. Note that UCM matching never worked for Tegra ASoC drivers if they were compiled as built-in, this is fixed by supporting the new naming scheme.
--- sound/soc/tegra/tegra_alc5632.c | 1 + sound/soc/tegra/tegra_max98090.c | 1 + sound/soc/tegra/tegra_rt5640.c | 1 + sound/soc/tegra/tegra_rt5677.c | 1 + sound/soc/tegra/tegra_sgtl5000.c | 1 + sound/soc/tegra/tegra_wm8753.c | 1 + sound/soc/tegra/tegra_wm8903.c | 1 + sound/soc/tegra/tegra_wm9712.c | 1 + sound/soc/tegra/trimslice.c | 1 + 9 files changed, 9 insertions(+)
sound/soc/tegra/tegra_alc5632.c +1 -0
@@ -149,6 +149,7 @@ static struct snd_soc_dai_link tegra_alcstatic struct snd_soc_card snd_soc_tegra_alc5632 = { .name ="tegra-alc5632" , + .driver_name ="tegra" , .owner =THIS_MODULE , .remove = tegra_alc5632_card_remove, .dai_link = &tegra_alc5632_dai,
sound/soc/tegra/tegra_max98090.c +1 -0
@@ -205,6 +205,7 @@ static struct snd_soc_dai_link tegra_maxstatic struct snd_soc_card snd_soc_tegra_max98090 = { .name ="tegra-max98090" , + .driver_name ="tegra" , .owner =THIS_MODULE , .remove = tegra_max98090_card_remove, .dai_link = &tegra_max98090_dai,
sound/soc/tegra/tegra_rt5640.c +1 -0
@@ -150,6 +150,7 @@ static struct snd_soc_dai_link tegra_rt5static struct snd_soc_card snd_soc_tegra_rt5640 = { .name ="tegra-rt5640" , + .driver_name ="tegra" , .owner =THIS_MODULE , .remove = tegra_rt5640_card_remove, .dai_link = &tegra_rt5640_dai,
sound/soc/tegra/tegra_rt5677.c +1 -0
@@ -198,6 +198,7 @@ static struct snd_soc_dai_link tegra_rt5static struct snd_soc_card snd_soc_tegra_rt5677 = { .name ="tegra-rt5677" , + .driver_name ="tegra" , .owner =THIS_MODULE , .remove = tegra_rt5677_card_remove, .dai_link = &tegra_rt5677_dai,
sound/soc/tegra/tegra_sgtl5000.c +1 -0
@@ -103,6 +103,7 @@ static struct snd_soc_dai_link tegra_sgtstatic struct snd_soc_card snd_soc_tegra_sgtl5000 = { .name ="tegra-sgtl5000" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_sgtl5000_dai, .num_links =1 ,
sound/soc/tegra/tegra_wm8753.c +1 -0
@@ -110,6 +110,7 @@ static struct snd_soc_dai_link tegra_wm8static struct snd_soc_card snd_soc_tegra_wm8753 = { .name ="tegra-wm8753" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_wm8753_dai, .num_links =1 ,
sound/soc/tegra/tegra_wm8903.c +1 -0
@@ -228,6 +228,7 @@ static struct snd_soc_dai_link tegra_wm8static struct snd_soc_card snd_soc_tegra_wm8903 = { .name ="tegra-wm8903" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_wm8903_dai, .num_links =1 ,
sound/soc/tegra/tegra_wm9712.c +1 -0
@@ -59,6 +59,7 @@ static struct snd_soc_dai_link tegra_wm9static struct snd_soc_card snd_soc_tegra_wm9712 = { .name ="tegra-wm9712" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &tegra_wm9712_dai, .num_links =1 ,
sound/soc/tegra/trimslice.c +1 -0
@@ -103,6 +103,7 @@ static struct snd_soc_dai_link trimslicestatic struct snd_soc_card snd_soc_trimslice = { .name ="tegra-trimslice" , + .driver_name ="tegra" , .owner =THIS_MODULE , .dai_link = &trimslice_tlv320aic23_dai, .num_links =1 ,
Greg Kroah-Hartman
maintainerPATCH 167/245 qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
commit fca41af18e10318e4de090db47d9fa7169e1bf2f upstream.
fw_cfg_showrev() is called by an indirect call in kobj_attr_show(), which violates clang's CFI checking because fw_cfg_showrev()'s second parameter is 'struct attribute', whereas the ->show() member of 'struct kobj_structure' expects the second parameter to be of type 'struct kobj_attribute'.
$ cat /sys/firmware/qemu_fw_cfg/rev 3
$ dmesg | grep "CFI failure" [ 26.016832] CFI failure (target: fw_cfg_showrev+0x0/0x8):
Fix this by converting fw_cfg_rev_attr to 'struct kobj_attribute' where this would have been caught automatically by the incompatible pointer types compiler warning. Update fw_cfg_showrev() accordingly.
--- drivers/firmware/qemu_fw_cfg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/firmware/qemu_fw_cfg.c +3 -5
@@ -192,15 +192,13 @@ static int fw_cfg_do_platform_probe(stru/* fw_cfg revision attribute, in /sys/firmware/qemu_fw_cfg top-level dir. */ static u32 fw_cfg_rev; -static ssize_t fw_cfg_showrev (struct kobject *k,struct attribute *a,char *buf) +static ssize_t fw_cfg_showrev (struct kobject *k,struct kobj_attribute *a, +char *buf) {return sprintf (buf,"%u\n" , fw_cfg_rev); } -static const struct { -struct attribute attr; -ssize_t (*show)(struct kobject *k,struct attribute *a,char *buf); -} fw_cfg_rev_attr = { +static const struct kobj_attribute fw_cfg_rev_attr = { .attr = { .name ="rev" , .mode =S_IRUSR }, .show = fw_cfg_showrev, };
Greg Kroah-Hartman
maintainerPATCH 168/245 ipmi/watchdog: Stop watchdog timer when the current action is none
In reply to Greg Kroah-HartmanFrom: Petr Pavlu <[email protected]>
commit 2253042d86f57d90a621ac2513a7a7a13afcf809 upstream.
When an IPMI watchdog timer is being stopped in ipmi_close() or ipmi_ioctl(WDIOS_DISABLECARD), the current watchdog action is updated to WDOG_TIMEOUT_NONE and _ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB) is called to install this action. The latter function ends up invoking __ipmi_set_timeout() which makes the actual 'Set Watchdog Timer' IPMI request.
For IPMI 1.0, this operation results in fully stopping the watchdog timer. For IPMI >= 1.5, function __ipmi_set_timeout() always specifies the "don't stop" flag in the prepared 'Set Watchdog Timer' IPMI request. This causes that the watchdog timer has its action correctly updated to 'none' but the timer continues to run. A problem is that IPMI firmware can then still log an expiration event when the configured timeout is reached, which is unexpected because the watchdog timer was requested to be stopped.
The patch fixes this problem by not setting the "don't stop" flag in __ipmi_set_timeout() when the current action is WDOG_TIMEOUT_NONE which results in stopping the watchdog timer. This makes the behaviour for IPMI >= 1.5 consistent with IPMI 1.0. It also matches the logic in __ipmi_heartbeat() which does not allow to reset the watchdog if the current action is WDOG_TIMEOUT_NONE as that would start the timer.
Message-Id: <[email protected]>
--- drivers/char/ipmi/ipmi_watchdog.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
drivers/char/ipmi/ipmi_watchdog.c +12 -10
@@ -393,16 +393,18 @@ static int i_ipmi_set_timeout(struct ipm data[0 ] =0 ;WDOG_SET_TIMER_USE (data[0 ],WDOG_TIMER_USE_SMS_OS ); -if ((ipmi_version_major >1 ) - || ((ipmi_version_major ==1 ) && (ipmi_version_minor >=5 ))) { -/* This is an IPMI 1.5-only feature. */ - data[0 ] |=WDOG_DONT_STOP_ON_SET ; - }else if (ipmi_watchdog_state !=WDOG_TIMEOUT_NONE ) { -/* -* In ipmi 1.0, setting the timer stops the watchdog, we -* need to start it back up again. -*/ - hbnow =1 ; +if (ipmi_watchdog_state !=WDOG_TIMEOUT_NONE ) { +if ((ipmi_version_major >1 ) || + ((ipmi_version_major ==1 ) && (ipmi_version_minor >=5 ))) { +/* This is an IPMI 1.5-only feature. */ + data[0 ] |=WDOG_DONT_STOP_ON_SET ; + }else { +/* +* In ipmi 1.0, setting the timer stops the watchdog, we +* need to start it back up again. +*/ + hbnow =1 ; + } } data[1 ] =0 ;
Greg Kroah-Hartman
maintainerPATCH 169/245 power: supply: ab8500: Fix an old bug
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
commit f1c74a6c07e76fcb31a4bcc1f437c4361a2674ce upstream.
Trying to get the AB8500 charging driver working I ran into a bit of bitrot: we haven't used the driver for a while so errors in refactorings won't be noticed.
This one is pretty self evident: use argument to the macro or we end up with a random pointer to something else.
--- include/linux/mfd/abx500/ux500_chargalg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mfd/abx500/ux500_chargalg.h +1 -1
@@ -15,7 +15,7 @@* - POWER_SUPPLY_TYPE_USB, * because only them store as drv_data pointer to struct ux500_charger. */ -#define psy_to_ux500_charger (x) power_supply_get_drvdata(psy) +#define psy_to_ux500_charger (x) power_supply_get_drvdata(x)/* Forward declaration */ struct ux500_charger ;
Greg Kroah-Hartman
maintainerPATCH 170/245 seq_buf: Fix overflow in seq_buf_putmem_hex()
In reply to Greg Kroah-HartmanFrom: Yun Zhou <[email protected]>
commit d3b16034a24a112bb83aeb669ac5b9b01f744bb7 upstream.
There's two variables being increased in that loop (i and j), and i follows the raw data, and j follows what is being written into the buffer. We should compare 'i' to MAX_MEMHEX_BYTES or compare 'j' to HEX_CHARS. Otherwise, if 'j' goes bigger than HEX_CHARS, it will overflow the destination buffer.
--- lib/seq_buf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/seq_buf.c +3 -1
@@ -227,8 +227,10 @@ int seq_buf_putmem_hex(struct seq_buf *sWARN_ON (s->size ==0 ); +BUILD_BUG_ON (MAX_MEMHEX_BYTES *2 >=HEX_CHARS ); +while (len) { - start_len =min (len,HEX_CHARS -1 ); + start_len =min (len,MAX_MEMHEX_BYTES );#ifdef __BIG_ENDIANfor (i =0 , j =0 ; i < start_len; i++) {#else
Greg Kroah-Hartman
maintainerPATCH 171/245 ipack/carriers/tpci200: Fix a double free in tpci200_pci_probe
In reply to Greg Kroah-HartmanFrom: Lv Yunlong <[email protected]>
commit 9272e5d0028d45a3b45b58c9255e6e0df53f7ad9 upstream.
In the out_err_bus_register error branch of tpci200_pci_probe, tpci200->info->cfg_regs is freed by tpci200_uninstall()-> tpci200_unregister()->pci_iounmap(..,tpci200->info->cfg_regs) in the first time.
But later, iounmap() is called to free tpci200->info->cfg_regs again.
My patch sets tpci200->info->cfg_regs to NULL after tpci200_uninstall() to avoid the double free.
--- drivers/ipack/carriers/tpci200.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/ipack/carriers/tpci200.c +4 -1
@@ -591,8 +591,11 @@ static int tpci200_pci_probe(struct pci_ out_err_bus_register:tpci200_uninstall (tpci200); +/* tpci200->info->cfg_regs is unmapped in tpci200_uninstall */ + tpci200->info->cfg_regs =NULL ; out_err_install: -iounmap (tpci200->info->cfg_regs); +if (tpci200->info->cfg_regs) +iounmap (tpci200->info->cfg_regs); out_err_ioremap:pci_release_region (pdev,TPCI200_CFG_MEM_BAR ); out_err_pci_request:
Greg Kroah-Hartman
maintainerPATCH 172/245 dm btree remove: assign new_root only when removal succeeds
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
commit b6e58b5466b2959f83034bead2e2e1395cca8aeb upstream.
remove_raw() in dm_btree_remove() may fail due to IO read error (e.g. read the content of origin block fails during shadowing), and the value of shadow_spine::root is uninitialized, but the uninitialized value is still assign to new_root in the end of dm_btree_remove().
For dm-thin, the value of pmd->details_root or pmd->root will become an uninitialized value, so if trying to read details_info tree again out-of-bound memory may occur as showed below:
general protection fault, probably for non-canonical address 0x3fdcb14c8d7520 CPU: 4 PID: 515 Comm: dmsetup Not tainted 5.13.0-rc6 Hardware name: QEMU Standard PC RIP: 0010:metadata_ll_load_ie+0x14/0x30 Call Trace: sm_metadata_count_is_more_than_one+0xb9/0xe0 dm_tm_shadow_block+0x52/0x1c0 shadow_step+0x59/0xf0 remove_raw+0xb2/0x170 dm_btree_remove+0xf4/0x1c0 dm_pool_delete_thin_device+0xc3/0x140 pool_message+0x218/0x2b0 target_message+0x251/0x290 ctl_ioctl+0x1c4/0x4d0 dm_ctl_ioctl+0xe/0x20 __x64_sys_ioctl+0x7b/0xb0 do_syscall_64+0x40/0xb0 entry_SYSCALL_64_after_hwframe+0x44/0xae
Fixing it by only assign new_root when removal succeeds
--- drivers/md/persistent-data/dm-btree-remove.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/persistent-data/dm-btree-remove.c +2 -1
@@ -549,7 +549,8 @@ int dm_btree_remove(struct dm_btree_infodelete_at (n, index); } - *new_root =shadow_root (&spine); +if (!r) + *new_root =shadow_root (&spine);exit_shadow_spine (&spine);return r;
Greg Kroah-Hartman
maintainerPATCH 173/245 media: dtv5100: fix control-request directions
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 8c8b9a9be2afa8bd6a72ad1130532baab9fab89d upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the control requests which erroneously used usb_rcvctrlpipe().
--- drivers/media/usb/dvb-usb/dtv5100.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb/dtv5100.c +5 -2
@@ -39,6 +39,7 @@ static int dtv5100_i2c_msg(struct dvb_us u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen) { struct dtv5100_state *st = d->priv; +unsigned int pipe;u8 request;u8 type;u16 value;
@@ -47,6 +48,7 @@ static int dtv5100_i2c_msg(struct dvb_usswitch (wlen) {case 1 :/* write { reg }, read { value } */ + pipe =usb_rcvctrlpipe (d->udev,0 ); request = (addr ==DTV5100_DEMOD_ADDR ?DTV5100_DEMOD_READ :DTV5100_TUNER_READ ); type =USB_TYPE_VENDOR |USB_DIR_IN ;
@@ -54,6 +56,7 @@ static int dtv5100_i2c_msg(struct dvb_usbreak ;case 2 :/* write { reg, value } */ + pipe =usb_sndctrlpipe (d->udev,0 ); request = (addr ==DTV5100_DEMOD_ADDR ?DTV5100_DEMOD_WRITE :DTV5100_TUNER_WRITE ); type =USB_TYPE_VENDOR |USB_DIR_OUT ;
@@ -67,7 +70,7 @@ static int dtv5100_i2c_msg(struct dvb_usmemcpy (st->data, rbuf, rlen);msleep (1 );/* avoid I2C errors */ -return usb_control_msg (d->udev,usb_rcvctrlpipe (d->udev,0 ), request, +return usb_control_msg (d->udev, pipe, request, type, value, index, st->data, rlen,DTV5100_USB_TIMEOUT ); }
@@ -154,7 +157,7 @@ static int dtv5100_probe(struct usb_inte/* initialize non qt1010/zl10353 part? */ for (i =0 ; dtv5100_init[i].request; i++) { - ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), dtv5100_init[i].request, USB_TYPE_VENDOR | USB_DIR_OUT, dtv5100_init[i].value,
Greg Kroah-Hartman
maintainerPATCH 174/245 media: zr364xx: fix memory leak in zr364xx_start_readpipe
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 0a045eac8d0427b64577a24d74bb8347c905ac65 upstream.
syzbot reported memory leak in zr364xx driver.
The problem was in non-freed urb in case ofusb_submit_urb() fail.
backtrace:
[<ffffffff82baedf6>] kmalloc include/linux/slab.h:561 [inline] [<ffffffff82baedf6>] usb_alloc_urb+0x66/0xe0 drivers/usb/core/urb.c:74 [<ffffffff82f7cce8>] zr364xx_start_readpipe+0x78/0x130 drivers/media/usb/zr364xx/zr364xx.c:1022 [<ffffffff84251dfc>] zr364xx_board_init drivers/media/usb/zr364xx/zr364xx.c:1383 [inline] [<ffffffff84251dfc>] zr364xx_probe+0x6a3/0x851 drivers/media/usb/zr364xx/zr364xx.c:1516 [<ffffffff82bb6507>] usb_probe_interface+0x177/0x370 drivers/usb/core/driver.c:396 [<ffffffff826018a9>] really_probe+0x159/0x500 drivers/base/dd.c:576
--- drivers/media/usb/zr364xx/zr364xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/zr364xx/zr364xx.c +1 -0
@@ -1066,6 +1066,7 @@ static int zr364xx_start_readpipe(structDBG ("submitting URB %p\n" , pipe_info->stream_urb); retval =usb_submit_urb (pipe_info->stream_urb,GFP_KERNEL );if (retval) { +usb_free_urb (pipe_info->stream_urb); printk(KERN_ERR KBUILD_MODNAME ": start read pipe failed\n");return retval; }
Greg Kroah-Hartman
maintainerPATCH 175/245 media: gspca/sq905: fix control-request direction
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit 53ae298fde7adcc4b1432bce2dbdf8dac54dfa72 upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Fix the USB_REQ_SYNCH_FRAME request which erroneously used usb_sndctrlpipe().
--- drivers/media/usb/gspca/sq905.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/gspca/sq905.c +1 -1
@@ -130,7 +130,7 @@ static int sq905_command(struct gspca_de } ret = usb_control_msg(gspca_dev->dev, - usb_sndctrlpipe(gspca_dev->dev, 0), + usb_rcvctrlpipe(gspca_dev->dev, 0), USB_REQ_SYNCH_FRAME, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, SQ905_PING, 0, gspca_dev->usb_buf, 1,
Greg Kroah-Hartman
maintainerPATCH 176/245 media: gspca/sunplus: fix zero-length control requests
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
commit b4bb4d425b7b02424afea2dfdcd77b3b4794175e upstream.
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation.
Control transfers without a data stage are treated as OUT requests by the USB stack and should be using usb_sndctrlpipe(). Failing to do so will now trigger a warning.
Fix the single zero-length control request which was using the read-register helper, and update the helper so that zero-length reads fail with an error message instead.
--- drivers/media/usb/gspca/sunplus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/media/usb/gspca/sunplus.c +6 -2
@@ -255,6 +255,10 @@ static void reg_r(struct gspca_dev *gspcPERR ("reg_r: buffer overflow\n" );return ; } +if (len ==0 ) { +PERR ("reg_r: zero-length read\n" ); +return ; + }if (gspca_dev->usb_err <0 )return ; ret = usb_control_msg(gspca_dev->dev,
@@ -263,7 +267,7 @@ static void reg_r(struct gspca_dev *gspcUSB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE ,0 ,/* value */ index, - len ? gspca_dev->usb_buf :NULL , len, + gspca_dev->usb_buf, len, 500);if (ret <0 ) {pr_err ("reg_r err %d\n" , ret);
@@ -739,7 +743,7 @@ static int sd_start(struct gspca_dev *gscase MegaImageVI:reg_w_riv (gspca_dev,0xf0 ,0 ,0 );spca504B_WaitCmdStatus (gspca_dev); -reg_r (gspca_dev,0xf0 ,4 ,0 ); +reg_w_riv (gspca_dev,0xf0 ,4 ,0 );spca504B_WaitCmdStatus (gspca_dev);break ;default :
Greg Kroah-Hartman
maintainerPATCH 177/245 media: uvcvideo: Fix pixel format change for Elgato Cam Link 4K
In reply to Greg Kroah-HartmanFrom: Benjamin Drung <[email protected]>
commit 4c6e0976295add7f0ed94d276c04a3d6f1ea8f83 upstream.
The Elgato Cam Link 4K HDMI video capture card reports to support three different pixel formats, where the first format depends on the connected HDMI device.
``` $ v4l2-ctl -d /dev/video0 --list-formats-ext ioctl: VIDIOC_ENUM_FMT Type: Video Capture [0]: 'NV12' (Y/CbCr 4:2:0) Size: Discrete 3840x2160 Interval: Discrete 0.033s (29.970 fps) [1]: 'NV12' (Y/CbCr 4:2:0) Size: Discrete 3840x2160 Interval: Discrete 0.033s (29.970 fps) [2]: 'YU12' (Planar YUV 4:2:0) Size: Discrete 3840x2160 Interval: Discrete 0.033s (29.970 fps) ```
Changing the pixel format to anything besides the first pixel format does not work:
``` $ v4l2-ctl -d /dev/video0 --try-fmt-video pixelformat=YU12 Format Video Capture: Width/Height : 3840/2160 Pixel Format : 'NV12' (Y/CbCr 4:2:0) Field : None Bytes per Line : 3840 Size Image : 12441600 Colorspace : sRGB Transfer Function : Rec. 709 YCbCr/HSV Encoding: Rec. 709 Quantization : Default (maps to Limited Range) Flags : ```
User space applications like VLC might show an error message on the terminal in that case:
``` libv4l2: error set_fmt gave us a different result than try_fmt! ```
Depending on the error handling of the user space applications, they might display a distorted video, because they use the wrong pixel format for decoding the stream.
The Elgato Cam Link 4K responds to the USB video probe VS_PROBE_CONTROL/VS_COMMIT_CONTROL with a malformed data structure: The second byte contains bFormatIndex (instead of being the second byte of bmHint). The first byte is always zero. The third byte is always 1.
The firmware bug was reported to Elgato on 2020-12-01 and it was forwarded by the support team to the developers as feature request. There is no firmware update available since then. The latest firmware for Elgato Cam Link 4K as of 2021-03-23 has MCU 20.02.19 and FPGA 67.
Therefore correct the malformed data structure for this device. The change was successfully tested with VLC, OBS, and Chromium using different pixel formats (YUYV, NV12, YU12), resolutions (3840x2160, 1920x1080), and frame rates (29.970 and 59.940 fps).
--- drivers/media/usb/uvc/uvc_video.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/media/usb/uvc/uvc_video.c +27 -0
@@ -89,10 +89,37 @@ int uvc_query_ctrl(struct uvc_device *destatic void uvc_fixup_video_ctrl (struct uvc_streaming *stream,struct uvc_streaming_control *ctrl) { +static const struct usb_device_id elgato_cam_link_4k = { +USB_DEVICE (0x0fd9 ,0x0066 ) + };struct uvc_format *format =NULL ;struct uvc_frame *frame =NULL ;unsigned int i; +/* +* The response of the Elgato Cam Link 4K is incorrect: The second byte +* contains bFormatIndex (instead of being the second byte of bmHint). +* The first byte is always zero. The third byte is always 1. +* +* The UVC 1.5 class specification defines the first five bits in the +* bmHint bitfield. The remaining bits are reserved and should be zero. +* Therefore a valid bmHint will be less than 32. +* +* Latest Elgato Cam Link 4K firmware as of 2021-03-23 needs this fix. +* MCU: 20.02.19, FPGA: 67 +*/ +if (usb_match_one_id (stream->dev->intf, &elgato_cam_link_4k) && + ctrl->bmHint >255 ) { +u8 corrected_format_index = ctrl->bmHint >>8 ; + +/* uvc_dbg(stream->dev, VIDEO, +"Correct USB video probe response from {bmHint: 0x%04x, bFormatIndex: %u} to {bmHint: 0x%04x, bFormatIndex: %u}\n", +ctrl->bmHint, ctrl->bFormatIndex, +1, corrected_format_index); */ + ctrl->bmHint =1 ; + ctrl->bFormatIndex = corrected_format_index; + } +for (i =0 ; i < stream->nformats; ++i) {if (stream->format[i].index == ctrl->bFormatIndex) { format = &stream->format[i];
Greg Kroah-Hartman
maintainerPATCH 178/245 jfs: fix GPF in diFree
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
commit 9d574f985fe33efd6911f4d752de6f485a1ea732 upstream.
Avoid passing inode with
JFS_SBI(inode->i_sb)->ipimap == NULL to
diFree()[1]. GFP will appear:
struct inode *ipimap = JFS_SBI(ip->i_sb)->ipimap; struct inomap *imap = JFS_IP(ipimap)->i_imap;
JFS_IP() will return invalid pointer when ipimap == NULL
Call Trace: diFree+0x13d/0x2dc0 fs/jfs/jfs_imap.c:853 [1] jfs_evict_inode+0x2c9/0x370 fs/jfs/inode.c:154 evict+0x2ed/0x750 fs/inode.c:578 iput_final fs/inode.c:1654 [inline] iput.part.0+0x3fe/0x820 fs/inode.c:1680 iput+0x58/0x70 fs/inode.c:1670
--- fs/jfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/inode.c +2 -1
@@ -161,7 +161,8 @@ void jfs_evict_inode(struct inode *inodeif (test_cflag (COMMIT_Freewmap, inode))jfs_free_zero_link (inode); -diFree (inode); +if (JFS_SBI (inode->i_sb)->ipimap) +diFree (inode);/* * Free the inode from the quota allocation.
Greg Kroah-Hartman
maintainerPATCH 179/245 smackfs: restrict bytes count in smk_set_cipso()
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
commit 49ec114a6e62d8d320037ce71c1aaf9650b3cafd upstream.
Oops, I failed to update subject line.
Quoted 1 line
From
07571157c91b98ce1a4aa70967531e64b78e8346Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <[email protected]>
Date: Mon, 12 Apr 2021 22:25:06 +0900
Subject: [PATCH 4.9 179/245] smackfs: restrict bytes count in smk_set_cipso()
Commit 7ef4c19d245f3dc2 ("smackfs: restrict bytes count in smackfs write functions") missed that count > SMK_CIPSOMAX check applies to only format == SMK_FIXED24_FMT case.
--- security/smack/smackfs.c | 2 ++ 1 file changed, 2 insertions(+)
security/smack/smackfs.c +2 -0
@@ -878,6 +878,8 @@ static ssize_t smk_set_cipso(struct fileif (format ==SMK_FIXED24_FMT && (count <SMK_CIPSOMIN || count >SMK_CIPSOMAX ))return -EINVAL ; +if (count >PAGE_SIZE ) +return -EINVAL ; data =memdup_user_nul (buf, count);if (IS_ERR (data))
Greg Kroah-Hartman
maintainerPATCH 180/245 KVM: x86: Use guest MAXPHYADDR from CPUID.0x8000_0008 iff TDP is enabled
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit 4bf48e3c0aafd32b960d341c4925b48f416f14a5 upstream.
Ignore the guest MAXPHYADDR reported by CPUID.0x8000_0008 if TDP, i.e. NPT, is disabled, and instead use the host's MAXPHYADDR. Per AMD'S APM:
Maximum guest physical address size in bits. This number applies only to guests using nested paging. When this field is zero, refer to the PhysAddrSize field for the maximum guest physical address size.
Message-Id: <[email protected]>
--- arch/x86/kvm/cpuid.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/kvm/cpuid.c +7 -1
@@ -633,8 +633,14 @@ static inline int __do_cpuid_ent(structunsigned virt_as =max ((entry->eax >>8 ) &0xff ,48U );unsigned phys_as = entry->eax &0xff ; -if (!g_phys_as) +/* +* Use bare metal's MAXPHADDR if the CPU doesn't report guest +* MAXPHYADDR separately, or if TDP (NPT) is disabled, as the +* guest version "applies only to guests using nested paging". +*/ +if (!g_phys_as || !tdp_enabled) g_phys_as = phys_as; + entry->eax = g_phys_as | (virt_as <<8 ); entry->edx =0 ;/*
Greg Kroah-Hartman
maintainerPATCH 181/245 KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
In reply to Greg Kroah-HartmanFrom: Lai Jiangshan <[email protected]>
commit f85d40160691881a17a397c448d799dfc90987ba upstream.
When the host is using debug registers but the guest is not using them nor is the guest in guest-debug state, the kvm code does not reset the host debug registers before kvm_x86->run(). Rather, it relies on the hardware vmentry instruction to automatically reset the dr7 registers which ensures that the host breakpoints do not affect the guest.
This however violates the non-instrumentable nature around VM entry and exit; for example, when a host breakpoint is set on vcpu->arch.cr2,
Another issue is consistency. When the guest debug registers are active, the host breakpoints are reset before kvm_x86->run(). But when the guest debug registers are inactive, the host breakpoints are delayed to be disabled. The host tracing tools may see different results depending on what the guest is doing.
To fix the problems, we clear %db7 unconditionally before kvm_x86->run() if the host has set any breakpoints, no matter if the guest is using them or not.
Message-Id: <[email protected]>
--- arch/x86/kvm/x86.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/x86.c +2 -0
@@ -7044,6 +7044,8 @@ static int vcpu_enter_guest(struct kvm_vset_debugreg (vcpu->arch.eff_db[3 ],3 );set_debugreg (vcpu->arch.dr6,6 ); vcpu->arch.switch_db_regs &= ~KVM_DEBUGREG_RELOAD ; + }else if (unlikely (hw_breakpoint_active ())) { +set_debugreg (0 ,7 ); } kvm_x86_ops->run (vcpu);
Greg Kroah-Hartman
maintainerPATCH 182/245 scsi: core: Fix bad pointer dereference when ehandler kthread is invalid
In reply to Greg Kroah-HartmanFrom: Tyrel Datwyler <[email protected]>
commit 93aa71ad7379900e61c8adff6a710a4c18c7c99b upstream.
Commit 66a834d09293 ("scsi: core: Fix error handling of scsi_host_alloc()") changed the allocation logic to call put_device() to perform host cleanup with the assumption that IDA removal and stopping the kthread would properly be performed in scsi_host_dev_release(). However, in the unlikely case that the error handler thread fails to spawn, shost->ehandler is set to ERR_PTR(-ENOMEM).
The error handler cleanup code in scsi_host_dev_release() will call kthread_stop() if shost->ehandler != NULL which will always be the case whether the kthread was successfully spawned or not. In the case that it failed to spawn this has the nasty side effect of trying to dereference an invalid pointer when kthread_stop() is called. The following splat provides an example of this behavior in the wild:
scsi host11: error handler thread failed to spawn, error = -4 Kernel attempted to read user page (10c) - exploit attempt? (uid: 0)
BUG: Kernel NULL pointer dereference on read at 0x0000010c Faulting instruction address: 0xc00000000818e9a8 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: ibmvscsi(+) scsi_transport_srp dm_multipath dm_mirror dm_region hash dm_log dm_mod fuse overlay squashfs loop CPU: 12 PID: 274 Comm: systemd-udevd Not tainted 5.13.0-rc7 #1 NIP: c00000000818e9a8 LR: c0000000089846e8 CTR: 0000000000007ee8 REGS: c000000037d12ea0 TRAP: 0300 Not tainted (5.13.0-rc7) MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 28228228
XER: 20040001
CFAR: c0000000089846e4 DAR: 000000000000010c DSISR: 40000000 IRQMASK: 0
GPR00: c0000000089846e8 c000000037d13140 c000000009cc1100 fffffffffffffffc
GPR04: 0000000000000001 0000000000000000 0000000000000000 c000000037dc0000
GPR08: 0000000000000000 c000000037dc0000 0000000000000001 00000000fffff7ff
GPR12: 0000000000008000 c00000000a049000 c000000037d13d00 000000011134d5a0
GPR16: 0000000000001740 c0080000190d0000 c0080000190d1740 c000000009129288
GPR20: c000000037d13bc0 0000000000000001 c000000037d13bc0 c0080000190b7898
GPR24: c0080000190b7708 0000000000000000 c000000033bb2c48 0000000000000000
GPR28: c000000046b28280 0000000000000000 000000000000010c fffffffffffffffc NIP [c00000000818e9a8] kthread_stop+0x38/0x230
LR [c0000000089846e8] scsi_host_dev_release+0x98/0x160
Call Trace:
[c000000033bb2c48] 0xc000000033bb2c48 (unreliable) [c0000000089846e8] scsi_host_dev_release+0x98/0x160 [c00000000891e960] device_release+0x60/0x100 [c0000000087e55c4] kobject_release+0x84/0x210 [c00000000891ec78] put_device+0x28/0x40 [c000000008984ea4] scsi_host_alloc+0x314/0x430 [c0080000190b38bc] ibmvscsi_probe+0x54/0xad0 [ibmvscsi] [c000000008110104] vio_bus_probe+0xa4/0x4b0 [c00000000892a860] really_probe+0x140/0x680 [c00000000892aefc] driver_probe_device+0x15c/0x200 [c00000000892b63c] device_driver_attach+0xcc/0xe0 [c00000000892b740] __driver_attach+0xf0/0x200 [c000000008926f28] bus_for_each_dev+0xa8/0x130 [c000000008929ce4] driver_attach+0x34/0x50 [c000000008928fc0] bus_add_driver+0x1b0/0x300 [c00000000892c798] driver_register+0x98/0x1a0 [c00000000810eb60] __vio_register_driver+0x80/0xe0 [c0080000190b4a30] ibmvscsi_module_init+0x9c/0xdc [ibmvscsi] [c0000000080121d0] do_one_initcall+0x60/0x2d0 [c000000008261abc] do_init_module+0x7c/0x320 [c000000008265700] load_module+0x2350/0x25b0 [c000000008265cb4] __do_sys_finit_module+0xd4/0x160 [c000000008031110] system_call_exception+0x150/0x2d0 [c00000000800d35c] system_call_common+0xec/0x278
Fix this be nulling shost->ehandler when the kthread fails to spawn.
--- drivers/scsi/hosts.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/hosts.c +1 -0
@@ -515,6 +515,7 @@ struct Scsi_Host *scsi_host_alloc(structshost_printk (KERN_WARNING , shost,"error handler thread failed to spawn, error = %ld\n" ,PTR_ERR (shost->ehandler)); + shost->ehandler =NULL ; goto fail; }