4.19.321-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainercover 4.19.321-rc1 review
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +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.19.321-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.19.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.19.321-rc1
Daniel Vetter <[email protected]>
drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
Vasily Averin <[email protected]>
ipc: remove memcg accounting for sops objects in do_semtimedop()
Ben Hutchings <[email protected]>
scsi: aacraid: Fix double-free on probe failure
Zijun Hu <[email protected]>
usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes()
Krzysztof Kozlowski <[email protected]>
usb: dwc3: st: fix probed platform device ref count on probe error path
Selvarasu Ganesan <[email protected]>
usb: dwc3: core: Prevent USB core invalid event buffer address access
Krzysztof Kozlowski <[email protected]>
usb: dwc3: omap: add missing depopulate in probe error path
ZHANG Yuntian <[email protected]>
USB: serial: option: add MeiG Smart SRM825L
Ian Ray <[email protected]>
cdc-acm: Add DISABLE_ECHO quirk for GE HealthCare UI Controller
Eric Dumazet <[email protected]>
net: busy-poll: use ktime_get_ns() instead of local_clock()
Cong Wang <[email protected]>
gtp: fix a potential NULL pointer dereference
Krzysztof Kozlowski <[email protected]>
soundwire: stream: fix programming slave ports for non-continous port maps
Eric Dumazet <[email protected]>
net: prevent mss overflow in skb_segment()
Matthew Wilcox (Oracle) <[email protected]>
ida: Fix crash in ida_free when the bitmap is empty
Allison Henderson <[email protected]>
net:rds: Fix possible deadlock in rds_message_put
Helge Deller <[email protected]>
fbmem: Check virtual screen sizes in fb_set_var()
Helge Deller <[email protected]>
fbcon: Prevent that screen size is smaller than font size
Vasily Averin <[email protected]>
memcg: enable accounting of ipc resources
Chen Ridong <[email protected]>
cgroup/cpuset: Prevent UAF in proc_cpuset_show()
Niklas Cassel <[email protected]>
ata: libata-core: Fix null pointer dereference on error
Ricardo Ribalda <[email protected]>
media: uvcvideo: Fix integer overflow calculating timestamp
Long Li <[email protected]>
filelock: Correct the filelock owner in fcntl_setlk/fcntl_setlk64
Damien Le Moal <[email protected]>
scsi: mpt3sas: Avoid IOMMU page faults on REPORT ZONES
Mikulas Patocka <[email protected]>
dm suspend: return -ERESTARTSYS instead of -EINTR
Sascha Hauer <[email protected]>
wifi: mwifiex: duplicate static structs used in driver instances
Ma Ke <[email protected]>
pinctrl: single: fix potential NULL dereference in pcs_get_function()
Jesse Zhang <[email protected]>
drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc
Alexander Lobakin <[email protected]>
tools: move alignment-related macros to new <linux/align.h>
Tetsuo Handa <[email protected]>
Input: MT - limit max slots
Lee, Chun-Yi <[email protected]>
Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
Takashi Iwai <[email protected]>
ALSA: timer: Relax start tick time check for slave timer elements
Ben Whitten <[email protected]>
mmc: dw_mmc: allow biu and ciu clocks to defer
Nikolay Kuratov <[email protected]>
cxgb4: add forgotten u64 ivlan cast before shift
Jason Gerecke <[email protected]>
HID: wacom: Defer calculation of resolution until resolution_code is known
Griffin Kroah-Hartman <[email protected]>
Bluetooth: MGMT: Add error handling to pair_device()
Dan Carpenter <[email protected]>
mmc: mmc_test: Fix NULL dereference on allocation failure
Dmitry Baryshkov <[email protected]>
drm/msm/dpu: don't play tricks with debug macros
Jani Nikula <[email protected]>
drm/msm: use drm_debug_enabled() to check for debug categories
Sean Anderson <[email protected]>
net: xilinx: axienet: Always disable promiscuous mode
Eric Dumazet <[email protected]>
ipv6: prevent UAF in ip6_send_skb()
Sebastian Andrzej Siewior <[email protected]>
netfilter: nft_counter: Synchronize nft_counter_reset() against reader.
Kuniyuki Iwashima <[email protected]>
kcm: Serialise kcm_sendmsg() for the same socket.
Luiz Augusto von Dentz <[email protected]>
Bluetooth: hci_core: Fix LE quote calculation
Luiz Augusto von Dentz <[email protected]>
Bluetooth: hci_core: Fix not handling link timeouts propertly
Luiz Augusto von Dentz <[email protected]>
Bluetooth: Make use of __check_timeout on hci_sched_le
Tetsuo Handa <[email protected]>
block: use "unsigned long" for blk_validate_block_size().
Eric Dumazet <[email protected]>
gtp: pull network headers in gtp_dev_xmit()
Phil Chang <[email protected]>
hrtimer: Prevent queuing of hrtimer without a function callback
Sagi Grimberg <[email protected]>
nvmet-rdma: fix possible bad dereference when freeing rsps
Baokun Li <[email protected]>
ext4: set the type of max_zeroout to unsigned int to avoid overflow
Guanrui Huang <[email protected]>
irqchip/gic-v3-its: Remove BUG_ON in its_vpe_irq_domain_alloc
Abdulrasaq Lawani <[email protected]>
fbdev: offb: replace of_node_put with __free(device_node)
Krishna Kurapati <[email protected]>
usb: dwc3: core: Skip setting event buffers for host only controllers
Alexander Gordeev <[email protected]>
s390/iucv: fix receive buffer virtual vs physical address confusion
Oreoluwa Babatunde <[email protected]>
openrisc: Call setup_memory() earlier in the init sequence
NeilBrown <[email protected]>
NFS: avoid infinite loop in pnfs_update_layout.
Luiz Augusto von Dentz <[email protected]>
Bluetooth: bnep: Fix out-of-bound access
Uwe Kleine-König <[email protected]>
usb: gadget: fsl: Increase size of name buffer for endpoints
Zhiguo Niu <[email protected]>
f2fs: fix to do sanity check in update_sit_entry
David Sterba <[email protected]>
btrfs: delete pointless BUG_ON check on quota root in btrfs_qgroup_account_extent()
David Sterba <[email protected]>
btrfs: send: handle unexpected data in header buffer in begin_cmd()
David Sterba <[email protected]>
btrfs: handle invalid root reference found in may_destroy_subvol()
David Sterba <[email protected]>
btrfs: change BUG_ON to assertion when checking for delayed_node root
Michael Ellerman <[email protected]>
powerpc/boot: Only free if realloc() succeeds
Li zeming <[email protected]>
powerpc/boot: Handle allocation failure in simple_realloc()
Helge Deller <[email protected]>
parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367
Li Nan <[email protected]>
md: clean up invalid BUG_ON in md_ioctl
Kees Cook <[email protected]>
net/sun3_82586: Avoid reading past buffer in debug output
Justin Tee <[email protected]>
scsi: lpfc: Initialize status local variable in lpfc_sli4_repost_sgl_list()
Max Filippov <[email protected]>
fs: binfmt_elf_efpic: don't use missing interpreter's properties
Hans Verkuil <[email protected]>
media: pci: cx23885: check cx23885_vdev_init() return
Jan Kara <[email protected]>
quota: Remove BUG_ON from dqget()
Baokun Li <[email protected]>
ext4: do not trim the group with corrupted block bitmap
Kunwu Chan <[email protected]>
powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu
Miri Korenblit <[email protected]>
wifi: iwlwifi: abort scan when rfkill on but device enabled
Andreas Gruenbacher <[email protected]>
gfs2: setattr_chown: Add missing initialization
Mike Christie <[email protected]>
scsi: spi: Fix sshdr use
Christian Brauner <[email protected]>
binfmt_misc: cleanup on filesystem umount
Chengfeng Ye <[email protected]>
staging: ks7010: disable bh on tx_dev_lock
Wolfram Sang <[email protected]>
i2c: riic: avoid potential division by zero
Jeff Johnson <[email protected]>
wifi: cw1200: Avoid processing an invalid TIM IE
Rand Deeb <[email protected]>
ssb: Fix division by zero issue in ssb_calc_clock_rate
Pawel Dembicki <[email protected]>
net: dsa: vsc73xx: pass value in phy_write operation
Dan Carpenter <[email protected]>
atm: idt77252: prevent use after free in dequeue_rx()
Cosmin Ratiu <[email protected]>
net/mlx5e: Correctly report errors for ethtool rx flows
Alexander Lobakin <[email protected]>
btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits()
Alexander Lobakin <[email protected]>
s390/cio: rename bitmap_size() -> idset_bitmap_size()
Al Viro <[email protected]>
memcg_write_event_control(): fix a user-triggerable oops
Bas Nieuwenhuizen <[email protected]>
drm/amdgpu: Actually check flags for all context ops.
Zhen Lei <[email protected]>
selinux: fix potential counting error in avc_add_xperms_decision()
Al Viro <[email protected]>
fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
Alexander Lobakin <[email protected]>
bitmap: introduce generic optimized bitmap_size()
Mikulas Patocka <[email protected]>
dm persistent data: fix memory allocation failure
Khazhismel Kumykov <[email protected]>
dm resume: don't return EINVAL when signalled
Haibo Xu <[email protected]>
arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
Mathias Nyman <[email protected]>
xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
Juan José Arboleda <[email protected]>
ALSA: usb-audio: Support Yamaha P-125 quirk entry
Jann Horn <[email protected]>
fuse: Initialize beyond-EOF page contents before setting uptodate
-------------
Diffstat:
Makefile | 4 +- arch/arm64/kernel/acpi_numa.c | 2 +- arch/openrisc/kernel/setup.c | 6 +- arch/parisc/kernel/irq.c | 4 +- arch/powerpc/boot/simple_alloc.c | 7 +- arch/powerpc/sysdev/xics/icp-native.c | 2 + drivers/ata/libata-core.c | 3 + drivers/atm/idt77252.c | 9 +- drivers/bluetooth/hci_ldisc.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 + drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 +- drivers/gpu/drm/drm_fb_helper.c | 3 + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 +- drivers/hid/wacom_wac.c | 4 +- drivers/i2c/busses/i2c-riic.c | 2 +- drivers/input/input-mt.c | 3 + drivers/irqchip/irq-gic-v3-its.c | 2 - drivers/md/dm-ioctl.c | 22 ++- drivers/md/dm.c | 2 +- drivers/md/md.c | 5 - drivers/md/persistent-data/dm-space-map-metadata.c | 4 +- drivers/media/pci/cx23885/cx23885-video.c | 8 + drivers/media/usb/uvc/uvc_video.c | 10 +- drivers/mmc/core/mmc_test.c | 9 +- drivers/mmc/host/dw_mmc.c | 8 + drivers/net/dsa/vitesse-vsc73xx.c | 2 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 +- drivers/net/ethernet/i825xx/sun3_82586.c | 2 +- .../ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 +- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 + drivers/net/gtp.c | 5 +- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 32 ++- drivers/net/wireless/st/cw1200/txrx.c | 2 +- drivers/nvme/target/rdma.c | 16 +- drivers/pinctrl/pinctrl-single.c | 2 + drivers/s390/cio/idset.c | 12 +- drivers/scsi/aacraid/comminit.c | 2 + drivers/scsi/lpfc/lpfc_sli.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_base.c | 20 +- drivers/scsi/scsi_transport_spi.c | 4 +- drivers/soundwire/stream.c | 8 +- drivers/ssb/main.c | 2 +- drivers/staging/ks7010/ks7010_sdio.c | 4 +- drivers/usb/class/cdc-acm.c | 3 + drivers/usb/core/sysfs.c | 1 + drivers/usb/dwc3/core.c | 21 ++ drivers/usb/dwc3/dwc3-omap.c | 4 +- drivers/usb/dwc3/dwc3-st.c | 11 +- drivers/usb/gadget/udc/fsl_udc_core.c | 2 +- drivers/usb/host/xhci.c | 8 +- drivers/usb/serial/option.c | 5 + drivers/video/fbdev/core/fbcon.c | 28 +++ drivers/video/fbdev/core/fbmem.c | 20 +- drivers/video/fbdev/offb.c | 3 +- fs/binfmt_elf_fdpic.c | 2 +- fs/binfmt_misc.c | 216 ++++++++++++++++----- fs/btrfs/delayed-inode.c | 2 +- fs/btrfs/free-space-cache.c | 8 +- fs/btrfs/inode.c | 9 +- fs/btrfs/qgroup.c | 2 - fs/btrfs/send.c | 7 +- fs/ext4/extents.c | 3 +- fs/ext4/mballoc.c | 3 + fs/f2fs/segment.c | 5 +- fs/file.c | 28 ++- fs/fuse/dev.c | 6 +- fs/gfs2/inode.c | 2 +- fs/locks.c | 4 +- fs/nfs/pnfs.c | 8 + fs/quota/dquot.c | 5 +- include/linux/bitmap.h | 20 +- include/linux/blkdev.h | 2 +- include/linux/cpumask.h | 2 +- include/linux/fbcon.h | 4 + include/net/busy_poll.h | 2 +- include/net/kcm.h | 1 + ipc/msg.c | 2 +- ipc/sem.c | 7 +- ipc/shm.c | 2 +- kernel/cgroup/cpuset.c | 13 +- kernel/time/hrtimer.c | 2 + lib/idr.c | 2 +- lib/test_ida.c | 40 ++++ mm/memcontrol.c | 7 +- net/bluetooth/bnep/core.c | 3 +- net/bluetooth/hci_core.c | 58 +++--- net/bluetooth/mgmt.c | 4 + net/core/skbuff.c | 3 +- net/ipv6/ip6_output.c | 2 + net/iucv/iucv.c | 3 +- net/kcm/kcmsock.c | 4 + net/netfilter/nft_counter.c | 5 + net/rds/recv.c | 13 +- security/selinux/avc.c | 2 +- sound/core/timer.c | 2 +- sound/usb/quirks-table.h | 1 + tools/include/linux/align.h | 12 ++ tools/include/linux/bitmap.h | 8 +- 99 files changed, 662 insertions(+), 253 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/98 fuse: Initialize beyond-EOF page contents before setting uptodate
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jann Horn <[email protected]>
commit 3c0da3d163eb32f1f91891efaade027fa9b245b9 upstream.
fuse_notify_store(), unlike fuse_do_readpage(), does not enable page zeroing (because it can be used to change partial page contents).
So fuse_notify_store() must be more careful to fully initialize page contents (including parts of the page that are beyond end-of-file) before marking the page uptodate.
The current code can leave beyond-EOF page contents uninitialized, which makes these uninitialized page contents visible to userspace via mmap().
This is an information leak, but only affects systems which do not enable init-on-alloc (via CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y or the corresponding kernel command line parameter).
--- fs/fuse/dev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/fuse/dev.c +4 -2
@@ -1671,9 +1671,11 @@ static int fuse_notify_store(struct fuse this_num =min_t (unsigned, num,PAGE_SIZE - offset); err =fuse_copy_page (cs, &page, offset, this_num,0 ); -if (!err && offset ==0 && - (this_num ==PAGE_SIZE || file_size == end)) +if (!PageUptodate (page) && !err && offset ==0 && + (this_num ==PAGE_SIZE || file_size == end)) { +zero_user_segment (page, this_num,PAGE_SIZE );SetPageUptodate (page); + }unlock_page (page);put_page (page);
Greg Kroah-Hartman
maintainerPATCH 2/98 ALSA: usb-audio: Support Yamaha P-125 quirk entry
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juan José Arboleda <[email protected]>
commit c286f204ce6ba7b48e3dcba53eda7df8eaa64dd9 upstream.
This patch adds a USB quirk for the Yamaha P-125 digital piano.
--- sound/usb/quirks-table.h | 1 + 1 file changed, 1 insertion(+)
sound/usb/quirks-table.h +1 -0
@@ -352,6 +352,7 @@ YAMAHA_DEVICE(0x105a, NULL), YAMAHA_DEVICE(0x105b, NULL), YAMAHA_DEVICE(0x105c, NULL), YAMAHA_DEVICE(0x105d, NULL), +YAMAHA_DEVICE(0x1718, "P-125"), { USB_DEVICE(0x0499, 0x1503), .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
Greg Kroah-Hartman
maintainerPATCH 3/98 xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Nyman <[email protected]>
commit af8e119f52e9c13e556be9e03f27957554a84656 upstream.
re-enumerating full-speed devices after a failed address device command can trigger a NULL pointer dereference.
Full-speed devices may need to reconfigure the endpoint 0 Max Packet Size value during enumeration. Usb core calls usb_ep0_reinit() in this case, which ends up calling xhci_configure_endpoint().
On Panther point xHC the xhci_configure_endpoint() function will additionally check and reserve bandwidth in software. Other hosts do this in hardware
If xHC address device command fails then a new xhci_virt_device structure is allocated as part of re-enabling the slot, but the bandwidth table pointers are not set up properly here.
This triggers the NULL pointer dereference the next time usb_ep0_reinit() is called and xhci_configure_endpoint() tries to check and reserve bandwidth
[46710.713538] usb 3-1: new full-speed USB device number 5 using xhci_hcd [46710.713699] usb 3-1: Device not responding to setup address. [46710.917684] usb 3-1: Device not responding to setup address. [46711.125536] usb 3-1: device not accepting address 5, error -71 [46711.125594] BUG: kernel NULL pointer dereference, address: 0000000000000008 [46711.125600] #PF: supervisor read access in kernel mode [46711.125603] #PF: error_code(0x0000) - not-present page [46711.125606] PGD 0 P4D 0 [46711.125610] Oops: Oops: 0000 [#1] PREEMPT SMP PTI [46711.125615] CPU: 1 PID: 25760 Comm: kworker/1:2 Not tainted 6.10.3_2 #1 [46711.125620] Hardware name: Gigabyte Technology Co., Ltd. [46711.125623] Workqueue: usb_hub_wq hub_event [usbcore] [46711.125668] RIP: 0010:xhci_reserve_bandwidth (drivers/usb/host/xhci.c
Fix this by making sure bandwidth table pointers are set up correctly after a failed address device command, and additionally by avoiding checking for bandwidth in cases like this where no actual endpoints are added or removed, i.e. only context for default control endpoint 0 is evaluated.
--- drivers/usb/host/xhci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/usb/host/xhci.c +5 -3
@@ -2790,7 +2790,7 @@ static int xhci_configure_endpoint(struc xhci->num_active_eps);return -ENOMEM ; } -if ((xhci->quirks &XHCI_SW_BW_CHECKING ) && +if ((xhci->quirks &XHCI_SW_BW_CHECKING ) && !ctx_change &&xhci_reserve_bandwidth (xhci, virt_dev, command->in_ctx)) {if ((xhci->quirks &XHCI_EP_LIMIT_QUIRK ))xhci_free_host_resources (xhci, ctrl_ctx);
@@ -4145,8 +4145,10 @@ static int xhci_setup_device(struct usb_mutex_unlock (&xhci->mutex); ret =xhci_disable_slot (xhci, udev->slot_id);xhci_free_virt_device (xhci, udev->slot_id); -if (!ret) -xhci_alloc_dev (hcd, udev); +if (!ret) { +if (xhci_alloc_dev (hcd, udev) ==1 ) +xhci_setup_addressable_virt_dev (xhci, udev); + }kfree (command->completion);kfree (command);return -EPROTO ;
Greg Kroah-Hartman
maintainerPATCH 4/98 arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haibo Xu <[email protected]>
commit a21dcf0ea8566ebbe011c79d6ed08cdfea771de3 upstream.
Currently, only acpi_early_node_map[0] was initialized to NUMA_NO_NODE. To ensure all the values were properly initialized, switch to initialize all of them to NUMA_NO_NODE.
--- arch/arm64/kernel/acpi_numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/acpi_numa.c +1 -1
@@ -28,7 +28,7 @@#include <asm/numa.h> -static int acpi_early_node_map[NR_CPUS ]__initdata = {NUMA_NO_NODE }; +static int acpi_early_node_map[NR_CPUS ]__initdata = { [0 ...NR_CPUS -1 ] =NUMA_NO_NODE };int __init acpi_numa_get_nid (unsigned int cpu) {
Greg Kroah-Hartman
maintainerPATCH 5/98 dm resume: dont return EINVAL when signalled
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khazhismel Kumykov <[email protected]>
commit 7a636b4f03af9d541205f69e373672e7b2b60a8a upstream.
If the dm_resume method is called on a device that is not suspended, the method will suspend the device briefly, before resuming it (so that the table will be swapped).
However, there was a bug that the return value of dm_suspended_md was not checked. dm_suspended_md may return an error when it is interrupted by a signal. In this case, do_resume would call dm_swap_table, which would return -EINVAL.
This commit fixes the logic, so that error returned by dm_suspend is checked and the resume operation is undone.
--- drivers/md/dm-ioctl.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/md/dm-ioctl.c +20 -2
@@ -1039,8 +1039,26 @@ static int do_resume(struct dm_ioctl *pa suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG ;if (param->flags &DM_NOFLUSH_FLAG ) suspend_flags |=DM_SUSPEND_NOFLUSH_FLAG ; -if (!dm_suspended_md (md)) -dm_suspend (md, suspend_flags); +if (!dm_suspended_md (md)) { + r =dm_suspend (md, suspend_flags); +if (r) { +down_write (&_hash_lock); + hc =dm_get_mdptr (md); +if (hc && !hc->new_map) { + hc->new_map = new_map; + new_map =NULL ; + }else { + r = -ENXIO ; + } +up_write (&_hash_lock); +if (new_map) { +dm_sync_table (md); +dm_table_destroy (new_map); + } +dm_put (md); +return r; + } + } old_map =dm_swap_table (md, new_map);if (IS_ERR (old_map)) {
Greg Kroah-Hartman
maintainerPATCH 6/98 dm persistent data: fix memory allocation failure
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit faada2174c08662ae98b439c69efe3e79382c538 upstream.
kmalloc is unreliable when allocating more than 8 pages of memory. It may fail when there is plenty of free memory but the memory is fragmented. Zdenek Kabelac observed such failure in his tests.
This commit changes kmalloc to kvmalloc - kvmalloc will fall back to vmalloc if the large allocation fails.
--- drivers/md/persistent-data/dm-space-map-metadata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +2 -2
@@ -275,7 +275,7 @@ static void sm_metadata_destroy(struct d { struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); -kfree (smm); +kvfree (smm); }static int sm_metadata_get_nr_blocks (struct dm_space_map *sm,dm_block_t *count)
@@ -759,7 +759,7 @@ struct dm_space_map *dm_sm_metadata_init {struct sm_metadata *smm; - smm =kmalloc (sizeof (*smm),GFP_KERNEL ); + smm =kvmalloc (sizeof (*smm),GFP_KERNEL );if (!smm)return ERR_PTR (-ENOMEM );
Greg Kroah-Hartman
maintainerPATCH 7/98 bitmap: introduce generic optimized bitmap_size()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
commit a37fbe666c016fd89e4460d0ebfcea05baba46dc upstream.
The number of times yet another open coded BITS_TO_LONGS(nbits) * sizeof(long) can be spotted is huge. Some generic helper is long overdue.
Add one, bitmap_size(), but with one detail. BITS_TO_LONGS() uses DIV_ROUND_UP(). The latter works well when both divident and divisor are compile-time constants or when the divisor is not a pow-of-2. When it is however, the compilers sometimes tend to generate suboptimal code (GCC 13):
48 83 c0 3f add $0x3f,%rax 48 c1 e8 06 shr $0x6,%rax
48 8d 14 c5 00 00 00 00 lea 0x0(,%rax,8),%rdx
%BITS_PER_LONG is always a pow-2 (either 32 or 64), but GCC still does full division of nbits + 63 by it and then multiplication by 8. Instead of BITS_TO_LONGS(), use ALIGN() and then divide by 8. GCC:
8d 50 3f lea 0x3f(%rax),%edx c1 ea 03 shr $0x3,%edx 81 e2 f8 ff ff 1f and $0x1ffffff8,%edx
Now it shifts nbits + 63 by 3 positions (IOW performs fast division by 8) and then masks bits[2:0]. bloat-o-meter:
add/remove: 0/0 grow/shrink: 20/133 up/down: 156/-773 (-617)
Clang does it better and generates the same code before/after starting from -O1, except that with the ALIGN() approach it uses %edx and thus still saves some bytes:
add/remove: 0/0 grow/shrink: 9/133 up/down: 18/-538 (-520)
Note that we can't expand DIV_ROUND_UP() by adding a check and using this approach there, as it's used in array declarations where expressions are not allowed.
Add this helper to tools/ as well.
--- drivers/s390/cio/idset.c | 2 +- include/linux/bitmap.h | 8 +++++--- include/linux/cpumask.h | 2 +- tools/include/linux/bitmap.h | 7 ++++--- 4 files changed, 11 insertions(+), 8 deletions(-)
drivers/s390/cio/idset.c +1 -1
@@ -18,7 +18,7 @@ struct idset {static inline unsigned long bitmap_size (int num_ssid,int num_id) { -return BITS_TO_LONGS (num_ssid * num_id) *sizeof (unsigned long ); +return bitmap_size (size_mul (num_ssid, num_id)); }static struct idset *idset_new (int num_ssid,int num_id)
include/linux/bitmap.h +5 -3
@@ -212,12 +212,14 @@ extern int bitmap_print_to_pagebuf(bool#define small_const_nbits (nbits) \ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) +#define bitmap_size (nbits) (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE) +static inline void bitmap_zero (unsigned long *dst,unsigned int nbits) {if (small_const_nbits (nbits)) *dst =0UL ;else { -unsigned int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); +unsigned int len =bitmap_size (nbits);memset (dst,0 , len); } }
@@ -227,7 +229,7 @@ static inline void bitmap_fill(unsignedif (small_const_nbits (nbits)) *dst = ~0UL ;else { -unsigned int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); +unsigned int len =bitmap_size (nbits);memset (dst,0xff , len); } }
@@ -238,7 +240,7 @@ static inline void bitmap_copy(unsignedif (small_const_nbits (nbits)) *dst = *src;else { -unsigned int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); +unsigned int len =bitmap_size (nbits);memcpy (dst, src, len); } }
include/linux/cpumask.h +1 -1
@@ -656,7 +656,7 @@ static inline int cpulist_parse(const ch*/ static inline unsigned int cpumask_size (void ) { -return BITS_TO_LONGS (nr_cpumask_bits) *sizeof (long ); +return bitmap_size (nr_cpumask_bits); }/*
tools/include/linux/bitmap.h +4 -3
@@ -27,13 +27,14 @@ int __bitmap_and(unsigned long *dst, con#define small_const_nbits (nbits) \ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) +#define bitmap_size (nbits) (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE) +static inline void bitmap_zero (unsigned long *dst,int nbits) {if (small_const_nbits (nbits)) *dst =0UL ;else { -int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); -memset (dst,0 , len); +memset (dst,0 ,bitmap_size (nbits)); } }
@@ -119,7 +120,7 @@ static inline int test_and_clear_bit(int*/ static inline unsigned long *bitmap_alloc (int nbits) { -return calloc (1 ,BITS_TO_LONGS (nbits) *sizeof (unsigned long )); +return calloc (1 ,bitmap_size (nbits)); }/*
Greg Kroah-Hartman
maintainerPATCH 8/98 fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 9a2fa1472083580b6c66bdaf291f591e1170123a upstream.
copy_fd_bitmaps(new, old, count) is expected to copy the first count/BITS_PER_LONG bits from old->full_fds_bits[] and fill the rest with zeroes. What it does is copying enough words (BITS_TO_LONGS(count/BITS_PER_LONG)), then memsets the rest. That works fine, *if* all bits past the cutoff point are clear. Otherwise we are risking garbage from the last word we'd copied.
For most of the callers that is true - expand_fdtable() has count equal to old->max_fds, so there's no open descriptors past count, let alone fully occupied words in ->open_fds[], which is what bits in ->full_fds_bits[] correspond to.
The other caller (dup_fd()) passes sane_fdtable_size(old_fdt, max_fds), which is the smallest multiple of BITS_PER_LONG that covers all opened descriptors below max_fds. In the common case (copying on fork()) max_fds is ~0U, so all opened descriptors will be below it and we are fine, by the same reasons why the call in expand_fdtable() is safe.
Unfortunately, there is a case where max_fds is less than that and where we might, indeed, end up with junk in ->full_fds_bits[] - close_range(from, to, CLOSE_RANGE_UNSHARE) with
* descriptor table being currently shared
* 'to' being above the current capacity of descriptor table
* 'from' being just under some chunk of opened descriptors.
In that case we end up with observably wrong behaviour - e.g. spawn a child with CLONE_FILES, get all descriptors in range 0..127 open, then close_range(64, ~0U, CLOSE_RANGE_UNSHARE) and watch dup(0) ending up with descriptor #128, despite #64 being observably not open.
The minimally invasive fix would be to deal with that in dup_fd(). If this proves to add measurable overhead, we can go that way, but let's try to fix copy_fd_bitmaps() first.
* new helper: bitmap_copy_and_expand(to, from, bits_to_copy, size).
* make copy_fd_bitmaps() take the bitmap size in words, rather than bits; it's 'count' argument is always a multiple of BITS_PER_LONG, so we are not losing any information, and that way we can use the same helper for all three bitmaps - compiler will see that count is a multiple of BITS_PER_LONG for the large ones, so it'll generate plain memcpy()+memset().
Reproducer added to tools/testing/selftests/core/close_range_test.c
--- fs/file.c | 28 ++++++++++++---------------- include/linux/bitmap.h | 12 ++++++++++++ 2 files changed, 24 insertions(+), 16 deletions(-)
fs/file.c +12 -16
@@ -41,27 +41,23 @@ static void free_fdtable_rcu(struct rcu_#define BITBIT_NR (nr) BITS_TO_LONGS(BITS_TO_LONGS(nr))#define BITBIT_SIZE (nr) (BITBIT_NR(nr) * sizeof(long)) +#define fdt_words (fdt) ((fdt)->max_fds / BITS_PER_LONG) // words in ->open_fds/* * Copy 'count' fd bits from the old table to the new table and clear the extra * space if any. This does not copy the file pointers. Called with the files * spinlock held for write. */ -static void copy_fd_bitmaps (struct fdtable *nfdt,struct fdtable *ofdt, -unsigned int count) +static inline void copy_fd_bitmaps (struct fdtable *nfdt,struct fdtable *ofdt, +unsigned int copy_words) { -unsigned int cpy, set; +unsigned int nwords =fdt_words (nfdt); - cpy = count /BITS_PER_BYTE ; - set = (nfdt->max_fds - count) /BITS_PER_BYTE ; -memcpy (nfdt->open_fds, ofdt->open_fds, cpy); -memset ((char *)nfdt->open_fds + cpy,0 , set); -memcpy (nfdt->close_on_exec, ofdt->close_on_exec, cpy); -memset ((char *)nfdt->close_on_exec + cpy,0 , set); - - cpy =BITBIT_SIZE (count); - set =BITBIT_SIZE (nfdt->max_fds) - cpy; -memcpy (nfdt->full_fds_bits, ofdt->full_fds_bits, cpy); -memset ((char *)nfdt->full_fds_bits + cpy,0 , set); +bitmap_copy_and_extend (nfdt->open_fds, ofdt->open_fds, + copy_words *BITS_PER_LONG , nwords *BITS_PER_LONG ); +bitmap_copy_and_extend (nfdt->close_on_exec, ofdt->close_on_exec, + copy_words *BITS_PER_LONG , nwords *BITS_PER_LONG ); +bitmap_copy_and_extend (nfdt->full_fds_bits, ofdt->full_fds_bits, + copy_words, nwords); }/*
@@ -79,7 +75,7 @@ static void copy_fdtable(struct fdtablememcpy (nfdt->fd, ofdt->fd, cpy);memset ((char *)nfdt->fd + cpy,0 , set); -copy_fd_bitmaps (nfdt, ofdt, ofdt->max_fds); +copy_fd_bitmaps (nfdt, ofdt,fdt_words (ofdt)); }static struct fdtable *alloc_fdtable (unsigned int nr)
@@ -330,7 +326,7 @@ struct files_struct *dup_fd(struct files open_files =count_open_files (old_fdt); } -copy_fd_bitmaps (new_fdt, old_fdt, open_files); +copy_fd_bitmaps (new_fdt, old_fdt, open_files /BITS_PER_LONG ); old_fds = old_fdt->fd; new_fds = new_fdt->fd;
include/linux/bitmap.h +12 -0
@@ -256,6 +256,18 @@ static inline void bitmap_copy_clear_tai dst[nbits /BITS_PER_LONG ] &=BITMAP_LAST_WORD_MASK (nbits); } +static inline void bitmap_copy_and_extend (unsigned long *to, +const unsigned long *from, +unsigned int count,unsigned int size) +{ +unsigned int copy =BITS_TO_LONGS (count); + +memcpy (to, from, copy *sizeof (long )); +if (count %BITS_PER_LONG ) + to[copy -1 ] &=BITMAP_LAST_WORD_MASK (count); +memset (to + copy,0 ,bitmap_size (size) - copy *sizeof (long )); +} +/* * On 32-bit systems bitmaps are represented as u32 arrays internally, and * therefore conversion is not needed when copying data from/to arrays of u32.
Greg Kroah-Hartman
maintainerPATCH 9/98 selinux: fix potential counting error in avc_add_xperms_decision()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhen Lei <[email protected]>
commit 379d9af3f3da2da1bbfa67baf1820c72a080d1f1 upstream.
The count increases only when a node is successfully added to the linked list.
--- security/selinux/avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/avc.c +1 -1
@@ -401,12 +401,12 @@ static int avc_add_xperms_decision(struc {struct avc_xperms_decision_node *dest_xpd; - node->ae.xp_node->xp.len++; dest_xpd =avc_xperms_decision_alloc (src->used);if (!dest_xpd)return -ENOMEM ;avc_copy_xperms_decision (&dest_xpd->xpd, src);list_add (&dest_xpd->xpd_list, &node->ae.xp_node->xpd_head); + node->ae.xp_node->xp.len++;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 10/98 drm/amdgpu: Actually check flags for all context ops.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bas Nieuwenhuizen <[email protected]>
commit 0573a1e2ea7e35bff08944a40f1adf2bb35cea61 upstream.
Missing validation ...
Checked libdrm and it clears all the structs, so we should be safe to just check everything.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +8 -0
@@ -288,16 +288,24 @@ int amdgpu_ctx_ioctl(struct drm_device *switch (args->in.op) {case AMDGPU_CTX_OP_ALLOC_CTX : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_alloc (adev, fpriv, filp, priority, &id); args->out.alloc.ctx_id = id;break ;case AMDGPU_CTX_OP_FREE_CTX : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_free (fpriv, id);break ;case AMDGPU_CTX_OP_QUERY_STATE : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_query (adev, fpriv, id, &args->out);break ;case AMDGPU_CTX_OP_QUERY_STATE2 : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_query2 (adev, fpriv, id, &args->out);break ;default :
Greg Kroah-Hartman
maintainerPATCH 11/98 memcg_write_event_control(): fix a user-triggerable oops
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 046667c4d3196938e992fba0dfcde570aa85cd0e upstream.
we are *not* guaranteed that anything past the terminating NUL is mapped (let alone initialized with anything sane).
--- mm/memcontrol.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/memcontrol.c +5 -2
@@ -4140,9 +4140,12 @@ static ssize_t memcg_write_event_control buf = endp +1 ; cfd =simple_strtoul (buf, &endp,10 ); -if ((*endp !=' ' ) && (*endp !='\0' )) +if (*endp =='\0' ) + buf = endp; +else if (*endp ==' ' ) + buf = endp +1 ; +else return -EINVAL ; - buf = endp +1 ; event =kzalloc (sizeof (*event),GFP_KERNEL );if (!event)
Greg Kroah-Hartman
maintainerPATCH 12/98 s390/cio: rename bitmap_size() -> idset_bitmap_size()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
commit c1023f5634b9bfcbfff0dc200245309e3cde9b54 upstream.
bitmap_size() is a pretty generic name and one may want to use it for a generic bitmap API function. At the same time, its logic is not "generic", i.e. it's not just nbits -> size of bitmap in bytes converter as it would be expected from its name.
Add the prefix 'idset_' used throughout the file where the function resides.
--- drivers/s390/cio/idset.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/s390/cio/idset.c +6 -4
@@ -16,7 +16,7 @@ struct idset {unsigned long bitmap[0 ]; }; -static inline unsigned long bitmap_size (int num_ssid,int num_id) +static inline unsigned long idset_bitmap_size (int num_ssid,int num_id) {return bitmap_size (size_mul (num_ssid, num_id)); }
@@ -25,11 +25,12 @@ static struct idset *idset_new(int num_s {struct idset *set; - set =vmalloc (sizeof (struct idset ) +bitmap_size (num_ssid, num_id)); + set =vmalloc (sizeof (struct idset ) + +idset_bitmap_size (num_ssid, num_id));if (set) { set->num_ssid = num_ssid; set->num_id = num_id; -memset (set->bitmap,0 ,bitmap_size (num_ssid, num_id)); +memset (set->bitmap,0 ,idset_bitmap_size (num_ssid, num_id)); }return set; }
@@ -41,7 +42,8 @@ void idset_free(struct idset *set)void idset_fill (struct idset *set) { -memset (set->bitmap,0xff ,bitmap_size (set->num_ssid, set->num_id)); +memset (set->bitmap,0xff , +idset_bitmap_size (set->num_ssid, set->num_id)); }static inline void idset_add (struct idset *set,int ssid,int id)
Greg Kroah-Hartman
maintainerPATCH 13/98 btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
commit 4ca532d64648d4776d15512caed3efea05ca7195 upstream.
bitmap_set_bits() does not start with the FS' prefix and may collide with a new generic helper one day. It operates with the FS-specific types, so there's no change those two could do the same thing. Just add the prefix to exclude such possible conflict.
--- fs/btrfs/free-space-cache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/free-space-cache.c +4 -4
@@ -1732,9 +1732,9 @@ static void bitmap_clear_bits(struct btr ctl->free_space -= bytes; } -static void bitmap_set_bits (struct btrfs_free_space_ctl *ctl, -struct btrfs_free_space *info,u64 offset, -u64 bytes) +static void btrfs_bitmap_set_bits (struct btrfs_free_space_ctl *ctl, +struct btrfs_free_space *info,u64 offset, +u64 bytes) {unsigned long start, count;
@@ -1991,7 +1991,7 @@ static u64 add_bytes_to_bitmap(struct bt bytes_to_set =min (end - offset, bytes); -bitmap_set_bits (ctl, info, offset, bytes_to_set); +btrfs_bitmap_set_bits (ctl, info, offset, bytes_to_set);/* * We set some bytes, we have no idea what the max extent size is
Greg Kroah-Hartman
maintainerPATCH 14/98 net/mlx5e: Correctly report errors for ethtool rx flows
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Ratiu <[email protected]>
[ Upstream commit cbc796be1779c4dbc9a482c7233995e2a8b6bfb3 ]
Previously, an ethtool rx flow with no attrs would not be added to the NIC as it has no rules to configure the hw with, but it would be reported as successful to the caller (return code 0). This is confusing for the user as ethtool then reports "Added rule $num", but no rule was actually added.
This change corrects that by instead reporting these wrong rules as -EINVAL.
--- drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +1 -1
@@ -689,7 +689,7 @@ mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,if (num_tuples <=0 ) {netdev_warn (priv->netdev,"%s: flow is not valid %d\n" , __func__, num_tuples); -return num_tuples; +return num_tuples <0 ? num_tuples : -EINVAL ; } eth_ft =get_flow_table (priv, fs, num_tuples);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 15/98 atm: idt77252: prevent use after free in dequeue_rx()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit a9a18e8f770c9b0703dab93580d0b02e199a4c79 ]
We can't dereference "skb" after calling vcc->push() because the skb is released.
--- drivers/atm/idt77252.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/atm/idt77252.c +5 -4
@@ -1117,8 +1117,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) rpp->len += skb->len;if (stat &SAR_RSQE_EPDU ) { +unsigned int len, truesize;unsigned char *l1l2; -unsigned int len; l1l2 = (unsigned char *) ((unsigned long ) skb->data + skb->len -6 );
@@ -1188,14 +1188,15 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)ATM_SKB (skb)->vcc = vcc;__net_timestamp (skb); + truesize = skb->truesize; vcc->push (vcc, skb);atomic_inc (&vcc->stats->rx); -if (skb->truesize >SAR_FB_SIZE_3 ) +if (truesize >SAR_FB_SIZE_3 )add_rx_skb (card,3 ,SAR_FB_SIZE_3 ,1 ); -else if (skb->truesize >SAR_FB_SIZE_2 ) +else if (truesize >SAR_FB_SIZE_2 )add_rx_skb (card,2 ,SAR_FB_SIZE_2 ,1 ); -else if (skb->truesize >SAR_FB_SIZE_1 ) +else if (truesize >SAR_FB_SIZE_1 )add_rx_skb (card,1 ,SAR_FB_SIZE_1 ,1 );else add_rx_skb (card,0 ,SAR_FB_SIZE_0 ,1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 16/98 net: dsa: vsc73xx: pass value in phy_write operation
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pawel Dembicki <[email protected]>
[ Upstream commit 5b9eebc2c7a5f0cc7950d918c1e8a4ad4bed5010 ]
In the 'vsc73xx_phy_write' function, the register value is missing, and the phy write operation always sends zeros.
This commit passes the value variable into the proper register.
--- drivers/net/dsa/vitesse-vsc73xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/vitesse-vsc73xx.c +1 -1
@@ -649,7 +649,7 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum,return 0 ; } - cmd = (phy <<21 ) | (regnum <<16 ); + cmd = (phy <<21 ) | (regnum <<16 ) | val; ret =vsc73xx_write (vsc,VSC73XX_BLOCK_MII ,0 ,1 , cmd);if (ret)return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 17/98 ssb: Fix division by zero issue in ssb_calc_clock_rate
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rand Deeb <[email protected]>
[ Upstream commit e0b5127fa134fe0284d58877b6b3133939c8b3ce ]
In ssb_calc_clock_rate(), there is a potential issue where the value of m1 could be zero due to initialization using clkfactor_f6_resolv(). This situation raised concerns about the possibility of a division by zero error.
We fixed it by following the suggestions provided by Larry Finger <[email protected]> and Michael Büsch <[email protected]>. The fix involves returning a value of 1 instead of 0 in clkfactor_f6_resolv(). This modification ensures the proper functioning of the code and eliminates the risk of division by zero errors.
--- drivers/ssb/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ssb/main.c +1 -1
@@ -835,7 +835,7 @@ static u32 clkfactor_f6_resolve(u32 v)case SSB_CHIPCO_CLK_F6_7 :return 7 ; } -return 0 ; +return 1 ; }/* Calculate the speed the backplane would run at a given set of clockcontrol values */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 18/98 wifi: cw1200: Avoid processing an invalid TIM IE
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <[email protected]>
[ Upstream commit b7bcea9c27b3d87b54075735c870500123582145 ]
While converting struct ieee80211_tim_ie::virtual_map to be a flexible array it was observed that the TIM IE processing in cw1200_rx_cb() could potentially process a malformed IE in a manner that could result in a buffer over-read. Add logic to verify that the TIM IE length is large enough to hold a valid TIM payload before processing it.
--- drivers/net/wireless/st/cw1200/txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/st/cw1200/txrx.c +1 -1
@@ -1173,7 +1173,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,size_t ies_len = skb->len - (ies - (u8 *)(skb->data)); tim_ie =cfg80211_find_ie (WLAN_EID_TIM , ies, ies_len); -if (tim_ie) { +if (tim_ie && tim_ie[1 ] >=sizeof (struct ieee80211_tim_ie )) {struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *)&tim_ie[2 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 19/98 i2c: riic: avoid potential division by zero
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 7890fce6201aed46d3576e3d641f9ee5c1f0e16f ]
Value comes from DT, so it could be 0. Unlikely, but could be.
--- drivers/i2c/busses/i2c-riic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-riic.c +1 -1
@@ -315,7 +315,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t)* frequency with only 62 clock ticks max (31 high, 31 low). * Aim for a duty of 60% LOW, 40% HIGH. */ - total_ticks =DIV_ROUND_UP (rate, t->bus_freq_hz); + total_ticks =DIV_ROUND_UP (rate, t->bus_freq_hz ?:1 );for (cks =0 ; cks <7 ; cks++) {/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 20/98 staging: ks7010: disable bh on tx_dev_lock
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chengfeng Ye <[email protected]>
[ Upstream commit 058cbee52ccd7be77e373d31a4f14670cfd32018 ]
As &priv->tx_dev.tx_dev_lock is also acquired by xmit callback which could be call from timer under softirq context, use spin_lock_bh() on it to prevent potential deadlock.
hostif_sme_work()
--> hostif_sme_set_pmksa()
--> hostif_mib_set_request()
--> ks_wlan_hw_tx()
--> spin_lock(&priv->tx_dev.tx_dev_lock)
ks_wlan_start_xmit()
--> hostif_data_request()
--> ks_wlan_hw_tx()
--> spin_lock(&priv->tx_dev.tx_dev_lock)
--- drivers/staging/ks7010/ks7010_sdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +2 -2
@@ -395,9 +395,9 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, priv->hostt.buff[priv->hostt.qtail] =le16_to_cpu (hdr->event); priv->hostt.qtail = (priv->hostt.qtail +1 ) %SME_EVENT_BUFF_SIZE ; -spin_lock (&priv->tx_dev.tx_dev_lock); +spin_lock_bh (&priv->tx_dev.tx_dev_lock); result =enqueue_txdev (priv, p, size, complete_handler, skb); -spin_unlock (&priv->tx_dev.tx_dev_lock); +spin_unlock_bh (&priv->tx_dev.tx_dev_lock);if (txq_has_space (priv))queue_delayed_work (priv->wq, &priv->rw_dwork,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 21/98 binfmt_misc: cleanup on filesystem umount
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
[ Upstream commit 1c5976ef0f7ad76319df748ccb99a4c7ba2ba464 ]
Currently, registering a new binary type pins the binfmt_misc filesystem. Specifically, this means that as long as there is at least one binary type registered the binfmt_misc filesystem survives all umounts, i.e. the superblock is not destroyed. Meaning that a umount followed by another mount will end up with the same superblock and the same binary type handlers. This is a behavior we tend to discourage for any new filesystems (apart from a few special filesystems such as e.g. configfs or debugfs). A umount operation without the filesystem being pinned - by e.g. someone holding a file descriptor to an open file - should usually result in the destruction of the superblock and all associated resources. This makes introspection easier and leads to clearly defined, simple and clean semantics. An administrator can rely on the fact that a umount will guarantee a clean slate making it possible to reinitialize a filesystem. Right now all binary types would need to be explicitly deleted before that can happen.
This allows us to remove the heavy-handed calls to simple_pin_fs() and simple_release_fs() when creating and deleting binary types. This in turn allows us to replace the current brittle pinning mechanism abusing dget() which has caused a range of bugs judging from prior fixes in [2] and [3]. The additional dget() in load_misc_binary() pins the dentry but only does so for the sake to prevent ->evict_inode() from freeing the node when a user removes the binary type and kill_node() is run. Which would mean ->interpreter and ->interp_file would be freed causing a UAF.
This isn't really nicely documented nor is it very clean because it relies on simple_pin_fs() pinning the filesystem as long as at least one binary type exists. Otherwise it would cause load_misc_binary() to hold on to a dentry belonging to a superblock that has been shutdown. Replace that implicit pinning with a clean and simple per-node refcount and get rid of the ugly dget() pinning. A similar mechanism exists for e.g. binderfs (cf. [4]). All the cleanup work can now be done in ->evict_inode().
In a follow-up patch we will make it possible to use binfmt_misc in sandboxes. We will use the cleaner semantics where a umount for the filesystem will cause the superblock and all resources to be deallocated. In preparation for this apply the same semantics to the initial binfmt_misc mount. Note, that this is a user-visible change and as such a uapi change but one that we can reasonably risk. We've discussed this in earlier versions of this patchset (cf. [1]).
The main user and provider of binfmt_misc is systemd. Systemd provides binfmt_misc via autofs since it is configurable as a kernel module and is used by a few exotic packages and users. As such a binfmt_misc mount is triggered when /proc/sys/fs/binfmt_misc is accessed and is only provided on demand. Other autofs on demand filesystems include EFI ESP which systemd umounts if the mountpoint stays idle for a certain amount of time. This doesn't apply to the binfmt_misc autofs mount which isn't touched once it is mounted meaning this change can't accidently wipe binary type handlers without someone having explicitly unmounted binfmt_misc. After speaking to systemd folks they don't expect this change to affect them.
In line with our general policy, if we see a regression for systemd or other users with this change we will switch back to the old behavior for the initial binfmt_misc mount and have binary types pin the filesystem again. But while we touch this code let's take the chance and let's improve on the status quo.
[1]: https://lore.kernel.org/r/[email protected]
[2]: commit 43a4f2619038 ("exec: binfmt_misc: fix race between load_misc_binary() and kill_node()" [3]: commit 83f918274e4b ("exec: binfmt_misc: shift filp_close(interp_file) from kill_node() to bm_evict_inode()") [4]: commit f0fe2c0f050d ("binder: prevent UAF for binderfs devices II")
--- fs/binfmt_misc.c | 216 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 168 insertions(+), 48 deletions(-)
fs/binfmt_misc.c +168 -48
@@ -58,12 +58,11 @@ typedef struct {char *name;struct dentry *dentry;struct file *interp_file; +refcount_t users;/* sync removal with load_misc_binary() */ } Node;static DEFINE_RWLOCK (entries_lock);static struct file_system_type bm_fs_type; -static struct vfsmount *bm_mnt; -static int entry_count;/* * Max length of the register string. Determined by:
@@ -80,19 +79,23 @@ static int entry_count;*/ #define MAX_REGISTER_LENGTH 1920 -/* -* Check if we support the binfmt -* if we do, return the node, else NULL -* locking is done in load_misc_binary +/** +* search_binfmt_handler - search for a binary handler for @bprm +* @misc: handle to binfmt_misc instance +* @bprm: binary for which we are looking for a handler +* +* Search for a binary type handler for @bprm in the list of registered binary +* type handlers. +* +* Return: binary type list entry on success, NULL on failure */ -static Node *check_file (struct linux_binprm *bprm) +static Node *search_binfmt_handler (struct linux_binprm *bprm) {char *p =strrchr (bprm->interp,'.' ); -struct list_head *l; +Node *e;/* Walk all the registered handlers. */ -list_for_each (l, &entries) { -Node *e =list_entry (l, Node, list); +list_for_each_entry (e, &entries, list) {char *s;int j;
@@ -121,9 +124,49 @@ static Node *check_file(struct linux_binprm *bprm)if (j == e->size)return e; } +return NULL ; } +/** +* get_binfmt_handler - try to find a binary type handler +* @misc: handle to binfmt_misc instance +* @bprm: binary for which we are looking for a handler +* +* Try to find a binfmt handler for the binary type. If one is found take a +* reference to protect against removal via bm_{entry,status}_write(). +* +* Return: binary type list entry on success, NULL on failure +*/ +static Node *get_binfmt_handler (struct linux_binprm *bprm) +{ +Node *e; + +read_lock (&entries_lock); + e =search_binfmt_handler (bprm); +if (e) +refcount_inc (&e->users); +read_unlock (&entries_lock); +return e; +} + +/** +* put_binfmt_handler - put binary handler node +* @e: node to put +* +* Free node syncing with load_misc_binary() and defer final free to +* load_misc_binary() in case it is using the binary type handler we were +* requested to remove. +*/ +static void put_binfmt_handler (Node *e) +{ +if (refcount_dec_and_test (&e->users)) { +if (e->flags &MISC_FMT_OPEN_FILE ) +filp_close (e->interp_file,NULL ); +kfree (e); + } +} +/* * the loader itself */
@@ -138,12 +181,7 @@ static int load_misc_binary(struct linux_binprm *bprm)if (!enabled)return retval; -/* to keep locking time low, we copy the interpreter string */ -read_lock (&entries_lock); - fmt =check_file (bprm); -if (fmt) -dget (fmt->dentry); -read_unlock (&entries_lock); + fmt =get_binfmt_handler (bprm);if (!fmt)return retval;
@@ -237,7 +275,16 @@ static int load_misc_binary(struct linux_binprm *bprm) goto error; ret: -dput (fmt->dentry); + +/* +* If we actually put the node here all concurrent calls to +* load_misc_binary() will have finished. We also know +* that for the refcount to be zero ->evict_inode() must have removed +* the node to be deleted from the list. All that is left for us is to +* close and free. +*/ +put_binfmt_handler (fmt); +return retval; error:if (fd_binary >0 )
@@ -598,30 +645,90 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)return inode; } +/** +* bm_evict_inode - cleanup data associated with @inode +* @inode: inode to which the data is attached +* +* Cleanup the binary type handler data associated with @inode if a binary type +* entry is removed or the filesystem is unmounted and the super block is +* shutdown. +* +* If the ->evict call was not caused by a super block shutdown but by a write +* to remove the entry or all entries via bm_{entry,status}_write() the entry +* will have already been removed from the list. We keep the list_empty() check +* to make that explicit. +*/ static void bm_evict_inode (struct inode *inode) {Node *e = inode->i_private; -if (e && e->flags &MISC_FMT_OPEN_FILE ) -filp_close (e->interp_file,NULL ); -clear_inode (inode); -kfree (e); + +if (e) { +write_lock (&entries_lock); +if (!list_empty (&e->list)) +list_del_init (&e->list); +write_unlock (&entries_lock); +put_binfmt_handler (e); + } } -static void kill_node (Node *e) +/** +* unlink_binfmt_dentry - remove the dentry for the binary type handler +* @dentry: dentry associated with the binary type handler +* +* Do the actual filesystem work to remove a dentry for a registered binary +* type handler. Since binfmt_misc only allows simple files to be created +* directly under the root dentry of the filesystem we ensure that we are +* indeed passed a dentry directly beneath the root dentry, that the inode +* associated with the root dentry is locked, and that it is a regular file we +* are asked to remove. +*/ +static void unlink_binfmt_dentry (struct dentry *dentry) { -struct dentry *dentry; +struct dentry *parent = dentry->d_parent; +struct inode *inode, *parent_inode; + +/* All entries are immediate descendants of the root dentry. */ +if (WARN_ON_ONCE (dentry->d_sb->s_root != parent)) +return ; +/* We only expect to be called on regular files. */ + inode =d_inode (dentry); +if (WARN_ON_ONCE (!S_ISREG (inode->i_mode))) +return ; + +/* The parent inode must be locked. */ + parent_inode =d_inode (parent); +if (WARN_ON_ONCE (!inode_is_locked (parent_inode))) +return ; + +if (simple_positive (dentry)) { +dget (dentry); +simple_unlink (parent_inode, dentry); +d_delete (dentry); +dput (dentry); + } +} + +/** +* remove_binfmt_handler - remove a binary type handler +* @misc: handle to binfmt_misc instance +* @e: binary type handler to remove +* +* Remove a binary type handler from the list of binary type handlers and +* remove its associated dentry. This is called from +* binfmt_{entry,status}_write(). In the future, we might want to think about +* adding a proper ->unlink() method to binfmt_misc instead of forcing caller's +* to use writes to files in order to delete binary type handlers. But it has +* worked for so long that it's not a pressing issue. +*/ +static void remove_binfmt_handler (Node *e) +{write_lock (&entries_lock);list_del_init (&e->list);write_unlock (&entries_lock); - - dentry = e->dentry; -drop_nlink (d_inode (dentry)); -d_drop (dentry); -dput (dentry); -simple_release_fs (&bm_mnt, &entry_count); +unlink_binfmt_dentry (e->dentry); }/* /<entry> */
@@ -648,8 +755,8 @@ bm_entry_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)static ssize_t bm_entry_write (struct file *file,const char __user *buffer,size_t count,loff_t *ppos) { -struct dentry *root; -Node *e =file_inode (file)->i_private; +struct inode *inode =file_inode (file); +Node *e = inode->i_private;int res =parse_command (buffer, count);switch (res) {
@@ -663,13 +770,22 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer,break ;case 3 :/* Delete this handler. */ - root =file_inode (file)->i_sb->s_root; -inode_lock (d_inode (root)); + inode =d_inode (inode->i_sb->s_root); +inode_lock (inode); +/* +* In order to add new element or remove elements from the list +* via bm_{entry,register,status}_write() inode_lock() on the +* root inode must be held. +* The lock is exclusive ensuring that the list can't be +* modified. Only load_misc_binary() can access but does so +* read-only. So we only need to take the write lock when we +* actually remove the entry from the list. +*/ if (!list_empty (&e->list)) -kill_node (e); +remove_binfmt_handler (e); -inode_unlock (d_inode (root)); +inode_unlock (inode);break ;default :return res;
@@ -728,13 +844,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer,if (!inode) goto out2; - err =simple_pin_fs (&bm_fs_type, &bm_mnt, &entry_count); -if (err) { -iput (inode); - inode =NULL ; - goto out2; - } - +refcount_set (&e->users,1 ); e->dentry =dget (dentry); inode->i_private = e; inode->i_fop = &bm_entry_operations;
@@ -778,7 +888,8 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { int res = parse_command(buffer, count); -struct dentry *root; +Node *e, *next; +struct inode *inode;switch (res) {case 1 :
@@ -791,13 +902,22 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer,break ;case 3 :/* Delete all handlers. */ - root =file_inode (file)->i_sb->s_root; -inode_lock (d_inode (root)); + inode =d_inode (file_inode (file)->i_sb->s_root); +inode_lock (inode); -while (!list_empty (&entries)) -kill_node (list_first_entry (&entries, Node, list)); +/* +* In order to add new element or remove elements from the list +* via bm_{entry,register,status}_write() inode_lock() on the +* root inode must be held. +* The lock is exclusive ensuring that the list can't be +* modified. Only load_misc_binary() can access but does so +* read-only. So we only need to take the write lock when we +* actually remove the entry from the list. +*/ +list_for_each_entry_safe (e, next, &entries, list) +remove_binfmt_handler (e); -inode_unlock (d_inode (root)); +inode_unlock (inode);break ;default :return res;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 22/98 scsi: spi: Fix sshdr use
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Christie <[email protected]>
[ Upstream commit 0b149cee836aa53989ea089af1cb9d90d7c6ac9e ]
If scsi_execute_cmd returns < 0, it doesn't initialize the sshdr, so we shouldn't access the sshdr. If it returns 0, then the cmd executed successfully, so there is no need to check the sshdr. This has us access the sshdr when we get a return value > 0.
--- drivers/scsi/scsi_transport_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_transport_spi.c +2 -2
@@ -690,10 +690,10 @@ spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer,for (r =0 ; r < retries; r++) { result =spi_execute (sdev, spi_write_buffer,DMA_TO_DEVICE , buffer, len, &sshdr); -if (result || !scsi_device_online (sdev)) { +if (result || !scsi_device_online (sdev)) {scsi_device_set_state (sdev,SDEV_QUIESCE ); -if (scsi_sense_valid (&sshdr) +if (result >0 &&scsi_sense_valid (&sshdr) && sshdr.sense_key ==ILLEGAL_REQUEST /* INVALID FIELD IN CDB */ && sshdr.asc ==0x24 && sshdr.ascq ==0x00 )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 23/98 gfs2: setattr_chown: Add missing initialization
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
[ Upstream commit 2d8d7990619878a848b1d916c2f936d3012ee17d ]
Add a missing initialization of variable ap in setattr_chown(). Without, chown() may be able to bypass quotas.
--- fs/gfs2/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/inode.c +1 -1
@@ -1847,7 +1847,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)kuid_t ouid, nuid;kgid_t ogid, ngid;int error; -struct gfs2_alloc_parms ap; +struct gfs2_alloc_parms ap = {}; ouid = inode->i_uid; ogid = inode->i_gid;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 24/98 wifi: iwlwifi: abort scan when rfkill on but device enabled
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <[email protected]>
[ Upstream commit 3c6a0b1f0add72e7f522bc9145222b86d0a7712a ]
In RFKILL we first set the RFKILL bit, then we abort scan (if one exists) by waiting for the notification from FW
and notifying mac80211. And then we stop the device.
But in case we have a scan ongoing in the period of time between rfkill on and before the device is stopped - we will not wait for the FW notification because of the iwl_mvm_is_radio_killed() condition, and then the scan_status and uid_status are misconfigured, (scan_status is cleared but uid_status not)
and when the notification suddenly arrives (before stopping the device) we will get into the assert about scan_status and uid_status mismatch. Fix this by waiting for FW notif when rfkill is on but the device isn't disabled yet.
--- drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +1 -1
@@ -1993,7 +1993,7 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify)if (!(mvm->scan_status & type))return 0 ; -if (iwl_mvm_is_radio_killed (mvm)) { +if (!test_bit (STATUS_DEVICE_ENABLED , &mvm->trans->status)) { ret =0 ; goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 25/98 powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kunwu Chan <[email protected]>
[ Upstream commit 45b1ba7e5d1f6881050d558baf9bc74a2ae13930 ]
kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.
--- arch/powerpc/sysdev/xics/icp-native.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/sysdev/xics/icp-native.c +2 -0
@@ -240,6 +240,8 @@ static int __init icp_native_map_one_cpu(int hw_id, unsigned long addr, rname =kasprintf (GFP_KERNEL ,"CPU %d [0x%x] Interrupt Presentation" , cpu, hw_id); +if (!rname) +return -ENOMEM ;if (!request_mem_region (addr, size, rname)) {pr_warn ("icp_native: Could not reserve ICP MMIO for CPU %d, interrupt server #0x%x\n" , cpu, hw_id);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 26/98 ext4: do not trim the group with corrupted block bitmap
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 172202152a125955367393956acf5f4ffd092e0d ]
Otherwise operating on an incorrupted block bitmap can lead to all sorts of unknown problems.
--- fs/ext4/mballoc.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/mballoc.c +3 -0
@@ -5219,6 +5219,9 @@ static int ext4_try_to_trim_range(struct super_block *sb,bool set_trimmed = false;void *bitmap; +if (unlikely (EXT4_MB_GRP_BBITMAP_CORRUPT (e4b->bd_info))) +return 0 ; + last =ext4_last_grp_cluster (sb, e4b->bd_group); bitmap = e4b->bd_bitmap;if (start ==0 && max >= last)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 27/98 quota: Remove BUG_ON from dqget()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
[ Upstream commit 249f374eb9b6b969c64212dd860cc1439674c4a8 ]
dqget() checks whether dquot->dq_sb is set when returning it using BUG_ON. Firstly this doesn't work as an invalidation check for quite some time (we release dquot with dq_sb set these days), secondly using BUG_ON is quite harsh. Use WARN_ON_ONCE and check whether dquot is still hashed instead.
--- fs/quota/dquot.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/quota/dquot.c +2 -3
@@ -985,9 +985,8 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)* smp_mb__before_atomic() in dquot_acquire(). */ smp_rmb (); -#ifdef CONFIG_QUOTA_DEBUG -BUG_ON (!dquot->dq_sb);/* Has somebody invalidated entry under us? */ -#endif +/* Has somebody invalidated entry under us? */ +WARN_ON_ONCE (hlist_unhashed (&dquot->dq_hash)); out:if (empty)do_destroy_dquot (empty);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 28/98 media: pci: cx23885: check cx23885_vdev_init() return
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 15126b916e39b0cb67026b0af3c014bfeb1f76b3 ]
cx23885_vdev_init() can return a NULL pointer, but that pointer is used in the next line without a check.
Add a NULL pointer check and go to the error unwind if it is NULL.
--- drivers/media/pci/cx23885/cx23885-video.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/pci/cx23885/cx23885-video.c +8 -0
@@ -1297,6 +1297,10 @@ int cx23885_video_register(struct cx23885_dev *dev)/* register Video device */ dev->video_dev =cx23885_vdev_init (dev, dev->pci, &cx23885_video_template,"video" ); +if (!dev->video_dev) { + err = -ENOMEM ; + goto fail_unreg; + } dev->video_dev->queue = &dev->vb2_vidq; err =video_register_device (dev->video_dev,VFL_TYPE_GRABBER , video_nr[dev->nr]);
@@ -1311,6 +1315,10 @@ int cx23885_video_register(struct cx23885_dev *dev)/* register VBI device */ dev->vbi_dev =cx23885_vdev_init (dev, dev->pci, &cx23885_vbi_template,"vbi" ); +if (!dev->vbi_dev) { + err = -ENOMEM ; + goto fail_unreg; + } dev->vbi_dev->queue = &dev->vb2_vbiq; err =video_register_device (dev->vbi_dev,VFL_TYPE_VBI , vbi_nr[dev->nr]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 29/98 fs: binfmt_elf_efpic: dont use missing interpreters properties
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Filippov <[email protected]>
[ Upstream commit 15fd1dc3dadb4268207fa6797e753541aca09a2a ]
Static FDPIC executable may get an executable stack even when it has non-executable GNU_STACK segment. This happens when STACK segment has rw permissions, but does not specify stack size. In that case FDPIC loader uses permissions of the interpreter's stack, and for static executables with no interpreter it results in choosing the arch-default permissions for the stack.
Fix that by using the interpreter's properties only when the interpreter is actually used.
--- fs/binfmt_elf_fdpic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_elf_fdpic.c +1 -1
@@ -324,7 +324,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)else executable_stack =EXSTACK_DEFAULT ; -if (stack_size ==0 ) { +if (stack_size ==0 && interp_params.flags &ELF_FDPIC_FLAG_PRESENT ) { stack_size = interp_params.stack_size;if (interp_params.flags &ELF_FDPIC_FLAG_EXEC_STACK ) executable_stack =EXSTACK_ENABLE_X ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 30/98 scsi: lpfc: Initialize status local variable in lpfc_sli4_repost_sgl_list()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Tee <[email protected]>
[ Upstream commit 3d0f9342ae200aa1ddc4d6e7a573c6f8f068d994 ]
A static code analyzer tool indicates that the local variable called status in the lpfc_sli4_repost_sgl_list() routine could be used to print garbage uninitialized values in the routine's log message.
Fix by initializing to zero.
--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -6597,7 +6597,7 @@ lpfc_sli4_repost_sgl_list(struct lpfc_hba *phba,struct lpfc_sglq *sglq_entry =NULL ;struct lpfc_sglq *sglq_entry_next =NULL ;struct lpfc_sglq *sglq_entry_first =NULL ; -int status, total_cnt; +int status =0 , total_cnt;int post_cnt =0 , num_posted =0 , block_cnt =0 ;int last_xritag =NO_XRI ;LIST_HEAD (prep_sgl_list);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 31/98 net/sun3_82586: Avoid reading past buffer in debug output
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 4bea747f3fbec33c16d369b2f51e55981d7c78d0 ]
Since NUM_XMIT_BUFFS is always 1, building m68k with sun3_defconfig and -Warraybounds, this build warning is visible[1]:
drivers/net/ethernet/i825xx/sun3_82586.c: In function 'sun3_82586_timeout':drivers/net/ethernet/i825xx/sun3_82586.c:990:122: warning: array subscript 1 is above array bounds of 'volatile struct transmit_cmd_struct *[1]' [-Warray-bounds=]
990 | printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status));
| ~~~~~~~~~~~~^~~
...drivers/net/ethernet/i825xx/sun3_82586.c:156:46: note: while referencing 'xmit_cmds'
156 | volatile struct transmit_cmd_struct *xmit_cmds[NUM_XMIT_BUFFS];
Avoid accessing index 1 since it doesn't exist.
--- drivers/net/ethernet/i825xx/sun3_82586.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/i825xx/sun3_82586.c +1 -1
@@ -990,7 +990,7 @@ static void sun3_82586_timeout(struct net_device *dev) {#ifdef DEBUG printk ("%s: xmitter timed out, try to restart! stat: %02x\n" ,dev->name,p->scb->cus); -printk ("%s: command-stats: %04x %04x\n" ,dev->name,swab16 (p->xmit_cmds[0 ]->cmd_status),swab16 (p->xmit_cmds[1 ]->cmd_status)); +printk ("%s: command-stats: %04x\n" , dev->name,swab16 (p->xmit_cmds[0 ]->cmd_status));printk ("%s: check, whether you set the right interrupt number!\n" ,dev->name);#endif sun3_82586_close (dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 32/98 md: clean up invalid BUG_ON in md_ioctl
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Nan <[email protected]>
[ Upstream commit 9dd8702e7cd28ebf076ff838933f29cf671165ec ]
'disk->private_data' is set to mddev in md_alloc() and never set to NULL, and users need to open mddev before submitting ioctl. So mddev must not have been freed during ioctl, and there is no need to check mddev here. Clean up it.
--- drivers/md/md.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/md/md.c +0 -5
@@ -7245,11 +7245,6 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, mddev = bdev->bd_disk->private_data; -if (!mddev) { -BUG (); - goto out; - } -/* Some actions do not requires the mutex */ switch (cmd) {case GET_ARRAY_INFO :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 33/98 parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit 73cb4a2d8d7e0259f94046116727084f21e4599f ]
Use irq*_rcu() functions to fix this kernel warning:
WARNING: CPU: 0 PID: 0 at kernel/context_tracking.c:367 ct_irq_enter+0xa0/0xd0 Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc3-64bit+ #1037 Hardware name: 9000/785/C3700
IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000412cd758 00000000412cd75c
IIR: 03ffe01f ISR: 0000000000000000 IOR: 0000000043c20c20
CPU: 0 CR30: 0000000041caa000 CR31: 0000000000000000
ORIG_R28: 0000000000000005
IAOQ[0]: ct_irq_enter+0xa0/0xd0
IAOQ[1]: ct_irq_enter+0xa4/0xd0
RP(r2): irq_enter+0x34/0x68
Backtrace: [<000000004034a3ec>] irq_enter+0x34/0x68 [<000000004030dc48>] do_cpu_irq_mask+0xc0/0x450 [<0000000040303070>] intr_return+0x0/0xc
--- arch/parisc/kernel/irq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/irq.c +2 -2
@@ -524,7 +524,7 @@ void do_cpu_irq_mask(struct pt_regs *regs) old_regs =set_irq_regs (regs);local_irq_disable (); -irq_enter (); +irq_enter_rcu (); eirr_val =mfctl (23 ) & cpu_eiem &per_cpu (local_ack_eiem, cpu);if (!eirr_val)
@@ -559,7 +559,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)#endif /* CONFIG_IRQSTACKS */ out: -irq_exit (); +irq_exit_rcu ();set_irq_regs (old_regs);return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 34/98 powerpc/boot: Handle allocation failure in simple_realloc()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li zeming <[email protected]>
[ Upstream commit 69b0194ccec033c208b071e019032c1919c2822d ]
simple_malloc() will return NULL when there is not enough memory left. Check pointer 'new' before using it to copy the old data.
--- arch/powerpc/boot/simple_alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/boot/simple_alloc.c +3 -1
@@ -114,7 +114,9 @@ static void *simple_realloc(void *ptr, unsigned long size)return ptr; new =simple_malloc (size); -memcpy (new, ptr, p->size); +if (new) +memcpy (new, ptr, p->size); +simple_free (ptr);return new; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 35/98 powerpc/boot: Only free if realloc() succeeds
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Ellerman <[email protected]>
[ Upstream commit f2d5bccaca3e8c09c9b9c8485375f7bdbb2631d2 ]
simple_realloc() frees the original buffer (ptr) even if the reallocation failed.
Fix it to behave like standard realloc() and only free the original buffer if the reallocation succeeded.
--- arch/powerpc/boot/simple_alloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/boot/simple_alloc.c +3 -2
@@ -114,10 +114,11 @@ static void *simple_realloc(void *ptr, unsigned long size)return ptr; new =simple_malloc (size); -if (new) +if (new) {memcpy (new, ptr, p->size); +simple_free (ptr); + } -simple_free (ptr);return new; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 36/98 btrfs: change BUG_ON to assertion when checking for delayed_node root
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit be73f4448b607e6b7ce41cd8ef2214fdf6e7986f ]
The pointer to root is initialized in btrfs_init_delayed_node(), no need to check for it again. Change the BUG_ON to assertion.
--- fs/btrfs/delayed-inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/delayed-inode.c +1 -1
@@ -984,7 +984,7 @@ static void btrfs_release_delayed_inode(struct btrfs_delayed_node *delayed_node)if (delayed_node &&test_bit (BTRFS_DELAYED_NODE_INODE_DIRTY , &delayed_node->flags)) { -BUG_ON (!delayed_node->root); +ASSERT (delayed_node->root);clear_bit (BTRFS_DELAYED_NODE_INODE_DIRTY , &delayed_node->flags); delayed_node->count--;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 37/98 btrfs: handle invalid root reference found in may_destroy_subvol()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit 6fbc6f4ac1f4907da4fc674251527e7dc79ffbf6 ]
The may_destroy_subvol() looks up a root by a key, allowing to do an inexact search when key->offset is -1. It's never expected to find such item, as it would break the allowed range of a root id.
--- fs/btrfs/inode.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +8 -1
@@ -4296,7 +4296,14 @@ static noinline int may_destroy_subvol(struct btrfs_root *root) ret =btrfs_search_slot (NULL , fs_info->tree_root, &key, path,0 ,0 );if (ret <0 ) goto out; -BUG_ON (ret ==0 ); +if (ret ==0 ) { +/* +* Key with offset -1 found, there would have to exist a root +* with such id, but this is out of valid range. +*/ + ret = -EUCLEAN ; + goto out; + } ret =0 ;if (path->slots[0 ] >0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 38/98 btrfs: send: handle unexpected data in header buffer in begin_cmd()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit e80e3f732cf53c64b0d811e1581470d67f6c3228 ]
Change BUG_ON to a proper error handling in the unlikely case of seeing data when the command is started. This is supposed to be reset when the command is finished (send_cmd, send_encoded_extent).
--- fs/btrfs/send.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/btrfs/send.c +6 -1
@@ -677,7 +677,12 @@ static int begin_cmd(struct send_ctx *sctx, int cmd)if (WARN_ON (!sctx->send_buf))return -EINVAL ; -BUG_ON (sctx->send_size); +if (unlikely (sctx->send_size !=0 )) { +btrfs_err (sctx->send_root->fs_info, +"send: command header buffer not empty cmd %d offset %llu" , + cmd, sctx->send_off); +return -EINVAL ; + } sctx->send_size +=sizeof (*hdr); hdr = (struct btrfs_cmd_header *)sctx->send_buf;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 39/98 btrfs: delete pointless BUG_ON check on quota root in btrfs_qgroup_account_extent()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
[ Upstream commit f40a3ea94881f668084f68f6b9931486b1606db0 ]
The BUG_ON is deep in the qgroup code where we can expect that it exists. A NULL pointer would cause a crash.
It was added long ago in 550d7a2ed5db35 ("btrfs: qgroup: Add new qgroup calculation function btrfs_qgroup_account_extents()."). It maybe made sense back then as the quota enable/disable state machine was not that robust as it is nowadays, so we can just delete it.
--- fs/btrfs/qgroup.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/qgroup.c +0 -2
@@ -2095,8 +2095,6 @@ int btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, u64 bytenr,if (nr_old_roots ==0 && nr_new_roots ==0 ) goto out_free; -BUG_ON (!fs_info->quota_root); -trace_btrfs_qgroup_account_extent (fs_info, trans->transid, bytenr, num_bytes, nr_old_roots, nr_new_roots);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 40/98 f2fs: fix to do sanity check in update_sit_entry
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhiguo Niu <[email protected]>
[ Upstream commit 36959d18c3cf09b3c12157c6950e18652067de77 ]
If GET_SEGNO return NULL_SEGNO for some unecpected case, update_sit_entry will access invalid memory address, cause system crash. It is better to do sanity check about GET_SEGNO just like update_segment_mtime & locate_dirty_segment.
Also remove some redundant judgment code.
--- fs/f2fs/segment.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/f2fs/segment.c +3 -2
@@ -2018,6 +2018,8 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)#endif segno =GET_SEGNO (sbi, blkaddr); +if (segno ==NULL_SEGNO ) +return ; se =get_seg_entry (sbi, segno); new_vblocks = se->valid_blocks + del;
@@ -2935,8 +2937,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,* since SSR needs latest valid block information. */ update_sit_entry (sbi, *new_blkaddr,1 ); -if (GET_SEGNO (sbi, old_blkaddr) !=NULL_SEGNO ) -update_sit_entry (sbi, old_blkaddr,-1 ); +update_sit_entry (sbi, old_blkaddr,-1 );if (!__has_curseg_space (sbi, type)) sit_i->s_ops->allocate_segment (sbi, type, false);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 41/98 usb: gadget: fsl: Increase size of name buffer for endpoints
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 87850f6cc20911e35eafcbc1d56b0d649ae9162d ]
This fixes a W=1 warning about sprintf writing up to 16 bytes into a buffer of size 14. There is no practical relevance because there are not more than 32 endpoints.
--- drivers/usb/gadget/udc/fsl_udc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/fsl_udc_core.c +1 -1
@@ -2501,7 +2501,7 @@ static int fsl_udc_probe(struct platform_device *pdev)/* setup the udc->eps[] for non-control endpoints and link * to gadget.ep_list */ for (i =1 ; i < (int )(udc_controller->max_ep /2 ); i++) { -char name[14 ]; +char name[16 ];sprintf (name,"ep%dout" , i);struct_ep_setup (udc_controller, i *2 , name,1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 42/98 Bluetooth: bnep: Fix out-of-bound access
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 0f0639b4d6f649338ce29c62da3ec0787fa08cd1 ]
This fixes attempting to access past ethhdr.h_source, although it seems intentional to copy also the contents of h_proto this triggers out-of-bound access problems with the likes of static analyzer, so this instead just copy ETH_ALEN and then proceed to use put_unaligned to copy h_proto separetely.
--- net/bluetooth/bnep/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/bnep/core.c +2 -1
@@ -385,7 +385,8 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)case BNEP_COMPRESSED_DST_ONLY :__skb_put_data (nskb,skb_mac_header (skb),ETH_ALEN ); -__skb_put_data (nskb, s->eh.h_source,ETH_ALEN +2 ); +__skb_put_data (nskb, s->eh.h_source,ETH_ALEN ); +put_unaligned (s->eh.h_proto, (__be16 *)__skb_put (nskb,2 ));break ;case BNEP_GENERAL :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 43/98 NFS: avoid infinite loop in pnfs_update_layout.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
[ Upstream commit 2fdbc20036acda9e5694db74a032d3c605323005 ]
If pnfsd_update_layout() is called on a file for which recovery has failed it will enter a tight infinite loop.
NFS_LAYOUT_INVALID_STID will be set, nfs4_select_rw_stateid() will return -EIO, and nfs4_schedule_stateid_recovery() will do nothing, so nfs4_client_recover_expired_lease() will not wait. So the code will loop indefinitely.
Break the loop by testing the validity of the open stateid at the top of the loop.
--- fs/nfs/pnfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/nfs/pnfs.c +8 -0
@@ -1889,6 +1889,14 @@ pnfs_update_layout(struct inode *ino, } lookup_again: +if (!nfs4_valid_open_stateid (ctx->state)) { +trace_pnfs_update_layout (ino, pos, count, + iomode, lo, lseg, +PNFS_UPDATE_LAYOUT_INVALID_OPEN ); + lseg =ERR_PTR (-EIO ); + goto out; + } + lseg =ERR_PTR (nfs4_client_recover_expired_lease (clp));if (IS_ERR (lseg)) goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 44/98 openrisc: Call setup_memory() earlier in the init sequence
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oreoluwa Babatunde <[email protected]>
[ Upstream commit 7b432bf376c9c198a7ff48f1ed14a14c0ffbe1fe ]
The unflatten_and_copy_device_tree() function contains a call to memblock_alloc(). This means that memblock is allocating memory before any of the reserved memory regions are set aside in the setup_memory() function which calls early_init_fdt_scan_reserved_mem(). Therefore, there is a possibility for memblock to allocate from any of the reserved memory regions.
Hence, move the call to setup_memory() to be earlier in the init sequence so that the reserved memory regions are set aside before any allocations are done using memblock.
--- arch/openrisc/kernel/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/openrisc/kernel/setup.c +3 -3
@@ -287,6 +287,9 @@ void calibrate_delay(void)void __init setup_arch (char **cmdline_p) { +/* setup memblock allocator */ +setup_memory (); +unflatten_and_copy_device_tree ();setup_cpuinfo ();
@@ -311,9 +314,6 @@ void __init setup_arch(char **cmdline_p) initrd_below_start_ok =1 ;#endif -/* setup memblock allocator */ -setup_memory (); -/* paging_init() sets up the MMU and marks all pages as reserved */ paging_init ();
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 45/98 s390/iucv: fix receive buffer virtual vs physical address confusion
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Gordeev <[email protected]>
[ Upstream commit 4e8477aeb46dfe74e829c06ea588dd00ba20c8cc ]
Fix IUCV_IPBUFLST-type buffers virtual vs physical address confusion. This does not fix a bug since virtual and physical address spaces are currently the same.
--- net/iucv/iucv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/iucv/iucv.c +1 -2
@@ -1149,8 +1149,7 @@ static int iucv_message_receive_iprmdata(struct iucv_path *path, size = (size <8 ) ? size :8 ;for (array = buffer; size >0 ; array++) { copy =min_t (size_t, size, array->length); -memcpy ((u8 *)(addr_t ) array->address, - rmmsg, copy); +memcpy (phys_to_virt (array->address), rmmsg, copy); rmmsg += copy; size -= copy; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 46/98 usb: dwc3: core: Skip setting event buffers for host only controllers
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krishna Kurapati <[email protected]>
[ Upstream commit 89d7f962994604a3e3d480832788d06179abefc5 ]
On some SoC's like SA8295P where the tertiary controller is host-only capable, GEVTADDRHI/LO, GEVTSIZ, GEVTCOUNT registers are not accessible. Trying to access them leads to a crash.
For DRD/Peripheral supported controllers, event buffer setup is done again in gadget_pullup. Skip setup or cleanup of event buffers if controller is host-only capable.
--- drivers/usb/dwc3/core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/usb/dwc3/core.c +13 -0
@@ -372,6 +372,13 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)static int dwc3_alloc_event_buffers (struct dwc3 *dwc,unsigned length) {struct dwc3_event_buffer *evt; +unsigned int hw_mode; + + hw_mode =DWC3_GHWPARAMS0_MODE (dwc->hwparams.hwparams0); +if (hw_mode ==DWC3_GHWPARAMS0_MODE_HOST ) { + dwc->ev_buf =NULL ; +return 0 ; + } evt =dwc3_alloc_one_event_buffer (dwc, length);if (IS_ERR (evt)) {
@@ -393,6 +400,9 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +if (!dwc->ev_buf) +return 0 ; + evt = dwc->ev_buf; evt->lpos =0 ; dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0),
@@ -410,6 +420,9 @@ void dwc3_event_buffers_cleanup(struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +if (!dwc->ev_buf) +return ; + evt = dwc->ev_buf; evt->lpos =0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 47/98 fbdev: offb: replace of_node_put with __free(device_node)
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abdulrasaq Lawani <[email protected]>
[ Upstream commit ce4a7ae84a58b9f33aae8d6c769b3c94f3d5ce76 ]
Replaced instance of of_node_put with __free(device_node) to simplify code and protect against any memory leaks due to future changes in the control flow.
--- drivers/video/fbdev/offb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/offb.c +1 -2
@@ -352,7 +352,7 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dp par->cmap_type = cmap_gxt2000; }else if (dp && !strncmp (name,"vga,Display-" ,12 )) {/* Look for AVIVO initialized by SLOF */ -struct device_node *pciparent =of_get_parent (dp); + struct device_node *pciparent __free(device_node) = of_get_parent(dp);const u32 *vid, *did; vid =of_get_property (pciparent,"vendor-id" ,NULL ); did =of_get_property (pciparent,"device-id" ,NULL );
@@ -364,7 +364,6 @@ static void offb_init_palette_hacks(struct fb_info *info, struct device_node *dpif (par->cmap_adr) par->cmap_type = cmap_avivo; } -of_node_put (pciparent); }else if (dp &&of_device_is_compatible (dp,"qemu,std-vga" )) {#ifdef __BIG_ENDIANconst __be32 io_of_addr[3 ] = {0x01000000 ,0x0 ,0x0 };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 48/98 irqchip/gic-v3-its: Remove BUG_ON in its_vpe_irq_domain_alloc
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guanrui Huang <[email protected]>
[ Upstream commit 382d2ffe86efb1e2fa803d2cf17e5bfc34e574f3 ]
This BUG_ON() is useless, because the same effect will be obtained by letting the code run its course and vm being dereferenced, triggering an exception.
So just remove this check.
--- drivers/irqchip/irq-gic-v3-its.c | 2 -- 1 file changed, 2 deletions(-)
drivers/irqchip/irq-gic-v3-its.c +0 -2
@@ -2958,8 +2958,6 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virqstruct page *vprop_page;int base, nr_ids, i, err =0 ; -BUG_ON (!vm); - bitmap =its_lpi_alloc (roundup_pow_of_two (nr_irqs), &base, &nr_ids);if (!bitmap)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 49/98 ext4: set the type of max_zeroout to unsigned int to avoid overflow
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baokun Li <[email protected]>
[ Upstream commit 261341a932d9244cbcd372a3659428c8723e5a49 ]
The max_zeroout is of type int and the s_extent_max_zeroout_kb is of type uint, and the s_extent_max_zeroout_kb can be freely modified via the sysfs interface. When the block size is 1024, max_zeroout may overflow, so declare it as unsigned int to avoid overflow.
--- fs/ext4/extents.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ext4/extents.c +2 -1
@@ -3445,9 +3445,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,struct ext4_extent *ex, *abut_ex;ext4_lblk_t ee_block, eof_block;unsigned int ee_len, depth, map_len = map->m_len; -int allocated =0 , max_zeroout =0 ;int err =0 ;int split_flag =EXT4_EXT_DATA_VALID2 ; +int allocated =0 ; +unsigned int max_zeroout =0 ; ext_debug("ext4_ext_convert_to_initialized: inode %lu, logical" "block %llu, max_blocks %u\n", inode->i_ino,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 50/98 nvmet-rdma: fix possible bad dereference when freeing rsps
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
[ Upstream commit 73964c1d07c054376f1b32a62548571795159148 ]
It is possible that the host connected and saw a cm established event and started sending nvme capsules on the qp, however the ctrl did not yet see an established event. This is why the rsp_wait_list exists (for async handling of these cmds, we move them to a pending list).
Furthermore, it is possible that the ctrl cm times out, resulting in a connect-error cm event. in this case we hit a bad deref [1] because in nvmet_rdma_free_rsps we assume that all the responses are in the free list.
We are freeing the cmds array anyways, so don't even bother to remove the rsp from the free_list. It is also guaranteed that we are not racing anything when we are releasing the queue so no other context accessing this array should be running.
[1]:
--
Workqueue: nvmet-free-wq nvmet_rdma_free_queue_work [nvmet_rdma] [...] pc : nvmet_rdma_free_rsps+0x78/0xb8 [nvmet_rdma] lr : nvmet_rdma_free_queue_work+0x88/0x120 [nvmet_rdma] Call trace: nvmet_rdma_free_rsps+0x78/0xb8 [nvmet_rdma] nvmet_rdma_free_queue_work+0x88/0x120 [nvmet_rdma] process_one_work+0x1ec/0x4a0 worker_thread+0x48/0x490 kthread+0x158/0x160 ret_from_fork+0x10/0x18
--
--- drivers/nvme/target/rdma.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/nvme/target/rdma.c +4 -12
@@ -435,12 +435,8 @@ nvmet_rdma_alloc_rsps(struct nvmet_rdma_queue *queue)return 0 ; out_free: -while (--i >=0 ) { -struct nvmet_rdma_rsp *rsp = &queue->rsps[i]; - -list_del (&rsp->free_list); -nvmet_rdma_free_rsp (ndev, rsp); - } +while (--i >=0 ) +nvmet_rdma_free_rsp (ndev, &queue->rsps[i]);kfree (queue->rsps); out:return ret;
@@ -451,12 +447,8 @@ static void nvmet_rdma_free_rsps(struct nvmet_rdma_queue *queue)struct nvmet_rdma_device *ndev = queue->dev;int i, nr_rsps = queue->recv_queue_size *2 ; -for (i =0 ; i < nr_rsps; i++) { -struct nvmet_rdma_rsp *rsp = &queue->rsps[i]; - -list_del (&rsp->free_list); -nvmet_rdma_free_rsp (ndev, rsp); - } +for (i =0 ; i < nr_rsps; i++) +nvmet_rdma_free_rsp (ndev, &queue->rsps[i]);kfree (queue->rsps); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 51/98 hrtimer: Prevent queuing of hrtimer without a function callback
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Chang <[email protected]>
[ Upstream commit 5a830bbce3af16833fe0092dec47b6dd30279825 ]
The hrtimer function callback must not be NULL. It has to be specified by the call side but it is not validated by the hrtimer code. When a hrtimer is queued without a function callback, the kernel crashes with a null pointer dereference when trying to execute the callback in __run_hrtimer().
Introduce a validation before queuing the hrtimer in hrtimer_start_range_ns().
[anna-maria: Rephrase commit message]
--- kernel/time/hrtimer.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/time/hrtimer.c +2 -0
@@ -1172,6 +1172,8 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,struct hrtimer_clock_base *base;unsigned long flags; +if (WARN_ON_ONCE (!timer->function)) +return ;/* * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft * match.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 52/98 gtp: pull network headers in gtp_dev_xmit()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 3a3be7ff9224f424e485287b54be00d2c6bd9c40 upstream.
syzbot/KMSAN reported use of uninit-value in get_dev_xmit() [1]
We must make sure the IPv4 or Ipv6 header is pulled in skb->head before accessing fields in them.
Use pskb_inet_may_pull() to fix this issue.
[1]
BUG: KMSAN: uninit-value in ipv6_pdp_find drivers/net/gtp.c:220 [inline] BUG: KMSAN: uninit-value in gtp_build_skb_ip6 drivers/net/gtp.c:1229 [inline] BUG: KMSAN: uninit-value in gtp_dev_xmit+0x1424/0x2540 drivers/net/gtp.c:1281 ipv6_pdp_find drivers/net/gtp.c:220 [inline] gtp_build_skb_ip6 drivers/net/gtp.c:1229 [inline] gtp_dev_xmit+0x1424/0x2540 drivers/net/gtp.c:1281 __netdev_start_xmit include/linux/netdevice.h:4913 [inline] netdev_start_xmit include/linux/netdevice.h:4922 [inline] xmit_one net/core/dev.c:3580 [inline] dev_hard_start_xmit+0x247/0xa20 net/core/dev.c:3596 __dev_queue_xmit+0x358c/0x5610 net/core/dev.c:4423 dev_queue_xmit include/linux/netdevice.h:3105 [inline] packet_xmit+0x9c/0x6c0 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3145 [inline] packet_sendmsg+0x90e3/0xa3a0 net/packet/af_packet.c:3177 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:745 __sys_sendto+0x685/0x830 net/socket.c:2204 __do_sys_sendto net/socket.c:2216 [inline] __se_sys_sendto net/socket.c:2212 [inline] __x64_sys_sendto+0x125/0x1d0 net/socket.c:2212 x64_sys_call+0x3799/0x3c10 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f
Uninit was created at:
slab_post_alloc_hook mm/slub.c:3994 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_node_noprof+0x6bf/0xb80 mm/slub.c:4080 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:583 __alloc_skb+0x363/0x7b0 net/core/skbuff.c:674 alloc_skb include/linux/skbuff.h:1320 [inline] alloc_skb_with_frags+0xc8/0xbf0 net/core/skbuff.c:6526 sock_alloc_send_pskb+0xa81/0xbf0 net/core/sock.c:2815 packet_alloc_skb net/packet/af_packet.c:2994 [inline] packet_snd net/packet/af_packet.c:3088 [inline] packet_sendmsg+0x749c/0xa3a0 net/packet/af_packet.c:3177 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x30f/0x380 net/socket.c:745 __sys_sendto+0x685/0x830 net/socket.c:2204 __do_sys_sendto net/socket.c:2216 [inline] __se_sys_sendto net/socket.c:2212 [inline] __x64_sys_sendto+0x125/0x1d0 net/socket.c:2212 x64_sys_call+0x3799/0x3c10 arch/x86/include/generated/asm/syscalls_64.h:45 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x1e0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f CPU: 0 UID: 0 PID: 7115 Comm: syz.1.515 Not tainted 6.11.0-rc1-syzkaller-00043-g94ede2a3e913 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024
--- drivers/net/gtp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/gtp.c +3 -0
@@ -577,6 +577,9 @@ static netdev_tx_t gtp_dev_xmit(struct sif (skb_cow_head (skb, dev->needed_headroom)) goto tx_err; +if (!pskb_inet_may_pull (skb)) + goto tx_err; +skb_reset_inner_headers (skb);/* PDP context lookups in gtp_build_skb_*() need rcu read-side lock. */
Greg Kroah-Hartman
maintainerPATCH 53/98 block: use "unsigned long" for blk_validate_block_size().
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 37ae5a0f5287a52cf51242e76ccf198d02ffe495 upstream.
Since lo_simple_ioctl(LOOP_SET_BLOCK_SIZE) and ioctl(NBD_SET_BLKSIZE) pass user-controlled "unsigned long arg" to blk_validate_block_size(), "unsigned long" should be used for validation.
--- include/linux/blkdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/blkdev.h +1 -1
@@ -56,7 +56,7 @@ struct blk_stat_callback;*/ #define BLKCG_MAX_POLS 5 -static inline int blk_validate_block_size (unsigned int bsize) +static inline int blk_validate_block_size (unsigned long bsize) {if (bsize <512 || bsize >PAGE_SIZE || !is_power_of_2 (bsize))return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 54/98 Bluetooth: Make use of __check_timeout on hci_sched_le
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 1b1d29e5149990e44634b2e681de71effd463591 ]
This reuse __check_timeout on hci_sched_le following the same logic used hci_sched_acl.
Stable-dep-of: 932021a11805 ("Bluetooth: hci_core: Fix LE quote calculation")
--- net/bluetooth/hci_core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
net/bluetooth/hci_core.c +3 -8
@@ -4116,15 +4116,10 @@ static void hci_sched_le(struct hci_dev *hdev)if (!hci_conn_num (hdev,LE_LINK ))return ; -if (!hci_dev_test_flag (hdev,HCI_UNCONFIGURED )) { -/* LE tx timeout must be longer than maximum -* link supervision timeout (40.9 seconds) */ -if (!hdev->le_cnt && hdev->le_pkts && -time_after (jiffies, hdev->le_last_tx +HZ *45 )) -hci_link_tx_to (hdev,LE_LINK ); - } - cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; + +__check_timeout (hdev, cnt); + tmp = cnt;while (cnt && (chan =hci_chan_sent (hdev,LE_LINK , "e))) {u32 priority = (skb_peek (&chan->data_q))->priority;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 55/98 Bluetooth: hci_core: Fix not handling link timeouts propertly
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 116523c8fac05d1d26f748fee7919a4ec5df67ea ]
Change that introduced the use of __check_timeout did not account for link types properly, it always assumes ACL_LINK is used thus causing hdev->acl_last_tx to be used even in case of LE_LINK and then again uses ACL_LINK with hci_link_tx_to.
To fix this __check_timeout now takes the link type as parameter and then procedure to use the right last_tx based on the link type and pass it to hci_link_tx_to.
Stable-dep-of: 932021a11805 ("Bluetooth: hci_core: Fix LE quote calculation")
--- net/bluetooth/hci_core.c | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-)
net/bluetooth/hci_core.c +23 -11
@@ -3931,15 +3931,27 @@ static inline int __get_blocks(struct hci_dev *hdev, struct sk_buff *skb)return DIV_ROUND_UP (skb->len -HCI_ACL_HDR_SIZE , hdev->block_len); } -static void __check_timeout (struct hci_dev *hdev,unsigned int cnt) +static void __check_timeout (struct hci_dev *hdev,unsigned int cnt,u8 type) { -if (!hci_dev_test_flag (hdev,HCI_UNCONFIGURED )) { -/* ACL tx timeout must be longer than maximum -* link supervision timeout (40.9 seconds) */ -if (!cnt &&time_after (jiffies, hdev->acl_last_tx + -HCI_ACL_TX_TIMEOUT )) -hci_link_tx_to (hdev,ACL_LINK ); +unsigned long last_tx; + +if (hci_dev_test_flag (hdev,HCI_UNCONFIGURED )) +return ; + +switch (type) { +case LE_LINK : + last_tx = hdev->le_last_tx; +break ; +default : + last_tx = hdev->acl_last_tx; +break ; } + +/* tx timeout must be longer than maximum link supervision timeout +* (40.9 seconds) +*/ +if (!cnt &&time_after (jiffies, last_tx +HCI_ACL_TX_TIMEOUT )) +hci_link_tx_to (hdev, type); }static void hci_sched_acl_pkt (struct hci_dev *hdev)
@@ -3949,7 +3961,7 @@ static void hci_sched_acl_pkt(struct hci_dev *hdev)struct sk_buff *skb;int quote; -__check_timeout (hdev, cnt); +__check_timeout (hdev, cnt,ACL_LINK );while (hdev->acl_cnt && (chan =hci_chan_sent (hdev,ACL_LINK , "e))) {
@@ -3988,8 +4000,6 @@ static void hci_sched_acl_blk(struct hci_dev *hdev)int quote;u8 type; -__check_timeout (hdev, cnt); -BT_DBG ("%s" , hdev->name);if (hdev->dev_type ==HCI_AMP )
@@ -3997,6 +4007,8 @@ static void hci_sched_acl_blk(struct hci_dev *hdev)else type =ACL_LINK ; +__check_timeout (hdev, cnt, type); +while (hdev->block_cnt >0 && (chan =hci_chan_sent (hdev, type, "e))) {u32 priority = (skb_peek (&chan->data_q))->priority;
@@ -4118,7 +4130,7 @@ static void hci_sched_le(struct hci_dev *hdev) cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; -__check_timeout (hdev, cnt); +__check_timeout (hdev, cnt,LE_LINK ); tmp = cnt;while (cnt && (chan =hci_chan_sent (hdev,LE_LINK , "e))) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 56/98 Bluetooth: hci_core: Fix LE quote calculation
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 932021a11805b9da4bd6abf66fe233cccd59fe0e ]
Function hci_sched_le needs to update the respective counter variable inplace other the likes of hci_quote_sent would attempt to use the possible outdated value of conn->{le_cnt,acl_cnt}.
--- net/bluetooth/hci_core.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
net/bluetooth/hci_core.c +7 -12
@@ -4121,19 +4121,19 @@ static void hci_sched_le(struct hci_dev *hdev) {struct hci_chan *chan;struct sk_buff *skb; -int quote, cnt, tmp; +int quote, *cnt, tmp;BT_DBG ("%s" , hdev->name);if (!hci_conn_num (hdev,LE_LINK ))return ; - cnt = hdev->le_pkts ? hdev->le_cnt : hdev->acl_cnt; + cnt = hdev->le_pkts ? &hdev->le_cnt : &hdev->acl_cnt; -__check_timeout (hdev, cnt,LE_LINK ); +__check_timeout (hdev, *cnt,LE_LINK ); - tmp = cnt; -while (cnt && (chan =hci_chan_sent (hdev,LE_LINK , "e))) { + tmp = *cnt; +while (*cnt && (chan =hci_chan_sent (hdev,LE_LINK , "e))) {u32 priority = (skb_peek (&chan->data_q))->priority;while (quote-- && (skb =skb_peek (&chan->data_q))) { BT_DBG("chan %p skb %p len %d priority %u", chan, skb,
@@ -4148,18 +4148,13 @@ static void hci_sched_le(struct hci_dev *hdev)hci_send_frame (hdev, skb); hdev->le_last_tx = jiffies; - cnt--; + (*cnt)--; chan->sent++; chan->conn->sent++; } } -if (hdev->le_pkts) - hdev->le_cnt = cnt; -else - hdev->acl_cnt = cnt; - -if (cnt != tmp) +if (*cnt != tmp)hci_prio_recalculate (hdev,LE_LINK ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 57/98 kcm: Serialise kcm_sendmsg() for the same socket.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 807067bf014d4a3ae2cc55bd3de16f22a01eb580 ]
syzkaller reported UAF in kcm_release(). [0]
The scenario is
1. Thread A builds a skb with MSG_MORE and sets kcm->seq_skb.
2. Thread A resumes building skb from kcm->seq_skb but is blocked by sk_stream_wait_memory()
3. Thread B calls sendmsg() concurrently, finishes building kcm->seq_skb and puts the skb to the write queue
4. Thread A faces an error and finally frees skb that is already in the write queue
5. kcm_release() does double-free the skb in the write queue
When a thread is building a MSG_MORE skb, another thread must not touch it.
Let's add a per-sk mutex and serialise kcm_sendmsg().
[0]:
BUG: KASAN: slab-use-after-free in __skb_unlink include/linux/skbuff.h:2366 [inline] BUG: KASAN: slab-use-after-free in __skb_dequeue include/linux/skbuff.h:2385 [inline] BUG: KASAN: slab-use-after-free in __skb_queue_purge_reason include/linux/skbuff.h:3175 [inline] BUG: KASAN: slab-use-after-free in __skb_queue_purge include/linux/skbuff.h:3181 [inline] BUG: KASAN: slab-use-after-free in kcm_release+0x170/0x4c8 net/kcm/kcmsock.c:1691 Read of size 8 at addr ffff0000ced0fc80 by task syz-executor329/6167 CPU: 1 PID: 6167 Comm: syz-executor329 Tainted: G B 6.8.0-rc5-syzkaller-g9abbc24128bc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x178/0x518 mm/kasan/report.c:488 kasan_report+0xd8/0x138 mm/kasan/report.c:601 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 __skb_unlink include/linux/skbuff.h:2366 [inline] __skb_dequeue include/linux/skbuff.h:2385 [inline] __skb_queue_purge_reason include/linux/skbuff.h:3175 [inline] __skb_queue_purge include/linux/skbuff.h:3181 [inline] kcm_release+0x170/0x4c8 net/kcm/kcmsock.c:1691 __sock_release net/socket.c:659 [inline] sock_close+0xa4/0x1e8 net/socket.c:1421 __fput+0x30c/0x738 fs/file_table.c:376 ____fput+0x20/0x30 fs/file_table.c:404 task_work_run+0x230/0x2e0 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x618/0x1f64 kernel/exit.c:871 do_group_exit+0x194/0x22c kernel/exit.c:1020 get_signal+0x1500/0x15ec kernel/signal.c:2893 do_signal+0x23c/0x3b44 arch/arm64/kernel/signal.c:1249 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:713 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Allocated by task 6166: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x70/0x84 mm/kasan/generic.c:626 unpoison_slab_object mm/kasan/common.c:314 [inline] __kasan_slab_alloc+0x74/0x8c mm/kasan/common.c:340 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] kmem_cache_alloc_node+0x204/0x4c0 mm/slub.c:3903 __alloc_skb+0x19c/0x3d8 net/core/skbuff.c:641 alloc_skb include/linux/skbuff.h:1296 [inline] kcm_sendmsg+0x1d3c/0x2124 net/kcm/kcmsock.c:783 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_sendmsg+0x220/0x2c0 net/socket.c:768 splice_to_socket+0x7cc/0xd58 fs/splice.c:889 do_splice_from fs/splice.c:941 [inline] direct_splice_actor+0xec/0x1d8 fs/splice.c:1164 splice_direct_to_actor+0x438/0xa0c fs/splice.c:1108 do_splice_direct_actor fs/splice.c:1207 [inline] do_splice_direct+0x1e4/0x304 fs/splice.c:1233 do_sendfile+0x460/0xb3c fs/read_write.c:1295 __do_sys_sendfile64 fs/read_write.c:1362 [inline] __se_sys_sendfile64 fs/read_write.c:1348 [inline] __arm64_sys_sendfile64+0x160/0x3b4 fs/read_write.c:1348 __invoke_syscall arch/arm64/kernel/syscall.c:37 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:51 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:136 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:155 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Freed by task 6167: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x5c/0x74 mm/kasan/generic.c:640 poison_slab_object+0x124/0x18c mm/kasan/common.c:241 __kasan_slab_free+0x3c/0x78 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kmem_cache_free+0x15c/0x3d4 mm/slub.c:4363 kfree_skbmem+0x10c/0x19c __kfree_skb net/core/skbuff.c:1109 [inline] kfree_skb_reason+0x240/0x6f4 net/core/skbuff.c:1144 kfree_skb include/linux/skbuff.h:1244 [inline] kcm_release+0x104/0x4c8 net/kcm/kcmsock.c:1685 __sock_release net/socket.c:659 [inline] sock_close+0xa4/0x1e8 net/socket.c:1421 __fput+0x30c/0x738 fs/file_table.c:376 ____fput+0x20/0x30 fs/file_table.c:404 task_work_run+0x230/0x2e0 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x618/0x1f64 kernel/exit.c:871 do_group_exit+0x194/0x22c kernel/exit.c:1020 get_signal+0x1500/0x15ec kernel/signal.c:2893 do_signal+0x23c/0x3b44 arch/arm64/kernel/signal.c:1249 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_svc+0xac/0x168 arch/arm64/kernel/entry-common.c:713 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 The buggy address belongs to the object at ffff0000ced0fc80 which belongs to the cache skbuff_head_cache of size 240
The buggy address is located 0 bytes inside of
freed 240-byte region [ffff0000ced0fc80, ffff0000ced0fd70)
The buggy address belongs to the physical page:
page:00000000d35f4ae4 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10ed0f
flags: 0x5ffc00000000800(slab|node=0|zone=2|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 05ffc00000000800 ffff0000c1cbf640 fffffdffc3423100 dead000000000004
raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff0000ced0fb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000ced0fc00: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc
>ffff0000ced0fc80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff0000ced0fd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
ffff0000ced0fd80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb--- include/net/kcm.h | 1 + net/kcm/kcmsock.c | 4 ++++ 2 files changed, 5 insertions(+)
include/net/kcm.h +1 -0
@@ -73,6 +73,7 @@ struct kcm_sock {struct work_struct tx_work;struct list_head wait_psock_list;struct sk_buff *seq_skb; +struct mutex tx_mutex; u32 tx_stopped : 1;/* Don't use bit fields here, these are set under different locks */
net/kcm/kcmsock.c +4 -0
@@ -912,6 +912,7 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) !(msg->msg_flags & MSG_MORE) : !!(msg->msg_flags & MSG_EOR);int err = -EPIPE ; +mutex_lock (&kcm->tx_mutex);lock_sock (sk);/* Per tcp_sendmsg this should be in poll */
@@ -1060,6 +1061,7 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)KCM_STATS_ADD (kcm->stats.tx_bytes, copied);release_sock (sk); +mutex_unlock (&kcm->tx_mutex);return copied; out_error:
@@ -1085,6 +1087,7 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) sk->sk_write_space (sk);release_sock (sk); +mutex_unlock (&kcm->tx_mutex);return err; }
@@ -1327,6 +1330,7 @@ static void init_kcm_sock(struct kcm_sock *kcm, struct kcm_mux *mux)spin_unlock_bh (&mux->lock);INIT_WORK (&kcm->tx_work, kcm_tx_work); +mutex_init (&kcm->tx_mutex);spin_lock_bh (&mux->rx_lock);kcm_rcv_ready (kcm);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 58/98 netfilter: nft_counter: Synchronize nft_counter_reset() against reader.
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit a0b39e2dc7017ac667b70bdeee5293e410fab2fb ]
nft_counter_reset() resets the counter by subtracting the previously retrieved value from the counter. This is a write operation on the counter and as such it requires to be performed with a write sequence of nft_counter_seq to serialize against its possible reader.
Update the packets/ bytes within write-sequence of nft_counter_seq.
--- net/netfilter/nft_counter.c | 5 +++++ 1 file changed, 5 insertions(+)
net/netfilter/nft_counter.c +5 -0
@@ -108,11 +108,16 @@ static void nft_counter_reset(struct nft_counter_percpu_priv __percpu *priv, struct nft_counter *total) {struct nft_counter *this_cpu; +seqcount_t *myseq;local_bh_disable (); this_cpu =this_cpu_ptr (priv->counter); + myseq =this_cpu_ptr (&nft_counter_seq); + +write_seqcount_begin (myseq); this_cpu->packets -= total->packets; this_cpu->bytes -= total->bytes; +write_seqcount_end (myseq);local_bh_enable (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 59/98 ipv6: prevent UAF in ip6_send_skb()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit faa389b2fbaaec7fd27a390b4896139f9da662e3 ]
syzbot reported an UAF in ip6_send_skb() [1]
After ip6_local_out() has returned, we no longer can safely dereference rt, unless we hold rcu_read_lock().
A similar issue has been fixed in commit a688caa34beb ("ipv6: take rcu lock in rawv6_send_hdrinc()")
Another potential issue in ip6_finish_output2() is handled in a separate patch.
[1]
BUG: KASAN: slab-use-after-free in ip6_send_skb+0x18d/0x230 net/ipv6/ip6_output.c:1964 Read of size 8 at addr ffff88806dde4858 by task syz.1.380/6530 CPU: 1 UID: 0 PID: 6530 Comm: syz.1.380 Not tainted 6.11.0-rc3-syzkaller-00306-gdf6cbc62cc9b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 ip6_send_skb+0x18d/0x230 net/ipv6/ip6_output.c:1964 rawv6_push_pending_frames+0x75c/0x9e0 net/ipv6/raw.c:588 rawv6_sendmsg+0x19c7/0x23c0 net/ipv6/raw.c:926 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x1a6/0x270 net/socket.c:745 sock_write_iter+0x2dd/0x400 net/socket.c:1160 do_iter_readv_writev+0x60a/0x890 vfs_writev+0x37c/0xbb0 fs/read_write.c:971 do_writev+0x1b1/0x350 fs/read_write.c:1018 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f936bf79e79 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f936cd7f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f936c115f80 RCX: 00007f936bf79e79 RDX: 0000000000000001 RSI: 0000000020000040 RDI: 0000000000000004 RBP: 00007f936bfe7916 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f936c115f80 R15: 00007fff2860a7a8 </TASK> Allocated by task 6530: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4044 dst_alloc+0x12b/0x190 net/core/dst.c:89 ip6_blackhole_route+0x59/0x340 net/ipv6/route.c:2670 make_blackhole net/xfrm/xfrm_policy.c:3120 [inline] xfrm_lookup_route+0xd1/0x1c0 net/xfrm/xfrm_policy.c:3313 ip6_dst_lookup_flow+0x13e/0x180 net/ipv6/ip6_output.c:1257 rawv6_sendmsg+0x1283/0x23c0 net/ipv6/raw.c:898 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x1a6/0x270 net/socket.c:745 ____sys_sendmsg+0x525/0x7d0 net/socket.c:2597 ___sys_sendmsg net/socket.c:2651 [inline] __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2680 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 45: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2252 [inline] slab_free mm/slub.c:4473 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4548 dst_destroy+0x2ac/0x460 net/core/dst.c:124 rcu_do_batch kernel/rcu/tree.c:2569 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2843 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 __call_rcu_common kernel/rcu/tree.c:3106 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:3210 refdst_drop include/net/dst.h:263 [inline] skb_dst_drop include/net/dst.h:275 [inline] nf_ct_frag6_queue net/ipv6/netfilter/nf_conntrack_reasm.c:306 [inline] nf_ct_frag6_gather+0xb9a/0x2080 net/ipv6/netfilter/nf_conntrack_reasm.c:485 ipv6_defrag+0x2c8/0x3c0 net/ipv6/netfilter/nf_defrag_ipv6_hooks.c:67 nf_hook_entry_hookfn include/linux/netfilter.h:154 [inline] nf_hook_slow+0xc3/0x220 net/netfilter/core.c:626 nf_hook include/linux/netfilter.h:269 [inline] __ip6_local_out+0x6fa/0x800 net/ipv6/output_core.c:143 ip6_local_out+0x26/0x70 net/ipv6/output_core.c:153 ip6_send_skb+0x112/0x230 net/ipv6/ip6_output.c:1959 rawv6_push_pending_frames+0x75c/0x9e0 net/ipv6/raw.c:588 rawv6_sendmsg+0x19c7/0x23c0 net/ipv6/raw.c:926 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0x1a6/0x270 net/socket.c:745 sock_write_iter+0x2dd/0x400 net/socket.c:1160 do_iter_readv_writev+0x60a/0x890
--- net/ipv6/ip6_output.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_output.c +2 -0
@@ -1757,6 +1757,7 @@ int ip6_send_skb(struct sk_buff *skb)struct rt6_info *rt = (struct rt6_info *)skb_dst (skb);int err; +rcu_read_lock (); err =ip6_local_out (net, skb->sk, skb);if (err) {if (err >0 )
@@ -1766,6 +1767,7 @@ int ip6_send_skb(struct sk_buff *skb) IPSTATS_MIB_OUTDISCARDS); } +rcu_read_unlock ();return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 60/98 net: xilinx: axienet: Always disable promiscuous mode
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
[ Upstream commit 4ae738dfef2c0323752ab81786e2d298c9939321 ]
If promiscuous mode is disabled when there are fewer than four multicast addresses, then it will not be reflected in the hardware. Fix this by always clearing the promiscuous mode flag even when we program multicast addresses.
--- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +4 -0
@@ -375,6 +375,10 @@ static void axienet_set_multicast_list(struct net_device *ndev) }else if (!netdev_mc_empty (ndev)) {struct netdev_hw_addr *ha; + reg =axienet_ior (lp,XAE_FMI_OFFSET ); + reg &= ~XAE_FMI_PM_MASK ; +axienet_iow (lp,XAE_FMI_OFFSET , reg); + i =0 ;netdev_for_each_mc_addr (ha, ndev) {if (i >=XAE_MULTICAST_CAM_TABLE_NUM )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 61/98 drm/msm: use drm_debug_enabled() to check for debug categories
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
[ Upstream commit d8db0b36d888b6a5eb392f112dc156e694de2369 ]
Allow better abstraction of the drm_debug global variable in the future. No functional changes.
v2: Move unlikely() to drm_debug_enabled()
Stable-dep-of: df24373435f5 ("drm/msm/dpu: don't play tricks with debug macros")
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +2 -2
@@ -42,7 +42,7 @@*/ #define DPU_DEBUG (fmt, ...) \ do { \ - if (unlikely(drm_debug & DRM_UT_KMS)) \ + if (drm_debug_enabled(DRM_UT_KMS)) \ DRM_DEBUG(fmt, ##__VA_ARGS__); \ else \ pr_debug(fmt, ##__VA_ARGS__); \
@@ -54,7 +54,7 @@*/ #define DPU_DEBUG_DRIVER (fmt, ...) \ do { \ - if (unlikely(drm_debug & DRM_UT_DRIVER)) \ + if (drm_debug_enabled(DRM_UT_DRIVER)) \ DRM_ERROR(fmt, ##__VA_ARGS__); \ else \ pr_debug(fmt, ##__VA_ARGS__); \
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 62/98 drm/msm/dpu: dont play tricks with debug macros
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit df24373435f5899a2a98b7d377479c8d4376613b ]
DPU debugging macros need to be converted to a proper drm_debug_* macros, however this is a going an intrusive patch, not suitable for a fix. Wire DPU_DEBUG and DPU_DEBUG_DRIVER to always use DRM_DEBUG_DRIVER to make sure that DPU debugging messages always end up in the drm debug messages and are controlled via the usual drm.debug mask.
I don't think that it is a good idea for a generic DPU_DEBUG macro to be tied to DRM_UT_KMS. It is used to report a debug message from driver, so by default it should go to the DRM_UT_DRIVER channel. While refactoring debug macros later on we might end up with particular messages going to ATOMIC or KMS, but DRIVER should be the default.
Patchwork: https://patchwork.freedesktop.org/patch/606932/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +2 -12
@@ -41,24 +41,14 @@* @fmt: Pointer to format string */ #define DPU_DEBUG (fmt, ...) \ - do { \ - if (drm_debug_enabled(DRM_UT_KMS)) \ - DRM_DEBUG(fmt, ##__VA_ARGS__); \ - else \ - pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)/** * DPU_DEBUG_DRIVER - macro for hardware driver logging * @fmt: Pointer to format string */ #define DPU_DEBUG_DRIVER (fmt, ...) \ - do { \ - if (drm_debug_enabled(DRM_UT_DRIVER)) \ - DRM_ERROR(fmt, ##__VA_ARGS__); \ - else \ - pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)#define DPU_ERROR (fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__)#define DPU_ERROR_RATELIMITED (fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 63/98 mmc: mmc_test: Fix NULL dereference on allocation failure
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit a1e627af32ed60713941cbfc8075d44cad07f6dd ]
If the "test->highmem = alloc_pages()" allocation fails then calling __free_pages(test->highmem) will result in a NULL dereference. Also change the error code to -ENOMEM instead of returning success.
--- drivers/mmc/core/mmc_test.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/core/mmc_test.c +5 -4
@@ -3101,13 +3101,13 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, test->buffer =kzalloc (BUFFER_SIZE ,GFP_KERNEL );#ifdef CONFIG_HIGHMEM test->highmem =alloc_pages (GFP_KERNEL | __GFP_HIGHMEM,BUFFER_ORDER ); +if (!test->highmem) { + count = -ENOMEM ; + goto free_test_buffer; + }#endif -#ifdef CONFIG_HIGHMEM -if (test->buffer && test->highmem) { -#else if (test->buffer) { -#endif mutex_lock (&mmc_test_lock);mmc_test_run (test, testcase);mutex_unlock (&mmc_test_lock);
@@ -3115,6 +3115,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,#ifdef CONFIG_HIGHMEM __free_pages (test->highmem,BUFFER_ORDER ); +free_test_buffer:#endif kfree (test->buffer);kfree (test);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 64/98 Bluetooth: MGMT: Add error handling to pair_device()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Griffin Kroah-Hartman <[email protected]>
commit 538fd3921afac97158d4177139a0ad39f056dbb2 upstream.
hci_conn_params_add() never checks for a NULL value and could lead to a NULL pointer dereference causing a crash.
Fixed by adding error handling in the function.
--- net/bluetooth/mgmt.c | 4 ++++ 1 file changed, 4 insertions(+)
net/bluetooth/mgmt.c +4 -0
@@ -2913,6 +2913,10 @@ static int pair_device(struct sock *sk,* will be kept and this function does nothing. */ p =hci_conn_params_add (hdev, &cp->addr.bdaddr, addr_type); +if (!p) { + err = -EIO ; + goto unlock; + }if (p->auto_connect ==HCI_AUTO_CONN_EXPLICIT ) p->auto_connect =HCI_AUTO_CONN_DISABLED ;
Greg Kroah-Hartman
maintainerPATCH 65/98 HID: wacom: Defer calculation of resolution until resolution_code is known
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
commit 1b8f9c1fb464968a5b18d3acc1da8c00bad24fad upstream.
The Wacom driver maps the HID_DG_TWIST usage to ABS_Z (rather than ABS_RZ) for historic reasons. When the code to support twist was introduced in commit 50066a042da5 ("HID: wacom: generic: Add support for height, tilt, and twist usages"), we were careful to write it in such a way that it had HID calculate the resolution of the twist axis assuming ABS_RZ instead (so that we would get correct angular behavior). This was broken with the introduction of commit 08a46b4190d3 ("HID: wacom: Set a default resolution for older tablets"), which moved the resolution calculation to occur *before* the adjustment from ABS_Z to ABS_RZ occurred.
This commit moves the calculation of resolution after the point that we are finished setting things up for its proper use.
--- drivers/hid/wacom_wac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/wacom_wac.c +3 -1
@@ -1830,12 +1830,14 @@ static void wacom_map_usage(struct inputint fmax = field->logical_maximum;unsigned int equivalent_usage =wacom_equivalent_usage (usage->hid);int resolution_code = code; -int resolution =hidinput_calc_abs_res (field, resolution_code); +int resolution;if (equivalent_usage ==HID_DG_TWIST ) { resolution_code =ABS_RZ ; } + resolution =hidinput_calc_abs_res (field, resolution_code); +if (equivalent_usage ==HID_GD_X ) { fmin += features->offset_left; fmax -= features->offset_right;
Greg Kroah-Hartman
maintainerPATCH 66/98 cxgb4: add forgotten u64 ivlan cast before shift
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Kuratov <[email protected]>
commit 80a1e7b83bb1834b5568a3872e64c05795d88f31 upstream.
It is done everywhere in cxgb4 code, e.g. in is_filter_exact_match() There is no reason it should not be done here
Found by Linux Verification Center (linuxtesting.org) with SVACE
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +2 -1
@@ -940,7 +940,8 @@ static u64 hash_filter_ntuple(struct ch_* in the Compressed Filter Tuple. */ if (tp->vlan_shift >=0 && fs->mask.ivlan) - ntuple |= (FT_VLAN_VLD_F | fs->val.ivlan) << tp->vlan_shift; + ntuple |= (u64)(FT_VLAN_VLD_F | + fs->val.ivlan) << tp->vlan_shift;if (tp->port_shift >=0 && fs->mask.iport) ntuple |= (u64 )fs->val.iport << tp->port_shift;
Greg Kroah-Hartman
maintainerPATCH 67/98 mmc: dw_mmc: allow biu and ciu clocks to defer
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Whitten <[email protected]>
commit 6275c7bc8dd07644ea8142a1773d826800f0f3f7 upstream.
Fix a race condition if the clock provider comes up after mmc is probed, this causes mmc to fail without retrying.
When given the DEFER error from the clk source, pass it on up the chain.
--- drivers/mmc/host/dw_mmc.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/mmc/host/dw_mmc.c +8 -0
@@ -3205,6 +3205,10 @@ int dw_mci_probe(struct dw_mci *host) host->biu_clk =devm_clk_get (host->dev,"biu" );if (IS_ERR (host->biu_clk)) {dev_dbg (host->dev,"biu clock not available\n" ); + ret =PTR_ERR (host->biu_clk); +if (ret == -EPROBE_DEFER ) +return ret; + }else { ret =clk_prepare_enable (host->biu_clk);if (ret) {
@@ -3216,6 +3220,10 @@ int dw_mci_probe(struct dw_mci *host) host->ciu_clk =devm_clk_get (host->dev,"ciu" );if (IS_ERR (host->ciu_clk)) {dev_dbg (host->dev,"ciu clock not available\n" ); + ret =PTR_ERR (host->ciu_clk); +if (ret == -EPROBE_DEFER ) + goto err_clk_biu; + host->bus_hz = host->pdata->bus_hz; }else { ret =clk_prepare_enable (host->ciu_clk);
Greg Kroah-Hartman
maintainerPATCH 68/98 ALSA: timer: Relax start tick time check for slave timer elements
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ccbfcac05866ebe6eb3bc6d07b51d4ed4fcde436 upstream.
The recent addition of a sanity check for a too low start tick time seems breaking some applications that uses aloop with a certain slave timer setup. They may have the initial resolution 0, hence it's treated as if it were a too low value.
Relax and skip the check for the slave timer instance for addressing the regression.
--- sound/core/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/timer.c +1 -1
@@ -532,7 +532,7 @@ static int snd_timer_start1(struct snd_t/* check the actual time for the start tick; * bail out as error if it's way too low (< 100us) */ -if (start) { +if (start && !(timer->hw.flags &SNDRV_TIMER_HW_SLAVE )) {if ((u64 )snd_timer_hw_resolution (timer) * ticks <100000 ) { result = -EINVAL ; goto unlock;
Greg Kroah-Hartman
maintainerPATCH 69/98 Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lee, Chun-Yi <[email protected]>
commit 9c33663af9ad115f90c076a1828129a3fbadea98 upstream.
This patch adds code to check HCI_UART_PROTO_READY flag before accessing hci_uart->proto. It fixes the race condition in hci_uart_tty_ioctl() between HCIUARTSETPROTO and HCIUARTGETPROTO. This issue bug found by Yu Hao and Weiteng Chen:
BUG: general protection fault in hci_uart_tty_ioctl [1]
The information of C reproducer can also reference the link [2]
--- drivers/bluetooth/hci_ldisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -773,7 +773,8 @@ static int hci_uart_tty_ioctl(struct ttybreak ;case HCIUARTGETPROTO : -if (test_bit (HCI_UART_PROTO_SET , &hu->flags)) +if (test_bit (HCI_UART_PROTO_SET , &hu->flags) && +test_bit (HCI_UART_PROTO_READY , &hu->flags)) err = hu->proto->id;else err = -EUNATCH ;
Greg Kroah-Hartman
maintainerPATCH 70/98 Input: MT - limit max slots
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
commit 99d3bf5f7377d42f8be60a6b9cb60fb0be34dceb upstream.
syzbot is reporting too large allocation at input_mt_init_slots(), for num_slots is supplied from userspace using ioctl(UI_DEV_CREATE).
Since nobody knows possible max slots, this patch chose 1024.
--- drivers/input/input-mt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/input/input-mt.c +3 -0
@@ -48,6 +48,9 @@ int input_mt_init_slots(struct input_devreturn 0 ;if (mt)return mt->num_slots != num_slots ? -EINVAL :0 ; +/* Arbitrary limit for avoiding too large memory allocation. */ +if (num_slots >1024 ) +return -EINVAL ; mt =kzalloc (struct_size (mt, slots, num_slots),GFP_KERNEL );if (!mt)
Greg Kroah-Hartman
maintainerPATCH 71/98 tools: move alignment-related macros to new <linux/align.h>
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Lobakin <[email protected]>
commit 10a04ff09bcc39e0044190ffe9f00f998f13647c upstream.
Currently, tools have *ALIGN*() macros scattered across the unrelated headers, as there are only 3 of them and they were added separately each time on an as-needed basis.
Anyway, let's make it more consistent with the kernel headers and allow using those macros outside of the mentioned headers. Create <linux/align.h> inside the tools/ folder and include it where needed.
--- tools/include/linux/align.h | 12 ++++++++++++ tools/include/linux/bitmap.h | 1 + 2 files changed, 13 insertions(+) create mode 100644 tools/include/linux/align.h
tools/include/linux/align.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _TOOLS_LINUX_ALIGN_H +#define _TOOLS_LINUX_ALIGN_H + +#include <uapi/linux/const.h> + +#define ALIGN (x, a) __ALIGN_KERNEL((x), (a)) +#define ALIGN_DOWN (x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) +#define IS_ALIGNED (x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#endif /* _TOOLS_LINUX_ALIGN_H */
tools/include/linux/bitmap.h +1 -0
@@ -3,6 +3,7 @@#define _PERF_BITOPS_H#include <string.h> +#include <linux/align.h> #include <linux/bitops.h> #include <stdlib.h> #include <linux/kernel.h>
Greg Kroah-Hartman
maintainerPATCH 72/98 drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Zhang <[email protected]>
commit 88a9a467c548d0b3c7761b4fd54a68e70f9c0944 upstream.
Initialize the size before calling amdgpu_vce_cs_reloc, such as case 0x03000001.
V2: To really improve the handling we would actually
need to have a separate value of 0xffffffff.(Christian)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 -1
@@ -714,7 +714,8 @@ int amdgpu_vce_ring_parse_cs(struct amdguint32_t created =0 ;uint32_t allocated =0 ;uint32_t tmp, handle =0 ; -uint32_t *size = &tmp; +uint32_t dummy =0xffffffff ; +uint32_t *size = &dummy;unsigned idx;int i, r =0 ;
Greg Kroah-Hartman
maintainerPATCH 73/98 pinctrl: single: fix potential NULL dereference in pcs_get_function()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
commit 1c38a62f15e595346a1106025722869e87ffe044 upstream.
pinmux_generic_get_function() can return NULL and the pointer 'function' was dereferenced without checking against NULL. Add checking of pointer 'function' in pcs_get_function().
Found by code review.
--- drivers/pinctrl/pinctrl-single.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pinctrl/pinctrl-single.c +2 -0
@@ -323,6 +323,8 @@ static int pcs_get_function(struct pinctreturn -ENOTSUPP ; fselector = setting->func; function =pinmux_generic_get_function (pctldev, fselector); +if (!function) +return -EINVAL ; *func = function->data;if (!(*func)) { dev_err(pcs->dev, "%s could not find function%i\n",
Greg Kroah-Hartman
maintainerPATCH 74/98 wifi: mwifiex: duplicate static structs used in driver instances
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Hauer <[email protected]>
commit 27ec3c57fcadb43c79ed05b2ea31bc18c72d798a upstream.
mwifiex_band_2ghz and mwifiex_band_5ghz are statically allocated, but used and modified in driver instances. Duplicate them before using them in driver instances so that different driver instances do not influence each other.
This was observed on a board which has one PCIe and one SDIO mwifiex adapter. It blew up in mwifiex_setup_ht_caps(). This was called with the statically allocated struct which is modified in this function.
--- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 32 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-)
drivers/net/wireless/marvell/mwifiex/cfg80211.c +26 -6
@@ -4294,11 +4294,27 @@ int mwifiex_register_cfg80211(struct mwiif (ISSUPP_ADHOC_ENABLED (adapter->fw_cap_info)) wiphy->interface_modes |=BIT (NL80211_IFTYPE_ADHOC ); - wiphy->bands[NL80211_BAND_2GHZ ] = &mwifiex_band_2ghz; -if (adapter->config_bands &BAND_A ) - wiphy->bands[NL80211_BAND_5GHZ ] = &mwifiex_band_5ghz; -else + wiphy->bands[NL80211_BAND_2GHZ ] =devm_kmemdup (adapter->dev, + &mwifiex_band_2ghz, +sizeof (mwifiex_band_2ghz), +GFP_KERNEL ); +if (!wiphy->bands[NL80211_BAND_2GHZ ]) { + ret = -ENOMEM ; + goto err; + } + +if (adapter->config_bands &BAND_A ) { + wiphy->bands[NL80211_BAND_5GHZ ] =devm_kmemdup (adapter->dev, + &mwifiex_band_5ghz, +sizeof (mwifiex_band_5ghz), +GFP_KERNEL ); +if (!wiphy->bands[NL80211_BAND_5GHZ ]) { + ret = -ENOMEM ; + goto err; + } + }else { wiphy->bands[NL80211_BAND_5GHZ ] =NULL ; + }if (adapter->drcs_enabled &&ISSUPP_DRCS_ENABLED (adapter->fw_cap_info)) wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_drcs;
@@ -4386,8 +4402,7 @@ int mwifiex_register_cfg80211(struct mwiif (ret <0 ) {mwifiex_dbg (adapter,ERROR ,"%s: wiphy_register failed: %d\n" , __func__, ret); -wiphy_free (wiphy); -return ret; + goto err; }if (!adapter->regd) {
@@ -4429,4 +4444,9 @@ int mwifiex_register_cfg80211(struct mwi adapter->wiphy = wiphy;return ret; + +err: +wiphy_free (wiphy); + +return ret; }
Greg Kroah-Hartman
maintainerPATCH 75/98 dm suspend: return -ERESTARTSYS instead of -EINTR
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 1e1fd567d32fcf7544c6e09e0e5bc6c650da6e23 upstream.
This commit changes device mapper, so that it returns -ERESTARTSYS instead of -EINTR when it is interrupted by a signal (so that the ioctl can be restarted).
The manpage signal(7) says that the ioctl function should be restarted if the signal was handled with SA_RESTART.
--- drivers/md/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm.c +1 -1
@@ -2468,7 +2468,7 @@ static int dm_wait_for_completion(structbreak ;if (signal_pending_state (task_state, current)) { - r = -EINTR ; + r = -ERESTARTSYS ;break ; }
Greg Kroah-Hartman
maintainerPATCH 76/98 scsi: mpt3sas: Avoid IOMMU page faults on REPORT ZONES
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Damien Le Moal <[email protected]>
commit 82dbb57ac8d06dfe8227ba9ab11a49de2b475ae5 upstream.
Some firmware versions of the 9600 series SAS HBA byte-swap the REPORT ZONES command reply buffer from ATA-ZAC devices by directly accessing the buffer in the host memory. This does not respect the default command DMA direction and causes IOMMU page faults on architectures with an IOMMU enforcing write-only mappings for DMA_FROM_DEVICE DMA driection (e.g. AMD hosts).
scsi 18:0:0:0: Direct-Access-ZBC ATA WDC WSH722020AL W870 PQ: 0 ANSI: 6
scsi 18:0:0:0: SATA: handle(0x0027), sas_addr(0x300062b2083e7c40), phy(0), device_name(0x5000cca29dc35e11) scsi 18:0:0:0: enclosure logical id (0x300062b208097c40), slot(0)
scsi 18:0:0:0: enclosure level(0x0000), connector name( C0.0)
scsi 18:0:0:0: atapi(n), ncq(y), asyn_notify(n), smart(y), fua(y), sw_preserve(y)
scsi 18:0:0:0: qdepth(32), tagged(1), scsi_level(7), cmd_que(1)
sd 18:0:0:0: Attached scsi generic sg2 type 20
sd 18:0:0:0: [sdc] Host-managed zoned block device
mpt3sas 0000:41:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0021 address=0xfff9b200 flags=0x0050] mpt3sas 0000:41:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0021 address=0xfff9b300 flags=0x0050]mpt3sas_cm0: mpt3sas_ctl_pre_reset_handler: Releasing the trace buffer due to adapter reset. mpt3sas_cm0 fault info from func: mpt3sas_base_make_ioc_readympt3sas_cm0: fault_state(0x2666)!mpt3sas_cm0: sending diag reset !!mpt3sas_cm0: diag reset: SUCCESS
sd 18:0:0:0: [sdc] REPORT ZONES start lba 0 failed
sd 18:0:0:0: [sdc] REPORT ZONES: Result: hostbyte=DID_RESET driverbyte=DRIVER_OK
sd 18:0:0:0: [sdc] 0 4096-byte logical blocks: (0 B/0 B)
Avoid such issue by always mapping the buffer of REPORT ZONES commands using DMA_BIDIRECTIONAL (read+write IOMMU mapping). This is done by introducing the helper function _base_scsi_dma_map() and using this helper in _base_build_sg_scmd() and _base_build_sg_scmd_ieee() instead of calling directly scsi_dma_map().
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +18 -2
@@ -2221,6 +2221,22 @@ _base_build_zero_len_sge_ieee(struct MPT_base_add_sg_single_ieee (paddr, sgl_flags,0 ,0 ,-1 ); } +static inline int _base_scsi_dma_map (struct scsi_cmnd *cmd) +{ +/* +* Some firmware versions byte-swap the REPORT ZONES command reply from +* ATA-ZAC devices by directly accessing in the host buffer. This does +* not respect the default command DMA direction and causes IOMMU page +* faults on some architectures with an IOMMU enforcing write mappings +* (e.g. AMD hosts). Avoid such issue by making the report zones buffer +* mapping bi-directional. +*/ +if (cmd->cmnd[0 ] ==ZBC_IN && cmd->cmnd[1 ] ==ZI_REPORT_ZONES ) + cmd->sc_data_direction =DMA_BIDIRECTIONAL ; + +return scsi_dma_map (cmd); +} +/** * _base_build_sg_scmd - main sg creation routine * pcie_device is unused here!
@@ -2267,7 +2283,7 @@ _base_build_sg_scmd(struct MPT3SAS_ADAPT sgl_flags = sgl_flags <<MPI2_SGE_FLAGS_SHIFT ; sg_scmd =scsi_sglist (scmd); - sges_left =scsi_dma_map (scmd); + sges_left =_base_scsi_dma_map (scmd);if (sges_left <0 ) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg failed: request for %d bytes!\n",
@@ -2415,7 +2431,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ } sg_scmd =scsi_sglist (scmd); - sges_left =scsi_dma_map (scmd); + sges_left =_base_scsi_dma_map (scmd);if (sges_left <0 ) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg failed: request for %d bytes!\n",
Greg Kroah-Hartman
maintainerPATCH 77/98 filelock: Correct the filelock owner in fcntl_setlk/fcntl_setlk64
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
The locks_remove_posix() function in fcntl_setlk/fcntl_setlk64 is designed to reliably remove locks when an fcntl/close race is detected. However, it was passing in the wrong filelock owner, it looks like a mistake and resulting in a failure to remove locks. More critically, if the lock removal fails, it could lead to a uaf issue while traversing the locks.
This problem occurs only in the 4.19/5.4 stable version.
--- fs/locks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/locks.c +2 -2
@@ -2313,7 +2313,7 @@ int fcntl_setlk(unsigned int fd, struct f =fcheck (fd);spin_unlock (¤t->files->file_lock);if (f != filp) { -locks_remove_posix (filp, ¤t->files); +locks_remove_posix (filp, current->files); error = -EBADF ; } }
@@ -2443,7 +2443,7 @@ int fcntl_setlk64(unsigned int fd, struc f =fcheck (fd);spin_unlock (¤t->files->file_lock);if (f != filp) { -locks_remove_posix (filp, ¤t->files); +locks_remove_posix (filp, current->files); error = -EBADF ; } }
Greg Kroah-Hartman
maintainerPATCH 78/98 media: uvcvideo: Fix integer overflow calculating timestamp
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 8676a5e796fa18f55897ca36a94b2adf7f73ebd1 upstream.
The function uvc_video_clock_update() supports a single SOF overflow. Or in other words, the maximum difference between the first ant the last timestamp can be 4096 ticks or 4.096 seconds.
This results in a maximum value for y2 of: 0x12FBECA00, that overflows 32bits.
y2 = (u32)ktime_to_ns(ktime_sub(last->host_time, first->host_time)) + y1;
Extend the size of y2 to u64 to support all its values.
Without this patch:
# yavta -s 1920x1080 -f YUYV -t 1/5 -c /dev/video0 Device /dev/v4l/by-id/usb-Shine-Optics_Integrated_Camera_0001-video-index0 opened. Device `Integrated Camera: Integrated C' on `usb-0000:00:14.0-6' (driver 'uvcvideo') supports video, capture, without mplanes. Video format set: YUYV (56595559) 1920x1080 (stride 3840) field none buffer size 4147200 Video format: YUYV (56595559) 1920x1080 (stride 3840) field none buffer size 4147200 Current frame rate: 1/5 Setting frame rate to: 1/5 Frame rate set: 1/5 8 buffers requested. length: 4147200 offset: 0 timestamp type/source: mono/SoE Buffer 0/0 mapped at address 0x7947ea94c000. length: 4147200 offset: 4149248 timestamp type/source: mono/SoE Buffer 1/0 mapped at address 0x7947ea557000. length: 4147200 offset: 8298496 timestamp type/source: mono/SoE Buffer 2/0 mapped at address 0x7947ea162000. length: 4147200 offset: 12447744 timestamp type/source: mono/SoE Buffer 3/0 mapped at address 0x7947e9d6d000. length: 4147200 offset: 16596992 timestamp type/source: mono/SoE Buffer 4/0 mapped at address 0x7947e9978000. length: 4147200 offset: 20746240 timestamp type/source: mono/SoE Buffer 5/0 mapped at address 0x7947e9583000. length: 4147200 offset: 24895488 timestamp type/source: mono/SoE Buffer 6/0 mapped at address 0x7947e918e000. length: 4147200 offset: 29044736 timestamp type/source: mono/SoE Buffer 7/0 mapped at address 0x7947e8d99000. 0 (0) [-] none 0 4147200 B 507.554210 508.874282 242.836 fps ts mono/SoE 1 (1) [-] none 2 4147200 B 508.886298 509.074289 0.751 fps ts mono/SoE 2 (2) [-] none 3 4147200 B 509.076362 509.274307 5.261 fps ts mono/SoE 3 (3) [-] none 4 4147200 B 509.276371 509.474336 5.000 fps ts mono/SoE 4 (4) [-] none 5 4147200 B 509.476394 509.674394 4.999 fps ts mono/SoE 5 (5) [-] none 6 4147200 B 509.676506 509.874345 4.997 fps ts mono/SoE 6 (6) [-] none 7 4147200 B 509.876430 510.074370 5.002 fps ts mono/SoE 7 (7) [-] none 8 4147200 B 510.076434 510.274365 5.000 fps ts mono/SoE 8 (0) [-] none 9 4147200 B 510.276421 510.474333 5.000 fps ts mono/SoE 9 (1) [-] none 10 4147200 B 510.476391 510.674429 5.001 fps ts mono/SoE 10 (2) [-] none 11 4147200 B 510.676434 510.874283 4.999 fps ts mono/SoE 11 (3) [-] none 12 4147200 B 510.886264 511.074349 4.766 fps ts mono/SoE 12 (4) [-] none 13 4147200 B 511.070577 511.274304 5.426 fps ts mono/SoE 13 (5) [-] none 14 4147200 B 511.286249 511.474301 4.637 fps ts mono/SoE 14 (6) [-] none 15 4147200 B 511.470542 511.674251 5.426 fps ts mono/SoE 15 (7) [-] none 16 4147200 B 511.672651 511.874337 4.948 fps ts mono/SoE 16 (0) [-] none 17 4147200 B 511.873988 512.074462 4.967 fps ts mono/SoE 17 (1) [-] none 18 4147200 B 512.075982 512.278296 4.951 fps ts mono/SoE 18 (2) [-] none 19 4147200 B 512.282631 512.482423 4.839 fps ts mono/SoE 19 (3) [-] none 20 4147200 B 518.986637 512.686333 0.149 fps ts mono/SoE 20 (4) [-] none 21 4147200 B 518.342709 512.886386 -1.553 fps ts mono/SoE 21 (5) [-] none 22 4147200 B 517.909812 513.090360 -2.310 fps ts mono/SoE 22 (6) [-] none 23 4147200 B 517.590775 513.294454 -3.134 fps ts mono/SoE 23 (7) [-] none 24 4147200 B 513.298465 513.494335 -0.233 fps ts mono/SoE 24 (0) [-] none 25 4147200 B 513.510273 513.698375 4.721 fps ts mono/SoE 25 (1) [-] none 26 4147200 B 513.698904 513.902327 5.301 fps ts mono/SoE 26 (2) [-] none 27 4147200 B 513.895971 514.102348 5.074 fps ts mono/SoE 27 (3) [-] none 28 4147200 B 514.099091 514.306337 4.923 fps ts mono/SoE 28 (4) [-] none 29 4147200 B 514.310348 514.510567 4.734 fps ts mono/SoE 29 (5) [-] none 30 4147200 B 514.509295 514.710367 5.026 fps ts mono/SoE 30 (6) [-] none 31 4147200 B 521.532513 514.914398 0.142 fps ts mono/SoE 31 (7) [-] none 32 4147200 B 520.885277 515.118385 -1.545 fps ts mono/SoE 32 (0) [-] none 33 4147200 B 520.411140 515.318336 -2.109 fps ts mono/SoE 33 (1) [-] none 34 4147200 B 515.325425 515.522278 -0.197 fps ts mono/SoE 34 (2) [-] none 35 4147200 B 515.538276 515.726423 4.698 fps ts mono/SoE 35 (3) [-] none 36 4147200 B 515.720767 515.930373 5.480 fps ts mono/SoE
--- drivers/media/usb/uvc/uvc_video.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/usb/uvc/uvc_video.c +5 -5
@@ -728,11 +728,11 @@ void uvc_video_clock_update(struct uvc_sunsigned long flags;u64 timestamp;u32 delta_stc; -u32 y1, y2; +u32 y1;u32 x1, x2;u32 mean;u32 sof; -u64 y; +u64 y, y2;if (!uvc_hw_timestamps_param)return ;
@@ -772,7 +772,7 @@ void uvc_video_clock_update(struct uvc_s sof = y; uvc_trace(UVC_TRACE_CLOCK, "%s: PTS %u y %llu.%06llu SOF %u.%06llu " - "(x1 %u x2 %u y1 %u y2 %u SOF offset %u)\n", + "(x1 %u x2 %u y1 %u y2 %llu SOF offset %u)\n", stream->dev->name, buf->pts, y >> 16, div_u64((y & 0xffff) * 1000000, 65536), sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536),
@@ -787,7 +787,7 @@ void uvc_video_clock_update(struct uvc_s goto done; y1 =NSEC_PER_SEC ; - y2 = (u32 )ktime_to_ns (ktime_sub (last->host_time, first->host_time)) + y1; + y2 =ktime_to_ns (ktime_sub (last->host_time, first->host_time)) + y1;/* Interpolated and host SOF timestamps can wrap around at slightly * different times. Handle this by adding or removing 2048 to or from
@@ -807,7 +807,7 @@ void uvc_video_clock_update(struct uvc_s timestamp =ktime_to_ns (first->host_time) + y - y1; uvc_trace(UVC_TRACE_CLOCK, "%s: SOF %u.%06llu y %llu ts %llu " - "buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %u)\n", + "buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %llu)\n", stream->dev->name, sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536), y, timestamp, vbuf->vb2_buf.timestamp,
Greg Kroah-Hartman
maintainerPATCH 79/98 ata: libata-core: Fix null pointer dereference on error
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 5d92c7c566dc76d96e0e19e481d926bbe6631c1e upstream.
If the ata_port_alloc() call in ata_host_alloc() fails, ata_host_release() will get called.
However, the code in ata_host_release() tries to free ata_port struct members unconditionally, which can lead to the following:
BUG: unable to handle page fault for address: 0000000000003990 PGD 0 P4D 0 Oops: Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 10 PID: 594 Comm: (udev-worker) Not tainted 6.10.0-rc5 #44 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-2.fc40 04/01/2014 RIP: 0010:ata_host_release.cold+0x2f/0x6e [libata] Code: e4 4d 63 f4 44 89 e2 48 c7 c6 90 ad 32 c0 48 c7 c7 d0 70 33 c0 49 83 c6 0e 41 RSP: 0018:ffffc90000ebb968 EFLAGS: 00010246 RAX: 0000000000000041 RBX: ffff88810fb52e78 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff88813b3218c0 RDI: ffff88813b3218c0 RBP: ffff88810fb52e40 R08: 0000000000000000 R09: 6c65725f74736f68 R10: ffffc90000ebb738 R11: 73692033203a746e R12: 0000000000000004 R13: 0000000000000000 R14: 0000000000000011 R15: 0000000000000006 FS: 00007f6cc55b9980(0000) GS:ffff88813b300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000003990 CR3: 00000001122a2000 CR4: 0000000000750ef0 PKRU: 55555554 Call Trace: <TASK> ? __die_body.cold+0x19/0x27 ? page_fault_oops+0x15a/0x2f0 ? exc_page_fault+0x7e/0x180 ? asm_exc_page_fault+0x26/0x30 ? ata_host_release.cold+0x2f/0x6e [libata] ? ata_host_release.cold+0x2f/0x6e [libata] release_nodes+0x35/0xb0 devres_release_group+0x113/0x140 ata_host_alloc+0xed/0x120 [libata] ata_host_alloc_pinfo+0x14/0xa0 [libata] ahci_init_one+0x6c9/0xd20 [ahci]
Do not access ata_port struct members unconditionally.
--- drivers/ata/libata-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-core.c +3 -0
@@ -6159,6 +6159,9 @@ static void ata_host_release(struct kreffor (i =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i]; +if (!ap) +continue ; +kfree (ap->pmp_link);kfree (ap->slave_link);kfree (ap);
Greg Kroah-Hartman
maintainerPATCH 80/98 cgroup/cpuset: Prevent UAF in proc_cpuset_show()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
commit 1be59c97c83ccd67a519d8a49486b3a8a73ca28a upstream.
An UAF can happen when /proc/cpuset is read as reported in [1].
This can be reproduced by the following methods:
1.add an mdelay(1000) before acquiring the cgroup_lock In the
cgroup_path_ns function.
2.$cat /proc/<pid>/cpuset repeatly.
3.$mount -t cgroup -o cpuset cpuset /sys/fs/cgroup/cpuset/
$umount /sys/fs/cgroup/cpuset/ repeatly.
The race that cause this bug can be shown as below:
(umount) | (cat /proc/<pid>/cpuset)css_release | proc_cpuset_showcss_release_work_fn | css = task_get_css(tsk, cpuset_cgrp_id);css_free_rwork_fn | cgroup_path_ns(css->cgroup, ...);cgroup_destroy_root | mutex_lock(&cgroup_mutex);rebind_subsystems |cgroup_free_root |
| // cgrp was freed, UAF | cgroup_path_ns_locked(cgrp,..);
When the cpuset is initialized, the root node top_cpuset.css.cgrp will point to &cgrp_dfl_root.cgrp. In cgroup v1, the mount operation will allocate cgroup_root, and top_cpuset.css.cgrp will point to the allocated &cgroup_root.cgrp. When the umount operation is executed, top_cpuset.css.cgrp will be rebound to &cgrp_dfl_root.cgrp.
The problem is that when rebinding to cgrp_dfl_root, there are cases where the cgroup_root allocated by setting up the root for cgroup v1 is cached. This could lead to a Use-After-Free (UAF) if it is subsequently freed. The descendant cgroups of cgroup v1 can only be freed after the css is released. However, the css of the root will never be released, yet the cgroup_root should be freed when it is unmounted. This means that obtaining a reference to the css of the root does not guarantee that css.cgrp->root will not be freed.
Fix this problem by using rcu_read_lock in proc_cpuset_show(). As cgroup_root is kfree_rcu after commit d23b5c577715 ("cgroup: Make operations on the cgroup root_list RCU safe"), css->cgroup won't be freed during the critical section.
To call cgroup_path_ns_locked, css_set_lock is needed, so it is safe to replace task_get_css with task_css.
[1] https://syzkaller.appspot.com/bug?extid=9b1ff7be974a403aa4cd
--- kernel/cgroup/cpuset.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
kernel/cgroup/cpuset.c +9 -4
@@ -22,6 +22,7 @@* distribution for more details. */ +#include "cgroup-internal.h" #include <linux/cpu.h> #include <linux/cpumask.h> #include <linux/cpuset.h>
@@ -2758,10 +2759,14 @@ int proc_cpuset_show(struct seq_file *m,if (!buf) goto out; - css =task_get_css (tsk, cpuset_cgrp_id); - retval =cgroup_path_ns (css->cgroup, buf,PATH_MAX , - current->nsproxy->cgroup_ns); -css_put (css); +rcu_read_lock (); +spin_lock_irq (&css_set_lock); + css =task_css (tsk, cpuset_cgrp_id); + retval =cgroup_path_ns_locked (css->cgroup, buf,PATH_MAX , + current->nsproxy->cgroup_ns); +spin_unlock_irq (&css_set_lock); +rcu_read_unlock (); +if (retval >=PATH_MAX ) retval = -ENAMETOOLONG ;if (retval <0 )
Greg Kroah-Hartman
maintainerPATCH 81/98 memcg: enable accounting of ipc resources
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit 18319498fdd4cdf8c1c2c48cd432863b1f915d6f upstream.
When user creates IPC objects it forces kernel to allocate memory for these long-living objects.
It makes sense to account them to restrict the host's memory consumption from inside the memcg-limited container.
This patch enables accounting for IPC shared memory segments, messages semaphores and semaphore's undo lists.
--- ipc/msg.c | 2 +- ipc/sem.c | 10 ++++++---- ipc/shm.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-)
ipc/msg.c +1 -1
@@ -137,7 +137,7 @@ static int newque(struct ipc_namespace *key_t key = params->key;int msgflg = params->flg; - msq =kvmalloc (sizeof (*msq),GFP_KERNEL ); + msq =kvmalloc (sizeof (*msq),GFP_KERNEL_ACCOUNT );if (unlikely (!msq))return -ENOMEM ;
ipc/sem.c +6 -4
@@ -494,7 +494,7 @@ static struct sem_array *sem_alloc(size_return NULL ; size =sizeof (*sma) + nsems *sizeof (sma->sems[0 ]); - sma =kvmalloc (size,GFP_KERNEL ); + sma =kvmalloc (size,GFP_KERNEL_ACCOUNT );if (unlikely (!sma))return NULL ;
@@ -1813,7 +1813,7 @@ static inline int get_undo_list(struct s undo_list = current->sysvsem.undo_list;if (!undo_list) { - undo_list =kzalloc (sizeof (*undo_list),GFP_KERNEL ); + undo_list =kzalloc (sizeof (*undo_list),GFP_KERNEL_ACCOUNT );if (undo_list ==NULL )return -ENOMEM ;spin_lock_init (&undo_list->lock);
@@ -1897,7 +1897,8 @@ static struct sem_undo *find_alloc_undo(rcu_read_unlock ();/* step 2: allocate new undo structure */ - new =kzalloc (sizeof (struct sem_undo ) +sizeof (short )*nsems,GFP_KERNEL ); + new =kzalloc (sizeof (struct sem_undo ) +sizeof (short )*nsems, +GFP_KERNEL_ACCOUNT );if (!new) {ipc_rcu_putref (&sma->sem_perm, sem_rcu_free);return ERR_PTR (-ENOMEM );
@@ -1961,7 +1962,8 @@ static long do_semtimedop(int semid, strif (nsops > ns->sc_semopm)return -E2BIG ;if (nsops >SEMOPM_FAST ) { - sops =kvmalloc_array (nsops,sizeof (*sops),GFP_KERNEL ); + sops =kvmalloc_array (nsops,sizeof (*sops), +GFP_KERNEL_ACCOUNT );if (sops ==NULL )return -ENOMEM ; }
ipc/shm.c +1 -1
@@ -711,7 +711,7 @@ static int newseg(struct ipc_namespace * ns->shm_tot + numpages > ns->shm_ctlall)return -ENOSPC ; - shp =kvmalloc (sizeof (*shp),GFP_KERNEL ); + shp =kvmalloc (sizeof (*shp),GFP_KERNEL_ACCOUNT );if (unlikely (!shp))return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 82/98 fbcon: Prevent that screen size is smaller than font size
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit e64242caef18b4a5840b0e7a9bff37abd4f4f933 upstream.
We need to prevent that users configure a screen size which is smaller than the currently selected font size. Otherwise rendering chars on the screen will access memory outside the graphics memory region.
This patch adds a new function fbcon_modechange_possible() which implements this check and which later may be extended with other checks if necessary. The new function is called from the FBIOPUT_VSCREENINFO ioctl handler in fbmem.c, which will return -EINVAL if userspace asked for a too small screen size.
--- drivers/video/fbdev/core/fbcon.c | 28 ++++++++++++++++++++++++++++ drivers/video/fbdev/core/fbmem.c | 9 ++++++--- include/linux/fbcon.h | 4 ++++ 3 files changed, 38 insertions(+), 3 deletions(-)
drivers/video/fbdev/core/fbcon.c +28 -0
@@ -2734,6 +2734,34 @@ static void fbcon_set_all_vcs(struct fb_fbcon_modechanged (info); } +/* let fbcon check if it supports a new screen resolution */ +int fbcon_modechange_possible (struct fb_info *info,struct fb_var_screeninfo *var) +{ +struct fbcon_ops *ops = info->fbcon_par; +struct vc_data *vc; +unsigned int i; + +WARN_CONSOLE_UNLOCKED (); + +if (!ops) +return 0 ; + +/* prevent setting a screen size which is smaller than font size */ +for (i = first_fb_vc; i <= last_fb_vc; i++) { + vc = vc_cons[i].d; +if (!vc || vc->vc_mode !=KD_TEXT || + registered_fb[con2fb_map[i]] != info) +continue ; + +if (vc->vc_font.width >FBCON_SWAP (var->rotate, var->xres, var->yres) || + vc->vc_font.height >FBCON_SWAP (var->rotate, var->yres, var->xres)) +return -EINVAL ; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (fbcon_modechange_possible); +static int fbcon_mode_deleted (struct fb_info *info,struct fb_videomode *mode) {
drivers/video/fbdev/core/fbmem.c +6 -3
@@ -1121,9 +1121,12 @@ static long do_fb_ioctl(struct fb_info *console_unlock ();return -ENODEV ; } - info->flags |=FBINFO_MISC_USEREVENT ; - ret =fb_set_var (info, &var); - info->flags &= ~FBINFO_MISC_USEREVENT ; + ret =fbcon_modechange_possible (info, &var); +if (!ret) { + info->flags |=FBINFO_MISC_USEREVENT ; + ret =fb_set_var (info, &var); + info->flags &= ~FBINFO_MISC_USEREVENT ; + }unlock_fb_info (info);console_unlock ();if (!ret &©_to_user (argp, &var,sizeof (var)))
include/linux/fbcon.h +4 -0
@@ -4,9 +4,13 @@#ifdef CONFIG_FRAMEBUFFER_CONSOLE void __init fb_console_init (void ); void __exit fb_console_exit(void); +int fbcon_modechange_possible (struct fb_info *info, +struct fb_var_screeninfo *var);#else static inline void fb_console_init (void ) {}static inline void fb_console_exit (void ) {} +static inline int fbcon_modechange_possible (struct fb_info *info, +struct fb_var_screeninfo *var) {return 0 ; }#endif #endif /* _LINUX_FBCON_H */
Greg Kroah-Hartman
maintainerPATCH 83/98 fbmem: Check virtual screen sizes in fb_set_var()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 6c11df58fd1ac0aefcb3b227f72769272b939e56 upstream.
Verify that the fbdev or drm driver correctly adjusted the virtual screen sizes. On failure report the failing driver and reject the screen size change.
--- drivers/video/fbdev/core/fbmem.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/video/fbdev/core/fbmem.c +11 -0
@@ -1006,6 +1006,17 @@ fb_set_var(struct fb_info *info, structif (ret) goto done; +/* verify that virtual resolution >= physical resolution */ +if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { +pr_warn ("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n" , + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); + ret = -EINVAL ; + goto done; + } +if ((var->activate &FB_ACTIVATE_MASK ) ==FB_ACTIVATE_NOW ) {struct fb_var_screeninfo old_var;struct fb_videomode mode;
Greg Kroah-Hartman
maintainerPATCH 84/98 net:rds: Fix possible deadlock in rds_message_put
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Allison Henderson <[email protected]>
commit f1acf1ac84d2ae97b7889b87223c1064df850069 upstream.
Functions rds_still_queued and rds_clear_recv_queue lock a given socket in order to safely iterate over the incoming rds messages. However calling rds_inc_put while under this lock creates a potential deadlock. rds_inc_put may eventually call rds_message_purge, which will lock m_rs_lock. This is the incorrect locking order since m_rs_lock is meant to be locked before the socket. To fix this, we move the message item to a local list or variable that wont need rs_recv_lock protection. Then we can safely call rds_inc_put on any item stored locally after rs_recv_lock is released.
--- net/rds/recv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
net/rds/recv.c +11 -2
@@ -429,6 +429,7 @@ static int rds_still_queued(struct rds_sstruct sock *sk =rds_rs_to_sk (rs);int ret =0 ;unsigned long flags; +struct rds_incoming *to_drop =NULL ;write_lock_irqsave (&rs->rs_recv_lock, flags);if (!list_empty (&inc->i_item)) {
@@ -439,11 +440,14 @@ static int rds_still_queued(struct rds_s -be32_to_cpu (inc->i_hdr.h_len), inc->i_hdr.h_dport);list_del_init (&inc->i_item); -rds_inc_put (inc); + to_drop = inc; } }write_unlock_irqrestore (&rs->rs_recv_lock, flags); +if (to_drop) +rds_inc_put (to_drop); +rdsdebug ("inc %p rs %p still %d dropped %d\n" , inc, rs, ret, drop);return ret; }
@@ -752,16 +756,21 @@ void rds_clear_recv_queue(struct rds_socstruct sock *sk =rds_rs_to_sk (rs);struct rds_incoming *inc, *tmp;unsigned long flags; +LIST_HEAD (to_drop);write_lock_irqsave (&rs->rs_recv_lock, flags);list_for_each_entry_safe (inc, tmp, &rs->rs_recv_queue, i_item) {rds_recv_rcvbuf_delta (rs, sk, inc->i_conn->c_lcong, -be32_to_cpu (inc->i_hdr.h_len), inc->i_hdr.h_dport); +list_move (&inc->i_item, &to_drop); + } +write_unlock_irqrestore (&rs->rs_recv_lock, flags); + +list_for_each_entry_safe (inc, tmp, &to_drop, i_item) {list_del_init (&inc->i_item);rds_inc_put (inc); } -write_unlock_irqrestore (&rs->rs_recv_lock, flags); }/*
Greg Kroah-Hartman
maintainerPATCH 85/98 ida: Fix crash in ida_free when the bitmap is empty
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
commit af73483f4e8b6f5c68c9aa63257bdd929a9c194a upstream.
The IDA usually detects double-frees, but that detection failed to consider the case when there are no nearby IDs allocated and so we have a NULL bitmap rather than simply having a clear bit. Add some tests to the test-suite to be sure we don't inadvertently reintroduce this problem. Unfortunately they're quite noisy so include a message to disregard the warnings.
--- lib/idr.c | 2 +- lib/test_ida.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-)
lib/idr.c +1 -1
@@ -471,7 +471,7 @@ static void ida_remove(struct ida *ida, }else { btmp = bitmap->bitmap; } -if (!test_bit (offset, btmp)) +if (!bitmap || !test_bit (offset, btmp)) goto err;__clear_bit (offset, btmp);
lib/test_ida.c +40 -0
@@ -150,6 +150,45 @@ static void ida_check_conv(struct ida *iIDA_BUG_ON (ida, !ida_is_empty (ida)); } +/* +* Check various situations where we attempt to free an ID we don't own. +*/ +static void ida_check_bad_free (struct ida *ida) +{ +unsigned long i; + +printk ("vvv Ignore \"not allocated\" warnings\n" ); +/* IDA is empty; all of these will fail */ +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); + +/* IDA contains a single value entry */ +IDA_BUG_ON (ida,ida_alloc_min (ida,3 ,GFP_KERNEL ) !=3 ); +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); + +/* IDA contains a single bitmap */ +IDA_BUG_ON (ida,ida_alloc_min (ida,1023 ,GFP_KERNEL ) !=1023 ); +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); + +/* IDA contains a tree */ +IDA_BUG_ON (ida,ida_alloc_min (ida, (1 <<20 ) -1 ,GFP_KERNEL ) != (1 <<20 ) -1 ); +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); +printk ("^^^ \"not allocated\" warnings over\n" ); + +ida_free (ida,3 ); +ida_free (ida,1023 ); +ida_free (ida, (1 <<20 ) -1 ); + +IDA_BUG_ON (ida, !ida_is_empty (ida)); +} +static DEFINE_IDA (ida);static int ida_checks (void )
@@ -162,6 +201,7 @@ static int ida_checks(void)ida_check_leaf (&ida,1024 *64 );ida_check_max (&ida);ida_check_conv (&ida); +ida_check_bad_free (&ida);printk ("IDA: %u of %u tests passed\n" , tests_passed, tests_run);return (tests_run != tests_passed) ?0 : -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 86/98 net: prevent mss overflow in skb_segment()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 23d05d563b7e7b0314e65c8e882bc27eac2da8e7 upstream.
Once again syzbot is able to crash the kernel in skb_segment() [1]
GSO_BY_FRAGS is a forbidden value, but unfortunately the following computation in skb_segment() can reach it quite easily :
mss = mss * partial_segs;
65535 = 3 * 5 * 17 * 257, so many initial values of mss can lead to a bad final result.
Make sure to limit segmentation so that the new mss value is smaller than GSO_BY_FRAGS.
[1]
general protection fault, probably for non-canonical address 0xdffffc000000000e: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077] CPU: 1 PID: 5079 Comm: syz-executor993 Not tainted 6.7.0-rc4-syzkaller-00141-g1ae4cd3cbdd0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023 RIP: 0010:skb_segment+0x181d/0x3f30 net/core/skbuff.c:4551 Code: 83 e3 02 e9 fb ed ff ff e8 90 68 1c f9 48 8b 84 24 f8 00 00 00 48 8d 78 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 8a 21 00 00 48 8b 84 24 f8 00 RSP: 0018:ffffc900043473d0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000010046 RCX: ffffffff886b1597 RDX: 000000000000000e RSI: ffffffff886b2520 RDI: 0000000000000070 RBP: ffffc90004347578 R08: 0000000000000005 R09: 000000000000ffff R10: 000000000000ffff R11: 0000000000000002 R12: ffff888063202ac0 R13: 0000000000010000 R14: 000000000000ffff R15: 0000000000000046 FS: 0000555556e7e380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020010000 CR3: 0000000027ee2000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> udp6_ufo_fragment+0xa0e/0xd00 net/ipv6/udp_offload.c:109 ipv6_gso_segment+0x534/0x17e0 net/ipv6/ip6_offload.c:120 skb_mac_gso_segment+0x290/0x610 net/core/gso.c:53 __skb_gso_segment+0x339/0x710 net/core/gso.c:124 skb_gso_segment include/net/gso.h:83 [inline] validate_xmit_skb+0x36c/0xeb0 net/core/dev.c:3626 __dev_queue_xmit+0x6f3/0x3d60 net/core/dev.c:4338 dev_queue_xmit include/linux/netdevice.h:3134 [inline] packet_xmit+0x257/0x380 net/packet/af_packet.c:276 packet_snd net/packet/af_packet.c:3087 [inline] packet_sendmsg+0x24c6/0x5220 net/packet/af_packet.c:3119 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg+0xd5/0x180 net/socket.c:745 __sys_sendto+0x255/0x340 net/socket.c:2190 __do_sys_sendto net/socket.c:2202 [inline] __se_sys_sendto net/socket.c:2198 [inline] __x64_sys_sendto+0xe0/0x1b0 net/socket.c:2198 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7f8692032aa9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 d1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff8d685418 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f8692032aa9 RDX: 0000000000010048 RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00000000000f4240 R08: 0000000020000540 R09: 0000000000000014 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff8d685480 R13: 0000000000000001 R14: 00007fff8d685480 R15: 0000000000000003 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:skb_segment+0x181d/0x3f30 net/core/skbuff.c:4551 Code: 83 e3 02 e9 fb ed ff ff e8 90 68 1c f9 48 8b 84 24 f8 00 00 00 48 8d 78 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 8a 21 00 00 48 8b 84 24 f8 00 RSP: 0018:ffffc900043473d0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 0000000000010046 RCX: ffffffff886b1597 RDX: 000000000000000e RSI: ffffffff886b2520 RDI: 0000000000000070 RBP: ffffc90004347578 R08: 0000000000000005 R09: 000000000000ffff R10: 000000000000ffff R11: 0000000000000002 R12: ffff888063202ac0 R13: 0000000000010000 R14: 000000000000ffff R15: 0000000000000046 FS: 0000555556e7e380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020010000 CR3: 0000000027ee2000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
--- net/core/skbuff.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/core/skbuff.c +2 -1
@@ -3625,8 +3625,9 @@ struct sk_buff *skb_segment(struct sk_bu/* GSO partial only requires that we trim off any excess that * doesn't fit into an MSS sized block, so take care of that * now. +* Cap len to not accidentally hit GSO_BY_FRAGS. */ - partial_segs = len / mss; + partial_segs =min (len, (unsigned int )(GSO_BY_FRAGS -1 )) / mss;if (partial_segs >1 ) mss *= partial_segs;else
Greg Kroah-Hartman
maintainerPATCH 87/98 soundwire: stream: fix programming slave ports for non-continous port maps
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 upstream.
Two bitmasks in 'struct sdw_slave_prop' - 'source_ports' and 'sink_ports' - define which ports to program in sdw_program_slave_port_params(). The masks are used to get the appropriate data port properties ('struct sdw_get_slave_dpn_prop') from an array.
Bitmasks can be non-continuous or can start from index different than 0, thus when looking for matching port property for given port, we must iterate over mask bits, not from 0 up to number of ports.
This fixes allocation and programming slave ports, when a source or sink masks start from further index.
--- drivers/soundwire/stream.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/soundwire/stream.c +4 -4
@@ -1232,18 +1232,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_p unsigned int port_num) {struct sdw_dpn_prop *dpn_prop; -u8 num_ports; +unsigned long mask;int i;if (direction ==SDW_DATA_DIR_TX ) { - num_ports =hweight32 (slave->prop.source_ports); + mask = slave->prop.source_ports; dpn_prop = slave->prop.src_dpn_prop; }else { - num_ports =hweight32 (slave->prop.sink_ports); + mask = slave->prop.sink_ports; dpn_prop = slave->prop.sink_dpn_prop; } -for (i =0 ; i < num_ports; i++) { +for_each_set_bit (i, &mask,32 ) {if (dpn_prop[i].num == port_num)return &dpn_prop[i]; }
Greg Kroah-Hartman
maintainerPATCH 88/98 gtp: fix a potential NULL pointer dereference
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit defd8b3c37b0f9cb3e0f60f47d3d78d459d57fda ]
When sockfd_lookup() fails, gtp_encap_enable_socket() returns a NULL pointer, but its callers only check for error pointers thus miss the NULL pointer case.
Fix it by returning an error pointer with the error code carried from sockfd_lookup().
(I found this bug during code inspection.)
--- drivers/net/gtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gtp.c +1 -1
@@ -812,7 +812,7 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, sock =sockfd_lookup (fd, &err);if (!sock) {pr_debug ("gtp socket fd=%d not found\n" , fd); -return NULL ; +return ERR_PTR (err); } sk = sock->sk;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 89/98 net: busy-poll: use ktime_get_ns() instead of local_clock()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 0870b0d8b393dde53106678a1e2cec9dfa52f9b7 ]
Typically, busy-polling durations are below 100 usec.
When/if the busy-poller thread migrates to another cpu, local_clock() can be off by +/-2msec or more for small values of HZ, depending on the platform.
Use ktimer_get_ns() to ensure deterministic behavior, which is the whole point of busy-polling.
--- include/net/busy_poll.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/busy_poll.h +1 -1
@@ -73,7 +73,7 @@ static inline bool sk_can_busy_loop(struct sock *sk)static inline unsigned long busy_loop_current_time (void ) {#ifdef CONFIG_NET_RX_BUSY_POLL -return (unsigned long )(local_clock () >>10 ); +return (unsigned long )(ktime_get_ns () >>10 );#else return 0 ;#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 90/98 cdc-acm: Add DISABLE_ECHO quirk for GE HealthCare UI Controller
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Ray <[email protected]>
commit 0b00583ecacb0b51712a5ecd34cf7e6684307c67 upstream.
USB_DEVICE(0x1901, 0x0006) may send data before cdc_acm is ready, which may be misinterpreted in the default N_TTY line discipline.
--- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/class/cdc-acm.c +3 -0
@@ -1807,6 +1807,9 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x11ca, 0x0201), /* VeriFone Mx870 Gadget Serial */ .driver_info =SINGLE_RX_URB , }, + { USB_DEVICE(0x1901, 0x0006), /* GE Healthcare Patient Monitor UI Controller */ + .driver_info = DISABLE_ECHO, /* DISABLE ECHO in termios flag */ + }, { USB_DEVICE(0x1965, 0x0018), /* Uniden UBC125XLT */ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ },
Greg Kroah-Hartman
maintainerPATCH 91/98 USB: serial: option: add MeiG Smart SRM825L
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: ZHANG Yuntian <[email protected]>
commit 9a471de516c35219d1722c13367191ce1f120fe9 upstream.
Add support for MeiG Smart SRM825L which is based on Qualcomm 315 chip.
T: Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=5000 MxCh= 0 D: Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs= 1 P: Vendor=2dee ProdID=4d22 Rev= 4.14 S: Manufacturer=MEIG S: Product=LTE-A Module S: SerialNumber=6f345e48 C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=896mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option E: Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option E: Ad=85(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option E: Ad=87(I) Atr=03(Int.) MxPS= 10 Ivl=32ms E: Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms I:* If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) E: Ad=05(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=88(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan E: Ad=89(I) Atr=03(Int.) MxPS= 8 Ivl=32ms E: Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms E: Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
--- drivers/usb/serial/option.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/serial/option.c +5 -0
@@ -619,6 +619,8 @@ static void option_instat_callback(struc/* MeiG Smart Technology products */ #define MEIGSMART_VENDOR_ID 0x2dee +/* MeiG Smart SRM825L based on Qualcomm 315 */ +#define MEIGSMART_PRODUCT_SRM825L 0x4d22/* MeiG Smart SLM320 based on UNISOC UIS8910 */ #define MEIGSMART_PRODUCT_SLM320 0x4d41
@@ -2366,6 +2368,9 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
Greg Kroah-Hartman
maintainerPATCH 92/98 usb: dwc3: omap: add missing depopulate in probe error path
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 2aa765a43817ec8add990f83c8e54a9a5d87aa9c upstream.
Depopulate device in probe error paths to fix leak of children resources.
--- drivers/usb/dwc3/dwc3-omap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-omap.c +3 -1
@@ -526,11 +526,13 @@ static int dwc3_omap_probe(struct platfoif (ret) {dev_err (dev,"failed to request IRQ #%d --> %d\n" , omap->irq, ret); - goto err1; + goto err2; }dwc3_omap_enable_irqs (omap);return 0 ; +err2: +of_platform_depopulate (dev); err1:pm_runtime_put_sync (dev);pm_runtime_disable (dev);
Greg Kroah-Hartman
maintainerPATCH 93/98 usb: dwc3: core: Prevent USB core invalid event buffer address access
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Selvarasu Ganesan <[email protected]>
commit 14e497183df28c006603cc67fd3797a537eef7b9 upstream.
This commit addresses an issue where the USB core could access an invalid event buffer address during runtime suspend, potentially causing SMMU faults and other memory issues in Exynos platforms. The problem arises from the following sequence.
1. In dwc3_gadget_suspend, there is a chance of a timeout when moving the USB core to the halt state after clearing the run/stop bit by software.
2. In dwc3_core_exit, the event buffer is cleared regardless of the USB core's status, which may lead to an SMMU faults and other memory issues. if the USB core tries to access the event buffer address.
To prevent this hardware quirk on Exynos platforms, this commit ensures that the event buffer address is not cleared by software when the USB core is active during runtime suspend by checking its status before clearing the buffer address.
--- drivers/usb/dwc3/core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/dwc3/core.c +8 -0
@@ -419,9 +419,17 @@ int dwc3_event_buffers_setup(struct dwc3void dwc3_event_buffers_cleanup (struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +u32 reg;if (!dwc->ev_buf)return ; +/* +* Exynos platforms may not be able to access event buffer if the +* controller failed to halt on dwc3_core_exit(). +*/ + reg =dwc3_readl (dwc->regs,DWC3_DSTS ); +if (!(reg &DWC3_DSTS_DEVCTRLHLT )) +return ; evt = dwc->ev_buf;
Greg Kroah-Hartman
maintainerPATCH 94/98 usb: dwc3: st: fix probed platform device ref count on probe error path
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit ddfcfeba891064b88bb844208b43bef2ef970f0c upstream.
The probe function never performs any paltform device allocation, thus error path "undo_platform_dev_alloc" is entirely bogus. It drops the reference count from the platform device being probed. If error path is triggered, this will lead to unbalanced device reference counts and premature release of device resources, thus possible use-after-free when releasing remaining devm-managed resources.
--- drivers/usb/dwc3/dwc3-st.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/usb/dwc3/dwc3-st.c +3 -8
@@ -219,10 +219,8 @@ static int st_dwc3_probe(struct platform dwc3_data->regmap = regmap; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"syscfg-reg" ); -if (!res) { - ret = -ENXIO ; - goto undo_platform_dev_alloc; - } +if (!res) +return -ENXIO ; dwc3_data->syscfg_reg_off = res->start;
@@ -233,8 +231,7 @@ static int st_dwc3_probe(struct platformdevm_reset_control_get_exclusive (dev,"powerdown" );if (IS_ERR (dwc3_data->rstc_pwrdn)) {dev_err (&pdev->dev,"could not get power controller\n" ); - ret =PTR_ERR (dwc3_data->rstc_pwrdn); - goto undo_platform_dev_alloc; +return PTR_ERR (dwc3_data->rstc_pwrdn); }/* Manage PowerDown */
@@ -296,8 +293,6 @@ undo_softreset:reset_control_assert (dwc3_data->rstc_rst); undo_powerdown:reset_control_assert (dwc3_data->rstc_pwrdn); -undo_platform_dev_alloc: -platform_device_put (pdev);return ret; }
Greg Kroah-Hartman
maintainerPATCH 95/98 usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 3a8839bbb86da7968a792123ed2296d063871a52 upstream.
Device attribute group @usb3_hardware_lpm_attr_group is merged by add_power_attributes(), but it is not unmerged explicitly, fixed by unmerging it in remove_power_attributes().
--- drivers/usb/core/sysfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/core/sysfs.c +1 -0
@@ -689,6 +689,7 @@ static int add_power_attributes(struct dstatic void remove_power_attributes (struct device *dev) { +sysfs_unmerge_group (&dev->kobj, &usb3_hardware_lpm_attr_group);sysfs_unmerge_group (&dev->kobj, &usb2_hardware_lpm_attr_group);sysfs_unmerge_group (&dev->kobj, &power_attr_group); }
Greg Kroah-Hartman
maintainerPATCH 96/98 scsi: aacraid: Fix double-free on probe failure
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
[ Upstream commit 919ddf8336f0b84c0453bac583808c9f165a85c2 ]
aac_probe_one() calls hardware-specific init functions through the aac_driver_ident::init pointer, all of which eventually call down to aac_init_adapter().
If aac_init_adapter() fails after allocating memory for aac_dev::queues, it frees the memory but does not clear that member.
After the hardware-specific init function returns an error, aac_probe_one() goes down an error path that frees the memory pointed to by aac_dev::queues, resulting.in a double-free.
--- drivers/scsi/aacraid/comminit.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/aacraid/comminit.c +2 -0
@@ -652,6 +652,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)if (aac_comm_init (dev)<0 ){kfree (dev->queues); + dev->queues =NULL ;return NULL ; }/*
@@ -659,6 +660,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)*/ if (aac_fib_setup (dev) <0 ) {kfree (dev->queues); + dev->queues =NULL ;return NULL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 97/98 ipc: remove memcg accounting for sops objects in do_semtimedop()
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
commit 6a4746ba06191e23d30230738e94334b26590a8a upstream.
Linus proposes to revert an accounting for sops objects in do_semtimedop() because it's really just a temporary buffer for a single semtimedop() system call.
This object can consume up to 2 pages, syscall is sleeping one, size and duration can be controlled by user, and this allocation can be repeated by many thread at the same time.
However Shakeel Butt pointed that there are much more popular objects with the same life time and similar memory consumption, the accounting of which was decided to be rejected for performance reasons.
Considering at least 2 pages for task_struct and 2 pages for the kernel stack, a back of the envelope calculation gives a footprint amplification of <1.5 so this temporal buffer can be safely ignored.
The factor would IMO be interesting if it was >> 2 (from the PoV of excessive (ab)use, fine-grained accounting seems to be currently unfeasible due to performance impact).
--- ipc/sem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
ipc/sem.c +1 -2
@@ -1962,8 +1962,7 @@ static long do_semtimedop(int semid, strif (nsops > ns->sc_semopm)return -E2BIG ;if (nsops >SEMOPM_FAST ) { - sops =kvmalloc_array (nsops,sizeof (*sops), -GFP_KERNEL_ACCOUNT ); + sops =kvmalloc_array (nsops,sizeof (*sops),GFP_KERNEL );if (sops ==NULL )return -ENOMEM ; }
Greg Kroah-Hartman
maintainerPATCH 98/98 drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
In reply to Greg Kroah-Hartman4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 1935f0deb6116dd785ea64d8035eab0ff441255b upstream.
Drivers are supposed to fix this up if needed if they don't outright reject it. Uncovered by 6c11df58fd1a ("fbmem: Check virtual screen sizes in fb_set_var()").
--- drivers/gpu/drm/drm_fb_helper.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +3 -0
@@ -1713,6 +1713,9 @@ int drm_fb_helper_check_var(struct fb_vareturn -EINVAL ; } + var->xres_virtual = fb->width; + var->yres_virtual = fb->height; +/* * Workaround for SDL 1.2, which is known to be setting all pixel format * fields values to zero in some cases. We treat this situation as a
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.19.321 release. There are 98 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.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-4.19.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.321-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
The Powerpc defconfig builds failed on Linux stable-rc due to following build warnings / errors with clang-18 and gcc-12.
This is a same problem on current stable-rc review on
- 4.19.321-rc1 review
- 5.4.283-rc1 review
- 5.10.225-rc1 review
- 5.15.166-rc1 review
In the case of stable-rc linux-4.19.y
Anders bisected this to first bad commit id as,
fbdev: offb: replace of_node_put with __free(device_node) [ Upstream commit ce4a7ae84a58b9f33aae8d6c769b3c94f3d5ce76 ]
build log:
--------kernel/profile.c: In function 'profile_dead_cpu':kernel/profile.c:346:27: warning: the comparison will always evaluate as 'true' for the address of 'prof_cpu_mask' will never be NULL [-Waddress]
346 | if (prof_cpu_mask != NULL)
| ^~kernel/profile.c:49:22: note: 'prof_cpu_mask' declared here
49 | static cpumask_var_t prof_cpu_mask;
| ^~~~~~~~~~~~~kernel/profile.c: In function 'profile_online_cpu':kernel/profile.c:383:27: warning: the comparison will always evaluate as 'true' for the address of 'prof_cpu_mask' will never be NULL [-Waddress]
383 | if (prof_cpu_mask != NULL)
| ^~kernel/profile.c:49:22: note: 'prof_cpu_mask' declared here
49 | static cpumask_var_t prof_cpu_mask;
| ^~~~~~~~~~~~~kernel/profile.c: In function 'profile_tick':kernel/profile.c:413:47: warning: the comparison will always evaluate as 'true' for the address of 'prof_cpu_mask' will never be NULL [-Waddress]
413 | if (!user_mode(regs) && prof_cpu_mask != NULL &&
| ^~kernel/profile.c:49:22: note: 'prof_cpu_mask' declared here
49 | static cpumask_var_t prof_cpu_mask;
| ^~~~~~~~~~~~~fs/xfs/libxfs/xfs_inode_fork.c: In function 'xfs_ifork_verify_attr':fs/xfs/libxfs/xfs_inode_fork.c:731:13: warning: the comparison will always evaluate as 'true' for the address of 'i_df' will never be NULL [-Waddress]
731 | if (!XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
| ^
In file included from fs/xfs/libxfs/xfs_inode_fork.c:14:fs/xfs/xfs_inode.h:38:33: note: 'i_df' declared here
38 | struct xfs_ifork i_df; /* data fork */
| ^~~~drivers/video/fbdev/offb.c: In function 'offb_init_palette_hacks':drivers/video/fbdev/offb.c:355:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__free'
355 | struct device_node *pciparent__free(device_node) = of_get_parent(dp);
| ^~~~~~drivers/video/fbdev/offb.c:355:47: error: implicit declaration of function '__free'; did you mean 'kzfree'? [-Werror=implicit-function-declaration]
355 | struct device_node *pciparent__free(device_node) = of_get_parent(dp);
| ^~~~~~
| kzfreedrivers/video/fbdev/offb.c:355:54: error: 'device_node' undeclared (first use in this function)
355 | struct device_node *pciparent__free(device_node) = of_get_parent(dp);
| ^~~~~~~~~~~drivers/video/fbdev/offb.c:355:54: note: each undeclared identifier is reported only once for each function it appears in drivers/video/fbdev/offb.c:356:17: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
356 | const u32 *vid, *did;
| ^~~~~
drivers/video/fbdev/offb.c:357:39: error: 'pciparent' undeclared
(first use in this function); did you mean 'pci_alert'?
357 | vid = of_get_property(pciparent, "vendor-id", NULL);
| ^~~~~~~~~
| pci_alertcc1: some warnings being treated as errors
Build Log links,
--------
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.320-99-g0cc44dd838a6/testrun/24994095/suite/build/test/gcc-12-ppc64e_defconfig/log
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 30 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.321-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
The Powerpc defconfig builds failed on Linux stable-rc due to following build warnings / errors with clang-18 and gcc-12.
This is a same problem on current stable-rc review on
- 4.19.321-rc1 review
- 5.4.283-rc1 review
- 5.10.225-rc1 review
- 5.15.166-rc1 review
Quoted 7 lines
In the case of stable-rc linux-4.19.y
Anders bisected this to first bad commit id as,
fbdev: offb: replaceof_node_putwith__free(device_node)[ Upstream commitce4a7ae84a58b9f33aae8d6c769b3c94f3d5ce76]
Now dropped, thanks.
greg k-h
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.321-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Apart from Powerpc build regressions we have noticed s390 build regression. The S390 defconfig builds failed on Linux stable-rc 4.19.321-rc1 due to following build warnings / errors with clang-18 and gcc-12.
This is a same problem on current stable-rc review on
- 4.19.321-rc1 review
In the case of stable-rc linux-4.19.y
Following two commits have been added on 4.19.321-rc1.
-------
s390/cio: rename bitmap_size() -> idset_bitmap_size() commit c1023f5634b9bfcbfff0dc200245309e3cde9b54 upstream.
bitmap: introduce generic optimized bitmap_size() commit a37fbe666c016fd89e4460d0ebfcea05baba46dc upstream.
build log:
--------drivers/s390/cio/idset.c: In function 'idset_bitmap_size':drivers/s390/cio/idset.c:21:28: error: implicit declaration of function 'size_mul' [-Werror=implicit-function-declaration]
21 | return bitmap_size(size_mul(num_ssid, num_id));
| ^~~~~~~~include/uapi/linux/const.h:32:44: note: in definition of macro '__ALIGN_KERNEL_MASK'
32 | #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
| ^include/linux/kernel.h:58:33: note: in expansion of macro '__ALIGN_KERNEL'
58 | #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
| ^~~~~~~~~~~~~~include/linux/bitmap.h:215:34: note: in expansion of macro 'ALIGN'
215 | #define bitmap_size(nbits) (ALIGN(nbits, BITS_PER_LONG) /BITS_PER_BYTE)
| ^~~~~drivers/s390/cio/idset.c:21:16: note: in expansion of macro 'bitmap_size'
21 | return bitmap_size(size_mul(num_ssid, num_id));
| ^~~~~~~~~~~cc1: some warnings being treated as errors
Build Log links,
--------
- https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.19.y/build/v4.19.320-99-g0cc44dd838a6/testrun/24994013/suite/build/test/gcc-12-defconfig/log
metadata:
----
git describe: v4.19.320-99-g0cc44dd838a6
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git sha: 0cc44dd838a6e3fee60d7af3ca412c4d1b824562
kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2lTf8qakoJKDjTgS3TvH3naApk1/config
build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2lTf8qakoJKDjTgS3TvH3naApk1/
toolchain: clang-18 and gcc-12
config: defconfig
arch: S390
Steps to reproduce:
---------
- tuxmake --runtime podman --target-arch s390 --toolchain gcc-12 --kconfig defconfig
--
Linaro LKFT
https://lkft.linaro.org
Greg Kroah-Hartman
maintainerQuoted 32 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.321-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Apart from Powerpc build regressions we have noticed s390 build regression. The S390 defconfig builds failed on Linux stable-rc 4.19.321-rc1 due to following build warnings / errors with clang-18 and gcc-12.
This is a same problem on current stable-rc review on
- 4.19.321-rc1 reviewIn the case of stable-rc linux-4.19.y
Quoted 7 lines
Following two commits have been added on 4.19.321-rc1.
-------
s390/cio: renamebitmap_size()->idset_bitmap_size()commitc1023f5634b9bfcbfff0dc200245309e3cde9b54upstream.bitmap: introduce generic optimized
bitmap_size()commita37fbe666c016fd89e4460d0ebfcea05baba46dcupstream.
Odd, this should have also shown up in your 5.4.y builds too.
I'll go drop this from both trees now, thanks.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 38 lines · Greg Kroah-Hartman
Quoted 37 lines · Naresh Kamboju
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.321-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
Apart from Powerpc build regressions we have noticed s390 build regression. The S390 defconfig builds failed on Linux stable-rc 4.19.321-rc1 due to following build warnings / errors with clang-18 and gcc-12.
This is a same problem on current stable-rc review on
- 4.19.321-rc1 reviewIn the case of stable-rc linux-4.19.y
Following two commits have been added on 4.19.321-rc1.
-------
s390/cio: renamebitmap_size()->idset_bitmap_size()commitc1023f5634b9bfcbfff0dc200245309e3cde9b54upstream.
Quoted 6 lines
Quoted 2 lines
bitmap: introduce generic optimized
bitmap_size()commita37fbe666c016fd89e4460d0ebfcea05baba46dcupstream.Odd, this should have also shown up in your 5.4.y builds too.
I'll go drop this from both trees now, thanks.
Nope, I need it there, I'll go add some helper functions to make this work, thanks.
greg k-h
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
Build fails on our infrastructure.
BUILDSTDERR: In file included from /builddir/build/BUILD/kernel-4.19.321/linux-4.19.321-master.20240901.el7.dev/tools/include/linux/bitmap.h:6, BUILDSTDERR: from /builddir/build/BUILD/kernel-4.19.321/linux-4.19.321-master.20240901.el7.dev/tools/perf/util/include/../../util/pmu.h:5, BUILDSTDERR: from arch/x86/util/pmu.c:9: BUILDSTDERR: /builddir/build/BUILD/kernel-4.19.321/linux-4.19.321-master.20240901.el7.dev/tools/include/linux/align.h:6:10: fatal error: uapi/linux/const.h: No such file or directory BUILDSTDERR: #include <uapi/linux/const.h> BUILDSTDERR: ^~~~~~~~~~~~~~~~~~~~ BUILDSTDERR: compilation terminated.
Looked at the commits:
This commit 993a20bf6225c: ("tools: move alignment-related macros to new <linux/align.h>") is causing that perf build to fail.
Solution is not to drop this patch as this is probably pulled in to support bitmap_size() macros in these commits(which are also part of this release):
6fbe5a3920f48 fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE ef9ebc42c10f8 bitmap: introduce generic optimized bitmap_size()
Applying the below diff, helps the perf build to pass: I think we should fold this into: commit 993a20bf6225c: ("tools: move alignment-related macros to new <linux/align.h>")
tools/include/linux/align.h +1 -1
@@ -3,7 +3,7 @@#ifndef _TOOLS_LINUX_ALIGN_H#define _TOOLS_LINUX_ALIGN_H -#include <uapi/linux/const.h> +#include <linux/const.h> #define ALIGN (x, a) __ALIGN_KERNEL((x), (a))#define ALIGN_DOWN (x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
!! But this breaks the build for arm here.
!! Not sure what is the best way to solve this problem.
Thanks,
Harshit
Greg Kroah-Hartman
maintainerQuoted 47 lines · Harshit Mogalapalli
Hi Greg,
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
Build fails on our infrastructure.
BUILDSTDERR: In file included from /builddir/build/BUILD/kernel-4.19.321/linux-4.19.321-master.20240901.el7.dev/tools/include/linux/bitmap.h:6, BUILDSTDERR: from /builddir/build/BUILD/kernel-4.19.321/linux-4.19.321-master.20240901.el7.dev/tools/perf/util/include/../../util/pmu.h:5, BUILDSTDERR: from arch/x86/util/pmu.c:9: BUILDSTDERR: /builddir/build/BUILD/kernel-4.19.321/linux-4.19.321-master.20240901.el7.dev/tools/include/linux/align.h:6:10: fatal error: uapi/linux/const.h: No such file or directory BUILDSTDERR: #include <uapi/linux/const.h> BUILDSTDERR: ^~~~~~~~~~~~~~~~~~~~ BUILDSTDERR: compilation terminated.Looked at the commits:
This commit
993a20bf6225c: ("tools: move alignment-related macros to new <linux/align.h>") is causing that perf build to fail.Solution is not to drop this patch as this is probably pulled in to support
bitmap_size()macros in these commits(which are also part of this release):
6fbe5a3920f48fix bitmap corruption onclose_range()withCLOSE_RANGE_UNSHAREef9ebc42c10f8bitmap: introduce generic optimizedbitmap_size()Applying the below diff, helps the perf build to pass: I think we should fold this into: commit
993a20bf6225c: ("tools: move alignment-related macros to new <linux/align.h>")tools/include/linux/align.h +0
-0
tools/include/linux/align.h line 9
Quoted 8 lines
tools/include/linux/align.h +1
-1@@ -3,7 +3,7 @@#ifndef _TOOLS_LINUX_ALIGN_H#define _TOOLS_LINUX_ALIGN_H -#include <uapi/linux/const.h> +#include <linux/const.h> #define ALIGN (x, a) __ALIGN_KERNEL((x), (a))#define ALIGN_DOWN (x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
Change now made, thanks.
Quoted 2 lines
!! But this breaks the build for arm here.
!! Not sure what is the best way to solve this problem.
Are people building perf for arm on 4.19.y? If so, wow, this thing is about to go end-of-life any week now, and I would be amazed if it built at all anymore as I can't get perf to build on _ANY_ lts kernel these days.
Anyway, I'll make this change and if any arm build fixes want to show up, I'll be glad to take them.
thanks,
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.321 release. There are 98 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Tue, 03 Sep 2024 16:07:34 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.321-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
10 builds: 10 pass, 0 fail
20 boots: 20 pass, 0 fail
37 tests: 37 pass, 0 failLinux version: 4.19.321-rc1-g0cc44dd838a6
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Jon